예제 #1
0
 public static AppMain.MTS_TASK_TCB mtTaskMake(
     AppMain.GSF_TASK_PROCEDURE proc,
     AppMain.GSF_TASK_PROCEDURE dest,
     uint flag,
     ushort pause_level,
     uint prio,
     int group,
     AppMain.TaskWorkFactoryDelegate work_size,
     string name)
 {
     if (((int)flag & int.MinValue) == 0 && (uint)group >= 15U)
     {
         group = 14;
     }
     AppMain.AMS_TCB amsTcb = AppMain.amTaskMake(AppMain._mtTaskProcedure, AppMain._mtTaskDestructor, prio, (uint)(1 << group), 2U, name);
     amsTcb.work = (object)new AppMain.MTS_TASK_TCB();
     AppMain.MTS_TASK_TCB work = (AppMain.MTS_TASK_TCB)AppMain.amTaskGetWork(amsTcb);
     work.am_tcb      = amsTcb;
     work.proc        = proc;
     work.dest        = dest;
     work.pause_level = pause_level;
     if (((int)flag & 1) != 0)
     {
         work.pause_level = ushort.MaxValue;
     }
     work.work = (object)null;
     if (work_size != null)
     {
         work.work = work_size();
     }
     AppMain.amTaskStart(amsTcb);
     return(work);
 }
예제 #2
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);
    }
 // Token: 0x060016D7 RID: 5847 RVA: 0x000C741C File Offset: 0x000C561C
 public static AppMain.MTS_TASK_TCB mtTaskMake(AppMain.GSF_TASK_PROCEDURE proc, AppMain.GSF_TASK_PROCEDURE dest, uint flag, ushort pause_level, uint prio, int group, AppMain.TaskWorkFactoryDelegate work_size, string name)
 {
     if ((flag & 2147483648U) == 0U && group >= 15)
     {
         group = 14;
     }
     AppMain.AMS_TCB ams_TCB = AppMain.amTaskMake(AppMain._mtTaskProcedure, AppMain._mtTaskDestructor, prio, 1U << group, 2U, name);
     ams_TCB.work = new AppMain.MTS_TASK_TCB();
     AppMain.MTS_TASK_TCB mts_TASK_TCB = (AppMain.MTS_TASK_TCB)AppMain.amTaskGetWork(ams_TCB);
     mts_TASK_TCB.am_tcb      = ams_TCB;
     mts_TASK_TCB.proc        = proc;
     mts_TASK_TCB.dest        = dest;
     mts_TASK_TCB.pause_level = pause_level;
     if ((flag & 1U) != 0U)
     {
         mts_TASK_TCB.pause_level = ushort.MaxValue;
     }
     mts_TASK_TCB.work = null;
     if (work_size != null)
     {
         mts_TASK_TCB.work = work_size();
     }
     AppMain.amTaskStart(ams_TCB);
     return(mts_TASK_TCB);
 }
예제 #4
0
 private static void gsInitTaskProcedure(AppMain.AMS_TCB tcb)
 {
     AppMain.GSS_INIT_WORK work = (AppMain.GSS_INIT_WORK)AppMain.amTaskGetWork(tcb);
     if (work.proc == null)
     {
         AppMain.amTaskDelete(tcb);
     }
     else
     {
         Delegate proc = (Delegate)work.proc;
         work.proc(work);
         if ((object)work.proc != (object)proc)
         {
             work.count = 0;
         }
         else
         {
             if (work.count >= -1)
             {
                 return;
             }
             ++work.count;
         }
     }
 }
예제 #5
0
 private static void _amTaskDeleteReal(AppMain.AMS_TCB tcb)
 {
     AppMain.AMS_TASK taskp = tcb.taskp;
     tcb.prev.next = tcb.next;
     tcb.next.prev = tcb.prev;
     AppMain.GlobalPool <AppMain.AMS_TCB> .Release(tcb);
 }
