ADuCM302x Device Drivers API Reference Manual  Release 3.1.2.0
adi_rtos_map_threadx.h
1 
47 #ifndef ADI_RTOS_MAP_THREADX_H
48 #define ADI_RTOS_MAP_THREADX_H
49 
50 /* If building a c file */
51 #if defined(__STDC__)
52 
53 
54 #include <tx_api.h>
55 #include <stdint.h>
56 #include <stddef.h>
57 
61 #define SEM_VAR_DECLR \
62  TX_SEMAPHORE Semaphore;
63 
69 #define ADI_SEM_SIZE (sizeof(TX_SEMAPHORE))
70 
73 #define SEM_CREATE(DEV, name, error) \
74  do { \
75  UINT status; \
76  status = tx_semaphore_create((&(DEV)->Semaphore),name,0); \
77  if(TX_SUCCESS != status) {return((error));} \
78  } while (0)
79 
80 
83 #define SEM_DELETE(DEV, error) \
84  do { \
85  UINT status; \
86  status = tx_semaphore_delete(&((DEV)->Semaphore)); \
87  if(TX_SUCCESS != status) {return((error));} \
88  } while (0)
89 
90 
91 
93 #define SEM_PEND(DEV, error) \
94  do { \
95  UINT status; \
96  status=tx_semaphore_get(&((DEV)->Semaphore), TX_WAIT_FOREVER); \
97  if(TX_SUCCESS != status) {return((error));} \
98  } while (0)
99 
100 
101 
102 
104 #define SEM_POST(DEV) \
105  do { \
106  tx_semaphore_put(&((DEV)->Semaphore)); \
107  } while (0)
108 
109 
110 
111 
120 #define ADI_INT_STATUS_ALLOC() UINT threadx_interrupt_status;
121 
122 
123 
130 #define ADI_ENTER_CRITICAL_REGION() \
131  do { \
132  threadx_interrupt_status = tx_interrupt_control(TX_INT_DISABLE); \
133  } while (0)
134 
135 
136 
143 #define ADI_EXIT_CRITICAL_REGION() \
144  do { \
145  threadx_interrupt_status = tx_interrupt_control(threadx_interrupt_status); \
146  } while (0)
147 
148 
149 
154 /* In Cortex-M processors ThreadX does not require a prolog or epilog and the handlers can be written in C */
155 #define ISR_PROLOG()
156 
160 #define ISR_EPILOG() \
161 
162 
163 #endif /* __STDC__ */
164 
165 #define PENDSV_HANDLER __tx_PendSVHandler
166 #define SYSTICK_HANDLER __tx_SysTickHandler
167 #define SVC_HANDLER SVC_Handler
168 
169 
170 #endif /* ADI_RTOS_MAP_UCOS_III_H */