Example #1
0
    private static AppMain.AMS_TCB amTaskMake(
        AppMain.AMS_TASK taskp,
        AppMain.TaskProc proc,
        AppMain.TaskProc dest,
        uint prio,
        uint user,
        uint attr,
        string name,
        uint stall,
        int group,
        uint run)
    {
        AppMain.AMS_TCB amsTcb = AppMain.GlobalPool <AppMain.AMS_TCB> .Alloc();

        amsTcb.name = name;
        AppMain.AMS_TCB_FOOTER tcbFooter = AppMain.amTaskGetTcbFooter(amsTcb);
        tcbFooter.cpu_cnt     = 0U;
        tcbFooter.cpu_cnt_max = 0U;
        amsTcb.priority       = prio;
        amsTcb.priority       = prio;
        amsTcb.user_id        = user;
        amsTcb.attribute      = attr;
        AppMain.amTaskSetProcedure(amsTcb, proc);
        AppMain.amTaskSetDestructor(amsTcb, dest);
        AppMain.AMS_TCB next = taskp.tcb_head.next;
        while (next != taskp.tcb_tail && next.priority <= prio)
        {
            next = next.next;
        }
        next.prev.next = amsTcb;
        amsTcb.prev    = next.prev;
        next.prev      = amsTcb;
        amsTcb.next    = next;
        return(amsTcb);
    }
Example #2
0
 public static AppMain.AMS_TCB amTaskMake(
     AppMain.TaskProc proc,
     AppMain.TaskProc dest,
     uint prio,
     uint user,
     uint attr,
     string name)
 {
     return(AppMain.amTaskMake(AppMain._am_default_taskp, proc, dest, prio, user, attr, name, 1U, 0, uint.MaxValue));
 }
Example #3
0
 public static AppMain.AMS_TCB amTaskMake(
     AppMain.TaskProc proc,
     AppMain.TaskProc dest,
     uint prio,
     uint user,
     uint attr,
     string name,
     uint stall,
     int group,
     uint run)
 {
     return(AppMain.amTaskMake(AppMain._am_default_taskp, proc, dest, prio, user, attr, name, stall, group, run));
 }
Example #4
0
 public void Clear()
 {
     this.name         = string.Empty;
     this.user_id      = 0U;
     this.attribute    = 0U;
     this.priority     = 0U;
     this.procedure    = (AppMain.TaskProc)null;
     this.proc_addr    = 0;
     this.destructor   = (AppMain.TaskProc)null;
     this.prev         = (AppMain.AMS_TCB)null;
     this.next         = (AppMain.AMS_TCB)null;
     this.taskp        = (AppMain.AMS_TASK)null;
     this.footer.wkend = 0;
 }
Example #5
0
 private static void amTaskSetDestructor(AppMain.AMS_TCB tcb, AppMain.TaskProc dest)
 {
     tcb.destructor = dest;
 }
Example #6
0
 private static void amTaskSetProcedure(AppMain.AMS_TCB tcb, AppMain.TaskProc proc)
 {
     tcb.procedure = proc;
     tcb.proc_addr = int.MaxValue;
 }