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

📄 os_task.lis

📁 ucos如何移植到单片机mega128
💻 LIS
📖 第 1 页 / 共 5 页
字号:
 006C 9701              movw R18,R14
 006E 8501              movw R16,R10
 0070 0E940000          xcall _OSTaskStkInit
 0074 5801              movw R10,R16
 0076                   .dbline 178
 0076           ;         err = OS_TCBInit(prio, psp, (OS_STK *)0, 0, 0, (void *)0, 0);
 0076 2224              clr R2
 0078 3324              clr R3
 007A 3B86              std y+11,R3
 007C 2A86              std y+10,R2
 007E 3986              std y+9,R3
 0080 2886              std y+8,R2
 0082 40E0              ldi R20,0
 0084 50E0              ldi R21,0
 0086 60E0              ldi R22,0
 0088 70E0              ldi R23,0
 008A 4C83              std y+4,R20
 008C 5D83              std y+5,R21
 008E 6E83              std y+6,R22
 0090 7F83              std y+7,R23
 0092 3B82              std y+3,R3
 0094 2A82              std y+2,R2
 0096 3982              std y+1,R3
 0098 2882              std y+0,R2
 009A 9501              movw R18,R10
 009C 0C2D              mov R16,R12
 009E 0E940000          xcall _OS_TCBInit
 00A2 A02E              mov R10,R16
 00A4                   .dbline 179
 00A4           ;         if (err == OS_NO_ERR) {
 00A4 0023              tst R16
 00A6 A9F4              brne L8
 00A8                   .dbline 179
 00A8                   .dbline 180
 00A8           ;             OS_ENTER_CRITICAL();
 00A8 0A93              st -y,r16
 00AA 0FB7              in r16,0x3F
 00AC F894              cli
 00AE 0F93              push r16
 00B0 0991              ld r16,y+
 00B2                   .dbline 180
 00B2                   .dbline 181
 00B2           ;             OSTaskCtr++;                                        /* Increment the #tasks counter        */
 00B2 80910000          lds R24,_OSTaskCtr
 00B6 8F5F              subi R24,255    ; addi 1
 00B8 80930000          sts _OSTaskCtr,R24
 00BC                   .dbline 182
 00BC           ;             OS_EXIT_CRITICAL();
 00BC 0A93              st -y,r16
 00BE 0F91              pop r16
 00C0 0FBF              out 0x3F,r16
 00C2 0991              ld r16,y+
 00C4                   .dbline 182
 00C4                   .dbline 183
 00C4           ;             if (OSRunning == TRUE) {         /* Find highest priority task if multitasking has started */
 00C4 80910000          lds R24,_OSRunning
 00C8 8130              cpi R24,1
 00CA B9F4              brne L9
 00CC                   .dbline 183
 00CC                   .dbline 184
 00CC           ;                 OS_Sched();
 00CC 0E940000          xcall _OS_Sched
 00D0                   .dbline 185
 00D0           ;             }
 00D0                   .dbline 186
 00D0 14C0              xjmp L9
 00D2           L8:
 00D2                   .dbline 186
 00D2           ;         } else {
 00D2                   .dbline 187
 00D2           ;             OS_ENTER_CRITICAL();
 00D2 0A93              st -y,r16
 00D4 0FB7              in r16,0x3F
 00D6 F894              cli
 00D8 0F93              push r16
 00DA 0991              ld r16,y+
 00DC                   .dbline 187
 00DC                   .dbline 188
 00DC           ;             OSTCBPrioTbl[prio] = (OS_TCB *)0;/* Make this priority available to others                 */
 00DC 82E0              ldi R24,2
 00DE 8C9D              mul R24,R12
 00E0 F001              movw R30,R0
 00E2 80E0              ldi R24,<_OSTCBPrioTbl
 00E4 90E0              ldi R25,>_OSTCBPrioTbl
 00E6 E80F              add R30,R24
 00E8 F91F              adc R31,R25
 00EA 2224              clr R2
 00EC 3324              clr R3
 00EE 3182              std z+1,R3
 00F0 2082              std z+0,R2
 00F2                   .dbline 189
 00F2           ;             OS_EXIT_CRITICAL();
 00F2 0A93              st -y,r16
 00F4 0F91              pop r16
 00F6 0FBF              out 0x3F,r16
 00F8 0991              ld r16,y+
 00FA                   .dbline 189
 00FA                   .dbline 190
 00FA           ;         }
 00FA           L9:
 00FA                   .dbline 191
 00FA           ;         return (err);
 00FA 0A2D              mov R16,R10
 00FC 05C0              xjmp L3
 00FE           L6:
 00FE                   .dbline 193
 00FE           ;     }
 00FE           ;     OS_EXIT_CRITICAL();
 00FE 0A93              st -y,r16
 0100 0F91              pop r16
 0102 0FBF              out 0x3F,r16
 0104 0991              ld r16,y+
 0106                   .dbline 193
 0106                   .dbline 194
 0106           ;     return (OS_PRIO_EXIST);
 0106 08E2              ldi R16,40
 0108                   .dbline -2
 0108           L3:
 0108 2C96              adiw R28,12
 010A 0E940000          xcall pop_gset5
 010E                   .dbline 0 ; func end
 010E 0895              ret
 0110                   .dbsym r psp 10 pc
 0110                   .dbsym r err 10 c
 0110                   .dbsym r prio 12 c
 0110                   .dbsym l ptos 22 pc
 0110                   .dbsym r pdata 14 pV
 0110                   .dbsym r task 10 pfV
 0110                   .dbend
 0110                   .dbfunc e OSTaskDel _OSTaskDel fc
 0110                   .dbstruct 0 10 .2
 0110                   .dbfield 0 OSFlagNodeNext pV
 0110                   .dbfield 2 OSFlagNodePrev pV
 0110                   .dbfield 4 OSFlagNodeTCB pV
 0110                   .dbfield 6 OSFlagNodeFlagGrp pV
 0110                   .dbfield 8 OSFlagNodeFlags c
 0110                   .dbfield 9 OSFlagNodeWaitType c
 0110                   .dbend
 0110                   .dbstruct 0 18 os_tcb
 0110                   .dbfield 0 OSTCBStkPtr pc
 0110                   .dbfield 2 OSTCBNext pS[os_tcb]
 0110                   .dbfield 4 OSTCBPrev pS[os_tcb]
 0110                   .dbfield 6 OSTCBFlagNode pS[.2]
 0110                   .dbfield 8 OSTCBFlagsRdy c
 0110                   .dbfield 9 OSTCBDly i
 0110                   .dbfield 11 OSTCBStat c
 0110                   .dbfield 12 OSTCBPrio c
 0110                   .dbfield 13 OSTCBX c
 0110                   .dbfield 14 OSTCBY c
 0110                   .dbfield 15 OSTCBBitX c
 0110                   .dbfield 16 OSTCBBitY c
 0110                   .dbfield 17 OSTCBDelReq c
 0110                   .dbend
 0110           ;           self -> <dead>
 0110           ;          pnode -> R10,R11
 0110           ;           ptcb -> R20,R21
 0110           ;           prio -> R22
                        .even
 0110           _OSTaskDel::
 0110 0E940000          xcall push_gset3
 0114 602F              mov R22,R16
 0116                   .dbline -1
 0116                   .dbline 358
 0116           ; }
 0116           ; #endif
 0116           ; /*$PAGE*/
 0116           ; /*
 0116           ; *********************************************************************************************************
 0116           ; *                                     CREATE A TASK (Extended Version)
 0116           ; *
 0116           ; * Description: This function is used to have uC/OS-II manage the execution of a task.  Tasks can either
 0116           ; *              be created prior to the start of multitasking or by a running task.  A task cannot be
 0116           ; *              created by an ISR.  This function is similar to OSTaskCreate() except that it allows
 0116           ; *              additional information about a task to be specified.
 0116           ; *
 0116           ; * Arguments  : task     is a pointer to the task's code
 0116           ; *
 0116           ; *              pdata    is a pointer to an optional data area which can be used to pass parameters to
 0116           ; *                       the task when the task first executes.  Where the task is concerned it thinks
 0116           ; *                       it was invoked and passed the argument 'pdata' as follows:
 0116           ; *
 0116           ; *                           void Task (void *pdata)
 0116           ; *                           {
 0116           ; *                               for (;;) {
 0116           ; *                                   Task code;
 0116           ; *                               }
 0116           ; *                           }
 0116           ; *
 0116           ; *              ptos     is a pointer to the task's top of stack.  If the configuration constant
 0116           ; *                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
 0116           ; *                       memory to low memory).  'pstk' will thus point to the highest (valid) memory
 0116           ; *                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pstk' will point to the
 0116           ; *                       lowest memory location of the stack and the stack will grow with increasing
 0116           ; *                       memory locations.  'pstk' MUST point to a valid 'free' data item.
 0116           ; *
 0116           ; *              prio     is the task's priority.  A unique priority MUST be assigned to each task and the
 0116           ; *                       lower the number, the higher the priority.
 0116           ; *
 0116           ; *              id       is the task's ID (0..65535)
 0116           ; *
 0116           ; *              pbos     is a pointer to the task's bottom of stack.  If the configuration constant
 0116           ; *                       OS_STK_GROWTH is set to 1, the stack is assumed to grow downward (i.e. from high
 0116           ; *                       memory to low memory).  'pbos' will thus point to the LOWEST (valid) memory
 0116           ; *                       location of the stack.  If OS_STK_GROWTH is set to 0, 'pbos' will point to the
 0116           ; *                       HIGHEST memory location of the stack and the stack will grow with increasing
 0116           ; *                       memory locations.  'pbos' MUST point to a valid 'free' data item.
 0116           ; *
 0116           ; *              stk_size is the size of the stack in number of elements.  If OS_STK is set to INT8U,
 0116           ; *                       'stk_size' corresponds to the number of bytes available.  If OS_STK is set to
 0116           ; *                       INT16U, 'stk_size' contains the number of 16-bit entries available.  Finally, if
 0116           ; *                       OS_STK is set to INT32U, 'stk_size' contains the number of 32-bit entries
 0116           ; *                       available on the stack.
 0116           ; *
 0116           ; *              pext     is a pointer to a user supplied memory location which is used as a TCB extension.
 0116           ; *                       For example, this user memory can hold the contents of floating-point registers
 0116           ; *                       during a context switch, the time each task takes to execute, the number of times
 0116           ; *                       the task has been switched-in, etc.
 0116           ; *
 0116           ; *              opt      contains additional information (or options) about the behavior of the task.  The
 0116           ; *                       LOWER 8-bits are reserved by uC/OS-II while the upper 8 bits can be application
 0116           ; *                       specific.  See OS_TASK_OPT_??? in uCOS-II.H.
 0116           ; *
 0116           ; * Returns    : OS_NO_ERR        if the function was successful.
 0116           ; *              OS_PRIO_EXIT     if the task priority already exist
 0116           ; *                               (each task MUST have a unique priority).
 0116           ; *              OS_PRIO_INVALID  if the priority you specify is higher that the maximum allowed
 0116           ; *                               (i.e. > OS_LOWEST_PRIO)
 0116           ; *********************************************************************************************************
 0116           ; */
 0116           ; /*$PAGE*/
 0116           ; #if OS_TASK_CREATE_EXT_EN > 0
 0116           ; INT8U  OSTaskCreateExt (void   (*task)(void *pd),
 0116           ;                         void    *pdata,
 0116           ;                         OS_STK  *ptos,
 0116           ;                         INT8U    prio,
 0116           ;                         INT16U   id,
 0116           ;                         OS_STK  *pbos,
 0116           ;                         INT32U   stk_size,
 0116           ;                         void    *pext,
 0116           ;                         INT16U   opt)
 0116           ; {
 0116           ; #if OS_CRITICAL_METHOD == 3                  /* Allocate storage for CPU status register               */
 0116           ;     OS_CPU_SR  cpu_sr;
 0116           ; #endif
 0116           ;     OS_STK    *psp;
 0116           ;     INT8U      err;
 0116           ; 
 0116           ; 
 0116           ; #if OS_ARG_CHK_EN > 0
 0116           ;     if (prio > OS_LOWEST_PRIO) {             /* Make sure priority is within allowable range           */
 0116           ;         return (OS_PRIO_INVALID);
 0116           ;     }
 0116           ; #endif
 0116           ;     OS_ENTER_CRITICAL();
 0116           ;     if (OSTCBPrioTbl[prio] == (OS_TCB *)0) { /* Make sure task doesn't already exist at this priority  */
 0116           ;         OSTCBPrioTbl[prio] = (OS_TCB *)1;    /* Reserve the priority to prevent others from doing ...  */
 0116           ;                                              /* ... the same thing until task is created.              */
 0116           ;         OS_EXIT_CRITICAL();
 0116           ; 

⌨️ 快捷键说明

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