1 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3 \page os2Migration Migration from API v1 to API v2
5 To use the API version 2 functions follow the steps described in:
6 - \subpage os2MigrationGuide - Steps to migrate from API version 1 to API version 2
7 - \subpage os2MigrationFunctions - List of function differences
10 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
13 \page os2MigrationFunctions Detailed API Function Differences
15 This section lists the CMSIS-RTOS API v1 and API v2 functions along with the differences in functionality.
16 The list is sorted alphabetically by API v2 function names and is structured the following way:
18 - RTOS API v2 function prototype
19 - RTOS API v1 function prototype that is equivalent or provides similar functionality
20 - Brief description of the RTOS v2 function.
21 - Description of the difference.
23 The background color indicates:
24 - <div class="new">Green: New functions in API v2 that are not available in API v1 </div>
26 - <div class="mod">Amber: Functions that are modified or replaced in API v2 compared to API v1 </div>
28 - <div class="del">Red: Functions in API v1 that are deprecated in API v2 </div>
32 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
33 Kernel Information and Control
36 \section mig_kernel Kernel Information and Control
39 \func{osStatus_t #osKernelGetInfo (osVersion_t* version, char* id_buf, uint32_t id_size)}
41 \copybrief{osKernelGetInfo}
42 New function #osKernelGetInfo.
46 \func{osKernelState_t #osKernelGetState (void)}
47 \func{int32_t osKernelRunning (void)}
48 \copybrief{osKernelGetState}
49 - The function \b osKernelGetState replaces the RTOS v1 function \b osKernelRunning.
50 - Return type changed to \ref osKernelState_t.
55 \func{uint32_t #osKernelGetTickCount (void)}
57 \copybrief{osKernelGetTickCount}
62 \func{uint32_t #osKernelGetTickFreq (void)}
64 \copybrief{osKernelGetTickFreq}
65 - The function \b osKernelGetTickFreq replaces the RTOS v1 macro \b osKernelTickMicroSec.
70 \func{uint32_t #osKernelGetSysTimerCount (void)}
71 \func{uint32_t osKernelSysTick (void)}
72 \copybrief{osKernelGetSysTimerCount}
73 - The function \b osKernelGetSysTimerCount replaces the RTOS v1 function \b osKernelSysTick.
78 \func{uint64_t #osKernelGetSysTimerFreq (void)}
80 \copybrief{osKernelGetSysTimerFreq}
85 \func{osStatus_t #osKernelInitialize (void)}
86 \func{osStatus osKernelInitialize (void)}
87 \copybrief{osKernelInitialize}
88 - Return type changed to \ref osStatus_t.
93 \func{int32_t #osKernelLock (void)}
95 \copybrief{osKernelLock}
100 \func{int32_t #osKernelUnlock (void)}
102 \copybrief{osKernelUnlock}
107 \func{void #osKernelRestoreLock (void)}
109 \copybrief{osKernelRestoreLock}
114 \func{osStatus_t #osKernelStart (void)}
115 \func{osStatus osKernelStart (void)}
116 \copybrief{osKernelStart}
117 - Return type changed to \ref osStatus_t.
122 \func{uint32_t #osKernelSuspend (void)}
124 \copybrief{osKernelSuspend}
129 \func{void #osKernelResume (uint32_t sleep_time)}
131 \copybrief{osKernelResume}
137 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
138 ====== Thread Management =======
141 \section mig_threadMgmt Thread Management
144 \func{osStatus_t #osThreadDetach (osThreadId_t thread_id)}
146 \copybrief{osThreadDetach}
151 \func{uint32_t #osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items)}
153 \copybrief{osThreadEnumerate}
158 \func{__NO_RETURN void #osThreadExit (void)}
160 \copybrief{osThreadExit}
165 \func{uint32_t #osThreadGetCount (osThreadId_t thread_id)}
167 \copybrief{osThreadGetCount}
172 \func{const char *#osThreadGetName (osThreadId_t thread_id)}
174 \copybrief{osThreadGetName}
179 \func{osThreadId_t #osThreadGetId (void)}
180 \func{osThreadId osThreadGetId (void)}
181 \copybrief{osThreadGetId}
182 - Return type changed to #osThreadId_t.
187 \func{osPriority_t #osThreadGetPriority (osThreadId_t thread_id)}
188 \func{osPriority osThreadGetPriority (osThreadId thread_id)}
189 \copybrief{osThreadGetPriority}
190 - Return type changed to #osPriority_t.
191 - Parameter type changed to #osThreadId_t.
196 \func{uint32_t #osThreadGetStackSize (osThreadId_t thread_id)}
198 \copybrief{osThreadGetStackSize}
203 \func{uint32_t #osThreadGetStackSpace (osThreadId_t thread_id)}
205 \copybrief{osThreadGetStackSpace}
210 \func{osThreadState_t #osThreadGetState (osThreadId_t thread_id)}
212 \copybrief{osThreadGetState}
217 \func{osStatus_t #osThreadJoin (osThreadId_t thread_id)}
219 \copybrief{osThreadJoin}
224 \func{osThreadId_t #osThreadNew (osThreadFunc_t function, void *argument, const osThreadAttr_t *attr)}
225 \func{osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)}
226 \copybrief{osThreadNew}
227 - The function \b osThreadNew replaces the RTOS v1 function \b osThreadCreate.
228 - Options are now passed using a \ref osThreadAttr_t struct, replacing the \b osThreadDef macro.
229 - New function prototype is <kbd>void func (void *arg)</kbd>, before: <kbd>void func (const void *arg)</kbd>.
234 \func{osStatus_t #osThreadResume (osThreadId_t thread_id)}
236 \copybrief{osThreadResume}
241 \func{osStatus_t #osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)}
242 \func{osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)}
243 \copybrief{osThreadSetPriority}
244 - Return type changed to #osStatus_t.
245 - Parameter types changed to #osThreadId_t and #osPriority_t.
250 \func{osStatus_t #osThreadSuspend (osThreadId_t thread_id)}
252 \copybrief{osThreadSuspend}
257 \func{osStatus_t #osThreadTerminate (osThreadId_t thread_id)}
258 \func{osStatus osThreadTerminate (osThreadId thread_id)}
259 \copybrief{osThreadTerminate}
260 - Return type changed to #osStatus_t.
261 - Parameter type changed to #osThreadId_t.
266 \func{osStatus_t #osThreadYield (void)}
267 \func{osStatus osThreadYield (void)}
268 \copybrief{osThreadYield}
269 - Return type changed to #osStatus_t.
275 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
276 ====== Thread Flags =======
279 \section mig_threadFlags Thread Flags
281 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.
282 Refer to \ref CMSIS_RTOS_ThreadFlagsMgmt for details.
285 \func{uint32_t #osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags)}
287 \copybrief{osThreadFlagsSet}
292 \func{uint32_t #osThreadFlagsClear (uint32_t flags)}
294 \copybrief{osThreadFlagsClear}
299 \func{uint32_t #osThreadFlagsGet (void)}
301 \copybrief{osThreadFlagsGet}
306 \func{uint32_t #osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout)}
308 \copybrief{osThreadFlagsWait}
314 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
315 ====== Event Flags =======
318 \section mig_eventFlags Event Flags
320 New section to synchronize events using flags. Event flags and thread flags are replacing the RTOS v1 <b>Signal Events</b>.
321 All functions listed in the RTOS v1 <b>Signal Events</b> have been deprecated.
322 Refer to \ref mig_signalEvents for a list of deprecated functions.
323 Refer to \ref CMSIS_RTOS_EventFlags for details about the new function.
326 \func{uint32_t #osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags)}
328 \copybrief{osEventFlagsClear}
333 \func{const char *#osEventFlagsGetName (osEventFlagsId_t ef_id)}
335 \copybrief{osEventFlagsGetName}
340 \func{osStatus_t #osEventFlagsDelete (osEventFlagsId_t ef_id)}
342 \copybrief{osEventFlagsDelete}
347 \func{uint32_t #osEventFlagsGet (osEventFlagsId_t ef_id)}
349 \copybrief{osEventFlagsGet}
354 \func{osEventFlagsId_t #osEventFlagsNew (const osEventFlagsAttr_t *attr)}
356 \copybrief{osEventFlagsNew}
361 \func{uint32_t #osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags)}
363 \copybrief{osEventFlagsSet}
368 \func{uint32_t #osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout)}
370 \copybrief{osEventFlagsWait}
376 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
377 ====== Generic Wait Functions =======
380 \section mig_wait Generic Wait Functions
382 Refer to \ref CMSIS_RTOS_Wait for details.
385 \func{osStatus_t #osDelay (uint32_t ticks)}
386 \func{osStatus osDelay (uint32_t timeout)}
388 - The return type changed to #osStatus_t.
393 \func{osStatus_t #osDelayUntil (uint32_t ticks)}
395 \copybrief{osDelayUntil}
401 \func{osEvent osWait (uint32_t millisec)}
409 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
410 ====== Timer Management =======
413 \section mig_timer Timer Management
415 Refer to \ref CMSIS_RTOS_TimerMgmt for details.
418 \func{osStatus_t #osTimerDelete (osTimerId_t timer_id)}
419 \func{osStatus osTimerDelete (osTimerId timer_id)}
420 \copybrief{osTimerDelete}
421 - The return type changed to #osStatus_t.
422 - The parameter type has changed to #osTimerId_t.
427 \func{const char *#osTimerGetName (osTimerId_t timer_id)}
429 \copybrief{osTimerGetName}
434 \func{uint32_t #osTimerIsRunning (osTimerId_t timer_id)}
436 \copybrief{osTimerIsRunning}
441 \func{osTimerId_t #osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr)}
442 \func{osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument)}
443 \copybrief{osTimerNew}
444 - The function \b osTimerNew replaces the RTOS v1 function \b osTimerCreate.
445 - The return type changed to #osTimerId_t.
446 - The parameter list and types have changed.
451 \func{osStatus_t #osTimerStart (osTimerId_t timer_id, uint32_t ticks)}
452 \func{osStatus osTimerStart (osTimerId timer_id, uint32_t timeout)}
453 \copybrief{osTimerStart}
454 - The return type changed to #osStatus_t.
455 - The first parameter type has changed to #osTimerId_t.
460 \func{osStatus_t #osTimerStop (osTimerId_t timer_id)}
461 \func{osStatus osTimerStop (osTimerId timer_id)}
462 \copybrief{osTimerStop}
463 - The return type changed to #osStatus_t.
464 - The parameter type has changed to #osTimerId_t.
470 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
471 ====== Mutexes =======
474 \section mig_mutex Mutexes
475 Refer to \ref CMSIS_RTOS_MutexMgmt for details.
478 \func{osStatus_t #osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout)}
479 \func{osStatus osMutexWait (osMutexId mutex_id, uint32_t timeout)}
480 \copybrief{osMutexAcquire}
481 - The function \b osMutexAcquire replaces the RTOS v1 function \b osMutexWait.
482 - Return type changed to \ref osStatus_t.
483 - First parameter type changed to \ref osMutexId_t.
488 \func{osStatus_t #osMutexDelete (osMutexId_t mutex_id)}
489 \func{osStatus osMutexDelete (osMutexId mutex_id)}
490 \copybrief{osMutexDelete}
491 - The return type changed to \ref osStatus_t.
492 - The parameter type changed to \ref osMutexId_t.
497 \func{const char *#osMutexGetName (osMutexId_t mutex_id)}
499 \copybrief{osMutexGetName}
504 \func{osThreadId_t #osMutexGetOwner (osMutexId_t mutex_id)}
506 \copybrief{osMutexGetOwner}
511 \func{osMutexId_t #osMutexNew (const osMutexAttr_t *attr)}
512 \func{osMutexId osMutexCreate (const osMutexDef_t *mutex_def)}
513 \copybrief{osMutexNew}
514 - The function \b osMutexNew replaces the RTOS v1 function \b osMutexCreate.
515 - The return type changed to \ref osMutexId_t.
516 - The parameter type changed to \ref osMutexAttr_t.
521 \func{osStatus_t #osMutexRelease (osMutexId_t mutex_id)}
522 \func{osStatus osMutexRelease (osMutexId mutex_id)}
523 \copybrief{osMutexRelease}
524 - The return type changed to \ref osStatus_t.
525 - The parameter type changed to \ref osMutexId_t.
531 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
532 ====== SEMAPHORES =======
535 \section mig_sem Semaphores
536 Refer to \ref CMSIS_RTOS_SemaphoreMgmt for details.
539 \func{osStatus_t #osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout)}
541 \copybrief{osSemaphoreAcquire}
542 New function. Replaces \c osSemaphoreWait.
546 \func{osStatus_t #osSemaphoreDelete (osSemaphoreId_t semaphore_id)}
547 \func{osStatus osSemaphoreDelete (osSemaphoreId semaphore_id)}
548 \copybrief{osSemaphoreDelete}
549 - The return type changed to #osStatus_t.
550 - The parameter type has changed to #osSemaphoreId_t.
555 \func{uint32_t #osSemaphoreGetCount (osSemaphoreId_t semaphore_id)}
557 \copybrief{osSemaphoreGetCount}
562 \func{const char *#osSemaphoreGetName (osSemaphoreId_t semaphore_id)}
564 \copybrief{osSemaphoreGetName}
569 \func{osSemaphoreId_t #osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr)}
570 \func{osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count)}
571 \copybrief{osSemaphoreNew}
572 - The function \b osSemaphoreNew replaces the RTOS v1 function \b osSemaphoreCreate.
573 - The return type changed to #osSemaphoreId_t.
574 - The parameter list and types have changed.
579 \func{osStatus_t #osSemaphoreRelease (osSemaphoreId_t semaphore_id)}
580 \func{osStatus osSemaphoreRelease (osSemaphoreId semaphore_id)}
581 \copybrief{osSemaphoreRelease}
582 - The return type changed to #osStatus_t.
583 - The parameter type has changed to #osSemaphoreId_t.
589 \func{int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t timeout)}
591 Deprecated. Replaced by #osSemaphoreAcquire.
596 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
597 ====== Memory Pool =======
600 \section mig_memPool Memory Pool
603 \func{void * #osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout)}
604 \func{void * osPoolAlloc (osPoolId pool_id)}
605 \copybrief{osMemoryPoolAlloc}
606 - The function \b osMemoryPoolAlloc replaces both RTOS v1 functions \b osPoolAlloc.
607 - The parameter list and types changed.
612 \func{osStatus_t #osMemoryPoolDelete (osMemoryPoolId_t mp_id)}
614 \copybrief{osMemoryPoolDelete}
619 \func{osStatus_t #osMemoryPoolFree (osMemoryPoolId_t mp_id, void * block)}
620 \func{osStatus osPoolFree (osPoolId pool_id, void * block)}
621 \copybrief{osMemoryPoolFree}
622 - The function \b osMemoryPoolFree replaces the RTOS v1 function \b osPoolFree.
623 - The first parameter type \b osMemoryPoolId_t replaces the ROTS v1 type \b osPoolId.
628 \func{uint32_t #osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id)}
630 \copybrief{osMemoryPoolGetBlockSize}
635 \func{uint32_t #osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id)}
637 \copybrief{osMemoryPoolGetCapacity}
642 \func{uint32_t #osMemoryPoolGetCount (osMemoryPoolId_t mp_id)}
644 \copybrief{osMemoryPoolGetCount}
649 \func{const char *#osMemoryPoolGetName (osMemoryPoolId_t mp_id)}
651 \copybrief{osMemoryPoolGetName}
656 \func{uint32_t #osMemoryPoolGetSpace (osMemoryPoolId_t mp_id)}
658 \copybrief{osMemoryPoolGetSpace}
663 \func{osMemoryPoolId_t #osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr)}
664 \func{osPoolId osPoolCreate (const osPoolDef_t * pool_def)}
665 \copybrief{osMemoryPoolGetSpace}
666 - The function \b osMemoryPoolNew replaces the RTOS v1 function \b osPoolCreate.
667 - The return type changed to #osMemoryPoolId_t.
668 - Parameter list and parameter types have changed.
674 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
675 ====== Message Queue =======
678 \section mig_msgQueue Message Queue
679 In general, messages are now using fixed size memory instead of being 32-bit values. Refer to \ref CMSIS_RTOS_Message for
683 \func{osStatus_t #osMessageQueueDelete (osMessageQueueId_t mq_id)}
685 \copybrief{osMessageQueueDelete}
690 \func{osStatus_t #osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)}
691 \func{osEvent osMessageGet (osMessageQId queue_id, uint32_t timeout)}
692 \copybrief{osMessageQueueGet}
693 - The function \b osMessageQueueGet replaces the RTOS v1 function \b osMessageGet.
694 - The return type changed to #osStatus_t.
695 - The parameter list and parameter types have changed.
700 \func{uint32_t #osMessageQueueGetCapacity (osMessageQueueId_t mq_id)}
702 \copybrief{osMessageQueueGetCapacity}
707 \func{uint32_t #osMessageQueueGetCount (osMessageQueueId_t mq_id)}
709 \copybrief{osMessageQueueGetCount}
714 \func{uint32_t #osMessageQueueGetMsgSize (osMessageQueueId_t mq_id)}
716 \copybrief{osMessageQueueGetMsgSize}
721 \func{const char *#osMessageQueueGetName (osMessageQueueId_t mq_id)}
723 \copybrief{osMessageQueueGetName}
728 \func{uint32_t #osMessageQueueGetSpace (osMessageQueueId_t mq_id)}
730 \copybrief{osMessageQueueGetSpace}
735 \func{osMessageQueueId_t #osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)}
736 \func{osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id)}
737 \copybrief{osMessageQueueNew}
738 - The function \b osMessageQueueNew replaces the RTOS v1 function \b osMessageCreate.
739 - The return type changed to #osMessageQueueId_t.
740 - The parameter list and parameter types have changed.
745 \func{osStatus_t #osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)}
746 \func{osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t timeout)}
747 \copybrief{osMessageQueuePut}
748 - The function \b osMessageQueuePut replaces the RTOS v1 function \b osMessagePut.
749 - The return type changed to #osStatus_t.
750 - The parameter list and parameter types have changed.
755 \func{osStatus_t #osMessageQueueReset (osMessageQueueId_t mq_id)}
757 \copybrief{osMessageQueueReset}
763 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
764 ====== Mail Queue =======
767 \section mig_mailQueue Mail Queue
768 The <b>Mail Queue</b> RTOS v1 functions have been deprecated.
769 Use the functionality of the \ref CMSIS_RTOS_Message instead.
770 Differences are listed under \ref mig_msgQueue.
774 \func{void * osMailAlloc (osMailQId queue_id, uint32_t timeout)}
781 \func{void * osMailCAlloc (osMailQId queue_id, uint32_t timeout)}
788 \func{osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id)}
795 \func{osStatus osMailFree (osMailQId queue_id, void *mail)}
802 \func{osEvent osMailGet (osMailQId queue_id, uint32_t timeout)}
809 \func{osStatus osMailPut (osMailQId queue_id, void *mail)}
816 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
817 ====== Signal Events =======
820 \section mig_signalEvents Signal Events
822 The section RTOS v1 <b>Signal Events</b> has been deprecated. Use the functions listed under \ref mig_threadFlags instead.
826 \func{int32_t osSignalClear (osThreadId thread_id, int32_t signals)}
833 \func{int32_t osSignalSet (osThreadId thread_id, int32_t signals)}
840 \func{osEvent osSignalWait (int32_t signals, uint32_t timeout)}