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

📄 os_q.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 5 页
字号:
    115          
    116          
    117              if (OSIntNesting > 0) {                      /* See if called from ISR ...                         */
   \   00000006   ....               LDR      R0,??DataTable14  ;; OSIntNesting
   \   00000008   0078               LDRB     R0,[R0, #+0]
   \   0000000A   0028               CMP      R0,#+0
   \   0000000C   01D0               BEQ      ??OSQCreate_0
    118                  return ((OS_EVENT *)0);                  /* ... can't CREATE from an ISR                       */
   \   0000000E   0020               MOVS     R0,#+0
   \   00000010   34E0               B        ??OSQCreate_1
    119              }
    120              OS_ENTER_CRITICAL();
   \                     ??OSQCreate_0:
   \   00000012   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    121              pevent = OSEventFreeList;                    /* Get next free event control block                  */
   \   00000016   ....               LDR      R1,??DataTable13  ;; OSEventFreeList
   \   00000018   0E68               LDR      R6,[R1, #+0]
    122              if (OSEventFreeList != (OS_EVENT *)0) {      /* See if pool of free ECB pool was empty             */
   \   0000001A   002E               CMP      R6,#+0
   \   0000001C   01D0               BEQ      ??OSQCreate_2
    123                  OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
   \   0000001E   7268               LDR      R2,[R6, #+4]
   \   00000020   0A60               STR      R2,[R1, #+0]
    124              }
    125              OS_EXIT_CRITICAL();
   \                     ??OSQCreate_2:
   \   00000022   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    126              if (pevent != (OS_EVENT *)0) {               /* See if we have an event control block              */
   \   00000026   002E               CMP      R6,#+0
   \   00000028   27D0               BEQ      ??OSQCreate_3
    127                  OS_ENTER_CRITICAL();
   \   0000002A   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    128                  pq = OSQFreeList;                        /* Get a free queue control block                     */
   \   0000002E   ....               LDR      R1,??DataTable11  ;; OSQFreeList
   \   00000030   0F68               LDR      R7,[R1, #+0]
    129                  if (pq != (OS_Q *)0) {                   /* Were we able to get a queue control block ?        */
   \   00000032   002F               CMP      R7,#+0
   \   00000034   19D0               BEQ      ??OSQCreate_4
    130                      OSQFreeList            = OSQFreeList->OSQPtr; /* Yes, Adjust free list pointer to next free*/
   \   00000036   3A68               LDR      R2,[R7, #+0]
   \   00000038   0A60               STR      R2,[R1, #+0]
    131                      OS_EXIT_CRITICAL();
   \   0000003A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    132                      pq->OSQStart           = start;               /*      Initialize the queue                 */
   \   0000003E   7C60               STR      R4,[R7, #+4]
    133                      pq->OSQEnd             = &start[size];
   \   00000040   A800               LSLS     R0,R5,#+2
   \   00000042   2018               ADDS     R0,R4,R0
   \   00000044   B860               STR      R0,[R7, #+8]
    134                      pq->OSQIn              = start;
   \   00000046   FC60               STR      R4,[R7, #+12]
    135                      pq->OSQOut             = start;
   \   00000048   3C61               STR      R4,[R7, #+16]
    136                      pq->OSQSize            = size;
   \   0000004A   BD82               STRH     R5,[R7, #+20]
    137                      pq->OSQEntries         = 0;
   \   0000004C   0020               MOVS     R0,#+0
   \   0000004E   F882               STRH     R0,[R7, #+22]
    138                      pevent->OSEventType    = OS_EVENT_TYPE_Q;
   \   00000050   0220               MOVS     R0,#+2
   \   00000052   3070               STRB     R0,[R6, #+0]
    139                      pevent->OSEventCnt     = 0;
   \   00000054   0020               MOVS     R0,#+0
   \   00000056   7080               STRH     R0,[R6, #+2]
    140                      pevent->OSEventPtr     = pq;
   \   00000058   7760               STR      R7,[R6, #+4]
    141          #if OS_EVENT_NAME_SIZE > 1
    142                      pevent->OSEventName[0] = '?';                  /* Unknown name                             */
   \   0000005A   3F20               MOVS     R0,#+63
   \   0000005C   3074               STRB     R0,[R6, #+16]
    143                      pevent->OSEventName[1] = OS_ASCII_NUL;
   \   0000005E   0020               MOVS     R0,#+0
   \   00000060   7074               STRB     R0,[R6, #+17]
    144          #endif
    145                      OS_EventWaitListInit(pevent);                 /*      Initalize the wait list              */
   \   00000062   3000               MOVS     R0,R6
   \   00000064   ........           _BLF     OS_EventWaitListInit,??OS_EventWaitListInit??rT
   \   00000068   07E0               B        ??OSQCreate_3
    146                  } else {
    147                      pevent->OSEventPtr = (void *)OSEventFreeList; /* No,  Return event control block on error  */
   \                     ??OSQCreate_4:
   \   0000006A   ....               LDR      R1,??DataTable13  ;; OSEventFreeList
   \   0000006C   0968               LDR      R1,[R1, #+0]
   \   0000006E   7160               STR      R1,[R6, #+4]
    148                      OSEventFreeList    = pevent;
   \   00000070   ....               LDR      R1,??DataTable13  ;; OSEventFreeList
   \   00000072   0E60               STR      R6,[R1, #+0]
    149                      OS_EXIT_CRITICAL();
   \   00000074   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    150                      pevent = (OS_EVENT *)0;
   \   00000078   0026               MOVS     R6,#+0
    151                  }
    152              }
    153              return (pevent);
   \                     ??OSQCreate_3:
   \   0000007A   3000               MOVS     R0,R6
   \                     ??OSQCreate_1:
   \   0000007C   F0BC               POP      {R4-R7}
   \   0000007E   02BC               POP      {R1}
   \   00000080   0847               BX       R1               ;; return
    154          }
    155          /*$PAGE*/
    156          /*
    157          *********************************************************************************************************
    158          *                                        DELETE A MESSAGE QUEUE
    159          *
    160          * Description: This function deletes a message queue and readies all tasks pending on the queue.
    161          *
    162          * Arguments  : pevent        is a pointer to the event control block associated with the desired
    163          *                            queue.
    164          *
    165          *              opt           determines delete options as follows:
    166          *                            opt == OS_DEL_NO_PEND   Delete the queue ONLY if no task pending
    167          *                            opt == OS_DEL_ALWAYS    Deletes the queue even if tasks are waiting.
    168          *                                                    In this case, all the tasks pending will be readied.
    169          *
    170          *              err           is a pointer to an error code that can contain one of the following values:
    171          *                            OS_NO_ERR               The call was successful and the queue was deleted
    172          *                            OS_ERR_DEL_ISR          If you tried to delete the queue from an ISR
    173          *                            OS_ERR_INVALID_OPT      An invalid option was specified
    174          *                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the queue
    175          *                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a queue
    176          *                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
    177          *
    178          * Returns    : pevent        upon error
    179          *              (OS_EVENT *)0 if the queue was successfully deleted.
    180          *
    181          * Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
    182          *                 the queue MUST check the return code of OSQPend().
    183          *              2) OSQAccept() callers will not know that the intended queue has been deleted unless
    184          *                 they check 'pevent' to see that it's a NULL pointer.
    185          *              3) This call can potentially disable interrupts for a long time.  The interrupt disable
    186          *                 time is directly proportional to the number of tasks waiting on the queue.
    187          *              4) Because ALL tasks pending on the queue will be readied, you MUST be careful in
    188          *                 applications where the queue is used for mutual exclusion because the resource(s)
    189          *                 will no longer be guarded by the queue.
    190          *              5) If the storage for the message queue was allocated dynamically (i.e. using a malloc()
    191          *                 type call) then your application MUST release the memory storage by call the counterpart
    192          *                 call of the dynamic allocation scheme used.  If the queue storage was created statically
    193          *                 then, the storage can be reused.
    194          *********************************************************************************************************
    195          */
    196          
    197          #if OS_Q_DEL_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    198          OS_EVENT  *OSQDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
    199          {
   \                     OSQDel:
   \   00000000   F2B5               PUSH     {R1,R4-R7,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   1500               MOVS     R5,R2
    200          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    201              OS_CPU_SR  cpu_sr;
    202          #endif
    203              BOOLEAN    tasks_waiting;
    204              OS_Q      *pq;
    205          
    206          
    207              if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
   \   00000006   ....               LDR      R0,??DataTable14  ;; OSIntNesting
   \   00000008   0078               LDRB     R0,[R0, #+0]
   \   0000000A   0028               CMP      R0,#+0
   \   0000000C   03D0               BEQ      ??OSQDel_0
    208                  *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
   \   0000000E   8C20               MOVS     R0,#+140
   \                     ??OSQDel_1:
   \   00000010   2870               STRB     R0,[R5, #+0]
    209                  return ((OS_EVENT *)0);
   \   00000012   0020               MOVS     R0,#+0
   \   00000014   61E0               B        ??OSQDel_2
    210              }
    211          #if OS_ARG_CHK_EN > 0
    212              if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
   \                     ??OSQDel_0:
   \   00000016   002C               CMP      R4,#+0
   \   00000018   01D1               BNE      ??OSQDel_3
    213                  *err = OS_ERR_PEVENT_NULL;
   \   0000001A   0420               MOVS     R0,#+4
   \   0000001C   F8E7               B.N      ??OSQDel_1
    214                  return (pevent);
    215              }
    216          #endif
    217              if (pevent->OSEventType != OS_EVENT_TYPE_Q) {          /* Validate event block type                */
   \                     ??OSQDel_3:
   \   0000001E   2078               LDRB     R0,[R4, #+0]
   \   00000020   0228               CMP      R0,#+2
   \   00000022   01D0               BEQ      ??OSQDel_4
    218                  *err = OS_ERR_EVENT_TYPE;
   \   00000024   0120               MOVS     R0,#+1
   \   00000026   56E0               B.N      ??OSQDel_5
    219                  return (pevent);
    220              }
    221              OS_ENTER_CRITICAL();
   \                     ??OSQDel_4:
   \   00000028   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   0000002C   0600               MOVS     R6,R0
    222              if (pevent->OSEventGrp != 0x00) {                      /* See if any tasks waiting on queue        */
   \   0000002E   6078               LDRB     R0,[R4, #+1]
   \   00000030   0028               CMP      R0,#+0
   \   00000032   01D0               BEQ      ??OSQDel_6
    223                  tasks_waiting = TRUE;                              /* Yes                                      */
   \   00000034   0127               MOVS     R7,#+1
   \   00000036   00E0               B        ??OSQDel_7
    224              } else {
    225                  tasks_waiting = FALSE;                             /* No                                       */
   \                     ??OSQDel_6:

⌨️ 快捷键说明

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