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)}
56 \func{uint32_t osKernelSysTick (void)}
57 \copybrief{osKernelGetTickCount}
58 - The function \b osKernelGetTickCount replaces the RTOS v1 function \b osKernelSysTick.
63 \func{uint32_t #osKernelGetTickFreq (void)}
65 \copybrief{osKernelGetTickFreq}
66 - The function \b osKernelGetTickFreq replaces the RTOS v1 macro \b osKernelTickMicroSec.
71 \func{uint64_t #osKernelGetSysTimerCount (void)}
73 \copybrief{osKernelGetSysTimerCount}
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{uint32_t #osKernelLock (void)}
95 \copybrief{osKernelLock}
100 \func{void #osKernelResume (uint32_t sleep_time)}
102 \copybrief{osKernelResume}
107 \func{osStatus_t #osKernelStart (void)}
108 \func{osStatus osKernelStart (void)}
109 \copybrief{osKernelStart}
110 - Return type changed to \ref osStatus_t.
115 \func{uint32_t #osKernelSuspend (void)}
117 \copybrief{osKernelSuspend}
122 \func{void #osKernelUnlock (void)}
124 \copybrief{osKernelUnlock}
130 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
131 ====== Thread Management =======
134 \section mig_threadMgmt Thread Management
137 \func{osStatus_t #osThreadDetach (osThreadId_t thread_id)}
139 \copybrief{osThreadDetach}
144 \func{__NO_RETURN void #osThreadExit (void)}
146 \copybrief{osThreadExit}
151 \func{const char *#osThreadGetName (osThreadId_t thread_id)}
153 \copybrief{osThreadGetName}
158 \func{osThreadId_t #osThreadGetId (void)}
159 \func{osThreadId osThreadGetId (void)}
160 \copybrief{osThreadGetId}
161 - Return type changed to #osThreadId_t.
166 \func{osPriority_t #osThreadGetPriority (osThreadId_t thread_id)}
167 \func{osPriority osThreadGetPriority (osThreadId thread_id)}
168 \copybrief{osThreadGetPriority}
169 - Return type changed to #osPriority_t.
170 - Parameter type changed to #osThreadId_t.
175 \func{osThreadState_t #osThreadGetState (osThreadId_t thread_id)}
177 \copybrief{osThreadGetState}
182 \func{osStatus_t #osThreadJoin (osThreadId_t thread_id)}
184 \copybrief{osThreadJoin}
189 \func{osThreadId_t #osThreadNew (os_thread_func_t function, void *argument, const osThreadAttr_t *attr)}
190 \func{osThreadId osThreadCreate (const osThreadDef_t *thread_def, void *argument)}
191 \copybrief{osThreadNew}
192 - The function \b osThreadNew replaces the RTOS v1 function \b osThreadCreate.
193 - Options are now passed using a \ref osThreadAttr_t struct, replacing the \b osThreadDef macro.
194 - New function prototype is <kbd>void func (void *arg)</kbd>, before: <kbd>void func (const void *arg)</kbd>.
199 \func{osStatus_t #osThreadResume (osThreadId_t thread_id)}
201 \copybrief{osThreadResume}
206 \func{osStatus_t #osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority)}
207 \func{osStatus osThreadSetPriority (osThreadId thread_id, osPriority priority)}
208 \copybrief{osThreadSetPriority}
209 - Return type changed to #osStatus_t.
210 - Parameter types changed to #osThreadId_t and #osPriority_t.
215 \func{osStatus_t #osThreadSuspend (osThreadId_t thread_id)}
217 \copybrief{osThreadSuspend}
222 \func{osStatus_t #osThreadTerminate (osThreadId_t thread_id)}
224 \copybrief{osThreadTerminate}
229 \func{osStatus_t #osThreadYield (void)}
230 \func{osStatus osThreadYield (void)}
231 \copybrief{osThreadYield}
232 - Return type changed to #osStatus_t.
238 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
239 ====== Generic Wait Functions =======
242 \section mig_wait Generic Wait Functions
244 Refer to \ref CMSIS_RTOS_Wait for details.
247 \func{osStatus_t #osDelay (uint32_t ticks)}
248 \func{osStatus osDelay (uint32_t timeout)}
250 - The return type changed to #osStatus_t.
255 \func{osStatus_t #osDelayUntil (uint64_t ticks)}
256 \func{osStatus osDelayUntil (uint64_t timeout)}
257 \copybrief{osDelayUntil}
258 - The return type changed to #osStatus_t.
264 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
265 ====== Timer Management =======
268 \section mig_timer Timer Management
270 Refer to \ref CMSIS_RTOS_TimerMgmt for details.
273 \func{osStatus_t #osTimerDelete (osTimerId_t timer_id)}
274 \func{osStatus osTimerDelete (osTimerId timer_id)}
275 \copybrief{osTimerDelete}
276 - The return type changed to #osStatus_t.
277 - The parameter type has changed to #osTimerId_t.
282 \func{uint32_t #osTimerIsRunning (osTimerId_t timer_id)}
284 \copybrief{osTimerIsRunning}
289 \func{osTimerId_t #osTimerNew (os_timer_func_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr)}
290 \func{osTimerId osTimerCreate (const osTimerDef_t *timer_def, os_timer_type type, void *argument)}
291 \copybrief{osTimerNew}
292 - The function \b osTimerNew replaces the RTOS v1 function \b osTimerCreate.
293 - The return type changed to #osTimerId_t.
294 - The parameter list and types have changed.
299 \func{osStatus_t #osTimerStart (osTimerId_t timer_id, uint32_t ticks)}
300 \func{osStatus osTimerStart (osTimerId timer_id, uint32_t timeout)}
301 \copybrief{osTimerStart}
302 - The return type changed to #osStatus_t.
303 - The first parameter type has changed to #osTimerId_t.
308 \func{osStatus_t #osTimerStop (osTimerId_t timer_id)}
309 \func{osStatus osTimerStop (osTimerId timer_id)}
310 \copybrief{osTimerStop}
311 - The return type changed to #osStatus_t.
312 - The parameter type has changed to #osTimerId_t.
318 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
319 ====== Signal Events =======
322 \section mig_signalEvents Signal Events
324 The section RTOS v1 <b>Signal Events</b> has been deprecated.
325 Use the functions listed under \ref mig_threadFlags and \ref mig_eventFlags instead.
329 \func{int32_t osSignalClear (osThreadId thread_id, int32_t signals)}
336 \func{int32_t osSignalSet (osThreadId thread_id, int32_t signals)}
343 \func{osEvent osSignalWait (int32_t signals, uint32_t timeout)}
351 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
352 ====== Event Flags =======
355 \section mig_eventFlags Event Flags
357 New section to synchronize events using flags. Event flags and thread flags are replacing the RTOS v1 <b>Signal Events</b>.
358 All functions listed in the RTOS v1 <b>Signal Events</b> have been deprecated.
359 Refer to \ref mig_signalEvents for a list of deprecated functions.
360 Refer to \ref CMSIS_RTOS_EventFlags for details about the new function.
363 \func{int32_t #osEventFlagsClear (osEventFlagsId_t ef_id, int32_t flags)}
365 \copybrief{osEventFlagsClear}
370 \func{osStatus_t #osEventFlagsDelete (osEventFlagsId_t ef_id)}
372 \copybrief{osEventFlagsDelete}
377 \func{int32_t #osEventFlagsGet (osEventFlagsId_t ef_id)}
379 \copybrief{osEventFlagsGet}
384 \func{osEventFlagsId_t #osEventFlagsNew (const osEventFlagsAttr_t *attr)}
386 \copybrief{osEventFlagsNew}
391 \func{int32_t #osEventFlagsSet (osEventFlagsId_t ef_id, int32_t flags)}
393 \copybrief{osEventFlagsSet}
398 \func{int32_t #osEventFlagsWait (osEventFlagsId_t ef_id, int32_t flags, uint32_t options, uint32_t timeout)}
400 \copybrief{osEventFlagsWait}
406 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
407 ====== Thread Flags =======
410 \section mig_threadFlags Thread Flags
412 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.
413 Refer to \ref CMSIS_RTOS_ThreadFlagsMgmt for details.
416 \func{int32_t #osThreadFlagsSet (osThreadId_t thread_id, int32_t flags)}
418 \copybrief{osThreadFlagsSet}
423 \func{int32_t #osThreadFlagsClear (int32_t flags)}
425 \copybrief{osThreadFlagsClear}
430 \func{int32_t #osThreadFlagsGet (void)}
432 \copybrief{osThreadFlagsGet}
437 \func{int32_t #osThreadFlagsWait (int32_t flags, uint32_t options, uint32_t timeout)}
439 \copybrief{osThreadFlagsWait}
445 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
446 ====== Message Queue =======
449 \section mig_msgQueue Message Queue
450 Refer to \ref CMSIS_RTOS_Message for details.
453 \func{osStatus_t #osMessageQueueDelete (osMessageQueueId_t mq_id)}
455 \copybrief{osMessageQueueDelete}
460 \func{osStatus_t #osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)}
461 \func{osEvent osMessageGet (osMessageQId queue_id, uint32_t timeout)}
462 \copybrief{osMessageQueueGet}
463 - The function \b osMessageQueueGet replaces the RTOS v1 function \b osMessageGet.
464 - The return type changed to #osStatus_t.
465 - The parameter list and parameter types have changed.
470 \func{uint32_t #osMessageQueueGetCapacity (osMessageQueueId_t mq_id)}
472 \copybrief{osMessageQueueGetCapacity}
477 \func{uint32_t #osMessageQueueGetCount (osMessageQueueId_t mq_id)}
479 \copybrief{osMessageQueueGetCount}
484 \func{uint32_t #osMessageQueueGetMsgSize (osMessageQueueId_t mq_id)}
486 \copybrief{osMessageQueueGetMsgSize}
491 \func{uint32_t #osMessageQueueGetSpace (osMessageQueueId_t mq_id)}
493 \copybrief{osMessageQueueGetSpace}
498 \func{osMessageQueueId_t #osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr)}
499 \func{osMessageQId osMessageCreate (const osMessageQDef_t *queue_def, osThreadId thread_id)}
500 \copybrief{osMessageQueueNew}
501 - The function \b osMessageQueueNew replaces the RTOS v1 function \b osMessageCreate.
502 - The return type changed to #osMessageQueueId_t.
503 - The parameter list and parameter types have changed.
508 \func{osStatus_t #osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout)}
509 \func{osStatus osMessagePut (osMessageQId queue_id, uint32_t info, uint32_t timeout)}
510 \copybrief{osMessageQueuePut}
511 - The function \b osMessageQueuePut replaces the RTOS v1 function \b osMessagePut.
512 - The return type changed to #osStatus_t.
513 - The parameter list and parameter types have changed.
518 \func{osStatus_t #osMessageQueueReset (osMessageQueueId_t mq_id)}
520 \copybrief{osMessageQueueReset}
526 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
527 ====== Memory Pool =======
530 \section mig_memPool Memory Pool
533 \func{void * #osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout)}
534 \func{void * osPoolAlloc (osPoolId pool_id)}
535 \func{void * osPoolCAlloc (osPoolId pool_id)}
536 \copybrief{osMemoryPoolAlloc}
537 - The function \b osMemoryPoolAlloc replaces both RTOS v1 functions \b osPoolAlloc and \b osPoolCAlloc.
538 - The parameter list and types changed.
543 \func{osStatus_t #osMemoryPoolDelete (osMemoryPoolId_t mp_id)}
545 \copybrief{osMemoryPoolDelete}
550 \func{osStatus_t #osMemoryPoolFree (osMemoryPoolId_t mp_id, void * block)}
551 \func{osStatus osPoolFree (osPoolId pool_id, void * block)}
552 \copybrief{osMemoryPoolFree}
553 - The function \b osMemoryPoolFree replaces the RTOS v1 function \b osPoolFree.
554 - The first parameter type \b osMemoryPoolId_t replaces the ROTS v1 type \b osPoolId.
559 \func{uint32_t #osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id)}
561 \copybrief{osMemoryPoolGetBlockSize}
566 \func{uint32_t #osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id)}
568 \copybrief{osMemoryPoolGetCapacity}
573 \func{uint32_t #osMemoryPoolGetCount (osMemoryPoolId_t mp_id)}
575 \copybrief{osMemoryPoolGetCount}
580 \func{uint32_t #osMemoryPoolGetSpace (osMemoryPoolId_t mp_id)}
582 \copybrief{osMemoryPoolGetSpace}
587 \func{osMemoryPoolId_t #osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr)}
588 \func{osPoolId osPoolCreate (const osPoolDef_t * pool_def)}
589 \copybrief{osMemoryPoolGetSpace}
590 - The function \b osMemoryPoolNew replaces the RTOS v1 function \b osPoolCreate.
591 - The return type changed to #osMemoryPoolId_t.
592 - Parameter list and parameter types have changed.
598 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
599 ====== Mail Queue =======
602 \section mig_mailQueue Mail Queue
603 The <b>Mail Queue</b> RTOS v1 functions have been deprecated.
604 Use the functionality of the \ref CMSIS_RTOS_Message instead.
605 Differences are listed under \ref mig_msgQueue.
609 \func{void * osMailAlloc (osMailQId queue_id, uint32_t timeout)}
616 \func{void * osMailCAlloc (osMailQId queue_id, uint32_t timeout)}
623 \func{osMailQId osMailCreate (const osMailQDef_t *queue_def, osThreadId thread_id)}
630 \func{osStatus osMailFree (osMailQId queue_id, void *mail)}
637 \func{osEvent osMailGet (osMailQId queue_id, uint32_t timeout)}
644 \func{osStatus osMailPut (osMailQId queue_id, void *mail)}
651 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
652 ====== Mutexes =======
655 \section mig_mutex Mutexes
656 Refer to \ref CMSIS_RTOS_MutexMgmt for details.
659 \func{osStatus_t #osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout)}
660 \func{osStatus osMutexWait (osMutexId mutex_id, uint32_t timeout)}
661 \copybrief{osMutexAcquire}
662 - The function \b osMutexAcquire replaces the RTOS v1 function \b osMutexWait.
663 - Return type changed to \ref osStatus_t.
664 - First parameter type changed to \ref osMutexId_t.
669 \func{osStatus_t #osMutexDelete (osMutexId_t mutex_id)}
670 \func{osStatus osMutexDelete (osMutexId mutex_id)}
671 \copybrief{osMutexDelete}
672 - The return type changed to \ref osStatus_t.
673 - The parameter type changed to \ref osMutexId_t.
678 \func{osThreadId_t #osMutexGetOwner (osMutexId_t mutex_id)}
680 \copybrief{osMutexGetOwner}
685 \func{osMutexId_t #osMutexNew (const osMutexAttr_t *attr)}
686 \func{osMutexId osMutexCreate (const osMutexDef_t *mutex_def)}
687 \copybrief{osMutexNew}
688 - The function \b osMutexNew replaces the RTOS v1 function \b osMutexCreate.
689 - The return type changed to \ref osMutexId_t.
690 - The parameter type changed to \ref osMutexAttr_t.
695 \func{osStatus_t #osMutexRelease (osMutexId_t mutex_id)}
696 \func{osStatus osMutexRelease (osMutexId mutex_id)}
697 \copybrief{osMutexRelease}
698 - The return type changed to \ref osStatus_t.
699 - The parameter type changed to \ref osMutexId_t.
705 =======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====
706 ====== SEMAPHORES =======
709 \section mig_sem Semaphores
710 Refer to \ref CMSIS_RTOS_SemaphoreMgmt for details.
713 \func{osStatus_t #osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout)}
715 \copybrief{osSemaphoreAcquire}
720 \func{osStatus_t #osSemaphoreDelete (osSemaphoreId_t semaphore_id)}
721 \func{osStatus osSemaphoreDelete (osSemaphoreId semaphore_id)}
722 \copybrief{osSemaphoreDelete}
723 - The return type changed to #osStatus_t.
724 - The parameter type has changed to #osSemaphoreId_t.
729 \func{uint32_t #osSemaphoreGetCount (osSemaphoreId_t semaphore_id)}
731 \copybrief{osSemaphoreGetCount}
736 \func{osSemaphoreId_t #osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr)}
737 \func{osSemaphoreId osSemaphoreCreate (const osSemaphoreDef_t *semaphore_def, int32_t count)}
738 \copybrief{osSemaphoreNew}
739 - The function \b osSemaphoreNew replaces the RTOS v1 function \b osSemaphoreCreate.
740 - The return type changed to #osSemaphoreId_t.
741 - The parameter list and types have changed.
746 \func{osStatus_t #osSemaphoreRelease (osSemaphoreId_t semaphore_id)}
747 \func{osStatus osSemaphoreRelease (osSemaphoreId semaphore_id)}
748 \copybrief{osSemaphoreRelease}
749 - The return type changed to #osStatus_t.
750 - The parameter type has changed to #osSemaphoreId_t.
756 \func{int32_t osSemaphoreWait (osSemaphoreId semaphore_id, uint32_t timeout)}