1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3 \page os2Migration Migration from API v1 to API v2
5 This section lists the CMSIS-RTOS API v1 and API v2 functions along with the differences in functionality.
6 The list is sorted alphabetically by API v2 function names and is structured the following way:
8 - RTOS API v2 function prototype
9 - RTOS API v1 function prototype that is equivalent or provides similar functionality
10 - Brief description of the RTOS v2 function.
11 - Description of the difference.
13 The background color indicates:
14 - <div class="new">Green: New functions in API v2 that are not available in API v1 </div>
16 - <div class="mod">Amber: Functions that are modified or replaced in API v2 compared to API v1 </div>
18 - <div class="del">Red: Functions in API v1 that are deprecated in API v2 </div>
22 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
23 Kernel Information and Control
26 \section mig_kernel Kernel Information and Control
29 \func{osStatus_t #osKernelGetInfo (osVersion_t* version, char* id_buf, uint32_t id_size)}
31 \copybrief{osKernelGetInfo}
32 New function #osKernelGetInfo.
36 \func{osKernelState_t #osKernelGetState (void)}
37 \func{int32_t osKernelRunning (void)}
38 \copybrief{osKernelGetState}
39 - The function \b osKernelGetState replaces the RTOS v1 function \b osKernelRunning.
40 - Return type changed to \ref osKernelState_t.
45 \func{uint32_t #osKernelGetTickCount (void)}
46 \func{uint32_t osKernelSysTick (void)}
47 \copybrief{osKernelGetTickCount}
48 - The function \b osKernelGetTickCount replaces the RTOS v1 function \b osKernelSysTick.
53 \func{uint32_t #osKernelGetTickFreq (void)}
55 \copybrief{osKernelGetTickFreq}
56 - The function \b osKernelGetTickFreq replaces the RTOS v1 macro \b osKernelTickMicroSec.
61 \func{uint64_t #osKernelGetSysTimerCount (void)}
63 \copybrief{osKernelGetSysTimerCount}
68 \func{uint64_t #osKernelGetSysTimerFreq (void)}
70 \copybrief{osKernelGetSysTimerFreq}
75 \func{osStatus_t #osKernelInitialize (void)}
76 \func{osStatus osKernelInitialize (void)}
77 \copybrief{osKernelInitialize}
78 - Return type changed to \ref osStatus_t.
83 \func{uint32_t #osKernelLock (void)}
85 \copybrief{osKernelLock}
90 \func{void #osKernelResume (uint32_t sleep_time)}
92 \copybrief{osKernelResume}
97 \func{osStatus_t #osKernelStart (void)}
98 \func{osStatus osKernelStart (void)}
99 \copybrief{osKernelStart}
100 - Return type changed to \ref osStatus_t.
105 \func{uint32_t #osKernelSuspend (void)}
107 \copybrief{osKernelSuspend}
112 \func{void #osKernelUnlock (void)}
114 \copybrief{osKernelUnlock}
120 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
121 ====== Thread Management =======
124 \section mig_threadMgmt Thread Management
127 \func{osStatus_t #osThreadDetach (osThreadId_t thread_id)}
129 \copybrief{osThreadDetach}
134 \func{__NO_RETURN void #osThreadExit (void)}
136 \copybrief{osThreadExit}
141 \func{const char *#osThreadGetName (osThreadId_t thread_id)}
143 \copybrief{osThreadGetName}
148 \func{osThreadId_t #osThreadGetId (void)}
149 \func{osThreadId osThreadGetId (void)}
150 \copybrief{osThreadGetId}
151 - Return type changed to #osThreadId_t.
156 \func{osPriority_t #osThreadGetPriority (osThreadId_t thread_id)}
157 \func{osPriority osThreadGetPriority (osThreadId thread_id)}
158 \copybrief{osThreadGetPriority}
159 - Return type changed to #osPriority_t.
160 - Parameter type changed to #osThreadId_t.
165 \func{osThreadState_t #osThreadGetState (osThreadId_t thread_id)}
167 \copybrief{osThreadGetState}
172 \func{osStatus_t #osThreadJoin (osThreadId_t thread_id)}
174 \copybrief{osThreadJoin}
179 \func{osThreadId_t #osThreadNew (os_thread_func_t function, void *argument, const osThreadAttr_t *attr)}
180 \func{osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)}
181 \copybrief{osThreadNew}
182 - The function \b osThreadNew replaces the RTOS v1 function \b osThreadCreate.
183 - Options are now passed using a \ref osThreadAttr_t struct, replacing the \b osThreadDef macro.
184 - New function prototype is <kbd>void *func (void *arg)</kbd>, before: <kbd>void func (const void *arg)</kbd>.
189 \func{osStatus_t #osThreadResume (osThreadId_t thread_id)}
191 \copybrief{osThreadResume}
196 \func{osStatus_t #osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)}
197 \func{osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)}
198 \copybrief{osThreadSetPriority}
199 - Return type changed to #osStatus_t.
200 - Parameter types changed to #osThreadId_t and #osPriority_t.
205 \func{osStatus_t #osThreadSuspend (osThreadId_t thread_id)}
207 \copybrief{osThreadSuspend}
212 \func{osStatus_t #osThreadTerminate (osThreadId_t thread_id)}
214 \copybrief{osThreadTerminate}
219 \func{osStatus_t #osThreadYield (void)}
220 \func{osStatus osThreadYield (void)}
221 \copybrief{osThreadYield}
222 - Return type changed to #osStatus_t.
228 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
229 ====== Generic Wait Functions =======
232 \section mig_wait Generic Wait Functions
234 Refer to \ref CMSIS_RTOS_Wait for details.
237 \func{osStatus_t #osDelay (uint32_t ticks)}
238 \func{osStatus osDelay (uint32_t millisec)}
240 - The return type changed to #osStatus_t.
245 \func{osStatus_t #osDelayUntil (uint64_t ticks)}
246 \func{osStatus osDelayUntil (uint64_t millisec)}
247 \copybrief{osDelayUntil}
248 - The return type changed to #osStatus_t.
254 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
255 ====== Timer Management =======
258 \section mig_timer Timer Management
260 Refer to \ref CMSIS_RTOS_TimerMgmt for details.
263 \func{osStatus_t #osTimerDelete (osTimerId_t timer_id)}
264 \func{osStatus osTimerDelete (osTimerId timer_id)}
265 \copybrief{osTimerDelete}
266 - The return type changed to #osStatus_t.
267 - The parameter type has changed to #osTimerId_t.
272 \func{uint32_t #osTimerIsRunning (osTimerId_t timer_id)}
274 \copybrief{osTimerIsRunning}
279 \func{osTimerId_t #osTimerNew (os_timer_func_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr)}
280 \func{osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument)}
281 \copybrief{osTimerNew}
282 - The function \b osTimerNew replaces the RTOS v1 function \b osTimerCreate.
283 - The return type changed to #osTimerId_t.
284 - The parameter list and types have changed.
289 \func{osStatus_t #osTimerStart (osTimerId_t timer_id, uint32_t ticks)}
290 \func{osStatus osTimerStart (osTimerId timer_id, uint32_t millisec)}
291 \copybrief{osTimerStart}
292 - The return type changed to #osStatus_t.
293 - The first parameter type has changed to #osTimerId_t.
298 \func{osStatus_t #osTimerStop (osTimerId_t timer_id)}
299 \func{osStatus osTimerStop (osTimerId timer_id)}
300 \copybrief{osTimerStop}
301 - The return type changed to #osStatus_t.
302 - The parameter type has changed to #osTimerId_t.
308 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
309 ====== Signal Events =======
312 \section mig_signalEvents Signal Events
314 The section RTOS v1 <b>Signal Events</b> has been deprecated.
315 Use the functions listed under \ref mig_threadFlags and \ref mig_eventFlags instead.
319 \func{int32_t osSignalClear (osThreadId thread_id, int32_t signals)}
326 \func{int32_t osSignalSet (osThreadId thread_id, int32_t signals)}
333 \func{osEvent osSignalWait (int32_t signals, uint32_t millisec)}
341 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
342 ====== Event Flags =======
345 \section mig_eventFlags Event Flags
347 New section to synchronize events using flags. Event flags and thread flags are replacing the RTOS v1 <b>Signal Events</b>.
348 All functions listed in the RTOS v1 <b>Signal Events</b> have been deprecated.
349 Refer to \ref mig_signalEvents for a list of deprecated functions.
350 Refer to \ref CMSIS_RTOS_EventFlags for details about the new function.
353 \func{int32_t #osEventFlagsClear (osEventFlagsId_t ef_id, int32_t flags)}
355 \copybrief{osEventFlagsClear}
360 \func{osStatus_t #osEventFlagsDelete (osEventFlagsId_t ef_id)}
362 \copybrief{osEventFlagsDelete}
367 \func{int32_t #osEventFlagsGet (osEventFlagsId_t ef_id)}
369 \copybrief{osEventFlagsGet}
374 \func{osEventFlagsId_t #osEventFlagsNew (const osEventFlagsAttr_t *attr)}
376 \copybrief{osEventFlagsNew}
381 \func{int32_t #osEventFlagsSet (osEventFlagsId_t ef_id, int32_t flags)}
383 \copybrief{osEventFlagsSet}
388 \func{int32_t #osEventFlagsWait (osEventFlagsId_t ef_id, int32_t flags, uint32_t options, uint32_t timeout)}
390 \copybrief{osEventFlagsWait}
396 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
397 ====== Thread Flags =======
400 \section mig_threadFlags Thread Flags
402 New section to synchronize threads using flags. Thread flags and the more flexible \ref mig_eventFlags are replacing the RTOS v1 <b>Signal Events</b>. Refer to \ref mig_signalEvents for a list of deprecated functions.
403 Refer to \ref CMSIS_RTOS_ThreadFlagsMgmt for details.
406 \func{int32_t #osThreadFlagsSet (osThreadId_t thread_id, int32_t flags)}
408 \copybrief{osThreadFlagsSet}
413 \func{int32_t #osThreadFlagsClear (int32_t flags)}
415 \copybrief{osThreadFlagsClear}
420 \func{int32_t #osThreadFlagsGet (void)}
422 \copybrief{osThreadFlagsGet}
427 \func{int32_t #osThreadFlagsWait (int32_t flags, uint32_t options, uint32_t timeout)}
429 \copybrief{osThreadFlagsWait}
435 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
436 ====== Message Queue =======
439 \section mig_msgQueue Message Queue
440 Refer to \ref CMSIS_RTOS_Message for details.
443 \func{osStatus_t #osMessageQueueDelete (osMessageQueueId_t mq_id)}
445 \copybrief{osMessageQueueDelete}
450 \func{osStatus_t #osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)}
451 \func{osEvent osMessageGet (osMessageQId queue_id, uint32_t millisec)}
452 \copybrief{osMessageQueueGet}
453 - The function \b osMessageQueueGet replaces the RTOS v1 function \b osMessageGet.
454 - The return type changed to #osStatus_t.
455 - The parameter list and parameter types have changed.
460 \func{uint32_t #osMessageQueueGetCapacity (osMessageQueueId_t mq_id)}
462 \copybrief{osMessageQueueGetCapacity}
467 \func{uint32_t #osMessageQueueGetCount (osMessageQueueId_t mq_id)}
469 \copybrief{osMessageQueueGetCount}
474 \func{uint32_t #osMessageQueueGetMsgSize (osMessageQueueId_t mq_id)}
476 \copybrief{osMessageQueueGetMsgSize}
481 \func{uint32_t #osMessageQueueGetSpace (osMessageQueueId_t mq_id)}
483 \copybrief{osMessageQueueGetSpace}
488 \func{osMessageQueueId_t #osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)}
489 \func{osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id)}
490 \copybrief{osMessageQueueNew}
491 - The function \b osMessageQueueNew replaces the RTOS v1 function \b osMessageCreate.
492 - The return type changed to #osMessageQueueId_t.
493 - The parameter list and parameter types have changed.
498 \func{osStatus_t #osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)}
499 \func{osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t millisec)}
500 \copybrief{osMessageQueuePut}
501 - The function \b osMessageQueuePut replaces the RTOS v1 function \b osMessagePut.
502 - The return type changed to #osStatus_t.
503 - The parameter list and parameter types have changed.
508 \func{osStatus_t #osMessageQueueReset (osMessageQueueId_t mq_id)}
510 \copybrief{osMessageQueueReset}
516 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
517 ====== Memory Pool =======
520 \section mig_memPool Memory Pool
523 \func{void * #osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout)}
524 \func{void * osPoolAlloc (osPoolId pool_id)}
525 \func{void * osPoolCAlloc (osPoolId pool_id)}
526 \copybrief{osMemoryPoolAlloc}
527 - The function \b osMemoryPoolAlloc replaces both RTOS v1 functions \b osPoolAlloc and \b osPoolCAlloc.
528 - The parameter list and types changed.
533 \func{osStatus_t #osMemoryPoolDelete (osMemoryPoolId_t mp_id)}
535 \copybrief{osMemoryPoolDelete}
540 \func{osStatus_t #osMemoryPoolFree (osMemoryPoolId_t mp_id, void * block)}
541 \func{osStatus osPoolFree (osPoolId pool_id, void * block)}
542 \copybrief{osMemoryPoolFree}
543 - The function \b osMemoryPoolFree replaces the RTOS v1 function \b osPoolFree.
544 - The first parameter type \b osMemoryPoolId_t replaces the ROTS v1 type \b osPoolId.
549 \func{uint32_t #osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id)}
551 \copybrief{osMemoryPoolGetBlockSize}
556 \func{uint32_t #osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id)}
558 \copybrief{osMemoryPoolGetCapacity}
563 \func{uint32_t #osMemoryPoolGetCount (osMemoryPoolId_t mp_id)}
565 \copybrief{osMemoryPoolGetCount}
570 \func{uint32_t #osMemoryPoolGetSpace (osMemoryPoolId_t mp_id)}
572 \copybrief{osMemoryPoolGetSpace}
577 \func{osMemoryPoolId_t #osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr)}
578 \func{osPoolId osPoolCreate (const osPoolDef_t * pool_def)}
579 \copybrief{osMemoryPoolGetSpace}
580 - The function \b osMemoryPoolNew replaces the RTOS v1 function \b osPoolCreate.
581 - The return type changed to #osMemoryPoolId_t.
582 - Parameter list and parameter types have changed.
588 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
589 ====== Mail Queue =======
592 \section mig_mailQueue Mail Queue
593 The <b>Mail Queue</b> RTOS v1 functions have been deprecated.
594 Use the functionality of the \ref CMSIS_RTOS_Message instead.
595 Differences are listed under \ref mig_msgQueue.
599 \func{void * osMailAlloc (osMailQId queue_id, uint32_t millisec)}
606 \func{void * osMailCAlloc (osMailQId queue_id, uint32_t millisec)}
613 \func{osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id)}
620 \func{osStatus osMailFree (osMailQId queue_id, void *mail)}
627 \func{osEvent osMailGet (osMailQId queue_id, uint32_t millisec)}
634 \func{osStatus osMailPut (osMailQId queue_id, void *mail)}
641 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
642 ====== Mutexes =======
645 \section mig_mutex Mutexes
646 Refer to \ref CMSIS_RTOS_MutexMgmt for details.
649 \func{osStatus_t #osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout)}
650 \func{osStatus osMutexWait (osMutexId mutex_id, uint32_t millisec)}
651 \copybrief{osMutexAcquire}
652 - The function \b osMutexAcquire replaces the RTOS v1 function \b osMutexWait.
653 - Return type changed to \ref osStatus_t.
654 - First parameter type changed to \ref osMutexId_t.
659 \func{osStatus_t #osMutexDelete (osMutexId_t mutex_id)}
660 \func{osStatus osMutexDelete (osMutexId mutex_id)}
661 \copybrief{osMutexDelete}
662 - The return type changed to \ref osStatus_t.
663 - The parameter type changed to \ref osMutexId_t.
668 \func{osThreadId_t #osMutexGetOwner (osMutexId_t mutex_id)}
670 \copybrief{osMutexGetOwner}
675 \func{osMutexId_t #osMutexNew (const osMutexAttr_t *attr)}
676 \func{osMutexId osMutexCreate (const osMutexDef_t *mutex_def)}
677 \copybrief{osMutexNew}
678 - The function \b osMutexNew replaces the RTOS v1 function \b osMutexCreate.
679 - The return type changed to \ref osMutexId_t.
680 - The parameter type changed to \ref osMutexAttr_t.
685 \func{osStatus_t #osMutexRelease (osMutexId_t mutex_id)}
686 \func{osStatus osMutexRelease (osMutexId mutex_id)}
687 \copybrief{osMutexRelease}
688 - The return type changed to \ref osStatus_t.
689 - The parameter type changed to \ref osMutexId_t.
695 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
696 ====== SEMAPHORES =======
699 \section mig_sem Semaphores
700 Refer to \ref CMSIS_RTOS_SemaphoreMgmt for details.
703 \func{osStatus_t #osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout)}
705 \copybrief{osSemaphoreAcquire}
710 \func{osStatus_t #osSemaphoreDelete (osSemaphoreId_t semaphore_id)}
711 \func{osStatus osSemaphoreDelete (osSemaphoreId semaphore_id)}
712 \copybrief{osSemaphoreDelete}
713 - The return type changed to #osStatus_t.
714 - The parameter type has changed to #osSemaphoreId_t.
719 \func{uint32_t #osSemaphoreGetCount (osSemaphoreId_t semaphore_id)}
721 \copybrief{osSemaphoreGetCount}
726 \func{osSemaphoreId_t #osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr)}
727 \func{osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count)}
728 \copybrief{osSemaphoreNew}
729 - The function \b osSemaphoreNew replaces the RTOS v1 function \b osSemaphoreCreate.
730 - The return type changed to #osSemaphoreId_t.
731 - The parameter list and types have changed.
736 \func{osStatus_t #osSemaphoreRelease (osSemaphoreId_t semaphore_id)}
737 \func{osStatus osSemaphoreRelease (osSemaphoreId semaphore_id)}
738 \copybrief{osSemaphoreRelease}
739 - The return type changed to #osStatus_t.
740 - The parameter type has changed to #osSemaphoreId_t.
746 \func{int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t millisec)}