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

📄 os_sem.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   00000028   0068               LDR      R0,[R0, #+0]
   \   0000002A   4068               LDR      R0,[R0, #+4]
   \   0000002C   ....               LDR.N    R1,??DataTable3_2
   \   0000002E   0860               STR      R0,[R1, #+0]
    117              }
    118              OS_EXIT_CRITICAL();
   \                     ??OSSemCreate_2:
   \   00000030   3000               MOVS     R0,R6
   \   00000032   ........           BL       OS_CPU_SR_Restore
    119              if (pevent != (OS_EVENT *)0) {                         /* Get an event control block               */
   \   00000036   002D               CMP      R5,#+0
   \   00000038   09D0               BEQ.N    ??OSSemCreate_3
    120                  pevent->OSEventType    = OS_EVENT_TYPE_SEM;
   \   0000003A   0320               MOVS     R0,#+3
   \   0000003C   2870               STRB     R0,[R5, #+0]
    121                  pevent->OSEventCnt     = cnt;                      /* Set semaphore value                      */
   \   0000003E   2C81               STRH     R4,[R5, #+8]
    122                  pevent->OSEventPtr     = (void *)0;                /* Unlink from ECB free list                */
   \   00000040   0020               MOVS     R0,#+0
   \   00000042   6860               STR      R0,[R5, #+4]
    123          #if OS_EVENT_NAME_EN > 0u
    124                  pevent->OSEventName    = (INT8U *)(void *)"?";
   \   00000044   ....               ADR.N    R0,??DataTable3  ;; "\?"
   \   00000046   6861               STR      R0,[R5, #+20]
    125          #endif
    126                  OS_EventWaitListInit(pevent);                      /* Initialize to 'nobody waiting' on sem.   */
   \   00000048   2800               MOVS     R0,R5
   \   0000004A   ........           BL       OS_EventWaitListInit
    127              }
    128              return (pevent);
   \                     ??OSSemCreate_3:
   \   0000004E   2800               MOVS     R0,R5
   \                     ??OSSemCreate_1:
   \   00000050   70BD               POP      {R4-R6,PC}       ;; return
    129          }
    130          
    131          /*$PAGE*/
    132          /*
    133          *********************************************************************************************************
    134          *                                         DELETE A SEMAPHORE
    135          *
    136          * Description: This function deletes a semaphore and readies all tasks pending on the semaphore.
    137          *
    138          * Arguments  : pevent        is a pointer to the event control block associated with the desired
    139          *                            semaphore.
    140          *
    141          *              opt           determines delete options as follows:
    142          *                            opt == OS_DEL_NO_PEND   Delete semaphore ONLY if no task pending
    143          *                            opt == OS_DEL_ALWAYS    Deletes the semaphore even if tasks are waiting.
    144          *                                                    In this case, all the tasks pending will be readied.
    145          *
    146          *              perr          is a pointer to an error code that can contain one of the following values:
    147          *                            OS_ERR_NONE             The call was successful and the semaphore was deleted
    148          *                            OS_ERR_DEL_ISR          If you attempted to delete the semaphore from an ISR
    149          *                            OS_ERR_INVALID_OPT      An invalid option was specified
    150          *                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the semaphore
    151          *                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a semaphore
    152          *                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
    153          *
    154          * Returns    : pevent        upon error
    155          *              (OS_EVENT *)0 if the semaphore was successfully deleted.
    156          *
    157          * Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
    158          *                 the semaphore MUST check the return code of OSSemPend().
    159          *              2) OSSemAccept() callers will not know that the intended semaphore has been deleted unless
    160          *                 they check 'pevent' to see that it's a NULL pointer.
    161          *              3) This call can potentially disable interrupts for a long time.  The interrupt disable
    162          *                 time is directly proportional to the number of tasks waiting on the semaphore.
    163          *              4) Because ALL tasks pending on the semaphore will be readied, you MUST be careful in
    164          *                 applications where the semaphore is used for mutual exclusion because the resource(s)
    165          *                 will no longer be guarded by the semaphore.
    166          *********************************************************************************************************
    167          */
    168          
    169          #if OS_SEM_DEL_EN > 0u

   \                                 In section .text, align 2, keep-with-next
    170          OS_EVENT  *OSSemDel (OS_EVENT  *pevent,
    171                               INT8U      opt,
    172                               INT8U     *perr)
    173          {
   \                     OSSemDel:
   \   00000000   2DE9F843           PUSH     {R3-R9,LR}
   \   00000004   8146               MOV      R9,R0
   \   00000006   0C00               MOVS     R4,R1
   \   00000008   1500               MOVS     R5,R2
    174              BOOLEAN    tasks_waiting;
    175              OS_EVENT  *pevent_return;
    176          #if OS_CRITICAL_METHOD == 3u                               /* Allocate storage for CPU status register */
    177              OS_CPU_SR  cpu_sr = 0u;
   \   0000000A   5FF00008           MOVS     R8,#+0
    178          #endif
    179          
    180          
    181          
    182          #ifdef OS_SAFETY_CRITICAL
    183              if (perr == (INT8U *)0) {
    184                  OS_SAFETY_CRITICAL_EXCEPTION();
    185                  return ((OS_EVENT *)0);
    186              }
    187          #endif
    188          
    189          #if OS_ARG_CHK_EN > 0u
    190              if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
    191                  *perr = OS_ERR_PEVENT_NULL;
    192                  return (pevent);
    193              }
    194          #endif
    195              if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
   \   0000000E   99F80000           LDRB     R0,[R9, #+0]
   \   00000012   0328               CMP      R0,#+3
   \   00000014   03D0               BEQ.N    ??OSSemDel_0
    196                  *perr = OS_ERR_EVENT_TYPE;
   \   00000016   0120               MOVS     R0,#+1
   \   00000018   2870               STRB     R0,[R5, #+0]
    197                  return (pevent);
   \   0000001A   4846               MOV      R0,R9
   \   0000001C   6AE0               B.N      ??OSSemDel_1
    198              }
    199              if (OSIntNesting > 0u) {                               /* See if called from ISR ...               */
   \                     ??OSSemDel_0:
   \   0000001E   ....               LDR.N    R0,??DataTable3_1
   \   00000020   0078               LDRB     R0,[R0, #+0]
   \   00000022   0028               CMP      R0,#+0
   \   00000024   03D0               BEQ.N    ??OSSemDel_2
    200                  *perr = OS_ERR_DEL_ISR;                            /* ... can't DELETE from an ISR             */
   \   00000026   0F20               MOVS     R0,#+15
   \   00000028   2870               STRB     R0,[R5, #+0]
    201                  return (pevent);
   \   0000002A   4846               MOV      R0,R9
   \   0000002C   62E0               B.N      ??OSSemDel_1
    202              }
    203              OS_ENTER_CRITICAL();
   \                     ??OSSemDel_2:
   \   0000002E   ........           BL       OS_CPU_SR_Save
   \   00000032   8046               MOV      R8,R0
    204              if (pevent->OSEventGrp != 0u) {                        /* See if any tasks waiting on semaphore    */
   \   00000034   99F80A00           LDRB     R0,[R9, #+10]
   \   00000038   0028               CMP      R0,#+0
   \   0000003A   02D0               BEQ.N    ??OSSemDel_3
    205                  tasks_waiting = OS_TRUE;                           /* Yes                                      */
   \   0000003C   0120               MOVS     R0,#+1
   \   0000003E   0600               MOVS     R6,R0
   \   00000040   01E0               B.N      ??OSSemDel_4
    206              } else {
    207                  tasks_waiting = OS_FALSE;                          /* No                                       */
   \                     ??OSSemDel_3:
   \   00000042   0020               MOVS     R0,#+0
   \   00000044   0600               MOVS     R6,R0
    208              }
    209              switch (opt) {
   \                     ??OSSemDel_4:
   \   00000046   E4B2               UXTB     R4,R4            ;; ZeroExt  R4,R4,#+24,#+24
   \   00000048   002C               CMP      R4,#+0
   \   0000004A   02D0               BEQ.N    ??OSSemDel_5
   \   0000004C   012C               CMP      R4,#+1
   \   0000004E   22D0               BEQ.N    ??OSSemDel_6
   \   00000050   49E0               B.N      ??OSSemDel_7
    210                  case OS_DEL_NO_PEND:                               /* Delete semaphore only if no task waiting */
    211                       if (tasks_waiting == OS_FALSE) {
   \                     ??OSSemDel_5:
   \   00000052   F6B2               UXTB     R6,R6            ;; ZeroExt  R6,R6,#+24,#+24
   \   00000054   002E               CMP      R6,#+0
   \   00000056   17D1               BNE.N    ??OSSemDel_8
    212          #if OS_EVENT_NAME_EN > 0u
    213                           pevent->OSEventName    = (INT8U *)(void *)"?";
   \   00000058   ....               ADR.N    R0,??DataTable3  ;; "\?"
   \   0000005A   C9F81400           STR      R0,[R9, #+20]
    214          #endif
    215                           pevent->OSEventType    = OS_EVENT_TYPE_UNUSED;
   \   0000005E   0020               MOVS     R0,#+0
   \   00000060   89F80000           STRB     R0,[R9, #+0]
    216                           pevent->OSEventPtr     = OSEventFreeList; /* Return Event Control Block to free list  */
   \   00000064   ....               LDR.N    R0,??DataTable3_2
   \   00000066   0068               LDR      R0,[R0, #+0]
   \   00000068   C9F80400           STR      R0,[R9, #+4]
    217                           pevent->OSEventCnt     = 0u;
   \   0000006C   0020               MOVS     R0,#+0
   \   0000006E   A9F80800           STRH     R0,[R9, #+8]
    218                           OSEventFreeList        = pevent;          /* Get next free event control block        */
   \   00000072   ....               LDR.N    R0,??DataTable3_2
   \   00000074   C0F80090           STR      R9,[R0, #+0]
    219                           OS_EXIT_CRITICAL();
   \   00000078   4046               MOV      R0,R8
   \   0000007A   ........           BL       OS_CPU_SR_Restore
    220                           *perr                  = OS_ERR_NONE;
   \   0000007E   0020               MOVS     R0,#+0
   \   00000080   2870               STRB     R0,[R5, #+0]
    221                           pevent_return          = (OS_EVENT *)0;   /* Semaphore has been deleted               */
   \   00000082   0020               MOVS     R0,#+0
   \   00000084   0700               MOVS     R7,R0
   \   00000086   05E0               B.N      ??OSSemDel_9
    222                       } else {
    223                           OS_EXIT_CRITICAL();
   \                     ??OSSemDel_8:
   \   00000088   4046               MOV      R0,R8
   \   0000008A   ........           BL       OS_CPU_SR_Restore
    224                           *perr                  = OS_ERR_TASK_WAITING;
   \   0000008E   4920               MOVS     R0,#+73
   \   00000090   2870               STRB     R0,[R5, #+0]
    225                           pevent_return          = pevent;
   \   00000092   4F46               MOV      R7,R9
    226                       }
    227                       break;
   \                     ??OSSemDel_9:
   \   00000094   2DE0               B.N      ??OSSemDel_10
    228          
    229                  case OS_DEL_ALWAYS:                                /* Always delete the semaphore              */
    230                       while (pevent->OSEventGrp != 0u) {            /* Ready ALL tasks waiting for semaphore    */
   \                     ??OSSemDel_6:
   \   00000096   99F80A00           LDRB     R0,[R9, #+10]
   \   0000009A   0028               CMP      R0,#+0
   \   0000009C   06D0               BEQ.N    ??OSSemDel_11

⌨️ 快捷键说明

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