jnguyen095 / rtos

Real Time OS - リアルタイム OS
0 stars 0 forks source link

Manipulative on CS+ to understand the way OS work #3

Open jnguyen095 opened 7 years ago

jnguyen095 commented 7 years ago

Create and debug to understand:

jnguyen095 commented 7 years ago

Task Configuration: 2 types of TASK:

1. Basic(no event) has 3 states: SUSPENDED, READY and RUNNING, Activation = 2
2. Extended(has event) has 4 states: SUSPENDED, READY, RUNNING, and WAITING, Activation = 1

Os_Config.oil

TASK Task_And_Event_1 {
    ACTIVATION  = 2;
    PRIORITY    = 10;
    SCHEDULE    = FULL;
};
TASK Task_And_Event_2 {
    ACTIVATION  = 1;
    PRIORITY    = 13;
    SCHEDULE    = FULL;
    EVENT       = evt_Task2;
    STACKSIZE   = 0x100;
};
TASK Task_And_Event_3 {
    ACTIVATION  = 2;
    PRIORITY    = 12;
    SCHEDULE    = FULL;
};

task.c

image

Result:

image

jnguyen095 commented 7 years ago

Schedule Table configuration

Os_Config.oil

  SCHEDULETABLE ScheduleTable1_Osapp1 {
    LENGTH      = 20;      // Counter lenght
    PERIODIC    = TRUE; // Repeat value
    COUNTER = CounterOSTM0_Osapp1;  // Table need a counter
    ACTION {
        OFFSET  = 5;  // Trigger task at counter offset
        ACTIVATETASK {
            TASK    = Task2_Osapp1;
        };
    };

    ACTION {
        OFFSET  = 10;
        ACTIVATETASK {
            TASK    = Task3_Osapp1;
        };
    };

    ACTION {
        OFFSET  = 13;
        ACTIVATETASK {
            TASK    = Task4_Osapp1;
        };
    };

    ACTION {
        OFFSET  = 15;
        ACTIVATETASK {
            TASK    = Task5_Osapp1;
        };
    };

    ACTION {
        OFFSET  = 17;
        ACTIVATETASK {
            TASK    = Task6_Osapp2;
        };
    };

}; 
jnguyen095 commented 7 years ago

Resource Configuration

 RESOURCE Resource1 {
    PRIORITY     = 20; //0 to 29, INTPRI0 to INTPRI15 (or INTPRI0 to INTPRI7 when the target device is G3K), or AUTO
    RESOURCEPROPERTY = STANDARD; //STANDARD, INTERNAL, or LINKED
    ACCESSING_APPLICATION = Osapp1; //Specifies the identifier of an OS-Application that defines objects (tasks, interrupt service routines, and alarms) to which access privileges to this resource should be assigned.
};

AUTO Priority