1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3 \page os2Migration Migration from API v1 to API v2
6 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
10 This page lists the CMSIS-RTOS API v1 and API v2 functions along with the differences in functionality.
11 The list is sorted alphabetically by API v2 function names and is structured the following way:
13 - RTOS API v2 function prototype
14 - RTOS API v1 function prototype that is equivalent or provides similar functionality
15 - Brief description of the RTOS v2 function.
16 - Description of the difference.
18 The background color indicates:
19 - <div class="new">Green: New functions in API v2 that are not available in API v1 </div>
21 - <div class="mod">Amber: Functions that are modified or replaced in API v2 compared to API v1 </div>
23 - <div class="del">Red: Functions in API v1 that are deprecated in API v2 </div>
27 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
28 Kernel Information and Control
31 \section mig_kernel Kernel Information and Control
34 \func{osStatus_t #osKernelGetInfo (osVersion_t* version, char* id_buf, uint32_t id_size)}
36 \copybrief{osKernelGetInfo}
37 New function #osKernelGetInfo.
41 \func{osKernelState_t #osKernelGetState (void)}
42 \func{int32_t osKernelRunning (void)}
43 \copybrief{osKernelGetState}
44 - The function \b osKernelGetState replaces the RTOS v1 function \b osKernelRunning.
45 - Return type changed to \ref osKernelState_t.
50 \func{uint32_t #osKernelGetTickCount (void)}
52 \copybrief{osKernelGetTickCount}
57 \func{uint32_t #osKernelGetTickFreq (void)}
59 \copybrief{osKernelGetTickFreq}
60 - The function \b osKernelGetTickFreq replaces the RTOS v1 macro \b osKernelTickMicroSec.
65 \func{uint32_t #osKernelGetSysTimerCount (void)}
66 \func{uint32_t osKernelSysTick (void)}
67 \copybrief{osKernelGetSysTimerCount}
68 - The function \b osKernelGetSysTimerCount replaces the RTOS v1 function \b osKernelSysTick.
73 \func{uint64_t #osKernelGetSysTimerFreq (void)}
75 \copybrief{osKernelGetSysTimerFreq}
80 \func{osStatus_t #osKernelInitialize (void)}
81 \func{osStatus osKernelInitialize (void)}
82 \copybrief{osKernelInitialize}
83 - Return type changed to \ref osStatus_t.
88 \func{int32_t #osKernelLock (void)}
90 \copybrief{osKernelLock}
95 \func{int32_t #osKernelUnlock (void)}
97 \copybrief{osKernelUnlock}
102 \func{void #osKernelRestoreLock (void)}
104 \copybrief{osKernelRestoreLock}
109 \func{osStatus_t #osKernelStart (void)}
110 \func{osStatus osKernelStart (void)}
111 \copybrief{osKernelStart}
112 - Return type changed to \ref osStatus_t.
117 \func{uint32_t #osKernelSuspend (void)}
119 \copybrief{osKernelSuspend}
124 \func{void #osKernelResume (uint32_t sleep_time)}
126 \copybrief{osKernelResume}
132 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
133 ====== Thread Management =======
136 \section mig_threadMgmt Thread Management
139 \func{osStatus_t #osThreadDetach (osThreadId_t thread_id)}
141 \copybrief{osThreadDetach}
146 \func{uint32_t #osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items)}
148 \copybrief{osThreadEnumerate}
153 \func{__NO_RETURN void #osThreadExit (void)}
155 \copybrief{osThreadExit}
160 \func{uint32_t #osThreadGetCount (osThreadId_t thread_id)}
162 \copybrief{osThreadGetCount}
167 \func{const char *#osThreadGetName (osThreadId_t thread_id)}
169 \copybrief{osThreadGetName}
174 \func{osThreadId_t #osThreadGetId (void)}
175 \func{osThreadId osThreadGetId (void)}
176 \copybrief{osThreadGetId}
177 - Return type changed to #osThreadId_t.
182 \func{osPriority_t #osThreadGetPriority (osThreadId_t thread_id)}
183 \func{osPriority osThreadGetPriority (osThreadId thread_id)}
184 \copybrief{osThreadGetPriority}
185 - Return type changed to #osPriority_t.
186 - Parameter type changed to #osThreadId_t.
191 \func{uint32_t #osThreadGetStackSize (osThreadId_t thread_id)}
193 \copybrief{osThreadGetStackSize}
198 \func{uint32_t #osThreadGetStackSpace (osThreadId_t thread_id)}
200 \copybrief{osThreadGetStackSpace}
205 \func{osThreadState_t #osThreadGetState (osThreadId_t thread_id)}
207 \copybrief{osThreadGetState}
212 \func{osStatus_t #osThreadJoin (osThreadId_t thread_id)}
214 \copybrief{osThreadJoin}
219 \func{osThreadId_t #osThreadNew (osThreadFunc_t function, void *argument, const osThreadAttr_t *attr)}
220 \func{osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)}
221 \copybrief{osThreadNew}
222 - The function \b osThreadNew replaces the RTOS v1 function \b osThreadCreate.
223 - Options are now passed using a \ref osThreadAttr_t struct, replacing the \b osThreadDef macro.
224 - New function prototype is <kbd>void func (void *arg)</kbd>, before: <kbd>void func (const void *arg)</kbd>.
229 \func{osStatus_t #osThreadResume (osThreadId_t thread_id)}
231 \copybrief{osThreadResume}
236 \func{osStatus_t #osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)}
237 \func{osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)}
238 \copybrief{osThreadSetPriority}
239 - Return type changed to #osStatus_t.
240 - Parameter types changed to #osThreadId_t and #osPriority_t.
245 \func{osStatus_t #osThreadSuspend (osThreadId_t thread_id)}
247 \copybrief{osThreadSuspend}
252 \func{osStatus_t #osThreadTerminate (osThreadId_t thread_id)}
253 \func{osStatus osThreadTerminate (osThreadId thread_id)}
254 \copybrief{osThreadTerminate}
255 - Return type changed to #osStatus_t.
256 - Parameter type changed to #osThreadId_t.
261 \func{osStatus_t #osThreadYield (void)}
262 \func{osStatus osThreadYield (void)}
263 \copybrief{osThreadYield}
264 - Return type changed to #osStatus_t.
270 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
271 ====== Thread Flags =======
274 \section mig_threadFlags Thread Flags
276 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.
277 Refer to \ref CMSIS_RTOS_ThreadFlagsMgmt for details.
280 \func{uint32_t #osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags)}
282 \copybrief{osThreadFlagsSet}
287 \func{uint32_t #osThreadFlagsClear (uint32_t flags)}
289 \copybrief{osThreadFlagsClear}
294 \func{uint32_t #osThreadFlagsGet (void)}
296 \copybrief{osThreadFlagsGet}
301 \func{uint32_t #osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout)}
303 \copybrief{osThreadFlagsWait}
309 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
310 ====== Event Flags =======
313 \section mig_eventFlags Event Flags
315 New section to synchronize events using flags. Event flags and thread flags are replacing the RTOS v1 <b>Signal Events</b>.
316 All functions listed in the RTOS v1 <b>Signal Events</b> have been deprecated.
317 Refer to \ref mig_signalEvents for a list of deprecated functions.
318 Refer to \ref CMSIS_RTOS_EventFlags for details about the new function.
321 \func{uint32_t #osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags)}
323 \copybrief{osEventFlagsClear}
328 \func{const char *#osEventFlagsGetName (osEventFlagsId_t ef_id)}
330 \copybrief{osEventFlagsGetName}
335 \func{osStatus_t #osEventFlagsDelete (osEventFlagsId_t ef_id)}
337 \copybrief{osEventFlagsDelete}
342 \func{uint32_t #osEventFlagsGet (osEventFlagsId_t ef_id)}
344 \copybrief{osEventFlagsGet}
349 \func{osEventFlagsId_t #osEventFlagsNew (const osEventFlagsAttr_t *attr)}
351 \copybrief{osEventFlagsNew}
356 \func{uint32_t #osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags)}
358 \copybrief{osEventFlagsSet}
363 \func{uint32_t #osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout)}
365 \copybrief{osEventFlagsWait}
371 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
372 ====== Generic Wait Functions =======
375 \section mig_wait Generic Wait Functions
377 Refer to \ref CMSIS_RTOS_Wait for details.
380 \func{osStatus_t #osDelay (uint32_t ticks)}
381 \func{osStatus osDelay (uint32_t timeout)}
383 - The return type changed to #osStatus_t.
388 \func{osStatus_t #osDelayUntil (uint32_t ticks)}
390 \copybrief{osDelayUntil}
396 \func{osEvent osWait (uint32_t millisec)}
404 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
405 ====== Timer Management =======
408 \section mig_timer Timer Management
410 Refer to \ref CMSIS_RTOS_TimerMgmt for details.
413 \func{osStatus_t #osTimerDelete (osTimerId_t timer_id)}
414 \func{osStatus osTimerDelete (osTimerId timer_id)}
415 \copybrief{osTimerDelete}
416 - The return type changed to #osStatus_t.
417 - The parameter type has changed to #osTimerId_t.
422 \func{const char *#osTimerGetName (osTimerId_t timer_id)}
424 \copybrief{osTimerGetName}
429 \func{uint32_t #osTimerIsRunning (osTimerId_t timer_id)}
431 \copybrief{osTimerIsRunning}
436 \func{osTimerId_t #osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr)}
437 \func{osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument)}
438 \copybrief{osTimerNew}
439 - The function \b osTimerNew replaces the RTOS v1 function \b osTimerCreate.
440 - The return type changed to #osTimerId_t.
441 - The parameter list and types have changed.
446 \func{osStatus_t #osTimerStart (osTimerId_t timer_id, uint32_t ticks)}
447 \func{osStatus osTimerStart (osTimerId timer_id, uint32_t timeout)}
448 \copybrief{osTimerStart}
449 - The return type changed to #osStatus_t.
450 - The first parameter type has changed to #osTimerId_t.
455 \func{osStatus_t #osTimerStop (osTimerId_t timer_id)}
456 \func{osStatus osTimerStop (osTimerId timer_id)}
457 \copybrief{osTimerStop}
458 - The return type changed to #osStatus_t.
459 - The parameter type has changed to #osTimerId_t.
465 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
466 ====== Mutexes =======
469 \section mig_mutex Mutexes
470 Refer to \ref CMSIS_RTOS_MutexMgmt for details.
473 \func{osStatus_t #osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout)}
474 \func{osStatus osMutexWait (osMutexId mutex_id, uint32_t timeout)}
475 \copybrief{osMutexAcquire}
476 - The function \b osMutexAcquire replaces the RTOS v1 function \b osMutexWait.
477 - Return type changed to \ref osStatus_t.
478 - First parameter type changed to \ref osMutexId_t.
483 \func{osStatus_t #osMutexDelete (osMutexId_t mutex_id)}
484 \func{osStatus osMutexDelete (osMutexId mutex_id)}
485 \copybrief{osMutexDelete}
486 - The return type changed to \ref osStatus_t.
487 - The parameter type changed to \ref osMutexId_t.
492 \func{const char *#osMutexGetName (osMutexId_t mutex_id)}
494 \copybrief{osMutexGetName}
499 \func{osThreadId_t #osMutexGetOwner (osMutexId_t mutex_id)}
501 \copybrief{osMutexGetOwner}
506 \func{osMutexId_t #osMutexNew (const osMutexAttr_t *attr)}
507 \func{osMutexId osMutexCreate (const osMutexDef_t *mutex_def)}
508 \copybrief{osMutexNew}
509 - The function \b osMutexNew replaces the RTOS v1 function \b osMutexCreate.
510 - The return type changed to \ref osMutexId_t.
511 - The parameter type changed to \ref osMutexAttr_t.
516 \func{osStatus_t #osMutexRelease (osMutexId_t mutex_id)}
517 \func{osStatus osMutexRelease (osMutexId mutex_id)}
518 \copybrief{osMutexRelease}
519 - The return type changed to \ref osStatus_t.
520 - The parameter type changed to \ref osMutexId_t.
526 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
527 ====== SEMAPHORES =======
530 \section mig_sem Semaphores
531 Refer to \ref CMSIS_RTOS_SemaphoreMgmt for details.
534 \func{osStatus_t #osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout)}
536 \copybrief{osSemaphoreAcquire}
537 New function. Replaces \c osSemaphoreWait.
541 \func{osStatus_t #osSemaphoreDelete (osSemaphoreId_t semaphore_id)}
542 \func{osStatus osSemaphoreDelete (osSemaphoreId semaphore_id)}
543 \copybrief{osSemaphoreDelete}
544 - The return type changed to #osStatus_t.
545 - The parameter type has changed to #osSemaphoreId_t.
550 \func{uint32_t #osSemaphoreGetCount (osSemaphoreId_t semaphore_id)}
552 \copybrief{osSemaphoreGetCount}
557 \func{const char *#osSemaphoreGetName (osSemaphoreId_t semaphore_id)}
559 \copybrief{osSemaphoreGetName}
564 \func{osSemaphoreId_t #osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr)}
565 \func{osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count)}
566 \copybrief{osSemaphoreNew}
567 - The function \b osSemaphoreNew replaces the RTOS v1 function \b osSemaphoreCreate.
568 - The return type changed to #osSemaphoreId_t.
569 - The parameter list and types have changed.
574 \func{osStatus_t #osSemaphoreRelease (osSemaphoreId_t semaphore_id)}
575 \func{osStatus osSemaphoreRelease (osSemaphoreId semaphore_id)}
576 \copybrief{osSemaphoreRelease}
577 - The return type changed to #osStatus_t.
578 - The parameter type has changed to #osSemaphoreId_t.
584 \func{int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t timeout)}
586 Deprecated. Replaced by #osSemaphoreAcquire.
591 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
592 ====== Memory Pool =======
595 \section mig_memPool Memory Pool
598 \func{void * #osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout)}
599 \func{void * osPoolAlloc (osPoolId pool_id)}
600 \copybrief{osMemoryPoolAlloc}
601 - The function \b osMemoryPoolAlloc replaces both RTOS v1 functions \b osPoolAlloc.
602 - The parameter list and types changed.
607 \func{osStatus_t #osMemoryPoolDelete (osMemoryPoolId_t mp_id)}
609 \copybrief{osMemoryPoolDelete}
614 \func{osStatus_t #osMemoryPoolFree (osMemoryPoolId_t mp_id, void * block)}
615 \func{osStatus osPoolFree (osPoolId pool_id, void * block)}
616 \copybrief{osMemoryPoolFree}
617 - The function \b osMemoryPoolFree replaces the RTOS v1 function \b osPoolFree.
618 - The first parameter type \b osMemoryPoolId_t replaces the ROTS v1 type \b osPoolId.
623 \func{uint32_t #osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id)}
625 \copybrief{osMemoryPoolGetBlockSize}
630 \func{uint32_t #osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id)}
632 \copybrief{osMemoryPoolGetCapacity}
637 \func{uint32_t #osMemoryPoolGetCount (osMemoryPoolId_t mp_id)}
639 \copybrief{osMemoryPoolGetCount}
644 \func{const char *#osMemoryPoolGetName (osMemoryPoolId_t mp_id)}
646 \copybrief{osMemoryPoolGetName}
651 \func{uint32_t #osMemoryPoolGetSpace (osMemoryPoolId_t mp_id)}
653 \copybrief{osMemoryPoolGetSpace}
658 \func{osMemoryPoolId_t #osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr)}
659 \func{osPoolId osPoolCreate (const osPoolDef_t * pool_def)}
660 \copybrief{osMemoryPoolGetSpace}
661 - The function \b osMemoryPoolNew replaces the RTOS v1 function \b osPoolCreate.
662 - The return type changed to #osMemoryPoolId_t.
663 - Parameter list and parameter types have changed.
669 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
670 ====== Message Queue =======
673 \section mig_msgQueue Message Queue
674 In general, messages are now using fixed size memory instead of being 32-bit values. Refer to \ref CMSIS_RTOS_Message for
678 \func{osStatus_t #osMessageQueueDelete (osMessageQueueId_t mq_id)}
680 \copybrief{osMessageQueueDelete}
685 \func{osStatus_t #osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)}
686 \func{osEvent osMessageGet (osMessageQId queue_id, uint32_t timeout)}
687 \copybrief{osMessageQueueGet}
688 - The function \b osMessageQueueGet replaces the RTOS v1 function \b osMessageGet.
689 - The return type changed to #osStatus_t.
690 - The parameter list and parameter types have changed.
695 \func{uint32_t #osMessageQueueGetCapacity (osMessageQueueId_t mq_id)}
697 \copybrief{osMessageQueueGetCapacity}
702 \func{uint32_t #osMessageQueueGetCount (osMessageQueueId_t mq_id)}
704 \copybrief{osMessageQueueGetCount}
709 \func{uint32_t #osMessageQueueGetMsgSize (osMessageQueueId_t mq_id)}
711 \copybrief{osMessageQueueGetMsgSize}
716 \func{const char *#osMessageQueueGetName (osMessageQueueId_t mq_id)}
718 \copybrief{osMessageQueueGetName}
723 \func{uint32_t #osMessageQueueGetSpace (osMessageQueueId_t mq_id)}
725 \copybrief{osMessageQueueGetSpace}
730 \func{osMessageQueueId_t #osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)}
731 \func{osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id)}
732 \copybrief{osMessageQueueNew}
733 - The function \b osMessageQueueNew replaces the RTOS v1 function \b osMessageCreate.
734 - The return type changed to #osMessageQueueId_t.
735 - The parameter list and parameter types have changed.
740 \func{osStatus_t #osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)}
741 \func{osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t timeout)}
742 \copybrief{osMessageQueuePut}
743 - The function \b osMessageQueuePut replaces the RTOS v1 function \b osMessagePut.
744 - The return type changed to #osStatus_t.
745 - The parameter list and parameter types have changed.
750 \func{osStatus_t #osMessageQueueReset (osMessageQueueId_t mq_id)}
752 \copybrief{osMessageQueueReset}
758 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
759 ====== Mail Queue =======
762 \section mig_mailQueue Mail Queue
763 The <b>Mail Queue</b> RTOS v1 functions have been deprecated.
764 Use the functionality of the \ref CMSIS_RTOS_Message instead.
765 Differences are listed under \ref mig_msgQueue.
769 \func{void * osMailAlloc (osMailQId queue_id, uint32_t timeout)}
776 \func{void * osMailCAlloc (osMailQId queue_id, uint32_t timeout)}
783 \func{osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id)}
790 \func{osStatus osMailFree (osMailQId queue_id, void *mail)}
797 \func{osEvent osMailGet (osMailQId queue_id, uint32_t timeout)}
804 \func{osStatus osMailPut (osMailQId queue_id, void *mail)}
811 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
812 ====== Signal Events =======
815 \section mig_signalEvents Signal Events
817 The section RTOS v1 <b>Signal Events</b> has been deprecated. Use the functions listed under \ref mig_threadFlags instead.
821 \func{int32_t osSignalClear (osThreadId thread_id, int32_t signals)}
828 \func{int32_t osSignalSet (osThreadId thread_id, int32_t signals)}
835 \func{osEvent osSignalWait (int32_t signals, uint32_t timeout)}