ADuCM4x50 Device Drivers API Reference Manual  Release 4.0.0.0
adi_rtos_map_threadx.h
1 
14 #ifndef ADI_RTOS_MAP_THREADX_H
15 #define ADI_RTOS_MAP_THREADX_H
16 
17 /* If building a c file */
18 #if defined(__STDC__)
19 
20 
21 #include <tx_api.h>
22 #include <stdint.h>
23 #include <stddef.h>
24 
28 #define SEM_VAR_DECLR \
29  TX_SEMAPHORE Semaphore;
30 
36 #define ADI_SEM_SIZE (sizeof(TX_SEMAPHORE))
37 
40 #define SEM_CREATE(DEV, name, error) \
41  do { \
42  UINT status; \
43  status = tx_semaphore_create((&(DEV)->Semaphore),name,0); \
44  if(TX_SUCCESS != status) {return((error));} \
45  } while (0)
46 
47 
50 #define SEM_DELETE(DEV, error) \
51  do { \
52  UINT status; \
53  status = tx_semaphore_delete(&((DEV)->Semaphore)); \
54  if(TX_SUCCESS != status) {return((error));} \
55  } while (0)
56 
57 
58 
60 #define SEM_PEND(DEV, error) \
61  do { \
62  UINT status; \
63  status=tx_semaphore_get(&((DEV)->Semaphore), TX_WAIT_FOREVER); \
64  if(TX_SUCCESS != status) {return((error));} \
65  } while (0)
66 
67 
68 
69 
71 #define SEM_POST(DEV) \
72  do { \
73  tx_semaphore_put(&((DEV)->Semaphore)); \
74  } while (0)
75 
76 
77 
78 
87 #define ADI_INT_STATUS_ALLOC() UINT threadx_interrupt_status;
88 
89 
90 
97 #define ADI_ENTER_CRITICAL_REGION() \
98  do { \
99  threadx_interrupt_status = tx_interrupt_control(TX_INT_DISABLE); \
100  } while (0)
101 
102 
103 
110 #define ADI_EXIT_CRITICAL_REGION() \
111  do { \
112  threadx_interrupt_status = tx_interrupt_control(threadx_interrupt_status); \
113  } while (0)
114 
115 
116 
121 /* In Cortex-M processors ThreadX does not require a prolog or epilog and the handlers can be written in C */
122 #define ISR_PROLOG()
123 
127 #define ISR_EPILOG() \
128 
129 
130 #endif /* __STDC__ */
131 
132 #define PENDSV_HANDLER __tx_PendSVHandler
133 #define SYSTICK_HANDLER __tx_SysTickHandler
134 #define SVC_HANDLER SVC_Handler
135 
136 
137 #endif /* ADI_RTOS_MAP_UCOS_III_H */