SmartSnippets DA1459x SDK
osal.h
Go to the documentation of this file.
1 
44 #ifndef OSAL_H_
45 #define OSAL_H_
46 
47 #ifdef OS_PRESENT
48 
49 #if defined(OS_FREERTOS)
50 #include "osal_freertos.h"
51 #else
52 #error "No Operating System is defined."
53 #endif /* OS defined */
54 
55 /*
56  * OSAL CONFIGURATION FORWARD MACROS
57  *****************************************************************************************
58  */
59 
66 #define OS_USE_TICKLESS_IDLE _OS_USE_TICKLESS_IDLE
67 
71 #define OS_TOTAL_HEAP_SIZE _OS_TOTAL_HEAP_SIZE
72 
76 #define OS_STACK_WORD_SIZE _OS_STACK_WORD_SIZE
77 
84 #define OS_MINIMAL_TASK_STACK_SIZE _OS_MINIMAL_TASK_STACK_SIZE
85 
89 #define OS_DAEMON_TASK_PRIORITY _OS_DAEMON_TASK_PRIORITY
90 
91 /*
92  * OSAL DATA TYPE AND ENUMERATION FORWARD MACROS
93  *****************************************************************************************
94  */
95 
96 /*
97  * OS task priority values
98  */
99 #define OS_TASK_PRIORITY_LOWEST _OS_TASK_PRIORITY_LOWEST
100 #define OS_TASK_PRIORITY_NORMAL _OS_TASK_PRIORITY_NORMAL
101 #define OS_TASK_PRIORITY_HIGHEST _OS_TASK_PRIORITY_HIGHEST
102 
103 /*
104  * Data types and enumerations for OS tasks and functions that operate on them
105  */
106 #define OS_TASK _OS_TASK
107 #define OS_TASK_STATUS _OS_TASK_STATUS
108 #define OS_TASK_CREATE_SUCCESS _OS_TASK_CREATE_SUCCESS
109 #define OS_TASK_NOTIFY_SUCCESS _OS_TASK_NOTIFY_SUCCESS
110 #define OS_TASK_NOTIFY_FAIL _OS_TASK_NOTIFY_FAIL
111 #define OS_TASK_NOTIFY_NO_WAIT _OS_TASK_NOTIFY_NO_WAIT
112 #define OS_TASK_NOTIFY_FOREVER _OS_TASK_NOTIFY_FOREVER
113 #define OS_TASK_NOTIFY_NONE _OS_TASK_NOTIFY_NONE
114 #define OS_TASK_NOTIFY_ALL_BITS _OS_TASK_NOTIFY_ALL_BITS
115 
116 /*
117  * Data types and enumerations for OS mutexes and functions that operate on them
118  */
119 #define OS_MUTEX _OS_MUTEX
120 #define OS_MUTEX_CREATE_SUCCESS _OS_MUTEX_CREATE_SUCCESS
121 #define OS_MUTEX_CREATE_FAIL _OS_MUTEX_CREATE_FAIL
122 #define OS_MUTEX_TAKEN _OS_MUTEX_TAKEN
123 #define OS_MUTEX_NOT_TAKEN _OS_MUTEX_NOT_TAKEN
124 #define OS_MUTEX_NO_WAIT _OS_MUTEX_NO_WAIT
125 #define OS_MUTEX_FOREVER _OS_MUTEX_FOREVER
126 
127 /*
128  * Data types and enumerations for OS events and functions that operate on them
129  */
130 #define OS_EVENT _OS_EVENT
131 #define OS_EVENT_CREATE_SUCCESS _OS_EVENT_CREATE_SUCCESS
132 #define OS_EVENT_CREATE_FAIL _OS_EVENT_CREATE_FAIL
133 #define OS_EVENT_SIGNALED _OS_EVENT_SIGNALED
134 #define OS_EVENT_NOT_SIGNALED _OS_EVENT_NOT_SIGNALED
135 #define OS_EVENT_NO_WAIT _OS_EVENT_NO_WAIT
136 #define OS_EVENT_FOREVER _OS_EVENT_FOREVER
137 
138 /*
139  * Data types and enumerations for OS event groups and functions that operate on them
140  */
141 #define OS_EVENT_GROUP _OS_EVENT_GROUP
142 #define OS_EVENT_GROUP_OK _OS_EVENT_GROUP_OK
143 #define OS_EVENT_GROUP_FAIL _OS_EVENT_GROUP_FAIL
144 #define OS_EVENT_GROUP_NO_WAIT _OS_EVENT_GROUP_NO_WAIT
145 #define OS_EVENT_GROUP_FOREVER _OS_EVENT_GROUP_FOREVER
146 
147 /*
148  * Data types and enumerations for OS queues and functions that operate on them
149  */
150 #define OS_QUEUE _OS_QUEUE
151 #define OS_QUEUE_OK _OS_QUEUE_OK
152 #define OS_QUEUE_FULL _OS_QUEUE_FULL
153 #define OS_QUEUE_EMPTY _OS_QUEUE_EMPTY
154 #define OS_QUEUE_NO_WAIT _OS_QUEUE_NO_WAIT
155 #define OS_QUEUE_FOREVER _OS_QUEUE_FOREVER
156 
157 /*
158  * Data types and enumerations for OS timers and functions that operate on them
159  */
160 #define OS_TIMER _OS_TIMER
161 #define OS_TIMER_SUCCESS _OS_TIMER_SUCCESS
162 #define OS_TIMER_FAIL _OS_TIMER_FAIL
163 #define OS_TIMER_RELOAD _OS_TIMER_RELOAD
164 #define OS_TIMER_ONCE _OS_TIMER_ONCE
165 #define OS_TIMER_NO_WAIT _OS_TIMER_NO_WAIT
166 #define OS_TIMER_FOREVER _OS_TIMER_FOREVER
167 
168 /*
169  * Base data types matching underlying architecture
170  */
171 #define OS_BASE_TYPE _OS_BASE_TYPE
172 #define OS_UBASE_TYPE _OS_UBASE_TYPE
173 
174 /*
175  * Enumeration values indicating successful or not OS operation
176  */
177 #define OS_OK _OS_OK
178 #define OS_FAIL _OS_FAIL
179 
180 /*
181  * Boolean enumeration values
182  */
183 #define OS_TRUE _OS_TRUE
184 #define OS_FALSE _OS_FALSE
185 
186 
189 #define OS_MAX_DELAY _OS_MAX_DELAY
190 
194 #define OS_TICK_TIME _OS_TICK_TIME
195 
199 #define OS_TICK_PERIOD _OS_TICK_PERIOD
200 
204 #define OS_TICK_PERIOD_MS _OS_TICK_PERIOD_MS
205 
209 #define OS_TICK_CLOCK_HZ _OS_TICK_CLOCK_HZ
210 
216 #define OS_TASK_ARG_TYPE _OS_TASK_ARG_TYPE
217 
218 /*
219  * Enumeration values indicating successful or not OS Atomic compare and swap operation
220  */
221 #define OS_ATOMIC_COMPARE_AND_SWAP_SUCCESS _OS_ATOMIC_COMPARE_AND_SWAP_SUCCESS
222 #define OS_ATOMIC_COMPARE_AND_SWAP_FAILURE _OS_ATOMIC_COMPARE_AND_SWAP_FAILURE
223 
224 /* Data type containing heap memory statistics */
225 #define OS_HEAP_STATISTICS_TYPE _OS_HEAP_STATISTICS_TYPE
226 
227 /*
228  * OSAL ENUMERATIONS
229  *****************************************************************************************
230  */
231 
235 typedef enum {
236  OS_NOTIFY_NO_ACTION = _OS_NOTIFY_NO_ACTION,
237  OS_NOTIFY_SET_BITS = _OS_NOTIFY_SET_BITS,
238  OS_NOTIFY_INCREMENT = _OS_NOTIFY_INCREMENT,
239  OS_NOTIFY_VAL_WITH_OVERWRITE = _OS_NOTIFY_VAL_WITH_OVERWRITE,
240  OS_NOTIFY_VAL_WITHOUT_OVERWRITE = _OS_NOTIFY_VAL_WITHOUT_OVERWRITE,
242 } OS_NOTIFY_ACTION;
243 
247 typedef enum {
248  OS_TASK_RUNNING = _OS_TASK_RUNNING,
249  OS_TASK_READY = _OS_TASK_READY,
250  OS_TASK_BLOCKED = _OS_TASK_BLOCKED,
251  OS_TASK_SUSPENDED = _OS_TASK_SUSPENDED,
252  OS_TASK_DELETED = _OS_TASK_DELETED,
253 } OS_TASK_STATE;
254 
258 typedef enum {
259  OS_SCHEDULER_RUNNING = _OS_SCHEDULER_RUNNING,
260  OS_SCHEDULER_NOT_STARTED = _OS_SCHEDULER_NOT_STARTED,
261  OS_SCHEDULER_SUSPENDED = _OS_SCHEDULER_SUSPENDED,
262 } OS_SCHEDULER_STATE;
263 
264 /*
265  * OSAL MACRO FUNCTION DEFINITIONS
266  *****************************************************************************************
267  */
268 
272 #ifdef _OS_TASK_BEGIN
273 #define OS_TASK_BEGIN() _OS_TASK_BEGIN()
274 #else
275 #define OS_TASK_BEGIN() do { } while (0)
276 #endif /* _OS_TASK_BEGIN */
277 
281 #ifdef _OS_TASK_END
282 #define OS_TASK_END() _OS_TASK_END()
283 #else
284 #define OS_TASK_END() do { } while (0)
285 #endif /* _OS_TASK_END */
286 
293 #define OS_TASK_FUNCTION(func, arg) _OS_TASK_FUNCTION(func, arg)
294 
298 #define OS_TASK_SCHEDULER_RUN() _OS_TASK_SCHEDULER_RUN()
299 
308 #define OS_TIME_TO_TICKS(time_in_ms) _OS_TIME_TO_TICKS(time_in_ms)
309 
316 #define OS_GET_CURRENT_TASK() _OS_GET_CURRENT_TASK()
317 
333 #define OS_TASK_CREATE(name, task_func, arg, stack_size, priority, task) \
334  _OS_TASK_CREATE((name), (task_func), (OS_TASK_ARG_TYPE)(arg), \
335  MAX(stack_size + dg_configSYSTEMVIEW_STACK_OVERHEAD, OS_MINIMAL_TASK_STACK_SIZE ) , \
336  (priority), (task))
337 
346 #define OS_TASK_DELETE(task) _OS_TASK_DELETE(task)
347 
358 #define OS_TASK_PRIORITY_GET(task) _OS_TASK_PRIORITY_GET(task)
359 
371 #define OS_TASK_PRIORITY_GET_FROM_ISR(task) _OS_TASK_PRIORITY_GET_FROM_ISR(task)
372 
382 #define OS_TASK_PRIORITY_SET(task, prio) _OS_TASK_PRIORITY_SET((task), (prio))
383 
390 #define OS_TASK_YIELD() _OS_TASK_YIELD()
391 
398 #define OS_TASK_YIELD_FROM_ISR() _OS_TASK_YIELD_FROM_ISR()
399 
413 #define OS_TASK_NOTIFY(task, value, action) _OS_TASK_NOTIFY((task), (value), (action))
414 
429 #define OS_TASK_NOTIFY_INDEXED(task, index, value, action) \
430  _OS_TASK_NOTIFY_INDEXED((task), (index), (value), (action))
431 
446 #define OS_TASK_NOTIFY_AND_QUERY(task, value, action, prev_value) \
447  _OS_TASK_NOTIFY_AND_QUERY((task), (value), (action), (prev_value))
448 
464 #define OS_TASK_NOTIFY_AND_QUERY_INDEXED(task, index, value, action, prev_value) \
465  _OS_TASK_NOTIFY_AND_QUERY_INDEXED((task), (index), (value), (action), (prev_value))
466 
481 #define OS_TASK_NOTIFY_FROM_ISR(task, value, action) \
482  _OS_TASK_NOTIFY_FROM_ISR((task), (value), (action))
483 
499 #define OS_TASK_NOTIFY_INDEXED_FROM_ISR(task, index, value, action) \
500  _OS_TASK_NOTIFY_INDEXED_FROM_ISR((task), (index), (value), (action))
501 
518 #define OS_TASK_NOTIFY_AND_QUERY_FROM_ISR(task, value, action, prev_value) \
519  _OS_TASK_NOTIFY_AND_QUERY_FROM_ISR((task), (value), (action), (prev_value))
520 
538 #define OS_TASK_NOTIFY_AND_QUERY_INDEXED_FROM_ISR(task, index, value, action, prev_value) \
539  _OS_TASK_NOTIFY_AND_QUERY_INDEXED_FROM_ISR((task), (index), (value), (action), (prev_value))
540 
553 #define OS_TASK_NOTIFY_GIVE(task) _OS_TASK_NOTIFY_GIVE(task)
554 
568 #define OS_TASK_NOTIFY_GIVE_INDEXED(task, index) _OS_TASK_NOTIFY_GIVE_INDEXED((task), (index))
569 
580 #define OS_TASK_NOTIFY_GIVE_FROM_ISR(task) _OS_TASK_NOTIFY_GIVE_FROM_ISR(task)
581 
593 #define OS_TASK_NOTIFY_GIVE_INDEXED_FROM_ISR(task, index) \
594  _OS_TASK_NOTIFY_GIVE_INDEXED_FROM_ISR((task), (index))
595 
615 #define OS_TASK_NOTIFY_TAKE(clear_on_exit, time_to_wait) \
616  _OS_TASK_NOTIFY_TAKE((clear_on_exit), (time_to_wait))
617 
638 #define OS_TASK_NOTIFY_TAKE_INDEXED(index, clear_on_exit, time_to_wait) \
639  _OS_TASK_NOTIFY_TAKE_INDEXED((index), (clear_on_exit), (time_to_wait))
640 
652 #define OS_TASK_NOTIFY_STATE_CLEAR(task) _OS_TASK_NOTIFY_STATE_CLEAR(task)
653 
667 #define OS_TASK_NOTIFY_STATE_CLEAR_INDEXED(task, index) \
668  _OS_TASK_NOTIFY_STATE_CLEAR_INDEXED((task), (index))
669 
683 #define OS_TASK_NOTIFY_VALUE_CLEAR(task, bits_to_clear) \
684  _OS_TASK_NOTIFY_VALUE_CLEAR((task), (bits_to_clear))
685 
700 #define OS_TASK_NOTIFY_VALUE_CLEAR_INDEXED(task, index,bits_to_clear) \
701  _OS_TASK_NOTIFY_VALUE_CLEAR_INDEXED((task), (index), (bits_to_clear))
702 
725 #define OS_TASK_NOTIFY_WAIT(entry_bits, exit_bits, value, ticks_to_wait) \
726  _OS_TASK_NOTIFY_WAIT((entry_bits), (exit_bits), (value), (ticks_to_wait))
727 
751 #define OS_TASK_NOTIFY_WAIT_INDEXED(index, entry_bits, exit_bits, value, ticks_to_wait) \
752  _OS_TASK_NOTIFY_WAIT_INDEXED((index), (entry_bits), (exit_bits), (value), (ticks_to_wait))
753 
762 #define OS_TASK_RESUME(task) _OS_TASK_RESUME(task)
763 
772 #define OS_TASK_RESUME_FROM_ISR(task) _OS_TASK_RESUME_FROM_ISR(task)
773 
785 #define OS_TASK_SUSPEND(task) _OS_TASK_SUSPEND(task)
786 
787 
791 #define OS_TASK_RESUME_ALL() _OS_TASK_RESUME_ALL()
792 
796 #define OS_TASK_SUSPEND_ALL() _OS_TASK_SUSPEND_ALL()
797 
808 #define OS_MUTEX_CREATE(mutex) _OS_MUTEX_CREATE(mutex)
809 
818 #define OS_MUTEX_DELETE(mutex) _OS_MUTEX_DELETE(mutex)
819 
830 #define OS_MUTEX_PUT(mutex) _OS_MUTEX_PUT(mutex)
831 
847 #define OS_MUTEX_GET(mutex, timeout) _OS_MUTEX_GET((mutex), (timeout))
848 
856 #define OS_MUTEX_GET_OWNER(mutex) _OS_MUTEX_GET_OWNER(mutex)
857 
869 #define OS_MUTEX_GET_OWNER_FROM_ISR(mutex) _OS_MUTEX_GET_OWNER_FROM_ISR(mutex)
870 
878 #define OS_MUTEX_GET_COUNT(mutex) _OS_MUTEX_GET_COUNT(mutex)
879 
891 #define OS_MUTEX_GET_COUNT_FROM_ISR(mutex) _OS_MUTEX_GET_COUNT_FROM_ISR(mutex)
892 
901 #define OS_EVENT_CREATE(event) _OS_EVENT_CREATE(event)
902 
911 #define OS_EVENT_DELETE(event) _OS_EVENT_DELETE(event)
912 
926 #define OS_EVENT_SIGNAL(event) _OS_EVENT_SIGNAL(event)
927 
941 #define OS_EVENT_SIGNAL_FROM_ISR(event) _OS_EVENT_SIGNAL_FROM_ISR(event)
942 
958 #define OS_EVENT_SIGNAL_FROM_ISR_NO_YIELD(event, need_yield) \
959  _OS_EVENT_SIGNAL_FROM_ISR_NO_YIELD((event), (need_yield))
960 
977 #define OS_EVENT_WAIT(event, timeout) _OS_EVENT_WAIT((event), (timeout))
978 
991 #define OS_EVENT_CHECK(event) _OS_EVENT_CHECK(event)
992 
1005 #define OS_EVENT_CHECK_FROM_ISR(event) _OS_EVENT_CHECK_FROM_ISR(event)
1006 
1022 #define OS_EVENT_CHECK_FROM_ISR_NO_YIELD(event, need_yield) \
1023  _OS_EVENT_CHECK_FROM_ISR_NO_YIELD((event), (need_yield))
1024 
1037 #define OS_EVENT_GET_STATUS(event) _OS_EVENT_GET_STATUS(event)
1038 
1053 #define OS_EVENT_GET_STATUS_FROM_ISR(event) _OS_EVENT_GET_STATUS_FROM_ISR(event)
1054 
1063 #define OS_EVENT_GROUP_CREATE() _OS_EVENT_GROUP_CREATE()
1064 
1091 #define OS_EVENT_GROUP_WAIT_BITS(event_group, bits_to_wait, clear_on_exit, wait_for_all, timeout) \
1092  _OS_EVENT_GROUP_WAIT_BITS((event_group), (bits_to_wait), (clear_on_exit), (wait_for_all), \
1093  (timeout))
1094 
1106 #define OS_EVENT_GROUP_SET_BITS(event_group, bits_to_set) \
1107  _OS_EVENT_GROUP_SET_BITS((event_group), (bits_to_set))
1108 
1121 #define OS_EVENT_GROUP_SET_BITS_FROM_ISR(event_group, bits_to_set) \
1122  _OS_EVENT_GROUP_SET_BITS_FROM_ISR((event_group), (bits_to_set))
1123 
1138 #define OS_EVENT_GROUP_SET_BITS_FROM_ISR_NO_YIELD(event_group, bits_to_set, need_yield) \
1139  _OS_EVENT_GROUP_SET_BITS_FROM_ISR_NO_YIELD((event_group), (bits_to_set), (need_yield))
1140 
1153 #define OS_EVENT_GROUP_CLEAR_BITS(event_group, bits_to_clear) \
1154  _OS_EVENT_GROUP_CLEAR_BITS((event_group), (bits_to_clear))
1155 
1168 #define OS_EVENT_GROUP_CLEAR_BITS_FROM_ISR(event_group, bits_to_clear) \
1169  _OS_EVENT_GROUP_CLEAR_BITS_FROM_ISR((event_group), (bits_to_clear))
1170 
1182 #define OS_EVENT_GROUP_GET_BITS(event_group) _OS_EVENT_GROUP_GET_BITS(event_group)
1183 
1196 #define OS_EVENT_GROUP_GET_BITS_FROM_ISR(event_group) _OS_EVENT_GROUP_GET_BITS_FROM_ISR(event_group)
1197 
1216 #define OS_EVENT_GROUP_SYNC(event_group, bits_to_set, bits_to_wait, timeout) \
1217  _OS_EVENT_GROUP_SYNC((event_group), (bits_to_set), (bits_to_wait), (timeout))
1218 
1227 #define OS_EVENT_GROUP_DELETE(event_group) _OS_EVENT_GROUP_DELETE(event_group)
1228 
1239 #define OS_QUEUE_CREATE(queue, item_size, max_items) \
1240  _OS_QUEUE_CREATE((queue), (item_size), (max_items))
1241 
1250 #define OS_QUEUE_DELETE(queue) _OS_QUEUE_DELETE(queue)
1251 
1267 #define OS_QUEUE_PUT(queue, item, timeout) _OS_QUEUE_PUT((queue), (item), (timeout))
1268 
1284 #define OS_QUEUE_PUT_FROM_ISR(queue, item) _OS_QUEUE_PUT_FROM_ISR((queue), (item))
1285 
1300 #define OS_QUEUE_REPLACE(queue, item) _OS_QUEUE_REPLACE((queue), (item))
1301 
1318 #define OS_QUEUE_REPLACE_FROM_ISR(queue, item) _OS_QUEUE_REPLACE_FROM_ISR((queue), (item))
1319 
1338 #define OS_QUEUE_REPLACE_FROM_ISR_NO_YIELD(queue, item, need_yield) \
1339  _OS_QUEUE_REPLACE_FROM_ISR_NO_YIELD((queue), (item), (need_yield))
1340 
1357 #define OS_QUEUE_GET(queue, item, timeout) _OS_QUEUE_GET((queue), (item), (timeout))
1358 
1374 #define OS_QUEUE_GET_FROM_ISR(queue, item) _OS_QUEUE_GET_FROM_ISR((queue), (item))
1375 
1392 #define OS_QUEUE_GET_FROM_ISR_NO_YIELD(queue, item, need_yield) \
1393  _OS_QUEUE_GET_FROM_ISR_NO_YIELD((queue), (item), (need_yield))
1394 
1411 #define OS_QUEUE_PEEK(queue, item, timeout) _OS_QUEUE_PEEK((queue), (item), (timeout))
1412 
1428 #define OS_QUEUE_PEEK_FROM_ISR(queue, item) _OS_QUEUE_PEEK_FROM_ISR((queue), (item))
1429 
1437 #define OS_QUEUE_MESSAGES_WAITING(queue) _OS_QUEUE_MESSAGES_WAITING(queue)
1438 
1450 #define OS_QUEUE_MESSAGES_WAITING_FROM_ISR(queue) _OS_QUEUE_MESSAGES_WAITING_FROM_ISR(queue)
1451 
1463 #define OS_QUEUE_SPACES_AVAILABLE(queue) _OS_QUEUE_SPACES_AVAILABLE(queue)
1464 
1480 #define OS_TIMER_CREATE(name, period, reload, timer_id, callback) \
1481  _OS_TIMER_CREATE((name), (period), (reload), (timer_id), (callback))
1482 
1494 #define OS_TIMER_GET_TIMER_ID(timer) _OS_TIMER_GET_TIMER_ID(timer)
1495 
1505 #define OS_TIMER_IS_ACTIVE(timer) _OS_TIMER_IS_ACTIVE(timer)
1506 
1520 #define OS_TIMER_START(timer, timeout) _OS_TIMER_START((timer), (timeout))
1521 
1535 #define OS_TIMER_STOP(timer, timeout) _OS_TIMER_STOP((timer), (timeout))
1536 
1549 #define OS_TIMER_CHANGE_PERIOD(timer, period, timeout) \
1550  _OS_TIMER_CHANGE_PERIOD((timer), (period), (timeout))
1551 
1563 #define OS_TIMER_DELETE(timer, timeout) _OS_TIMER_DELETE((timer), (timeout))
1564 
1576 #define OS_TIMER_RESET(timer, timeout) _OS_TIMER_RESET((timer), (timeout))
1577 
1591 #define OS_TIMER_START_FROM_ISR(timer) _OS_TIMER_START_FROM_ISR(timer)
1592 
1606 #define OS_TIMER_STOP_FROM_ISR(timer) _OS_TIMER_STOP_FROM_ISR(timer)
1607 
1622 #define OS_TIMER_CHANGE_PERIOD_FROM_ISR(timer, period) \
1623  _OS_TIMER_CHANGE_PERIOD_FROM_ISR((timer), (period))
1624 
1638 #define OS_TIMER_RESET_FROM_ISR(timer) _OS_TIMER_RESET_FROM_ISR(timer)
1639 
1651 #define OS_TIMER_SET_RELOAD_MODE(timer, auto_reload) _OS_TIMER_SET_RELOAD_MODE(timer, auto_reload)
1652 
1660 #define OS_TIMER_GET_RELOAD_MODE(timer) _OS_TIMER_GET_RELOAD_MODE(timer)
1661 
1671 #define OS_DELAY(ticks) _OS_DELAY(ticks)
1672 
1682 #define OS_DELAY_UNTIL(ticks) _OS_DELAY_UNTIL(ticks)
1683 
1690 #define OS_GET_TICK_COUNT() _OS_GET_TICK_COUNT()
1691 
1702 #define OS_GET_TICK_COUNT_FROM_ISR() _OS_GET_TICK_COUNT_FROM_ISR()
1703 
1712 #define OS_TICKS_2_MS(ticks) _OS_TICKS_2_MS(ticks)
1713 
1722 #define OS_MS_2_TICKS(ms) _OS_MS_2_TICKS(ms)
1723 
1732 #define OS_DELAY_MS(ms) _OS_DELAY_MS(ms)
1733 
1746 #define OS_ENTER_CRITICAL_SECTION() _OS_ENTER_CRITICAL_SECTION()
1747 
1758 #define OS_ENTER_CRITICAL_SECTION_FROM_ISR(critical_section_status) \
1759  _OS_ENTER_CRITICAL_SECTION_FROM_ISR(critical_section_status)
1760 
1770 #define OS_LEAVE_CRITICAL_SECTION() _OS_LEAVE_CRITICAL_SECTION()
1771 
1782 #define OS_LEAVE_CRITICAL_SECTION_FROM_ISR(critical_section_status) \
1783  _OS_LEAVE_CRITICAL_SECTION_FROM_ISR(critical_section_status)
1784 
1785 
1792 #define OS_MALLOC_FUNC _OS_MALLOC_FUNC
1793 
1800 #define OS_MALLOC_NORET_FUNC _OS_MALLOC_NORET_FUNC
1801 
1810 #define OS_MALLOC(size) _OS_MALLOC(size)
1811 
1820 #define OS_MALLOC_NORET(size) _OS_MALLOC_NORET(size)
1821 
1828 #define OS_FREE_FUNC _OS_FREE_FUNC
1829 
1837 #define OS_FREE_NORET_FUNC _OS_FREE_NORET_FUNC
1838 
1847 #define OS_FREE(addr) _OS_FREE(addr)
1848 
1857 #define OS_FREE_NORET(addr) _OS_FREE_NORET(addr)
1858 
1859 #ifdef _OS_ASSERT
1860 
1865 #define OS_ASSERT(cond) _OS_ASSERT(cond)
1866 #else
1867 #define OS_ASSERT(cond)
1868 #endif /* _OS_ASSERT */
1869 
1870 #ifdef _OS_PRECONDITION
1871 
1876 #define OS_PRECONDITION(cond) _OS_PRECONDITION(cond)
1877 #else
1878 #define OS_PRECONDITION(cond)
1879 #endif /* OS_PRECONDITION */
1880 
1881 #ifdef _OS_MEMORY_BARRIER
1882 
1885 #define OS_MEMORY_BARRIER() _OS_MEMORY_BARRIER()
1886 #else
1887 #define OS_MEMORY_BARRIER()
1888 #endif /* OS_MEMORY_BARRIER */
1889 
1890 #ifdef _OS_SOFTWARE_BARRIER
1891 
1894 #define OS_SOFTWARE_BARRIER() _OS_SOFTWARE_BARRIER()
1895 #else
1896 #define OS_SOFTWARE_BARRIER()
1897 #endif /* OS_SOFTWARE_BARRIER */
1898 
1899 #ifdef _OS_GET_TASKS_STATUS
1900 
1911 #define OS_GET_TASKS_STATUS(task_status, status_size) \
1912  _OS_GET_TASKS_STATUS((task_status), (status_size))
1913 #endif /* _OS_GET_TASKS_STATUS */
1914 
1915 #ifdef _OS_GET_TASK_STACK_WATERMARK
1916 
1927 #define OS_GET_TASK_STACK_WATERMARK(task) _OS_GET_TASK_STACK_WATERMARK(task)
1928 #endif /* _OS_GET_TASK_STACK_WATERMARK */
1929 
1939 #define OS_GET_HEAP_WATERMARK() _OS_GET_HEAP_WATERMARK()
1940 
1949 #define OS_GET_FREE_HEAP_SIZE() _OS_GET_FREE_HEAP_SIZE()
1950 
1959 #define OS_GET_TASKS_NUMBER() _OS_GET_TASKS_NUMBER()
1960 
1961 #ifdef _OS_GET_TASK_NAME
1962 
1972 #define OS_GET_TASK_NAME(task) _OS_GET_TASK_NAME(task)
1973 #endif /* _OS_GET_TASK_NAME */
1974 
1975 #ifdef _OS_GET_TASK_STATE
1976 
1986 #define OS_GET_TASK_STATE(task) _OS_GET_TASK_STATE(task)
1987 #endif /* _OS_GET_TASK_STATE */
1988 
1989 #ifdef _OS_GET_TASK_PRIORITY
1990 
2000 #define OS_GET_TASK_PRIORITY(task) _OS_GET_TASK_PRIORITY(task)
2001 #endif /* _OS_GET_TASK_PRIORITY */
2002 
2003 #ifdef _OS_GET_TASK_SCHEDULER_STATE
2004 
2009 #define OS_GET_TASK_SCHEDULER_STATE() _OS_GET_TASK_SCHEDULER_STATE()
2010 #endif /* _OS_GET_TASK_SCHEDULER_STATE */
2011 
2012 #ifdef _OS_GET_IDLE_TASK_HANDLE
2013 
2018 #define OS_GET_IDLE_TASK_HANDLE() _OS_GET_IDLE_TASK_HANDLE()
2019 #endif /* _OS_GET_IDLE_TASK_HANDLE */
2020 
2021 #ifdef _OS_GET_TASK_HANDLE
2022 
2027 #define OS_GET_TASK_HANDLE(task_name) _OS_GET_TASK_HANDLE(task_name)
2028 #endif /* _OS_GET_TASK_HANDLE */
2029 
2030 #ifdef _OS_ATOMIC_COMPARE_AND_SWAP_U32
2031 
2047 #define OS_ATOMIC_COMPARE_AND_SWAP_U32(value_location, exchange_value, swap_condition) \
2048  _OS_ATOMIC_COMPARE_AND_SWAP_U32(value_location, exchange_value, swap_condition)
2049 #endif /* _OS_ATOMIC_COMPARE_AND_SWAP_U32 */
2050 
2051 #ifdef _OS_ATOMIC_SWAP_POINTERS_P32
2052 
2063 #define OS_ATOMIC_SWAP_POINTERS_P32(destination_pointer, exchange_pointer) \
2064  _OS_ATOMIC_SWAP_POINTERS_P32(destination_pointer, exchange_pointer)
2065 #endif /* _OS_ATOMIC_SWAP_POINTERS_P32 */
2066 
2067 #ifdef _OS_ATOMIC_COMPARE_AND_SWAP_POINTERS_P32
2068 
2084 #define OS_ATOMIC_COMPARE_AND_SWAP_POINTERS_P32(destination_pointer, exchange_pointer, swap_condition) \
2085  _OS_ATOMIC_COMPARE_AND_SWAP_POINTERS_P32(destination_pointer, exchange_pointer, swap_condition)
2086 #endif /* _OS_ATOMIC_COMPARE_AND_SWAP_POINTERS_P32 */
2087 
2088 #ifdef _OS_ATOMIC_ADD_U32
2089 
2100 #define OS_ATOMIC_ADD_U32(value_location, add_value) \
2101  _OS_ATOMIC_ADD_U32(value_location, add_value)
2102 #endif /* _OS_ATOMIC_ADD_U32 */
2103 
2104 #ifdef _OS_ATOMIC_SUBTRACT_U32
2105 
2116 #define OS_ATOMIC_SUBTRACT_U32(value_location, subtract_value) \
2117  _OS_ATOMIC_SUBTRACT_U32(value_location, subtract_value)
2118 #endif /* _OS_ATOMIC_SUBTRACT_U32 */
2119 
2120 #ifdef _OS_ATOMIC_INCREMENT_U32
2121 
2131 #define OS_ATOMIC_INCREMENT_U32(value_location) _OS_ATOMIC_INCREMENT_U32(value_location)
2132 #endif /* _OS_ATOMIC_INCREMENT_U32 */
2133 
2134 #ifdef _OS_ATOMIC_DECREMENT_U32
2135 
2145 #define OS_ATOMIC_DECREMENT_U32(value_location) _OS_ATOMIC_DECREMENT_U32(value_location)
2146 #endif /* _OS_ATOMIC_DECREMENT_U32 */
2147 
2148 #ifdef _OS_ATOMIC_OR_U32
2149 
2160 #define OS_ATOMIC_OR_U32(value_location, or_mask) _OS_ATOMIC_OR_U32(value_location, or_mask)
2161 #endif /* _OS_ATOMIC_OR_U32 */
2162 
2163 #ifdef _OS_ATOMIC_AND_U32
2164 
2175 #define OS_ATOMIC_AND_U32(value_location, and_mask) _OS_ATOMIC_AND_U32(value_location, and_mask)
2176 #endif /* _OS_ATOMIC_AND_U32 */
2177 
2178 #ifdef _OS_ATOMIC_NAND_U32
2179 
2190 #define OS_ATOMIC_NAND_U32(value_location, nand_mask) _OS_ATOMIC_NAND_U32(value_location, nand_mask)
2191 #endif /* _OS_ATOMIC_NAND_U32 */
2192 
2193 #ifdef _OS_ATOMIC_XOR_U32
2194 
2205 #define OS_ATOMIC_XOR_U32(value_location, xor_mask) _OS_ATOMIC_XOR_U32(value_location, xor_mask)
2206 #endif /* _OS_ATOMIC_XOR_U32 */
2207 
2208 #ifdef _OS_GET_HEAP_STATISTICS
2209 
2218 #define OS_GET_HEAP_STATISTICS(results_pointer) _OS_GET_HEAP_STATISTICS(results_pointer)
2219 #endif /* _OS_GET_HEAP_STATISTICS */
2220 
2221 /* ****************************************************** */
2222 /* The following macro functions are called by the system */
2223 /* ****************************************************** */
2224 
2225 #if !defined(OS_SYS_PRE_STOP_PROCESSING) && defined(_OS_SYS_PRE_STOP_PROCESSING)
2226 
2235 #define OS_SYS_PRE_STOP_PROCESSING() _OS_SYS_PRE_STOP_PROCESSING()
2236 #endif /* OS_SYS_PRE_STOP_PROCESSING && _OS_SYS_PRE_STOP_PROCESSING */
2237 
2238 #if !defined(OS_SYS_PRE_SLEEP_PROCESSING) && defined(_OS_SYS_PRE_SLEEP_PROCESSING)
2239 
2255 #define OS_SYS_PRE_SLEEP_PROCESSING(sleep_period) _OS_SYS_PRE_SLEEP_PROCESSING(sleep_period)
2256 #endif /* OS_SYS_PRE_SLEEP_PROCESSING && _OS_SYS_PRE_SLEEP_PROCESSING */
2257 
2258 #if !defined(OS_SYS_POST_SLEEP_PROCESSING) && defined(_OS_SYS_POST_SLEEP_PROCESSING)
2259 
2268 #define OS_SYS_POST_SLEEP_PROCESSING() _OS_SYS_POST_SLEEP_PROCESSING()
2269 #endif /* OS_SYS_POST_SLEEP_PROCESSING && _OS_SYS_POST_SLEEP_PROCESSING */
2270 
2271 #if !defined(OS_SYS_PRE_IDLE_PROCESSING) && defined(_OS_SYS_PRE_IDLE_PROCESSING)
2272 
2283 #define OS_SYS_PRE_IDLE_PROCESSING(sleep_period) _OS_SYS_PRE_IDLE_PROCESSING(sleep_period)
2284 #endif /* OS_SYS_PRE_IDLE_PROCESSING && _OS_SYS_PRE_IDLE_PROCESSING */
2285 
2286 #if !defined(OS_SYS_POST_IDLE_PROCESSING) && defined(_OS_SYS_POST_IDLE_PROCESSING)
2287 
2298 #define OS_SYS_POST_IDLE_PROCESSING(sleep_period) _OS_SYS_POST_IDLE_PROCESSING(sleep_period)
2299 #endif /* OS_SYS_POST_IDLE_PROCESSING && _OS_SYS_POST_IDLE_PROCESSING */
2300 
2311 #ifdef _OS_APP_MALLOC_FAILED
2312 #define OS_APP_MALLOC_FAILED(...) _OS_APP_MALLOC_FAILED(__VA_ARGS__)
2313 #else
2314 #define OS_APP_MALLOC_FAILED(...) void dummyMallocFailedHook(__VA_ARGS__) __UNUSED; \
2315  void dummyMallocFailedHook(__VA_ARGS__)
2316 #endif /* _OS_APP_MALLOC_FAILED */
2317 
2331 #ifdef _OS_APP_IDLE
2332 #define OS_APP_IDLE(...) _OS_APP_IDLE(__VA_ARGS__)
2333 #else
2334 #define OS_APP_IDLE(...) void dummyIdleHook(__VA_ARGS__) __UNUSED; \
2335  void dummyIdleHook(__VA_ARGS__)
2336 #endif /* _OS_APP_IDLE */
2337 
2343 #ifdef _OS_APP_STACK_OVERFLOW
2344 #define OS_APP_STACK_OVERFLOW(...) _OS_APP_STACK_OVERFLOW(__VA_ARGS__)
2345 #else
2346 #define OS_APP_STACK_OVERFLOW(...) void dummyStackOverflowHook(__VA_ARGS__) __UNUSED; \
2347  void dummyStackOverflowHook(__VA_ARGS__)
2348 #endif /* _OS_APP_STACK_OVERFLOW */
2349 
2359 #ifdef _OS_APP_TICK
2360 #define OS_APP_TICK(...) _OS_APP_TICK(__VA_ARGS__)
2361 #else
2362 #define OS_APP_TICK(...) void dummyTickHook(__VA_ARGS__) __UNUSED; \
2363  void dummyTickHook(__VA_ARGS__)
2364 #endif /* _OS_APP_TICK */
2365 
2372 #ifdef _OS_APP_DAEMON_TASK
2373 #define OS_APP_DAEMON_TASK(...) _OS_APP_DAEMON_TASK(__VA_ARGS__)
2374 #else
2375 #define OS_APP_DAEMON_TASK(...) void dummyDaemonTaskHook(__VA_ARGS__) __UNUSED; \
2376  void dummyDaemonTaskHook(__VA_ARGS__)
2377 #endif /* _OS_APP_DAEMON_TASK */
2378 
2379 /* *************************************************************** */
2380 /* The following macro functions are used internally by the system */
2381 /* *************************************************************** */
2382 
2391 #define OS_TICK_ADVANCE() _OS_TICK_ADVANCE()
2392 
2401 #define OS_TICK_INCREMENT(ticks) _OS_TICK_INCREMENT(ticks)
2402 
2403 /*
2404  * CHECKS DEFINITIONS OF MANDATORY OSAL MACRO FUNCTIONS
2405  *****************************************************************************************
2406  */
2407 
2408 
2409 /* *************** Mandatory OSAL configuration forward macros *************** */
2410 
2411 /* Enable use of low power tickless mode */
2412 #ifndef _OS_USE_TICKLESS_IDLE
2413 #error "OS_USE_TICKLESS_IDLE not defined"
2414 #endif
2415 
2416 /* Total size of heap memory available for the OS */
2417 #ifndef _OS_TOTAL_HEAP_SIZE
2418 #error "OS_TOTAL_HEAP_SIZE not defined"
2419 #endif
2420 
2421 /* Word size used for the items stored to the stack */
2422 #ifndef _OS_STACK_WORD_SIZE
2423 #error "OS_STACK_WORD_SIZE not defined"
2424 #endif
2425 
2426 /* Minimal stack size (in bytes) defined for an OS task */
2427 #ifndef _OS_MINIMAL_TASK_STACK_SIZE
2428 #error "OS_MINIMAL_TASK_STACK_SIZE not defined"
2429 #endif
2430 
2431 /* Priority of timer daemon OS task */
2432 #ifndef _OS_DAEMON_TASK_PRIORITY
2433 #error "OS_DAEMON_TASK_PRIORITY not defined"
2434 #endif
2435 
2436 /* ********* Mandatory OSAL data type and enumeration forward macros ********* */
2437 
2438 /* OS task priority values */
2439 
2440 #ifndef _OS_TASK_PRIORITY_LOWEST
2441 #error "OS_TASK_PRIORITY_LOWEST not defined"
2442 #endif
2443 
2444 #ifndef _OS_TASK_PRIORITY_NORMAL
2445 #error "OS_TASK_PRIORITY_NORMAL not defined"
2446 #endif
2447 
2448 #ifndef _OS_TASK_PRIORITY_HIGHEST
2449 #error "OS_TASK_PRIORITY_HIGHEST not defined"
2450 #endif
2451 
2452 /* Data types and enumerations for OS tasks and functions that operate on them */
2453 
2454 #ifndef _OS_TASK
2455 #error "OS_TASK not defined"
2456 #endif
2457 
2458 #ifndef _OS_TASK_CREATE_SUCCESS
2459 #error "OS_TASK_CREATE_SUCCESS not defined"
2460 #endif
2461 
2462 #ifndef _OS_TASK_NOTIFY_SUCCESS
2463 #error "OS_TASK_NOTIFY_SUCCESS not defined"
2464 #endif
2465 
2466 #ifndef _OS_TASK_NOTIFY_FAIL
2467 #error "OS_TASK_NOTIFY_FAIL not defined"
2468 #endif
2469 
2470 #ifndef _OS_TASK_NOTIFY_NO_WAIT
2471 #error "OS_TASK_NOTIFY_NO_WAIT not defined"
2472 #endif
2473 
2474 #ifndef _OS_TASK_NOTIFY_FOREVER
2475 #error "OS_TASK_NOTIFY_FOREVER not defined"
2476 #endif
2477 
2478 #ifndef _OS_TASK_NOTIFY_NONE
2479 #error "OS_TASK_NOTIFY_NONE not defined"
2480 #endif
2481 
2482 #ifndef _OS_TASK_NOTIFY_ALL_BITS
2483 #error "OS_TASK_NOTIFY_ALL_BITS not defined"
2484 #endif
2485 
2486 /* Data types and enumerations for OS mutexes and functions that operate on them */
2487 
2488 #ifndef _OS_MUTEX
2489 #error "OS_MUTEX not defined"
2490 #endif
2491 
2492 #ifndef _OS_MUTEX_CREATE_SUCCESS
2493 #error "OS_MUTEX_CREATE_SUCCESS not defined"
2494 #endif
2495 
2496 #ifndef _OS_MUTEX_CREATE_FAIL
2497 #error "OS_MUTEX_CREATE_FAIL not defined"
2498 #endif
2499 
2500 #ifndef _OS_MUTEX_TAKEN
2501 #error "OS_MUTEX_TAKEN not defined"
2502 #endif
2503 
2504 #ifndef _OS_MUTEX_NOT_TAKEN
2505 #error "OS_MUTEX_NOT_TAKEN not defined"
2506 #endif
2507 
2508 #ifndef _OS_MUTEX_NO_WAIT
2509 #error "OS_MUTEX_NO_WAIT not defined"
2510 #endif
2511 
2512 #ifndef _OS_MUTEX_FOREVER
2513 #error "OS_MUTEX_FOREVER not defined"
2514 #endif
2515 
2516 /* Data types and enumerations for OS events and functions that operate on them */
2517 
2518 #ifndef _OS_EVENT
2519 #error "OS_EVENT not defined"
2520 #endif
2521 
2522 #ifndef _OS_EVENT_CREATE_SUCCESS
2523 #error "OS_EVENT_CREATE_SUCCESS not defined"
2524 #endif
2525 
2526 #ifndef _OS_EVENT_CREATE_FAIL
2527 #error "OS_EVENT_CREATE_FAIL not defined"
2528 #endif
2529 
2530 #ifndef _OS_EVENT_SIGNALED
2531 #error "OS_EVENT_SIGNALED not defined"
2532 #endif
2533 
2534 #ifndef _OS_EVENT_NOT_SIGNALED
2535 #error "OS_EVENT_NOT_SIGNALED not defined"
2536 #endif
2537 
2538 #ifndef _OS_EVENT_NO_WAIT
2539 #error "OS_EVENT_NO_WAIT not defined"
2540 #endif
2541 
2542 #ifndef _OS_EVENT_FOREVER
2543 #error "OS_EVENT_FOREVER not defined"
2544 #endif
2545 
2546 /* Data types and enumerations for OS event groups and functions that operate on them */
2547 
2548 #ifndef _OS_EVENT_GROUP
2549 #error "OS_EVENT_GROUP not defined"
2550 #endif
2551 
2552 #ifndef _OS_EVENT_GROUP_OK
2553 #error "OS_EVENT_GROUP_OK not defined"
2554 #endif
2555 
2556 #ifndef _OS_EVENT_GROUP_FAIL
2557 #error "OS_EVENT_GROUP_FAIL not defined"
2558 #endif
2559 
2560 #ifndef _OS_EVENT_GROUP_NO_WAIT
2561 #error "OS_EVENT_GROUP_NO_WAIT not defined"
2562 #endif
2563 
2564 #ifndef _OS_EVENT_GROUP_FOREVER
2565 #error "OS_EVENT_GROUP_FOREVER not defined"
2566 #endif
2567 
2568 /* Data types and enumerations for OS queues and functions that operate on them */
2569 
2570 #ifndef _OS_QUEUE
2571 #error "OS_QUEUE not defined"
2572 #endif
2573 
2574 #ifndef _OS_QUEUE_OK
2575 #error "OS_QUEUE_OK not defined"
2576 #endif
2577 
2578 #ifndef _OS_QUEUE_FULL
2579 #error "OS_QUEUE_FULL not defined"
2580 #endif
2581 
2582 #ifndef _OS_QUEUE_EMPTY
2583 #error "OS_QUEUE_EMPTY not defined"
2584 #endif
2585 
2586 #ifndef _OS_QUEUE_NO_WAIT
2587 #error "OS_QUEUE_NO_WAIT not defined"
2588 #endif
2589 
2590 #ifndef _OS_QUEUE_FOREVER
2591 #error "OS_QUEUE_FOREVER not defined"
2592 #endif
2593 
2594 /* Data types and enumerations for OS timers and functions that operate on them */
2595 
2596 #ifndef _OS_TIMER
2597 #error "OS_TIMER not defined"
2598 #endif
2599 
2600 #ifndef _OS_TIMER_SUCCESS
2601 #error "OS_TIMER_SUCCESS not defined"
2602 #endif
2603 
2604 #ifndef _OS_TIMER_FAIL
2605 #error "OS_TIMER_FAIL not defined"
2606 #endif
2607 
2608 #ifndef _OS_TIMER_RELOAD
2609 #error "OS_TIMER_RELOAD not defined"
2610 #endif
2611 
2612 #ifndef _OS_TIMER_ONCE
2613 #error "OS_TIMER_ONCE not defined"
2614 #endif
2615 
2616 #ifndef _OS_TIMER_NO_WAIT
2617 #error "OS_TIMER_NO_WAIT not defined"
2618 #endif
2619 
2620 #ifndef _OS_TIMER_FOREVER
2621 #error "OS_TIMER_FOREVER not defined"
2622 #endif
2623 
2624 /* Base data types matching underlying architecture */
2625 
2626 #ifndef _OS_BASE_TYPE
2627 #error "OS_BASE_TYPE not defined"
2628 #endif
2629 
2630 #ifndef _OS_UBASE_TYPE
2631 #error "OS_UBASE_TYPE not defined"
2632 #endif
2633 
2634 /* Enumeration values indicating successful or not OS operation */
2635 
2636 #ifndef _OS_OK
2637 #error "OS_OK not defined"
2638 #endif
2639 
2640 #ifndef _OS_FAIL
2641 #error "OS_FAIL not defined"
2642 #endif
2643 
2644 /* Boolean enumeration values */
2645 
2646 #ifndef _OS_TRUE
2647 #error "OS_TRUE not defined"
2648 #endif
2649 
2650 #ifndef _OS_FALSE
2651 #error "OS_FALSE not defined"
2652 #endif
2653 
2654 /* Maximum OS delay (in OS ticks) */
2655 #ifndef _OS_MAX_DELAY
2656 #error "OS_MAX_DELAY not defined"
2657 #endif
2658 
2659 /* OS tick time (i.e. time expressed in OS ticks) data type */
2660 #ifndef _OS_TICK_TIME
2661 #error "OS_TICK_TIME not defined"
2662 #endif
2663 
2664 /* OS tick period (in cycles of source clock used for the OS timer) */
2665 #ifndef _OS_TICK_PERIOD
2666 #error "OS_TICK_PERIOD not defined"
2667 #endif
2668 
2669 /* OS tick period (in msec) */
2670 #ifndef _OS_TICK_PERIOD_MS
2671 #error "OS_TICK_PERIOD_MS not defined"
2672 #endif
2673 
2674 /* Frequency (in Hz) of the source clock used for the OS timer */
2675 #ifndef _OS_TICK_CLOCK_HZ
2676 #error "OS_TICK_CLOCK_HZ not defined"
2677 #endif
2678 
2679 /* Data type of OS task function (i.e. OS_TASK_FUNCTION) argument */
2680 #ifndef _OS_TASK_ARG_TYPE
2681 #error "OS_TASK_ARG_TYPE not defined"
2682 #endif
2683 
2684 /* *********************** Mandatory OSAL enumerations *********************** */
2685 
2686 /* OS task notification action */
2687 
2688 #ifndef _OS_NOTIFY_NO_ACTION
2689 #error "OS_NOTIFY_NO_ACTION not defined"
2690 #endif
2691 
2692 #ifndef _OS_NOTIFY_SET_BITS
2693 #error "OS_NOTIFY_SET_BITS not defined"
2694 #endif
2695 
2696 #ifndef _OS_NOTIFY_INCREMENT
2697 #error "OS_NOTIFY_INCREMENT not defined"
2698 #endif
2699 
2700 #ifndef _OS_NOTIFY_VAL_WITH_OVERWRITE
2701 #error "OS_NOTIFY_VAL_WITH_OVERWRITE not defined"
2702 #endif
2703 
2704 #ifndef _OS_NOTIFY_VAL_WITHOUT_OVERWRITE
2705 #error "OS_NOTIFY_VAL_WITHOUT_OVERWRITE not defined"
2706 #endif
2707 
2708 /* OS task state */
2709 
2710 #ifndef _OS_TASK_RUNNING
2711 #error "OS_TASK_RUNNING not defined"
2712 #endif
2713 
2714 #ifndef _OS_TASK_READY
2715 #error "OS_TASK_READY not defined"
2716 #endif
2717 
2718 #ifndef _OS_TASK_BLOCKED
2719 #error "OS_TASK_BLOCKED not defined"
2720 #endif
2721 
2722 #ifndef _OS_TASK_SUSPENDED
2723 #error "OS_TASK_SUSPENDED not defined"
2724 #endif
2725 
2726 #ifndef _OS_TASK_DELETED
2727 #error "OS_TASK_DELETED not defined"
2728 #endif
2729 
2730 /* OS scheduler state */
2731 
2732 #ifndef _OS_SCHEDULER_RUNNING
2733 #error "OS_SCHEDULER_RUNNING not defined"
2734 #endif
2735 
2736 #ifndef _OS_SCHEDULER_NOT_STARTED
2737 #error "OS_SCHEDULER_NOT_STARTED not defined"
2738 #endif
2739 
2740 #ifndef _OS_SCHEDULER_SUSPENDED
2741 #error "OS_SCHEDULER_SUSPENDED not defined"
2742 #endif
2743 
2744 /* **************** Mandatory OSAL macro function definitions **************** */
2745 
2746 /* Declare an OS task function */
2747 #ifndef _OS_TASK_FUNCTION
2748 #error "OS_TASK_FUNCTION not defined"
2749 #endif
2750 
2751 /* Run the OS task scheduler */
2752 #ifndef _OS_TASK_SCHEDULER_RUN
2753 #error "OS_TASK_SCHEDULER_RUN not defined"
2754 #endif
2755 
2756 /* Convert a time in milliseconds to a time in OS ticks */
2757 #ifndef _OS_TIME_TO_TICKS
2758 #error "OS_TIME_TO_TICKS not defined"
2759 #endif
2760 
2761 /* Return current OS task handle */
2762 #ifndef _OS_GET_CURRENT_TASK
2763 #error "OS_GET_CURRENT_TASK not defined"
2764 #endif
2765 
2766 /* Create OS task */
2767 #ifndef _OS_TASK_CREATE
2768 #error "OS_TASK_CREATE not defined"
2769 #endif
2770 
2771 /* Delete OS task */
2772 #ifndef _OS_TASK_DELETE
2773 #error "OS_TASK_DELETE not defined"
2774 #endif
2775 
2776 /* Get the priority of an OS task */
2777 #ifndef _OS_TASK_PRIORITY_GET
2778 #error "OS_TASK_PRIORITY_GET not defined"
2779 #endif
2780 
2781 /* Get the priority of an OS task from ISR */
2782 #ifndef _OS_TASK_PRIORITY_GET_FROM_ISR
2783 #error "OS_TASK_PRIORITY_GET_FROM_ISR not defined"
2784 #endif
2785 
2786 /* Set the priority of an OS task */
2787 #ifndef _OS_TASK_PRIORITY_SET
2788 #error "OS_TASK_PRIORITY_SET not defined"
2789 #endif
2790 
2791 /* The running OS task yields control to the scheduler */
2792 #ifndef _OS_TASK_YIELD
2793 #error "OS_TASK_YIELD not defined"
2794 #endif
2795 
2796 /* The running OS task yields control to the scheduler from ISR */
2797 #ifndef _OS_TASK_YIELD_FROM_ISR
2798 #error "OS_TASK_YIELD_FROM_ISR not defined"
2799 #endif
2800 
2801 /* Send notification to OS task, updating its notification value */
2802 #ifndef _OS_TASK_NOTIFY
2803 #error "OS_TASK_NOTIFY not defined"
2804 #endif
2805 
2806 /* Send notification to OS task, updating its notification value and returning previous value */
2807 #ifndef _OS_TASK_NOTIFY_AND_QUERY
2808 #error "OS_TASK_NOTIFY_AND_QUERY not defined"
2809 #endif
2810 
2811 /* Send notification to OS task from ISR, updating its notification value */
2812 #ifndef _OS_TASK_NOTIFY_FROM_ISR
2813 #error "OS_TASK_NOTIFY_FROM_ISR not defined"
2814 #endif
2815 
2816 /* Send notification to OS task from ISR, updating its notification value and returning
2817  * previous value */
2818 #ifndef _OS_TASK_NOTIFY_AND_QUERY_FROM_ISR
2819 #error "OS_TASK_NOTIFY_AND_QUERY_FROM_ISR not defined"
2820 #endif
2821 
2822 /* Send a notification event to OS task, incrementing its notification value */
2823 #ifndef _OS_TASK_NOTIFY_GIVE
2824 #error "OS_TASK_NOTIFY_GIVE not defined"
2825 #endif
2826 
2827 /* Send a notification event to OS task from ISR, incrementing its notification value */
2828 #ifndef _OS_TASK_NOTIFY_GIVE_FROM_ISR
2829 #error "OS_TASK_NOTIFY_GIVE_FROM_ISR not defined"
2830 #endif
2831 
2832 /* Wait for the calling OS task to receive a notification event, clearing to zero or
2833  * decrementing task notification value on exit */
2834 #ifndef _OS_TASK_NOTIFY_TAKE
2835 #error "OS_TASK_NOTIFY_TAKE not defined"
2836 #endif
2837 
2838 /* Wait for the calling OS task to receive a notification, updating task notification value
2839  * on exit */
2840 #ifndef _OS_TASK_NOTIFY_WAIT
2841 #error "OS_TASK_NOTIFY_WAIT not defined"
2842 #endif
2843 
2844 /* Resume OS task */
2845 #ifndef _OS_TASK_RESUME
2846 #error "OS_TASK_RESUME not defined"
2847 #endif
2848 
2849 /* Resume OS task from ISR */
2850 #ifndef _OS_TASK_RESUME_FROM_ISR
2851 #error "OS_TASK_RESUME_FROM_ISR not defined"
2852 #endif
2853 
2854 /* Suspend OS task */
2855 #ifndef _OS_TASK_SUSPEND
2856 #error "OS_TASK_SUSPEND not defined"
2857 #endif
2858 
2859 /* Enable scheduler to resume all tasks */
2860 #ifndef _OS_TASK_RESUME_ALL
2861 #error "OS_TASK_RESUME_ALL not defined"
2862 #endif
2863 
2864 /* Disable scheduler to suspend all tasks */
2865 #ifndef _OS_TASK_SUSPEND_ALL
2866 #error "OS_TASK_SUSPEND_ALL not defined"
2867 #endif
2868 
2869 /* Create OS mutex */
2870 #ifndef _OS_MUTEX_CREATE
2871 #error "OS_MUTEX_CREATE not defined"
2872 #endif
2873 
2874 /* Delete OS mutex */
2875 #ifndef _OS_MUTEX_DELETE
2876 #error "OS_MUTEX_DELETE not defined"
2877 #endif
2878 
2879 /* Release OS mutex */
2880 #ifndef _OS_MUTEX_PUT
2881 #error "OS_MUTEX_PUT not defined"
2882 #endif
2883 
2884 /* Acquire OS mutex */
2885 #ifndef _OS_MUTEX_GET
2886 #error "OS_MUTEX_GET not defined"
2887 #endif
2888 
2889 /* Get OS task owner of OS mutex */
2890 #ifndef _OS_MUTEX_GET_OWNER
2891 #error "OS_MUTEX_GET_OWNER not defined"
2892 #endif
2893 
2894 /* Get OS task owner of OS mutex from ISR */
2895 #ifndef _OS_MUTEX_GET_OWNER_FROM_ISR
2896 #error "OS_MUTEX_GET_OWNER_FROM_ISR not defined"
2897 #endif
2898 
2899 /* Get OS mutex current count value */
2900 #ifndef _OS_MUTEX_GET_COUNT
2901 #error "OS_MUTEX_GET_COUNT not defined"
2902 #endif
2903 
2904 /* Get OS mutex current count value from ISR */
2905 #ifndef _OS_MUTEX_GET_COUNT_FROM_ISR
2906 #error "OS_MUTEX_GET_COUNT_FROM_ISR not defined"
2907 #endif
2908 
2909 /* Create OS event */
2910 #ifndef _OS_EVENT_CREATE
2911 #error "OS_EVENT_CREATE not defined"
2912 #endif
2913 
2914 /* Delete OS event */
2915 #ifndef _OS_EVENT_DELETE
2916 #error "OS_EVENT_DELETE not defined"
2917 #endif
2918 
2919 /* Set OS event in signaled state */
2920 #ifndef _OS_EVENT_SIGNAL
2921 #error "OS_EVENT_SIGNAL not defined"
2922 #endif
2923 
2924 /* Set OS event in signaled state from ISR */
2925 #ifndef _OS_EVENT_SIGNAL_FROM_ISR
2926 #error "OS_EVENT_SIGNAL_FROM_ISR not defined"
2927 #endif
2928 
2929 /* Set OS event in signaled state from ISR without requesting running OS task to yield */
2930 #ifndef _OS_EVENT_SIGNAL_FROM_ISR_NO_YIELD
2931 #error "OS_EVENT_SIGNAL_FROM_ISR_NO_YIELD not defined"
2932 #endif
2933 
2934 /* Wait for OS event to be signaled */
2935 #ifndef _OS_EVENT_WAIT
2936 #error "OS_EVENT_WAIT not defined"
2937 #endif
2938 
2939 /* Check if OS event is signaled and clear it */
2940 #ifndef _OS_EVENT_CHECK
2941 #error "OS_EVENT_CHECK not defined"
2942 #endif
2943 
2944 /* Check from ISR if OS event is signaled and clear it */
2945 #ifndef _OS_EVENT_CHECK_FROM_ISR
2946 #error "OS_EVENT_CHECK_FROM_ISR not defined"
2947 #endif
2948 
2949 /* Check from ISR if OS event is signaled and clear it, without requesting
2950  * running OS task to yield */
2951 #ifndef _OS_EVENT_CHECK_FROM_ISR_NO_YIELD
2952 #error "OS_EVENT_CHECK_FROM_ISR_NO_YIELD not defined"
2953 #endif
2954 
2955 /* Get OS event status */
2956 #ifndef _OS_EVENT_GET_STATUS
2957 #error "OS_EVENT_GET_STATUS not defined"
2958 #endif
2959 
2960 /* Get OS event status from ISR */
2961 #ifndef _OS_EVENT_GET_STATUS_FROM_ISR
2962 #error "OS_EVENT_GET_STATUS_FROM_ISR not defined"
2963 #endif
2964 
2965 /* Create OS event group */
2966 #ifndef _OS_EVENT_GROUP_CREATE
2967 #error "OS_EVENT_GROUP_CREATE not defined"
2968 #endif
2969 
2970 /* Wait for OS event group bits to become set */
2971 #ifndef _OS_EVENT_GROUP_WAIT_BITS
2972 #error "OS_EVENT_GROUP_WAIT_BITS not defined"
2973 #endif
2974 
2975 /* Set OS event group bits */
2976 #ifndef _OS_EVENT_GROUP_SET_BITS
2977 #error "OS_EVENT_GROUP_SET_BITS not defined"
2978 #endif
2979 
2980 /* Set OS event group bits from ISR */
2981 #ifndef _OS_EVENT_GROUP_SET_BITS_FROM_ISR
2982 #error "OS_EVENT_GROUP_SET_BITS_FROM_ISR not defined"
2983 #endif
2984 
2985 /* Set OS event group bits from ISR without requesting running OS task to yield */
2986 #ifndef _OS_EVENT_GROUP_SET_BITS_FROM_ISR_NO_YIELD
2987 #error "OS_EVENT_GROUP_SET_BITS_FROM_ISR_NO_YIELD not defined"
2988 #endif
2989 
2990 /* Clear OS event group bits */
2991 #ifndef _OS_EVENT_GROUP_CLEAR_BITS
2992 #error "OS_EVENT_GROUP_CLEAR_BITS not defined"
2993 #endif
2994 
2995 /* Clear OS event group bits from an interrupt */
2996 #ifndef _OS_EVENT_GROUP_CLEAR_BITS_FROM_ISR
2997 #error "OS_EVENT_GROUP_CLEAR_BITS_FROM_ISR not defined"
2998 #endif
2999 
3000 /* Get OS event group bits */
3001 #ifndef _OS_EVENT_GROUP_GET_BITS
3002 #error "OS_EVENT_GROUP_GET_BITS not defined"
3003 #endif
3004 
3005 /* Get OS event group bits from an interrupt */
3006 #ifndef _OS_EVENT_GROUP_GET_BITS_FROM_ISR
3007 #error "OS_EVENT_GROUP_GET_BITS_FROM_ISR not defined"
3008 #endif
3009 
3010 /* Synchronize OS event group bits */
3011 #ifndef _OS_EVENT_GROUP_SYNC
3012 #error "OS_EVENT_GROUP_SYNC not defined"
3013 #endif
3014 
3015 /* Delete OS event group */
3016 #ifndef _OS_EVENT_GROUP_DELETE
3017 #error "OS_EVENT_GROUP_DELETE not defined"
3018 #endif
3019 
3020 /* Create OS queue */
3021 #ifndef _OS_QUEUE_CREATE
3022 #error "OS_QUEUE_CREATE not defined"
3023 #endif
3024 
3025 /* Deletes OS queue */
3026 #ifndef _OS_QUEUE_DELETE
3027 #error "OS_QUEUE_DELETE not defined"
3028 #endif
3029 
3030 /* Put element in OS queue */
3031 #ifndef _OS_QUEUE_PUT
3032 #error "OS_QUEUE_PUT not defined"
3033 #endif
3034 
3035 /* Put element in OS queue */
3036 #ifndef _OS_QUEUE_PUT_FROM_ISR
3037 #error "OS_QUEUE_PUT_FROM_ISR not defined"
3038 #endif
3039 
3040 /* Replace element in OS queue of one element */
3041 #ifndef _OS_QUEUE_REPLACE
3042 #error "OS_QUEUE_REPLACE not defined"
3043 #endif
3044 
3045 /* Replace element in OS queue of one element from ISR */
3046 #ifndef _OS_QUEUE_REPLACE_FROM_ISR
3047 #error "OS_QUEUE_REPLACE_FROM_ISR not defined"
3048 #endif
3049 
3050 /* Replace element in OS queue of one element from ISR without requesting running OS task to yield */
3051 #ifndef _OS_QUEUE_REPLACE_FROM_ISR_NO_YIELD
3052 #error "OS_QUEUE_REPLACE_FROM_ISR_NO_YIELD not defined"
3053 #endif
3054 
3055 /* Get element from OS queue */
3056 #ifndef _OS_QUEUE_GET
3057 #error "OS_QUEUE_GET not defined"
3058 #endif
3059 
3060 /* Get element from OS queue from ISR */
3061 #ifndef _OS_QUEUE_GET_FROM_ISR
3062 #error "OS_QUEUE_GET_FROM_ISR not defined"
3063 #endif
3064 
3065 /* Get element from OS queue from ISR without requesting running OS task to yield */
3066 #ifndef _OS_QUEUE_GET_FROM_ISR_NO_YIELD
3067 #error "OS_QUEUE_GET_FROM_ISR_NO_YIELD not defined"
3068 #endif
3069 
3070 /* Peek element from OS queue */
3071 #ifndef _OS_QUEUE_PEEK
3072 #error "OS_QUEUE_PEEK not defined"
3073 #endif
3074 
3075 /* Peek element from OS queue from ISR */
3076 #ifndef _OS_QUEUE_PEEK_FROM_ISR
3077 #error "OS_QUEUE_PEEK_FROM_ISR not defined"
3078 #endif
3079 
3080 /* Get the number of messages stored in OS queue */
3081 #ifndef _OS_QUEUE_MESSAGES_WAITING
3082 #error "OS_QUEUE_MESSAGES_WAITING not defined"
3083 #endif
3084 
3085 /* Get the number of messages stored in OS queue from ISR */
3086 #ifndef _OS_QUEUE_MESSAGES_WAITING_FROM_ISR
3087 #error "OS_QUEUE_MESSAGES_WAITING_FROM_ISR not defined"
3088 #endif
3089 
3090 /* Get the number of free spaces in OS queue */
3091 #ifndef _OS_QUEUE_SPACES_AVAILABLE
3092 #error "OS_QUEUE_SPACES_AVAILABLE not defined"
3093 #endif
3094 
3095 /* Create OS timer */
3096 #ifndef _OS_TIMER_CREATE
3097 #error "OS_TIMER_CREATE not defined"
3098 #endif
3099 
3100 /* Get OS timer ID */
3101 #ifndef _OS_TIMER_GET_TIMER_ID
3102 #error "OS_TIMER_GET_TIMER_ID not defined"
3103 #endif
3104 
3105 /* Check if OS timer is active */
3106 #ifndef _OS_TIMER_IS_ACTIVE
3107 #error "OS_TIMER_IS_ACTIVE not defined"
3108 #endif
3109 
3110 /* Start OS timer */
3111 #ifndef _OS_TIMER_START
3112 #error "OS_TIMER_START not defined"
3113 #endif
3114 
3115 /* Stop OS timer */
3116 #ifndef _OS_TIMER_STOP
3117 #error "OS_TIMER_STOP not defined"
3118 #endif
3119 
3120 /* Change OS timer's period */
3121 #ifndef _OS_TIMER_CHANGE_PERIOD
3122 #error "OS_TIMER_CHANGE_PERIOD not defined"
3123 #endif
3124 
3125 /* Delete OS timer */
3126 #ifndef _OS_TIMER_DELETE
3127 #error "OS_TIMER_DELETE not defined"
3128 #endif
3129 
3130 /* Reset OS timer */
3131 #ifndef _OS_TIMER_RESET
3132 #error "OS_TIMER_RESET not defined"
3133 #endif
3134 
3135 /* Start OS timer from ISR */
3136 #ifndef _OS_TIMER_START_FROM_ISR
3137 #error "OS_TIMER_START_FROM_ISR not defined"
3138 #endif
3139 
3140 /* Stop OS timer from ISR */
3141 #ifndef _OS_TIMER_STOP_FROM_ISR
3142 #error "OS_TIMER_STOP_FROM_ISR not defined"
3143 #endif
3144 
3145 /* Change OS timer period from ISR */
3146 #ifndef _OS_TIMER_CHANGE_PERIOD_FROM_ISR
3147 #error "OS_TIMER_CHANGE_PERIOD_FROM_ISR not defined"
3148 #endif
3149 
3150 /* Reset OS timer from ISR */
3151 #ifndef _OS_TIMER_RESET_FROM_ISR
3152 #error "OS_TIMER_RESET_FROM_ISR not defined"
3153 #endif
3154 
3155 /* Delay execution of OS task for specified time */
3156 #ifndef _OS_DELAY
3157 #error "OS_DELAY not defined"
3158 #endif
3159 
3160 /* Delay execution of OS task until specified time */
3161 #ifndef _OS_DELAY_UNTIL
3162 #error "OS_DELAY_UNTIL not defined"
3163 #endif
3164 
3165 /* Get current OS tick count */
3166 #ifndef _OS_GET_TICK_COUNT
3167 #error "OS_GET_TICK_COUNT not defined"
3168 #endif
3169 
3170 /* Get current OS tick count from ISR */
3171 #ifndef _OS_GET_TICK_COUNT_FROM_ISR
3172 #error "OS_GET_TICK_COUNT_FROM_ISR not defined"
3173 #endif
3174 
3175 /* Convert from OS ticks to ms */
3176 #ifndef _OS_TICKS_2_MS
3177 #error "OS_TICKS_2_MS not defined"
3178 #endif
3179 
3180 /* Convert from ms to OS ticks */
3181 #ifndef _OS_MS_2_TICKS
3182 #error "OS_MS_2_TICKS not defined"
3183 #endif
3184 
3185 /* Delay execution of OS task for specified time */
3186 #ifndef _OS_DELAY_MS
3187 #error "OS_DELAY_MS not defined"
3188 #endif
3189 
3190 /* Enter critical section from non-ISR context */
3191 #ifndef _OS_ENTER_CRITICAL_SECTION
3192 #error "OS_ENTER_CRITICAL_SECTION not defined"
3193 #endif
3194 
3195 /* Enter critical section from ISR context */
3196 #ifndef _OS_ENTER_CRITICAL_SECTION_FROM_ISR
3197 #error "OS_ENTER_CRITICAL_SECTION_FROM_ISR not defined"
3198 #endif
3199 
3200 /* Leave critical section from non-ISR context */
3201 #ifndef _OS_LEAVE_CRITICAL_SECTION
3202 #error "OS_LEAVE_CRITICAL_SECTION not defined"
3203 #endif
3204 
3205 /* Leave critical section from ISR context */
3206 #ifndef _OS_LEAVE_CRITICAL_SECTION_FROM_ISR
3207 #error "OS_LEAVE_CRITICAL_SECTION_FROM_ISR not defined"
3208 #endif
3209 
3210 /* Name for OS memory allocation function */
3211 #ifndef _OS_MALLOC_FUNC
3212 #error "OS_MALLOC_FUNC not defined"
3213 #endif
3214 
3215 /* Name for non-retain memory allocation function */
3216 #ifndef _OS_MALLOC_NORET_FUNC
3217 #error "OS_MALLOC_NORET_FUNC not defined"
3218 #endif
3219 
3220 /* Allocate memory from OS provided heap */
3221 #ifndef _OS_MALLOC
3222 #error "OS_MALLOC not defined"
3223 #endif
3224 
3225 /* Allocate memory from non-retain heap */
3226 #ifndef _OS_MALLOC_NORET
3227 #error "OS_MALLOC_NORET not defined"
3228 #endif
3229 
3230 /* Name for OS free memory function */
3231 #ifndef _OS_FREE_FUNC
3232 #error "OS_FREE_FUNC not defined"
3233 #endif
3234 
3235 /* Name for non-retain memory free function */
3236 #ifndef _OS_FREE_NORET_FUNC
3237 #error "OS_FREE_NORET_FUNC not defined"
3238 #endif
3239 
3240 /* Free memory allocated by OS_MALLOC() */
3241 #ifndef _OS_FREE
3242 #error "OS_FREE not defined"
3243 #endif
3244 
3245 /* Free memory allocated by OS_MALLOC_NORET() */
3246 #ifndef _OS_FREE_NORET
3247 #error "OS_FREE_NORET not defined"
3248 #endif
3249 
3250 /* Get the high water mark of heap */
3251 #ifndef _OS_GET_HEAP_WATERMARK
3252 #error "OS_GET_HEAP_WATERMARK not defined"
3253 #endif
3254 
3255 /* Get current free heap size */
3256 #ifndef _OS_GET_FREE_HEAP_SIZE
3257 #error "OS_GET_FREE_HEAP_SIZE not defined"
3258 #endif
3259 
3260 /* Get current number of OS tasks */
3261 #ifndef _OS_GET_TASKS_NUMBER
3262 #error "OS_GET_TASKS_NUMBER not defined"
3263 #endif
3264 
3265 /* Advance OS tick count */
3266 #ifndef _OS_TICK_ADVANCE
3267 #error "OS_TICK_ADVANCE not defined"
3268 #endif
3269 
3270 /* Update OS tick count by adding a given number of OS ticks */
3271 #ifndef _OS_TICK_INCREMENT
3272 #error "OS_TICK_INCREMENT not defined"
3273 #endif
3274 
3275 #else
3276 
3277 #include <stdlib.h>
3278 /*
3279  * Basic set of macros that can be used in non OS environment.
3280  */
3281 #define PRIVILEGED_DATA
3282 #define OS_MALLOC malloc
3283 #define OS_FREE free
3284 #ifndef RELEASE_BUILD
3285 #define OS_ASSERT(a) do { if (!(a)) {__BKPT(0);} } while (0)
3286 #else
3287 #define OS_ASSERT(a) ((void) (a))
3288 #endif
3289 
3290 #endif /* OS_PRESENT */
3291 
3295 #define OS_PTR_TO_UINT(p) ((unsigned) (void *) (p))
3296 
3300 #define OS_PTR_TO_INT(p) ((int) (void *) (p))
3301 
3305 #define OS_UINT_TO_PTR(u) ((void *) (unsigned) (u))
3306 
3310 #define OS_INT_TO_PTR(i) ((void *) (int) (i))
3311 
3312 #endif /* OSAL_H_ */
3313 
osal_freertos.h
OS abstraction layer API for FreeRTOS.