ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
adi_rtos_map_ucos_iii.h
1 
14 #ifndef ADI_RTOS_MAP_UCOS_III_H
15 #define ADI_RTOS_MAP_UCOS_III_H
16 
17 /* If building a c file */
18 #if defined(__STDC__)
19 
20 #include <cpu.h>
21 #include <os.h>
22 #include <stdint.h>
23 #include <stddef.h>
24 
28 #define SEM_VAR_DECLR \
29  OS_SEM Semaphore;
30 
36 #define ADI_SEM_SIZE (sizeof(OS_SEM))
37 
39 #define SEM_CREATE(DEV, name, error) \
40  do { \
41  OS_ERR os_error; \
42  OSSemCreate(&((DEV)->Semaphore), name ,0u, &os_error); \
43  if(OS_ERR_NONE != os_error) {return((error));} \
44  } while (0)
45 
47 #if (OS_CFG_SEM_DEL_EN == DEF_ENABLED)
48 #define SEM_DELETE(DEV, error) \
49  do { \
50  OS_ERR os_error; \
51  OSSemDel( &((DEV)->Semaphore), OS_OPT_DEL_NO_PEND, &os_error ); \
52  if(OS_ERR_NONE != os_error) {return((error));} \
53  } while (0)
54 #else
55 #define SEM_DELETE(DEV, error) do { } while(0)
56 #endif
57 
59 #define SEM_PEND(DEV, error) \
60  do { \
61  OS_ERR os_error; \
62  OSSemPend (&((DEV)->Semaphore), 0u, OS_OPT_PEND_BLOCKING , NULL, &os_error); \
63  if(OS_ERR_NONE != os_error) {return((error));} \
64  } while (0)
65 
67 #define SEM_POST(DEV) \
68  do { \
69  OS_ERR os_error; \
70  OSSemPost(&((DEV)->Semaphore), OS_OPT_POST_1, &os_error); \
71  } while (0)
72 
73 
82 #define ADI_INT_STATUS_ALLOC() CPU_SR_ALLOC()
83 
90 #define ADI_ENTER_CRITICAL_REGION() CPU_CRITICAL_ENTER()
91 
98 #define ADI_EXIT_CRITICAL_REGION() CPU_CRITICAL_EXIT()
99 
100 
101 
102 #if defined(ADI_CYCLECOUNT_ENABLED) && (ADI_CYCLECOUNT_ENABLED == 1)
103 #define ADI_RTOS_UCOS_III_CYCLECOUNT_START adi_cyclecount_start();
104 #define ADI_RTOS_UCOS_III_CYCLECOUNT_STOP adi_cyclecount_stop();
105 #else
106 #define ADI_RTOS_UCOS_III_CYCLECOUNT_START
107 #define ADI_RTOS_UCOS_III_CYCLECOUNT_STOP
108 #endif
109 
113 #define ISR_PROLOG() \
114  do { \
115  CPU_SR_ALLOC(); \
116  CPU_CRITICAL_ENTER(); \
117  OSIntEnter(); \
118  CPU_CRITICAL_EXIT(); \
119  ADI_RTOS_UCOS_III_CYCLECOUNT_START \
120  } while (0);
121 
125 #define ISR_EPILOG() \
126  do { \
127  ADI_RTOS_UCOS_III_CYCLECOUNT_STOP \
128  OSIntExit(); \
129  } while (0); \
130 
131 #endif /* __STDC__ */
132 
133 #define PENDSV_HANDLER OS_CPU_PendSVHandler
134 #define SYSTICK_HANDLER OS_CPU_SysTickHandler
135 #define SVC_HANDLER SVC_Handler
136 
137 
138 #endif /* ADI_RTOS_MAP_UCOS_III_H */