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

📄 os_mbox.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
    107                  pevent->OSEventType    = OS_EVENT_TYPE_MBOX;
   \   00000028   0120               MOVS     R0,#+1
   \   0000002A   2870               STRB     R0,[R5, #+0]
    108                  pevent->OSEventCnt     = 0;
   \   0000002C   0020               MOVS     R0,#+0
   \   0000002E   0100               MOVS     R1,R0
   \   00000030   2981               STRH     R1,[R5, #+8]
    109                  pevent->OSEventPtr     = pmsg;           /* Deposit message in event control block             */
   \   00000032   6C60               STR      R4,[R5, #+4]
    110          #if OS_EVENT_NAME_SIZE > 1
    111                  pevent->OSEventName[0] = '?';
   \   00000034   3F21               MOVS     R1,#+63
   \   00000036   E973               STRB     R1,[R5, #+15]
    112                  pevent->OSEventName[1] = OS_ASCII_NUL;
   \   00000038   2874               STRB     R0,[R5, #+16]
    113          #endif
    114                  OS_EventWaitListInit(pevent);
   \   0000003A   2800               MOVS     R0,R5
   \   0000003C   ........           _BLF     OS_EventWaitListInit,??OS_EventWaitListInit??rT
    115              }
    116              return (pevent);                             /* Return pointer to event control block              */
   \                     ??OSMboxCreate_2:
   \   00000040   2800               MOVS     R0,R5
   \   00000042   30BD               POP      {R4,R5,PC}       ;; return
    117          }
    118          /*$PAGE*/
    119          /*
    120          *********************************************************************************************************
    121          *                                         DELETE A MAIBOX
    122          *
    123          * Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
    124          *
    125          * Arguments  : pevent        is a pointer to the event control block associated with the desired
    126          *                            mailbox.
    127          *
    128          *              opt           determines delete options as follows:
    129          *                            opt == OS_DEL_NO_PEND   Delete the mailbox ONLY if no task pending
    130          *                            opt == OS_DEL_ALWAYS    Deletes the mailbox even if tasks are waiting.
    131          *                                                    In this case, all the tasks pending will be readied.
    132          *
    133          *              perr          is a pointer to an error code that can contain one of the following values:
    134          *                            OS_ERR_NONE             The call was successful and the mailbox was deleted
    135          *                            OS_ERR_DEL_ISR          If you attempted to delete the mailbox from an ISR
    136          *                            OS_ERR_INVALID_OPT      An invalid option was specified
    137          *                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the mailbox
    138          *                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a mailbox
    139          *                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
    140          *
    141          * Returns    : pevent        upon error
    142          *              (OS_EVENT *)0 if the mailbox was successfully deleted.
    143          *
    144          * Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
    145          *                 the mailbox MUST check the return code of OSMboxPend().
    146          *              2) OSMboxAccept() callers will not know that the intended mailbox has been deleted!
    147          *              3) This call can potentially disable interrupts for a long time.  The interrupt disable
    148          *                 time is directly proportional to the number of tasks waiting on the mailbox.
    149          *              4) Because ALL tasks pending on the mailbox will be readied, you MUST be careful in
    150          *                 applications where the mailbox is used for mutual exclusion because the resource(s)
    151          *                 will no longer be guarded by the mailbox.
    152          *********************************************************************************************************
    153          */
    154          
    155          #if OS_MBOX_DEL_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    156          OS_EVENT  *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *perr)
    157          {
   \                     OSMboxDel:
   \   00000000   2DE9F04F           PUSH     {R4-R11,LR}
   \   00000004   8846               MOV      R8,R1
   \   00000006   0400               MOVS     R4,R0
   \   00000008   1500               MOVS     R5,R2
    158              BOOLEAN    tasks_waiting;
    159              OS_EVENT  *pevent_return;
    160          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    161              OS_CPU_SR  cpu_sr = 0;
    162          #endif
    163          
    164          
    165          
    166          #if OS_ARG_CHK_EN > 0
    167              if (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
    168                  return (pevent);
    169              }
    170              if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
    171                  *perr = OS_ERR_PEVENT_NULL;
    172                  return (pevent);
    173              }
    174          #endif
    175              if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {       /* Validate event block type                */
   \   0000000A   0127               MOVS     R7,#+1
   \   0000000C   2078               LDRB     R0,[R4, #+0]
   \   0000000E   0128               CMP      R0,#+1
   \   00000010   02D0               BEQ.N    ??OSMboxDel_0
    176                  *perr = OS_ERR_EVENT_TYPE;
   \   00000012   2F70               STRB     R7,[R5, #+0]
    177                  return (pevent);
   \   00000014   2000               MOVS     R0,R4
   \   00000016   51E0               B.N      ??OSMboxDel_1
    178              }
    179              if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
   \                     ??OSMboxDel_0:
   \   00000018   ....               LDR.N    R0,??DataTable4  ;; OSIntNesting
   \   0000001A   0078               LDRB     R0,[R0, #+0]
   \   0000001C   0028               CMP      R0,#+0
   \   0000001E   03D0               BEQ.N    ??OSMboxDel_2
    180                  *perr = OS_ERR_DEL_ISR;                            /* ... can't DELETE from an ISR             */
   \   00000020   0F20               MOVS     R0,#+15
   \   00000022   2870               STRB     R0,[R5, #+0]
    181                  return (pevent);
   \   00000024   2000               MOVS     R0,R4
   \   00000026   49E0               B.N      ??OSMboxDel_1
    182              }
    183              OS_ENTER_CRITICAL();
   \                     ??OSMboxDel_2:
   \   00000028   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   0000002C   8146               MOV      R9,R0
    184              if (pevent->OSEventGrp != 0) {                         /* See if any tasks waiting on mailbox      */
   \   0000002E   0020               MOVS     R0,#+0
   \   00000030   8246               MOV      R10,R0
   \   00000032   A07A               LDRB     R0,[R4, #+10]
   \   00000034   0028               CMP      R0,#+0
   \   00000036   00D1               BNE.N    ??OSMboxDel_3
    185                  tasks_waiting = OS_TRUE;                           /* Yes                                      */
    186              } else {
    187                  tasks_waiting = OS_FALSE;                          /* No                                       */
   \   00000038   5746               MOV      R7,R10
    188              }
    189              switch (opt) {
   \                     ??OSMboxDel_3:
   \   0000003A   ....               LDR.N    R6,??DataTable3  ;; OSEventFreeList
   \   0000003C   3F20               MOVS     R0,#+63
   \   0000003E   8346               MOV      R11,R0
   \   00000040   4046               MOV      R0,R8
   \   00000042   0028               CMP      R0,#+0
   \   00000044   02D0               BEQ.N    ??OSMboxDel_4
   \   00000046   0128               CMP      R0,#+1
   \   00000048   1CD0               BEQ.N    ??OSMboxDel_5
   \   0000004A   31E0               B.N      ??OSMboxDel_6
    190                  case OS_DEL_NO_PEND:                               /* Delete mailbox only if no task waiting   */
    191                       if (tasks_waiting == OS_FALSE) {
   \                     ??OSMboxDel_4:
   \   0000004C   002F               CMP      R7,#+0
   \   0000004E   0CD1               BNE.N    ??OSMboxDel_7
    192          #if OS_EVENT_NAME_SIZE > 1
    193                           pevent->OSEventName[0] = '?';             /* Unknown name                             */
   \   00000050   84F80FB0           STRB     R11,[R4, #+15]
    194                           pevent->OSEventName[1] = OS_ASCII_NUL;
   \   00000054   2074               STRB     R0,[R4, #+16]
    195          #endif
    196                           pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
   \   00000056   2070               STRB     R0,[R4, #+0]
    197                           pevent->OSEventPtr  = OSEventFreeList;    /* Return Event Control Block to free list  */
   \   00000058   3068               LDR      R0,[R6, #+0]
   \   0000005A   6060               STR      R0,[R4, #+4]
    198                           pevent->OSEventCnt  = 0;
   \   0000005C   5046               MOV      R0,R10
   \   0000005E   2081               STRH     R0,[R4, #+8]
    199                           OSEventFreeList     = pevent;             /* Get next free event control block        */
   \   00000060   3460               STR      R4,[R6, #+0]
    200                           OS_EXIT_CRITICAL();
   \   00000062   4846               MOV      R0,R9
   \   00000064   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
   \   00000068   1FE0               B.N      ??OSMboxDel_8
    201                           *perr               = OS_ERR_NONE;
    202                           pevent_return       = (OS_EVENT *)0;      /* Mailbox has been deleted                 */
    203                       } else {
    204                           OS_EXIT_CRITICAL();
   \                     ??OSMboxDel_7:
   \   0000006A   4846               MOV      R0,R9
   \   0000006C   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    205                           *perr               = OS_ERR_TASK_WAITING;
   \   00000070   4920               MOVS     R0,#+73
   \   00000072   2870               STRB     R0,[R5, #+0]
    206                           pevent_return       = pevent;
   \   00000074   2000               MOVS     R0,R4
   \   00000076   21E0               B.N      ??OSMboxDel_1
    207                       }
    208                       break;
    209          
    210                  case OS_DEL_ALWAYS:                                /* Always delete the mailbox                */
    211                       while (pevent->OSEventGrp != 0) {             /* Ready ALL tasks waiting for mailbox      */
    212                           (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_MBOX, OS_STAT_PEND_OK);
   \                     ??OSMboxDel_9:
   \   00000078   5346               MOV      R3,R10
   \   0000007A   0222               MOVS     R2,#+2
   \   0000007C   1946               MOV      R1,R3
   \   0000007E   2000               MOVS     R0,R4
   \   00000080   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    213                       }
   \                     ??OSMboxDel_5:
   \   00000084   A07A               LDRB     R0,[R4, #+10]
   \   00000086   0028               CMP      R0,#+0
   \   00000088   F6D1               BNE.N    ??OSMboxDel_9
    214          #if OS_EVENT_NAME_SIZE > 1
    215                       pevent->OSEventName[0] = '?';                 /* Unknown name                             */
   \   0000008A   84F80FB0           STRB     R11,[R4, #+15]
    216                       pevent->OSEventName[1] = OS_ASCII_NUL;
   \   0000008E   2074               STRB     R0,[R4, #+16]
    217          #endif
    218                       pevent->OSEventType    = OS_EVENT_TYPE_UNUSED;
   \   00000090   2070               STRB     R0,[R4, #+0]
    219                       pevent->OSEventPtr     = OSEventFreeList;     /* Return Event Control Block to free list  */
   \   00000092   3068               LDR      R0,[R6, #+0]
   \   00000094   6060               STR      R0,[R4, #+4]

⌨️ 快捷键说明

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