I am looking forward to adapt my current application program to schedule by OSEk .
So found on net Erika OSEK is open source to use.
My application have 4 task called every 5,10,20 & 40 ms interval :--
5_ms_task, 10_ms_task, 20_ms_task, 40_ms_task
I am using a 1_ms timer which use to increment the counter for each task, and call each task
from my startOS() function depending upon their turn :--
My scheduler code :--
Code: Select all
void StartOS(void)
{
/* Start the OS */
for(;;){
if(COUNTER_5MS == COUNTER_5MS_MAX){
TaskOs_05();
COUNTER_5MS = 0x00;
}else {
/*do Nothing*/
}
if(COUNTER_10MS == COUNTER_10MS_MAX){
TaskOs_10();
COUNTER_10MS = 0x00;
}else {
/*do Nothing*/
}
if(COUNTER_20MS == COUNTER_20MS_MAX){
TaskOs_20();
COUNTER_20MS = 0x00;
}else {
/*do Nothing*/
}
if(COUNTER_40MS == COUNTER_40MS_MAX){
TaskOs_40();
COUNTER_40MS = 0x00;
}else {
/*do Nothing*/
}
}
timer for 1-msec Interrupt :---
Code: Select all
__interrupt static void r_wutm_interrupt(void)
{
`
if(COUNTER_10MS < COUNTER_10MS_MAX){
COUNTER_10MS++;
}else {
/*do Nothing*/
}
if(COUNTER_20MS < COUNTER_20MS_MAX){
COUNTER_20MS++;
}else {
/*do Nothing*/
}
if(COUNTER_40MS < COUNTER_40MS_MAX){
COUNTER_40MS++;
}else {
/*do Nothing*/
}
}
But this is a simple scheduler and do have some disadvantage that if suppose 20 ms task is running and during that time timer interrupt occurs
and condition for 40ms & 5ms task both are satisfied then my top priority task will have to wait for completion of 20 & 40 msec task to complete
before getting share of processor. Preemption property is not their at present in this scheduler.
As per the OSEK specification for BCC1 :--
BCC1 (only basic tasks, limited to one activation request per task and one task per priority, while all tasks have different priorities)
I have few questions now, So if i switch to ERIKA OSEK and configure it for conformance class BCC1 :---
1> Does BCC1 conformance class provide preemption of the low priority task if high priority task is ready to be scheduled (like the case which i have covered above) ?
2> How does ERIKA osek keep track of time tick for each task do i have to use some hardware timer to give support to this O.S ?
3> suppose 20 ms task is running and in between during that time timer interrupt occurs and condition for 5ms task are satisfied then will OSEK preempt the 20ms task run the 5ms task & after 5 ms task finishes OSEK will resume 20 ms task is it right ? or osek will continue with current task of 20 ms & after this is completed OSEK will switch to high priority task of 5ms ?
Please suggest.
Regards,
Katoch