예제 #6
0
 public void Clear()
 {
     this.am_tcb      = (AppMain.AMS_TCB)null;
     this.proc        = (AppMain.GSF_TASK_PROCEDURE)null;
     this.dest        = (AppMain.GSF_TASK_PROCEDURE)null;
     this.pause_level = (ushort)0;
     this.work        = (object)null;
 }
 // Token: 0x06001167 RID: 4455 RVA: 0x00098D90 File Offset: 0x00096F90
 private static void izFadeDrawStart_DT(AppMain.AMS_TCB am_tcb)
 {
     AppMain.IZS_FADE_DT_WORK izs_FADE_DT_WORK = (AppMain.IZS_FADE_DT_WORK)AppMain.amTaskGetWork(am_tcb);
     AppMain.AoActDrawPre();
     AppMain.amDrawExecCommand(izs_FADE_DT_WORK.draw_state, izs_FADE_DT_WORK.drawflag);
     AppMain.amDrawEndScene();
     AppMain.IzFadeRestoreDrawSetting();
 }
    // Token: 0x06000A55 RID: 2645 RVA: 0x0005C5B4 File Offset: 0x0005A7B4
    public static void amTaskWakeupGroup(AppMain.AMS_TASK taskp, uint user, uint attr, uint flag)
    {
        AppMain.mppAssertNotImpl();
        if (user == 0U)
        {
            user = uint.MaxValue;
        }
        AppMain.AMS_TCB next = taskp.tcb_head.next;
        switch (flag)
        {
        case 0U:
            while (next != taskp.tcb_tail)
            {
                if ((next.user_id & user) != 0U && (next.attribute & attr) != 0U)
                {
                    AppMain.amTaskWakeup(next);
                }
                next = next.next;
            }
            return;

        case 1U:
            while (next != taskp.tcb_tail)
            {
                if ((next.user_id & user) != 0U && (next.attribute & attr) == attr)
                {
                    AppMain.amTaskWakeup(next);
                }
                next = next.next;
            }
            return;

        case 2U:
            while (next != taskp.tcb_tail)
            {
                if ((next.user_id & user) != 0U && (next.attribute & attr) == 0U)
                {
                    AppMain.amTaskWakeup(next);
                }
                next = next.next;
            }
            return;

        case 3U:
            while (next != taskp.tcb_tail)
            {
                if ((next.user_id & user) != 0U && (next.attribute & attr) != attr)
                {
                    AppMain.amTaskWakeup(next);
                }
                next = next.next;
            }
            return;

        default:
            return;
        }
    }
예제 #9
0
 public static void mtTaskProcedure(AppMain.AMS_TCB am_tcb)
 {
     AppMain.MTS_TASK_TCB work = (AppMain.MTS_TASK_TCB)AppMain.amTaskGetWork(am_tcb);
     if ((int)work.pause_level <= AppMain.gs_task_mtsys.pause_level || work.proc == null)
     {
         return;
     }
     work.proc(work);
 }
예제 #10
0
 // Token: 0x060007E6 RID: 2022 RVA: 0x00045278 File Offset: 0x00043478
 private static void aoStorageLoadTaskProcedure(AppMain.AMS_TCB tcb)
 {
     AppMain.AOS_STORAGE aos_STORAGE = AppMain.aoStorageGetGlobal();
     AppMain.amTaskDelete(tcb);
     aos_STORAGE.load_buf  = null;
     aos_STORAGE.load_size = 0U;
     aos_STORAGE.state     = 0;
     aos_STORAGE.tcb       = null;
 }
예제 #11
0
 public void DetachTask()
 {
     if (this.m_task_tcb == null)
     {
         return;
     }
     AppMain.amTaskSetDestructor(this.m_task_tcb, (AppMain.TaskProc)null);
     AppMain.amTaskDelete(this.m_task_tcb);
     this.TaskDestructor(AppMain.ITaskLink.EDestructorCbType.Type.DetachTask);
     this.m_task_tcb = (AppMain.AMS_TCB)null;
 }
예제 #12
0
 public static void amTaskDelete(AppMain.AMS_TCB tcb)
 {
     if (tcb.proc_addr == -1)
     {
         return;
     }
     if (tcb.destructor != null)
     {
         tcb.destructor(tcb);
     }
     tcb.proc_addr = -1;
 }
예제 #13
0
 // Token: 0x06001FEC RID: 8172 RVA: 0x0013D6CC File Offset: 0x0013B8CC
 public static AppMain.ITaskLinkAsv CastFromTaskTcb(AppMain.AMS_TCB tcb)
 {
     if (new AppMain.TaskProc(AppMain.ITaskLinkAsv.procedure) == tcb.procedure || new AppMain.TaskProc(AppMain.ITaskLinkAsv.destructor) == tcb.destructor)
     {
         AppMain.ITaskLinkAsv.SWork swork = (AppMain.ITaskLinkAsv.SWork)AppMain.amTaskGetWork(tcb);
         if (swork.owner != null && swork.owner.m_task_tcb == tcb)
         {
             return(swork.owner);
         }
     }
     return(null);
 }
 // Token: 0x060016E5 RID: 5861 RVA: 0x000C75B8 File Offset: 0x000C57B8
 public static void mtTaskProcedure(AppMain.AMS_TCB am_tcb)
 {
     AppMain.MTS_TASK_TCB mts_TASK_TCB = (AppMain.MTS_TASK_TCB)AppMain.amTaskGetWork(am_tcb);
     if (( int )mts_TASK_TCB.pause_level <= AppMain.gs_task_mtsys.pause_level)
     {
         return;
     }
     if (mts_TASK_TCB.proc != null)
     {
         mts_TASK_TCB.proc(mts_TASK_TCB);
     }
 }
예제 #15
0
    public static void amTaskWakeupGroup(AppMain.AMS_TASK taskp, uint user, uint attr, uint flag)
    {
        AppMain.mppAssertNotImpl();
        if (user == 0U)
        {
            user = uint.MaxValue;
        }
        AppMain.AMS_TCB next = taskp.tcb_head.next;
        switch (flag)
        {
        case 0:
            for (; next != taskp.tcb_tail; next = next.next)
            {
                if (((int)next.user_id & (int)user) != 0 && ((int)next.attribute & (int)attr) != 0)
                {
                    AppMain.amTaskWakeup(next);
                }
            }
            break;

        case 1:
            for (; next != taskp.tcb_tail; next = next.next)
            {
                if (((int)next.user_id & (int)user) != 0 && ((int)next.attribute & (int)attr) == (int)attr)
                {
                    AppMain.amTaskWakeup(next);
                }
            }
            break;

        case 2:
            for (; next != taskp.tcb_tail; next = next.next)
            {
                if (((int)next.user_id & (int)user) != 0 && ((int)next.attribute & (int)attr) == 0)
                {
                    AppMain.amTaskWakeup(next);
                }
            }
            break;

        case 3:
            for (; next != taskp.tcb_tail; next = next.next)
            {
                if (((int)next.user_id & (int)user) != 0 && ((int)next.attribute & (int)attr) != (int)attr)
                {
                    AppMain.amTaskWakeup(next);
                }
            }
            break;
        }
    }
예제 #16
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;
 }
예제 #17
0
 public void AttachTask(
     string name,
     uint priority,
     uint user,
     uint attribute,
     int group,
     uint stall_mask,
     uint run_mask)
 {
     this.DetachTask();
     this.m_task_tcb      = AppMain.amTaskMake(new AppMain.TaskProc(AppMain.ITaskLink.procedure), new AppMain.TaskProc(AppMain.ITaskLink.destructor), priority, user, attribute, name, stall_mask, group, run_mask);
     this.m_task_tcb.work = (object)new AppMain.ITaskLink.SWork();
     ((AppMain.ITaskLink.SWork)AppMain.amTaskGetWork(this.m_task_tcb)).owner = this;
 }
 // Token: 0x060016E6 RID: 5862 RVA: 0x000C75F8 File Offset: 0x000C57F8
 public static void mtTaskDestructor(AppMain.AMS_TCB am_tcb)
 {
     AppMain.MTS_TASK_TCB mts_TASK_TCB = (AppMain.MTS_TASK_TCB)AppMain.amTaskGetWork(am_tcb);
     if (mts_TASK_TCB.dest != null)
     {
         mts_TASK_TCB.dest(mts_TASK_TCB);
     }
     if (mts_TASK_TCB.work != null && mts_TASK_TCB.work is AppMain.GMS_EFFECT_3DES_WORK)
     {
         AppMain.GMS_EFFECT_3DES_WORK gms_EFFECT_3DES_WORK = (AppMain.GMS_EFFECT_3DES_WORK)mts_TASK_TCB.work;
         gms_EFFECT_3DES_WORK.Clear();
         AppMain.GMS_EFFECT_3DES_WORK_Pool.Release(gms_EFFECT_3DES_WORK);
     }
     mts_TASK_TCB.work = null;
 }
예제 #19
0
 public static void mtTaskDestructor(AppMain.AMS_TCB am_tcb)
 {
     AppMain.MTS_TASK_TCB work1 = (AppMain.MTS_TASK_TCB)AppMain.amTaskGetWork(am_tcb);
     if (work1.dest != null)
     {
         work1.dest(work1);
     }
     if (work1.work != null && work1.work is AppMain.GMS_EFFECT_3DES_WORK)
     {
         AppMain.GMS_EFFECT_3DES_WORK work2 = (AppMain.GMS_EFFECT_3DES_WORK)work1.work;
         work2.Clear();
         AppMain.GMS_EFFECT_3DES_WORK_Pool.Release(work2);
     }
     work1.work = (object)null;
 }
예제 #20
0
 private static void _amTaskExecuteInOrder(AppMain.AMS_TASK taskp)
 {
     for (AppMain.AMS_TCB next = taskp.tcb_head.next; next != taskp.tcb_tail; next = next.next)
     {
         if (next.procedure != null && next.proc_addr > 0)
         {
             next.procedure(next);
         }
     }
     for (AppMain.AMS_TCB next = taskp.tcb_head.next; next != taskp.tcb_tail; next = next.next)
     {
         if (next.proc_addr == -1)
         {
             AppMain._amTaskDeleteReal(next);
         }
     }
 }
예제 #21
0
 public static void amTaskDeletePriority(
     AppMain.AMS_TASK taskp,
     uint prio_begin,
     uint prio_end,
     uint user)
 {
     AppMain.AMS_TCB next = taskp.tcb_head.next;
     while (next != taskp.tcb_tail && next.priority < prio_begin)
     {
         next = next.next;
     }
     for (; next != taskp.tcb_tail && next.priority <= prio_end; next = next.next)
     {
         if (user == 0U || ((int)next.user_id & (int)user) != 0)
         {
             AppMain.amTaskDelete(next);
         }
     }
 }
예제 #22
0
    // Token: 0x060009EC RID: 2540 RVA: 0x00059A48 File Offset: 0x00057C48
    private static void gsInitTaskProcedure(AppMain.AMS_TCB tcb)
    {
        AppMain.GSS_INIT_WORK gss_INIT_WORK = (AppMain.GSS_INIT_WORK)AppMain.amTaskGetWork(tcb);
        if (gss_INIT_WORK.proc == null)
        {
            AppMain.amTaskDelete(tcb);
            return;
        }
        Delegate proc = gss_INIT_WORK.proc;

        gss_INIT_WORK.proc(gss_INIT_WORK);
        if (gss_INIT_WORK.proc != proc)
        {
            gss_INIT_WORK.count = 0;
            return;
        }
        if (gss_INIT_WORK.count < -1)
        {
            gss_INIT_WORK.count++;
        }
    }
