⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_core.lis

📁 ucos如何移植到单片机mega128
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 0254           ;     if ((pevent->OSEventTbl[y] &= ~bitx) == 0x00) {   /* Remove this task from the waiting list        */
 0254           ;         pevent->OSEventGrp &= ~bity;                  /* Clr group bit if this was only task pending   */
 0254           ;     }
 0254           ;     ptcb                 =  OSTCBPrioTbl[prio];       /* Point to this task's OS_TCB                   */
 0254           ;     ptcb->OSTCBDly       =  0;                        /* Prevent OSTimeTick() from readying task       */
 0254           ;     ptcb->OSTCBEventPtr  = (OS_EVENT *)0;             /* Unlink ECB from this task                     */
 0254           ; #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
 0254           ;     ptcb->OSTCBMsg       = msg;                       /* Send message directly to waiting task         */
 0254           ; #else
 0254           ;     msg                  = msg;                       /* Prevent compiler warning if not used          */
 0254           ; #endif
 0254           ;     ptcb->OSTCBStat     &= ~msk;                      /* Clear bit associated with event type          */
 0254           ;     if (ptcb->OSTCBStat == OS_STAT_RDY) {             /* See if task is ready (could be susp'd)        */
 0254           ;         OSRdyGrp        |=  bity;                     /* Put task in the ready to run list             */
 0254           ;         OSRdyTbl[y]     |=  bitx;
 0254           ;     }
 0254           ;     return (prio);
 0254           ; }
 0254           ; #endif
 0254           ; 
 0254           ; /*
 0254           ; *********************************************************************************************************
 0254           ; *                                   MAKE TASK WAIT FOR EVENT TO OCCUR
 0254           ; *
 0254           ; * Description: This function is called by other uC/OS-II services to suspend a task because an event has
 0254           ; *              not occurred.
 0254           ; *
 0254           ; * Arguments  : pevent   is a pointer to the event control block for which the task will be waiting for.
 0254           ; *
 0254           ; * Returns    : none
 0254           ; *
 0254           ; * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 0254           ; *********************************************************************************************************
 0254           ; */
 0254           ; #if OS_EVENT_EN > 0
 0254           ; void  OS_EventTaskWait (OS_EVENT *pevent)
 0254           ; {
 0254           ;     OSTCBCur->OSTCBEventPtr = pevent;            /* Store pointer to event control block in TCB        */
 0254           ;     if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {   /* Task no longer ready      */
 0254           ;         OSRdyGrp &= ~OSTCBCur->OSTCBBitY;        /* Clear event grp bit if this was only task pending  */
 0254           ;     }
 0254           ;     pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX;          /* Put task in waiting list  */
 0254           ;     pevent->OSEventGrp                   |= OSTCBCur->OSTCBBitY;
 0254           ; }
 0254           ; #endif
 0254           ; 
 0254           ; /*
 0254           ; *********************************************************************************************************
 0254           ; *                              MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
 0254           ; *
 0254           ; * Description: This function is called by other uC/OS-II services to make a task ready to run because a
 0254           ; *              timeout occurred.
 0254           ; *
 0254           ; * Arguments  : pevent   is a pointer to the event control block which is readying a task.
 0254           ; *
 0254           ; * Returns    : none
 0254           ; *
 0254           ; * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 0254           ; *********************************************************************************************************
 0254           ; */
 0254           ; #if OS_EVENT_EN > 0
 0254           ; void  OS_EventTO (OS_EVENT *pevent)
 0254           ; {
 0254           ;     if ((pevent->OSEventTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {
 0254           ;         pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
 0254           ;     }
 0254           ;     OSTCBCur->OSTCBStat     = OS_STAT_RDY;       /* Set status to ready                                */
 0254           ;     OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;     /* No longer waiting for event                        */
 0254           ; }
 0254           ; #endif
 0254           ; 
 0254           ; /*
 0254           ; *********************************************************************************************************
 0254           ; *                                 INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
 0254           ; *
 0254           ; * Description: This function is called by other uC/OS-II services to initialize the event wait list.
 0254           ; *
 0254           ; * Arguments  : pevent    is a pointer to the event control block allocated to the event.
 0254           ; *
 0254           ; * Returns    : none
 0254           ; *
 0254           ; * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 0254           ; *********************************************************************************************************
 0254           ; */
 0254           ; #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0)
 0254           ; void  OS_EventWaitListInit (OS_EVENT *pevent)
 0254           ; {
 0254           ;     INT8U  *ptbl;
 0254           ; 
 0254           ; 
 0254           ;     pevent->OSEventGrp = 0x00;                   /* No task waiting on event                           */
 0254           ;     ptbl               = &pevent->OSEventTbl[0];
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 0
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 1
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 2
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 3
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 4
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 5
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 6
 0254           ;     *ptbl++            = 0x00;
 0254           ; #endif
 0254           ; 
 0254           ; #if OS_EVENT_TBL_SIZE > 7
 0254           ;     *ptbl              = 0x00;
 0254           ; #endif
 0254           ; }
 0254           ; #endif
 0254           ; 
 0254           ; /*
 0254           ; *********************************************************************************************************
 0254           ; *                                             INITIALIZATION
 0254           ; *                           INITIALIZE THE FREE LIST OF EVENT CONTROL BLOCKS
 0254           ; *
 0254           ; * Description: This function is called by OSInit() to initialize the free list of event control blocks.
 0254           ; *
 0254           ; * Arguments  : none
 0254           ; *
 0254           ; * Returns    : none
 0254           ; *********************************************************************************************************
 0254           ; */
 0254           ; 
 0254           ; static  void  OS_InitEventList (void)
 0254           ; {
 0254                   .dbline -2
 0254           L35:
 0254                   .dbline 0 ; func end
 0254 0895              ret
 0256                   .dbend
 0256                   .dbfunc s OS_InitMisc _OS_InitMisc fV
                        .even
 0256           _OS_InitMisc:
 0256 0E940000          xcall push_gset2
 025A                   .dbline -1
 025A                   .dbline 656
 025A           ; #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
 025A           ; #if (OS_MAX_EVENTS > 1)
 025A           ;     INT16U     i;
 025A           ;     OS_EVENT  *pevent1;
 025A           ;     OS_EVENT  *pevent2;
 025A           ; 
 025A           ; 
 025A           ;     pevent1 = &OSEventTbl[0];
 025A           ;     pevent2 = &OSEventTbl[1];
 025A           ;     for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control blocks  */
 025A           ;         pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
 025A           ;         pevent1->OSEventPtr  = pevent2;
 025A           ;         pevent1++;
 025A           ;         pevent2++;
 025A           ;     }
 025A           ;     pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;
 025A           ;     pevent1->OSEventPtr  = (OS_EVENT *)0;
 025A           ;     OSEventFreeList      = &OSEventTbl[0];
 025A           ; #else
 025A           ;     OSEventFreeList              = &OSEventTbl[0];               /* Only have ONE event control block        */
 025A           ;     OSEventFreeList->OSEventType = OS_EVENT_TYPE_UNUSED;
 025A           ;     OSEventFreeList->OSEventPtr  = (OS_EVENT *)0;
 025A           ; #endif
 025A           ; #endif
 025A           ; }
 025A           ; 
 025A           ; /*
 025A           ; *********************************************************************************************************
 025A           ; *                                             INITIALIZATION
 025A           ; *                                    INITIALIZE MISCELLANEOUS VARIABLES
 025A           ; *
 025A           ; * Description: This function is called by OSInit() to initialize miscellaneous variables.
 025A           ; *
 025A           ; * Arguments  : none
 025A           ; *
 025A           ; * Returns    : none
 025A           ; *********************************************************************************************************
 025A           ; */
 025A           ; 
 025A           ; static  void  OS_InitMisc (void)
 025A           ; {
 025A                   .dbline 661
 025A           ; #if OS_TIME_GET_SET_EN > 0   
 025A           ;     OSTime        = 0L;                                          /* Clear the 32-bit system clock            */
 025A           ; #endif
 025A           ; 
 025A           ;     OSIntNesting  = 0;                                           /* Clear the interrupt nesting counter      */
 025A 2224              clr R2
 025C 20922C01          sts _OSIntNesting,R2
 0260                   .dbline 662
 0260           ;     OSLockNesting = 0;                                           /* Clear the scheduling lock counter        */
 0260 20922A01          sts _OSLockNesting,R2
 0264                   .dbline 664
 0264           ; 
 0264           ;     OSTaskCtr     = 0;                                           /* Clear the number of tasks                */
 0264 20922201          sts _OSTaskCtr,R2
 0268                   .dbline 666
 0268           ; 
 0268           ;     OSRunning     = FALSE;                                       /* Indicate that multitasking not started   */
 0268 20922301          sts _OSRunning,R2
 026C                   .dbline 668
 026C           ;     
 026C           ;     OSCtxSwCtr    = 0;                                           /* Clear the context switch counter         */
 026C 40E0              ldi R20,0
 026E 50E0              ldi R21,0
 0270 60E0              ldi R22,0
 0272 70E0              ldi R23,0
 0274 50934401          sts _OSCtxSwCtr+1,R21
 0278 40934301          sts _OSCtxSwCtr,R20
 027C 70934601          sts _OSCtxSwCtr+2+1,R23
 0280 60934501          sts _OSCtxSwCtr+2,R22
 0284                   .dbline 669
 0284           ;     OSIdleCtr     = 0L;                                          /* Clear the 32-bit idle counter            */
 0284 40E0              ldi R20,0
 0286 50E0              ldi R21,0
 0288 60E0              ldi R22,0
 028A 70E0              ldi R23,0
 028C 50931F01          sts _OSIdleCtr+1,R21
 0290 40931E01          sts _OSIdleCtr,R20
 0294 70932101          sts _OSIdleCtr+2+1,R23
 0298 60932001          sts _OSIdleCtr+2,R22
 029C                   .dbline -2
 029C           L36:
 029C 0E940000          xcall pop_gset2
 02A0                   .dbline 0 ; func end
 02A0 0895              ret
 02A2                   .dbend
 02A2                   .dbfunc s OS_InitRdyList _OS_InitRdyList fV
 02A2           ;        prdytbl -> R16,R17
 02A2           ;              i -> R18,R19
                        .even
 02A2           _OS_InitRdyList:
 02A2                   .dbline -1
 02A2                   .dbline 692
 02A2           ; 
 02A2           ; #if (OS_TASK_STAT_EN > 0) && (OS_TASK_CREATE_EXT_EN > 0)
 02A2           ;     OSIdleCtrRun  = 0L;
 02A2           ;     OSIdleCtrMax  = 0L;
 02A2           ;     OSStatRdy     = FALSE;                                       /* Statistic task is not ready              */
 02A2           ; #endif
 02A2           ; }
 02A2           ; 
 02A2           ; /*
 02A2           ; *********************************************************************************************************
 02A2           ; *                                             INITIALIZATION
 02A2           ; *                                       INITIALIZE THE READY LIST
 02A2           ; *
 02A2           ; * Description: This function is called by

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -