CMSIS-RTOS
Version 1.03
Real-Time Operating System: API and RTX Reference Implementation.
|
Supervisor Calls (SVC) are exceptions targeted at software and operating systems for generating system function calls. They are sometimes called software interrupts. For example, instead of allowing user programs to directly access hardware, an operating system may provide access to hardware through an SVC. So when a user program wants to use certain hardware, it generates the SVC exception using SVC instructions, and then the software exception handler in the operating system is executed and provides the requested service to the user application. In this way, access to hardware is under the control of the OS, which can provide a more robust system by preventing the user applications from directly accessing the hardware.
SVC can also make software more portable because the user application does not need to know the programming details of the underlying hardware. The user program will only need to know the application programming interface (API) function ID and parameters; the actual hardware-level programming is handled by device drivers.
SVCs run in Privileged Handler mode of the Cortex-M core. SVC functions accept arguments and can return values. The functions are used in the same way as other functions; however, differences are hidden to the user. The ARMCC handles the differences and generates code instructions to call SVC functions. SVC functions are called by executing the SVC instruction. When executing SVC instructions, the controller changes to the Privileged Handler Mode.
Interrupts are not disabled in this mode. To protect SVC function from interrupts, you need to include the disable/enable intrinsic functions __disable_irq() and __enable_irq() in your code.
You can use SVC functions to access protected peripherals, for example, to configure NVIC and interrupts. This is required if you run tasks in unprivileged (protected) mode and you need to change interrupts from the task.
To implement SVC functions in your CMSIS-RTOS RTX kernel project, you need to: