ADuCM302x Device Drivers API Reference Manual  Release 3.1.2.0
adi_rtos_map_noos.h
1 
47 #ifndef ADI_RTOS_MAP_NOOS_H
48 #define ADI_RTOS_MAP_NOOS_H
49 
50 /* If building a c file */
51 #if defined(__STDC__)
52 
53 #include <stdint.h>
54 #include <stddef.h>
55 #include <drivers/pwr/adi_pwr.h>
56 #include <adi_cyclecount.h>
57 
66 #define ADI_INT_STATUS_ALLOC() uint32_t IntStatus = 0u
67 
74 #define ADI_ENTER_CRITICAL_REGION() \
75 do { \
76  IntStatus = __get_PRIMASK(); \
77  __disable_irq(); \
78 } while (0)
79 
80 
87 #define ADI_EXIT_CRITICAL_REGION() \
88 do { \
89  __set_PRIMASK(IntStatus); \
90 } while (0)
91 
92 
95 #define ADI_SEM_SIZE (sizeof(uint32_t))
96 
100 #if defined(ADI_CYCLECOUNT_ENABLED) && (ADI_CYCLECOUNT_ENABLED == 1u)
101 #define ISR_PROLOG() adi_cyclecount_start();
102 #else
103 #define ISR_PROLOG()
104 #endif
105 
106 
110 #if defined(ADI_CYCLECOUNT_ENABLED) && (ADI_CYCLECOUNT_ENABLED == 1u)
111 #define ISR_EPILOG() adi_cyclecount_stop();
112 #else
113 #define ISR_EPILOG()
114 #endif
115 
116 #if (ADI_CFG_ENTER_LOW_PWR_MODE_SUPPORT == 1)
117 
121 #define SEM_VAR_DECLR volatile uint32_t nLowPowerExitFlag;
122 
124 #define SEM_CREATE(DEV, name, error) \
125  (DEV)->nLowPowerExitFlag = 0u
126 
128 #define SEM_DELETE(DEV, error) do { } while(0)
129 
131 #define SEM_PEND(DEV, error) \
132  do { \
133  ADI_PWR_RESULT eResult; \
134  eResult = adi_pwr_EnterLowPowerMode(ADI_PWR_MODE_FLEXI, &(DEV)->nLowPowerExitFlag, 0u); \
135  if(eResult != ADI_PWR_SUCCESS) { return ((error)); } \
136  } while(0)
137 
138 
140 #define SEM_POST(DEV) \
141  do { \
142  adi_pwr_ExitLowPowerMode(&(DEV)->nLowPowerExitFlag); \
143  } while(0)
144 
145 
146 #else /* ADI_CFG_ENTER_LOW_PWR_MODE_SUPPORT == 0 */
147 
151 #define SEM_VAR_DECLR volatile uint32_t nSemCount;
152 
154 #define SEM_CREATE(DEV, name, error) \
155  (DEV)->nSemCount = 0
156 
158 #define SEM_DELETE(DEV, error) do { } while(0)
159 
161 #define SEM_PEND(DEV, error) \
162  while ((DEV)->nSemCount == 0u) {} \
163  (DEV)->nSemCount--
164 
166 #define SEM_POST(DEV) { \
167  (DEV)->nSemCount++; \
168 }
169 
170 #endif /* ADI_CFG_ENTER_LOW_PWR_MODE_SUPPORT */
171 
172 #endif /* __STDC__ */
173 
174 #define PENDSV_HANDLER PendSV_Handler
175 #define SYSTICK_HANDLER SysTick_Handler
176 #define SVC_HANDLER SVC_Handler
177 
178 
179 #endif /* ADI_RTOS_MAP_NOOS_H */
180