30 #include "rtx_core_c.h" 31 #if ((defined(__ARM_ARCH_8M_BASE__) && (__ARM_ARCH_8M_BASE__ != 0)) || \ 32 (defined(__ARM_ARCH_8M_MAIN__) && (__ARM_ARCH_8M_MAIN__ != 0))) 33 #include "tz_context.h" 36 #include "cmsis_os2.h" 37 #include "RTX_Config.h" 44 #define os_thread_t osRtxThread_t 45 #define os_timer_t osRtxTimer_t 46 #define os_timer_finfo_t osRtxTimerFinfo_t 47 #define os_event_flags_t osRtxEventFlags_t 48 #define os_mutex_t osRtxMutex_t 49 #define os_semaphore_t osRtxSemaphore_t 50 #define os_mp_info_t osRtxMpInfo_t 51 #define os_memory_pool_t osRtxMemoryPool_t 52 #define os_message_t osRtxMessage_t 53 #define os_message_queue_t osRtxMessageQueue_t 54 #define os_object_t osRtxObject_t 59 __STATIC_INLINE os_thread_t *osRtxThreadId (osThreadId_t thread_id) {
61 return ((os_thread_t *)thread_id);
64 __STATIC_INLINE os_timer_t *osRtxTimerId (osTimerId_t timer_id) {
66 return ((os_timer_t *)timer_id);
69 __STATIC_INLINE os_event_flags_t *osRtxEventFlagsId (osEventFlagsId_t ef_id) {
71 return ((os_event_flags_t *)ef_id);
74 __STATIC_INLINE os_mutex_t *osRtxMutexId (osMutexId_t mutex_id) {
76 return ((os_mutex_t *)mutex_id);
79 __STATIC_INLINE os_semaphore_t *osRtxSemaphoreId (osSemaphoreId_t semaphore_id) {
81 return ((os_semaphore_t *)semaphore_id);
84 __STATIC_INLINE os_memory_pool_t *osRtxMemoryPoolId (osMemoryPoolId_t mp_id) {
86 return ((os_memory_pool_t *)mp_id);
89 __STATIC_INLINE os_message_queue_t *osRtxMessageQueueId (osMessageQueueId_t mq_id) {
91 return ((os_message_queue_t *)mq_id);
95 __STATIC_INLINE os_object_t *osRtxObject (
void *
object) {
97 return ((os_object_t *)
object);
101 __STATIC_INLINE os_thread_t *osRtxThreadObject (os_object_t *
object) {
103 return ((os_thread_t *)
object);
106 __STATIC_INLINE os_timer_t *osRtxTimerObject (os_object_t *
object) {
108 return ((os_timer_t *)
object);
111 __STATIC_INLINE os_event_flags_t *osRtxEventFlagsObject (os_object_t *
object) {
113 return ((os_event_flags_t *)
object);
116 __STATIC_INLINE os_mutex_t *osRtxMutexObject (os_object_t *
object) {
118 return ((os_mutex_t *)
object);
121 __STATIC_INLINE os_semaphore_t *osRtxSemaphoreObject (os_object_t *
object) {
123 return ((os_semaphore_t *)
object);
126 __STATIC_INLINE os_memory_pool_t *osRtxMemoryPoolObject (os_object_t *
object) {
128 return ((os_memory_pool_t *)
object);
131 __STATIC_INLINE os_message_queue_t *osRtxMessageQueueObject (os_object_t *
object) {
133 return ((os_message_queue_t *)
object);
136 __STATIC_INLINE os_message_t *osRtxMessageObject (os_object_t *
object) {
138 return ((os_message_t *)
object);
142 __STATIC_INLINE osKernelState_t osRtxKernelState (
void) {
144 return ((osKernelState_t)(osRtxInfo.kernel.
state));
148 __STATIC_INLINE osThreadState_t osRtxThreadState (
const os_thread_t *thread) {
149 uint8_t state = thread->state & osRtxThreadStateMask;
151 return ((osThreadState_t)state);
155 __STATIC_INLINE osPriority_t osRtxThreadPriority (
const os_thread_t *thread) {
157 return ((osPriority_t)thread->priority);
161 __STATIC_INLINE uint8_t osRtxKernelGetState (
void) {
162 return osRtxInfo.kernel.
state;
166 __STATIC_INLINE os_thread_t *osRtxThreadGetRunning (
void) {
167 return osRtxInfo.
thread.run.curr;
169 __STATIC_INLINE
void osRtxThreadSetRunning (os_thread_t *thread) {
170 osRtxInfo.
thread.run.curr = thread;
177 extern void osRtxKernelPreInit (
void);
180 extern void osRtxThreadListPut (os_object_t *
object, os_thread_t *thread);
181 extern os_thread_t *osRtxThreadListGet (os_object_t *
object);
182 extern void osRtxThreadListSort (os_thread_t *thread);
183 extern void osRtxThreadListRemove (os_thread_t *thread);
184 extern void osRtxThreadReadyPut (os_thread_t *thread);
185 extern void osRtxThreadDelayTick (
void);
186 extern uint32_t *osRtxThreadRegPtr (
const os_thread_t *thread);
187 extern void osRtxThreadSwitch (os_thread_t *thread);
188 extern void osRtxThreadDispatch (os_thread_t *thread);
189 extern void osRtxThreadWaitExit (os_thread_t *thread, uint32_t ret_val, bool_t dispatch);
190 extern bool_t osRtxThreadWaitEnter (uint8_t state, uint32_t timeout);
191 extern void osRtxThreadStackCheck (
void);
192 extern bool_t osRtxThreadStartup (
void);
195 extern void osRtxTimerThread (
void *argument);
198 extern void osRtxMutexOwnerRelease (os_mutex_t *mutex_list);
201 extern uint32_t osRtxMemoryInit (
void *mem, uint32_t size);
202 extern void *osRtxMemoryAlloc(
void *mem, uint32_t size, uint32_t type);
203 extern uint32_t osRtxMemoryFree (
void *mem,
void *block);
206 extern uint32_t osRtxMemoryPoolInit (os_mp_info_t *mp_info, uint32_t block_count, uint32_t block_size,
void *block_mem);
207 extern void *osRtxMemoryPoolAlloc (os_mp_info_t *mp_info);
208 extern osStatus_t osRtxMemoryPoolFree (os_mp_info_t *mp_info,
void *block);
211 extern void osRtxTick_Handler (
void);
212 extern void osRtxPendSV_Handler (
void);
213 extern void osRtxPostProcess (os_object_t *
object);
osRtxThread_t * thread
< Thread Round Robin Info
CMSIS OS Tick header file.
uint8_t state
< Kernel Info