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

📄 os_sem.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
    110              }
    111              OS_EXIT_CRITICAL();
   \                     ??OSSemCreate_1:
   \   00000020   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    112              if (pevent != (OS_EVENT *)0) {                         /* Get an event control block               */
   \   00000024   002C               CMP      R4,#+0
   \   00000026   0AD0               BEQ.N    ??OSSemCreate_2
    113                  pevent->OSEventType    = OS_EVENT_TYPE_SEM;
   \   00000028   0320               MOVS     R0,#+3
   \   0000002A   2070               STRB     R0,[R4, #+0]
    114                  pevent->OSEventCnt     = cnt;                      /* Set semaphore value                      */
   \   0000002C   2581               STRH     R5,[R4, #+8]
    115                  pevent->OSEventPtr     = (void *)0;                /* Unlink from ECB free list                */
   \   0000002E   0020               MOVS     R0,#+0
   \   00000030   6060               STR      R0,[R4, #+4]
    116          #if OS_EVENT_NAME_SIZE > 1
    117                  pevent->OSEventName[0] = '?';                      /* Unknown name                             */
   \   00000032   3F21               MOVS     R1,#+63
   \   00000034   E173               STRB     R1,[R4, #+15]
    118                  pevent->OSEventName[1] = OS_ASCII_NUL;
   \   00000036   2074               STRB     R0,[R4, #+16]
    119          #endif
    120                  OS_EventWaitListInit(pevent);                      /* Initialize to 'nobody waiting' on sem.   */
   \   00000038   2000               MOVS     R0,R4
   \   0000003A   ........           _BLF     OS_EventWaitListInit,??OS_EventWaitListInit??rT
    121              }
    122              return (pevent);
   \                     ??OSSemCreate_2:
   \   0000003E   2000               MOVS     R0,R4
   \   00000040   30BD               POP      {R4,R5,PC}       ;; return
    123          }
    124          
    125          /*$PAGE*/
    126          /*
    127          *********************************************************************************************************
    128          *                                         DELETE A SEMAPHORE
    129          *
    130          * Description: This function deletes a semaphore and readies all tasks pending on the semaphore.
    131          *
    132          * Arguments  : pevent        is a pointer to the event control block associated with the desired
    133          *                            semaphore.
    134          *
    135          *              opt           determines delete options as follows:
    136          *                            opt == OS_DEL_NO_PEND   Delete semaphore ONLY if no task pending
    137          *                            opt == OS_DEL_ALWAYS    Deletes the semaphore even if tasks are waiting.
    138          *                                                    In this case, all the tasks pending will be readied.
    139          *
    140          *              perr          is a pointer to an error code that can contain one of the following values:
    141          *                            OS_ERR_NONE             The call was successful and the semaphore was deleted
    142          *                            OS_ERR_DEL_ISR          If you attempted to delete the semaphore from an ISR
    143          *                            OS_ERR_INVALID_OPT      An invalid option was specified
    144          *                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the semaphore
    145          *                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a semaphore
    146          *                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
    147          *
    148          * Returns    : pevent        upon error
    149          *              (OS_EVENT *)0 if the semaphore was successfully deleted.
    150          *
    151          * Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
    152          *                 the semaphore MUST check the return code of OSSemPend().
    153          *              2) OSSemAccept() callers will not know that the intended semaphore has been deleted unless
    154          *                 they check 'pevent' to see that it's a NULL pointer.
    155          *              3) This call can potentially disable interrupts for a long time.  The interrupt disable
    156          *                 time is directly proportional to the number of tasks waiting on the semaphore.
    157          *              4) Because ALL tasks pending on the semaphore will be readied, you MUST be careful in
    158          *                 applications where the semaphore is used for mutual exclusion because the resource(s)
    159          *                 will no longer be guarded by the semaphore.
    160          *********************************************************************************************************
    161          */
    162          
    163          #if OS_SEM_DEL_EN > 0

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

⌨️ 快捷键说明

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