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

📄 os_mutex.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   00000074   2870               STRB     R0,[R5, #+0]
    228                  return (pevent);
   \   00000076   3000               MOVS     R0,R6
   \   00000078   1AE0               B.N      ??OSMutexCreate_1
    229              }
    230              OSEventFreeList     = (OS_EVENT *)OSEventFreeList->OSEventPtr; /* Adjust the free list             */
   \                     ??OSMutexCreate_4:
   \   0000007A   ........           LDR.W    R0,??DataTable7_3
   \   0000007E   0068               LDR      R0,[R0, #+0]
   \   00000080   4068               LDR      R0,[R0, #+4]
   \   00000082   ........           LDR.W    R1,??DataTable7_3
   \   00000086   0860               STR      R0,[R1, #+0]
    231              OS_EXIT_CRITICAL();
   \   00000088   3800               MOVS     R0,R7
   \   0000008A   ........           BL       OS_CPU_SR_Restore
    232              pevent->OSEventType = OS_EVENT_TYPE_MUTEX;
   \   0000008E   0420               MOVS     R0,#+4
   \   00000090   3070               STRB     R0,[R6, #+0]
    233              pevent->OSEventCnt  = (INT16U)((INT16U)prio << 8u) | OS_MUTEX_AVAILABLE; /* Resource is avail.     */
   \   00000092   E4B2               UXTB     R4,R4            ;; ZeroExt  R4,R4,#+24,#+24
   \   00000094   2002               LSLS     R0,R4,#+8
   \   00000096   50F0FF00           ORRS     R0,R0,#0xFF
   \   0000009A   3081               STRH     R0,[R6, #+8]
    234              pevent->OSEventPtr  = (void *)0;                       /* No task owning the mutex                 */
   \   0000009C   0020               MOVS     R0,#+0
   \   0000009E   7060               STR      R0,[R6, #+4]
    235          #if OS_EVENT_NAME_EN > 0u
    236              pevent->OSEventName = (INT8U *)(void *)"?";
   \   000000A0   ....               ADR.N    R0,??DataTable3  ;; "\?"
   \   000000A2   7061               STR      R0,[R6, #+20]
    237          #endif
    238              OS_EventWaitListInit(pevent);
   \   000000A4   3000               MOVS     R0,R6
   \   000000A6   ........           BL       OS_EventWaitListInit
    239             *perr = OS_ERR_NONE;
   \   000000AA   0020               MOVS     R0,#+0
   \   000000AC   2870               STRB     R0,[R5, #+0]
    240              return (pevent);
   \   000000AE   3000               MOVS     R0,R6
   \                     ??OSMutexCreate_1:
   \   000000B0   F2BD               POP      {R1,R4-R7,PC}    ;; return
    241          }
    242          
    243          /*$PAGE*/
    244          /*
    245          *********************************************************************************************************
    246          *                                          DELETE A MUTEX
    247          *
    248          * Description: This function deletes a mutual exclusion semaphore and readies all tasks pending on the it.
    249          *
    250          * Arguments  : pevent        is a pointer to the event control block associated with the desired mutex.
    251          *
    252          *              opt           determines delete options as follows:
    253          *                            opt == OS_DEL_NO_PEND   Delete mutex ONLY if no task pending
    254          *                            opt == OS_DEL_ALWAYS    Deletes the mutex even if tasks are waiting.
    255          *                                                    In this case, all the tasks pending will be readied.
    256          *
    257          *              perr          is a pointer to an error code that can contain one of the following values:
    258          *                            OS_ERR_NONE             The call was successful and the mutex was deleted
    259          *                            OS_ERR_DEL_ISR          If you attempted to delete the MUTEX from an ISR
    260          *                            OS_ERR_INVALID_OPT      An invalid option was specified
    261          *                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the mutex
    262          *                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a mutex
    263          *                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
    264          *
    265          * Returns    : pevent        upon error
    266          *              (OS_EVENT *)0 if the mutex was successfully deleted.
    267          *
    268          * Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
    269          *                 the mutex MUST check the return code of OSMutexPend().
    270          *
    271          *              2) This call can potentially disable interrupts for a long time.  The interrupt disable
    272          *                 time is directly proportional to the number of tasks waiting on the mutex.
    273          *
    274          *              3) Because ALL tasks pending on the mutex will be readied, you MUST be careful because the
    275          *                 resource(s) will no longer be guarded by the mutex.
    276          *
    277          *              4) IMPORTANT: In the 'OS_DEL_ALWAYS' case, we assume that the owner of the Mutex (if there
    278          *                            is one) is ready-to-run and is thus NOT pending on another kernel object or
    279          *                            has delayed itself.  In other words, if a task owns the mutex being deleted,
    280          *                            that task will be made ready-to-run at its original priority.
    281          *********************************************************************************************************
    282          */
    283          
    284          #if OS_MUTEX_DEL_EN > 0u

   \                                 In section .text, align 2, keep-with-next
    285          OS_EVENT  *OSMutexDel (OS_EVENT  *pevent,
    286                                 INT8U      opt,
    287                                 INT8U     *perr)
    288          {
   \                     OSMutexDel:
   \   00000000   2DE9F84F           PUSH     {R3-R11,LR}
   \   00000004   8346               MOV      R11,R0
   \   00000006   0C00               MOVS     R4,R1
   \   00000008   1500               MOVS     R5,R2
    289              BOOLEAN    tasks_waiting;
    290              OS_EVENT  *pevent_return;
    291              INT8U      pcp;                                        /* Priority ceiling priority                */
    292              INT8U      prio;
    293              OS_TCB    *ptcb;
    294          #if OS_CRITICAL_METHOD == 3u                               /* Allocate storage for CPU status register */
    295              OS_CPU_SR  cpu_sr = 0u;
   \   0000000A   5FF0000A           MOVS     R10,#+0
    296          #endif
    297          
    298          
    299          
    300          #ifdef OS_SAFETY_CRITICAL
    301              if (perr == (INT8U *)0) {
    302                  OS_SAFETY_CRITICAL_EXCEPTION();
    303                  return ((OS_EVENT *)0);
    304              }
    305          #endif
    306          
    307          #if OS_ARG_CHK_EN > 0u
    308              if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
    309                  *perr = OS_ERR_PEVENT_NULL;
    310                  return (pevent);
    311              }
    312          #endif
    313              if (pevent->OSEventType != OS_EVENT_TYPE_MUTEX) {      /* Validate event block type                */
   \   0000000E   9BF80000           LDRB     R0,[R11, #+0]
   \   00000012   0428               CMP      R0,#+4
   \   00000014   03D0               BEQ.N    ??OSMutexDel_0
    314                  *perr = OS_ERR_EVENT_TYPE;
   \   00000016   0120               MOVS     R0,#+1
   \   00000018   2870               STRB     R0,[R5, #+0]
    315                  return (pevent);
   \   0000001A   5846               MOV      R0,R11
   \   0000001C   B0E0               B.N      ??OSMutexDel_1
    316              }
    317              if (OSIntNesting > 0u) {                               /* See if called from ISR ...               */
   \                     ??OSMutexDel_0:
   \   0000001E   ........           LDR.W    R0,??DataTable7
   \   00000022   0078               LDRB     R0,[R0, #+0]
   \   00000024   0028               CMP      R0,#+0
   \   00000026   03D0               BEQ.N    ??OSMutexDel_2
    318                  *perr = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
   \   00000028   0F20               MOVS     R0,#+15
   \   0000002A   2870               STRB     R0,[R5, #+0]
    319                  return (pevent);
   \   0000002C   5846               MOV      R0,R11
   \   0000002E   A7E0               B.N      ??OSMutexDel_1
    320              }
    321              OS_ENTER_CRITICAL();
   \                     ??OSMutexDel_2:
   \   00000030   ........           BL       OS_CPU_SR_Save
   \   00000034   8246               MOV      R10,R0
    322              if (pevent->OSEventGrp != 0u) {                        /* See if any tasks waiting on mutex        */
   \   00000036   9BF80A00           LDRB     R0,[R11, #+10]
   \   0000003A   0028               CMP      R0,#+0
   \   0000003C   02D0               BEQ.N    ??OSMutexDel_3
    323                  tasks_waiting = OS_TRUE;                           /* Yes                                      */
   \   0000003E   0120               MOVS     R0,#+1
   \   00000040   0600               MOVS     R6,R0
   \   00000042   01E0               B.N      ??OSMutexDel_4
    324              } else {
    325                  tasks_waiting = OS_FALSE;                          /* No                                       */
   \                     ??OSMutexDel_3:
   \   00000044   0020               MOVS     R0,#+0
   \   00000046   0600               MOVS     R6,R0
    326              }
    327              switch (opt) {
   \                     ??OSMutexDel_4:
   \   00000048   E4B2               UXTB     R4,R4            ;; ZeroExt  R4,R4,#+24,#+24
   \   0000004A   002C               CMP      R4,#+0
   \   0000004C   02D0               BEQ.N    ??OSMutexDel_5
   \   0000004E   012C               CMP      R4,#+1
   \   00000050   35D0               BEQ.N    ??OSMutexDel_6
   \   00000052   8EE0               B.N      ??OSMutexDel_7
    328                  case OS_DEL_NO_PEND:                               /* DELETE MUTEX ONLY IF NO TASK WAITING --- */
    329                       if (tasks_waiting == OS_FALSE) {
   \                     ??OSMutexDel_5:
   \   00000054   F6B2               UXTB     R6,R6            ;; ZeroExt  R6,R6,#+24,#+24
   \   00000056   002E               CMP      R6,#+0
   \   00000058   2AD1               BNE.N    ??OSMutexDel_8
    330          #if OS_EVENT_NAME_EN > 0u
    331                           pevent->OSEventName   = (INT8U *)(void *)"?";
   \   0000005A   ....               ADR.N    R0,??DataTable3  ;; "\?"
   \   0000005C   CBF81400           STR      R0,[R11, #+20]
    332          #endif
    333                           pcp                   = (INT8U)(pevent->OSEventCnt >> 8u);
   \   00000060   BBF80800           LDRH     R0,[R11, #+8]
   \   00000064   80B2               UXTH     R0,R0            ;; ZeroExt  R0,R0,#+16,#+16
   \   00000066   000A               LSRS     R0,R0,#+8
   \   00000068   8046               MOV      R8,R0
    334                           if (pcp != OS_PRIO_MUTEX_CEIL_DIS) {
   \   0000006A   5FFA88F8           UXTB     R8,R8            ;; ZeroExt  R8,R8,#+24,#+24
   \   0000006E   B8F1FF0F           CMP      R8,#+255
   \   00000072   06D0               BEQ.N    ??OSMutexDel_9
    335                               OSTCBPrioTbl[pcp] = (OS_TCB *)0;      /* Free up the PCP                          */
   \   00000074   5FFA88F8           UXTB     R8,R8            ;; ZeroExt  R8,R8,#+24,#+24
   \   00000078   ........           LDR.W    R0,??DataTable7_2
   \   0000007C   0021               MOVS     R1,#+0
   \   0000007E   40F82810           STR      R1,[R0, R8, LSL #+2]
    336                           }
    337                           pevent->OSEventType   = OS_EVENT_TYPE_UNUSED;
   \                     ??OSMutexDel_9:
   \   00000082   0020               MOVS     R0,#+0
   \   00000084   8BF80000           STRB     R0,[R11, #+0]

⌨️ 快捷键说明

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