예제 #23
0
    // Token: 0x060016D7 RID: 5847 RVA: 0x000C741C File Offset: 0x000C561C
    public static MTS_TASK_TCB mtTaskMake(AppMain.GSF_TASK_PROCEDURE proc, AppMain.GSF_TASK_PROCEDURE dest,
                                          uint flag, ushort pause_level, uint prio, int group, AppMain.TaskWorkFactoryDelegate work_size, string name)
    {
        if ((flag & 2147483648U) == 0U && group >= 15)
        {
            group = 14;
        }

        if (string.IsNullOrEmpty(name))
        {
            throw new ArgumentNullException(nameof(name));
        }

        Debug.WriteLine($"Creating task {name}, group {group}, priority {prio}.");

        AppMain.AMS_TCB ams_TCB = AppMain.amTaskMake(AppMain._mtTaskProcedure, AppMain._mtTaskDestructor, prio,
                                                     1U << group, 2U, name);
        ams_TCB.work = new MTS_TASK_TCB();
        MTS_TASK_TCB mts_TASK_TCB = (MTS_TASK_TCB)AppMain.amTaskGetWork(ams_TCB);

        mts_TASK_TCB.am_tcb      = ams_TCB;
        mts_TASK_TCB.proc        = proc;
        mts_TASK_TCB.dest        = dest;
        mts_TASK_TCB.pause_level = pause_level;
        if ((flag & 1U) != 0U)
        {
            mts_TASK_TCB.pause_level = ushort.MaxValue;
        }

        mts_TASK_TCB.work = null;
        if (work_size != null)
        {
            mts_TASK_TCB.work = work_size();
        }

        AppMain.amTaskStart(ams_TCB);
        return(mts_TASK_TCB);
    }
예제 #24
0
 // Token: 0x060017C4 RID: 6084 RVA: 0x000D2C41 File Offset: 0x000D0E41
 private static void dmManualTaskDraw(AppMain.AMS_TCB tcb)
 {
     AppMain.AoActDrawPre();
     AppMain.amDrawExecCommand(AppMain.dm_manual_draw_state);
     AppMain.amDrawEndScene();
 }
예제 #25
0
 // Token: 0x060009ED RID: 2541 RVA: 0x00059AAB File Offset: 0x00057CAB
 private static void gsInitTaskDestructor(AppMain.AMS_TCB tcb)
 {
     AppMain.g_gs_init_tcb = null;
 }
예제 #26
0
 // Token: 0x06001FF2 RID: 8178 RVA: 0x0013D784 File Offset: 0x0013B984
 private static void destructor(AppMain.AMS_TCB tcb)
 {
     AppMain.ITaskLinkAsv.SWork swork = (AppMain.ITaskLinkAsv.SWork)AppMain.amTaskGetWork(tcb);
     swork.owner.TcbLinkDestructorCb();
 }
예제 #27
0
 // Token: 0x06001FF1 RID: 8177 RVA: 0x0013D760 File Offset: 0x0013B960
 private static void procedure(AppMain.AMS_TCB tcb)
 {
     AppMain.ITaskLinkAsv.SWork swork = (AppMain.ITaskLinkAsv.SWork)AppMain.amTaskGetWork(tcb);
     swork.owner.operator_brackets();
 }
예제 #28
0
 public static AppMain.ITaskLink CastFromTaskTcb(AppMain.AMS_TCB tcb)
 {
     AppMain.mppAssertNotImpl();
     return((AppMain.ITaskLink)null);
 }
예제 #29
0
 private static void destructor(AppMain.AMS_TCB tcb)
 {
     AppMain.mppAssertNotImpl();
 }
예제 #30
0
 private static void procedure(AppMain.AMS_TCB tcb)
 {
     ((AppMain.ITaskLink.SWork)AppMain.amTaskGetWork(tcb)).owner.operator_brackets();
 }