Home | History | Annotate | Download | only in cortexm4f
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef _CM4F_PENDSV_H_
     18 #define _CM4F_PENDSV_H_
     19 
     20 #include <stdbool.h>
     21 #include <stdint.h>
     22 
     23 #define MAX_PENDSV_SUBSCRIBERS	4
     24 
     25 struct PendsvRegsLow {
     26     uint32_t r0, r1, r2, r3;
     27     uint32_t r12, lr, pc, cpsr;
     28 };
     29 
     30 struct PendsvRegsHi {
     31     uint32_t r4, r5, r6, r7;
     32     uint32_t r8, r9, r10, r11;
     33 };
     34 
     35 typedef void (*PendsvCallbackF)(struct PendsvRegsLow *loRegs, struct PendsvRegsHi *hiRegs);
     36 
     37 bool pendsvSubscribe(PendsvCallbackF cbk);	//may not be interrupt safe if reentered
     38 bool pendsvUnsubscribe(PendsvCallbackF cbk);
     39 void pendsvTrigger(void);
     40 void pendsvClear(void);
     41 bool pendsvIsPending(void);
     42 
     43 
     44 #endif
     45 
     46