API Changes
The most significant change from µC/OS-II to µC/OS-III occurs in the API. In order to port a µC/OS-II-based application to µC/OS-III, it is necessary to change the way services are invoked.
Table C-7 shows changes in the way critical sections in µC/OS-III are handled. Specifically, µC/OS-II defines macros to disable interrupts, and they are moved to µC/CPU withµC/OS-III since they are CPU specific functions.
µC/OS-II (os_cpu.h ) | µC/CPU (cpu.h ) |
---|---|
OS_ENTER_CRITICAL() | CPU_CRITICAL_ENTER() |
OS_EXIT_CRITICAL() | CPU_CRITICAL_EXIT() |
One of the biggest changes in the µC/OS-III API is its consistency. In fact, based on the function performed, it is possible to guess which arguments are needed, and in what order. For example, “*p_err
” is a pointer to an error-returned variable. When present, “*p_err
” is always the last argument of a function. In µC/OS-II, error-returned values are at times returned as a “*perr
,” and at other times as the return value of the function. This inconsistency has been removed in µC/OS-III.