Download GU0102 TSK51x/TSK52x RTOS
Transcript
TSK51x / TSK52x RTOS
7.5
The Scheduler as a Special Resource
The scheduler can be considered as a special resource that can be locked by the running task. As a
result, while the running task has locked the scheduler, it behaves like a non-preemptive task (with the
same re-scheduling points).
If you plan to use the scheduler as a resource, you must first set the attribute USERESSCHEDULER to
TRUE in the OS object of your OIL file. C source code then can look as follows:
TASK(myTask)
{
...
/* preemptable */
GetResource(RES_SCHEDULER);
/* I am non-preemptable */
ReleaseResource(RES_SCHEDULER);
/* preemptable */
...
}
• You can neither define nor configure this resource in the user OIL file. It is a system resource
generated by the RTOS and already present in this OSEK/VDX implementation.
• You do not need to add it to the resource list of any task.
• Interrupts are received and processed irrespective of the state of the resource.
7.6
The C Interface for Resources
You can use the following data types, constants and system services in your C sources to deal with
resource related issues.
Element
C Interface
Data Types
ResourceType
Constants
RES_SCHEDULER
System Services
DeclareResource
GetResource
ReleaseResource
Table 7-1: C Interface for Resources
Please refer to the OSEK/VDX documentation for an extensive description.
7-18