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

📄 os_mbox.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 5 页
字号:
    313          * Returns    : OS_NO_ERR            The call was successful and the message was sent
    314          *              OS_MBOX_FULL         If the mailbox already contains a message.  You can can only send one
    315          *                                   message at a time and thus, the message MUST be consumed before you
    316          *                                   are allowed to send another one.
    317          *              OS_ERR_EVENT_TYPE    If you are attempting to post to a non mailbox.
    318          *              OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer
    319          *              OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
    320          *********************************************************************************************************
    321          */
    322          
    323          #if OS_MBOX_POST_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    324          INT8U  OSMboxPost (OS_EVENT *pevent, void *msg)
    325          {
   \                     OSMboxPost:
   \   00000000   70B5               PUSH     {R4-R6,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
    326          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    327              OS_CPU_SR  cpu_sr;
    328          #endif    
    329              
    330              
    331          #if OS_ARG_CHK_EN > 0
    332              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
   \   00000006   002C               CMP      R4,#+0
   \   00000008   01D1               BNE      ??OSMboxPost_0
    333                  return (OS_ERR_PEVENT_NULL);
   \   0000000A   0420               MOVS     R0,#+4
   \   0000000C   26E0               B        ??OSMboxPost_1
    334              }
    335              if (msg == (void *)0) {                           /* Make sure we are not posting a NULL pointer   */
   \                     ??OSMboxPost_0:
   \   0000000E   002D               CMP      R5,#+0
   \   00000010   01D1               BNE      ??OSMboxPost_2
    336                  return (OS_ERR_POST_NULL_PTR);
   \   00000012   0320               MOVS     R0,#+3
   \   00000014   22E0               B        ??OSMboxPost_1
    337              }
    338          #endif
    339              if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
   \                     ??OSMboxPost_2:
   \   00000016   2078               LDRB     R0,[R4, #+0]
   \   00000018   0128               CMP      R0,#+1
   \   0000001A   01D0               BEQ      ??OSMboxPost_3
    340                  return (OS_ERR_EVENT_TYPE);
   \   0000001C   0120               MOVS     R0,#+1
   \   0000001E   1DE0               B        ??OSMboxPost_1
    341              }
    342              OS_ENTER_CRITICAL();
   \                     ??OSMboxPost_3:
   \   00000020   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000024   0600               MOVS     R6,R0
    343              if (pevent->OSEventGrp != 0x00) {                 /* See if any task pending on mailbox            */
   \   00000026   6078               LDRB     R0,[R4, #+1]
   \   00000028   0028               CMP      R0,#+0
   \   0000002A   0AD0               BEQ      ??OSMboxPost_4
    344                  OS_EventTaskRdy(pevent, msg, OS_STAT_MBOX);   /* Ready highest priority task waiting on event  */
   \   0000002C   0222               MOVS     R2,#+2
   \   0000002E   2900               MOVS     R1,R5
   \   00000030   2000               MOVS     R0,R4
   \   00000032   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    345                  OS_EXIT_CRITICAL();
   \   00000036   3000               MOVS     R0,R6
   \   00000038   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    346                  OS_Sched();                                   /* Find highest priority task ready to run       */
   \   0000003C   ........           _BLF     OS_Sched,??OS_Sched??rT
    347                  return (OS_NO_ERR);
   \   00000040   0BE0               B.N      ??OSMboxPost_5
    348              }
    349              if (pevent->OSEventPtr != (void *)0) {            /* Make sure mailbox doesn't already have a msg  */
   \                     ??OSMboxPost_4:
   \   00000042   6068               LDR      R0,[R4, #+4]
   \   00000044   0028               CMP      R0,#+0
   \   00000046   04D0               BEQ      ??OSMboxPost_6
    350                  OS_EXIT_CRITICAL();
   \   00000048   3000               MOVS     R0,R6
   \   0000004A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    351                  return (OS_MBOX_FULL);
   \   0000004E   1420               MOVS     R0,#+20
   \   00000050   04E0               B        ??OSMboxPost_1
    352              }
    353              pevent->OSEventPtr = msg;                         /* Place message in mailbox                      */
   \                     ??OSMboxPost_6:
   \   00000052   6560               STR      R5,[R4, #+4]
    354              OS_EXIT_CRITICAL();
   \   00000054   3000               MOVS     R0,R6
   \   00000056   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    355              return (OS_NO_ERR);
   \                     ??OSMboxPost_5:
   \   0000005A   0020               MOVS     R0,#+0
   \                     ??OSMboxPost_1:
   \   0000005C   70BC               POP      {R4-R6}
   \   0000005E   02BC               POP      {R1}
   \   00000060   0847               BX       R1               ;; return
    356          }
    357          #endif
    358          
    359          
    360          /*
    361          *********************************************************************************************************
    362          *                                       POST MESSAGE TO A MAILBOX
    363          *
    364          * Description: This function sends a message to a mailbox
    365          *
    366          * Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
    367          *
    368          *              msg           is a pointer to the message to send.  You MUST NOT send a NULL pointer.
    369          *
    370          *              opt           determines the type of POST performed:
    371          *                            OS_POST_OPT_NONE         POST to a single waiting task 
    372          *                                                     (Identical to OSMboxPost())
    373          *                            OS_POST_OPT_BROADCAST    POST to ALL tasks that are waiting on the mailbox
    374          *
    375          * Returns    : OS_NO_ERR            The call was successful and the message was sent
    376          *              OS_MBOX_FULL         If the mailbox already contains a message.  You can can only send one
    377          *                                   message at a time and thus, the message MUST be consumed before you
    378          *                                   are allowed to send another one.
    379          *              OS_ERR_EVENT_TYPE    If you are attempting to post to a non mailbox.
    380          *              OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer
    381          *              OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
    382          *
    383          * Warning    : Interrupts can be disabled for a long time if you do a 'broadcast'.  In fact, the 
    384          *              interrupt disable time is proportional to the number of tasks waiting on the mailbox.
    385          *********************************************************************************************************
    386          */
    387          
    388          #if OS_MBOX_POST_OPT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    389          INT8U  OSMboxPostOpt (OS_EVENT *pevent, void *msg, INT8U opt)
    390          {
   \                     OSMboxPostOpt:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
   \   00000006   1600               MOVS     R6,R2
    391          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    392              OS_CPU_SR  cpu_sr;
    393          #endif    
    394              
    395              
    396          #if OS_ARG_CHK_EN > 0
    397              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
   \   00000008   002C               CMP      R4,#+0
   \   0000000A   01D1               BNE      ??OSMboxPostOpt_0
    398                  return (OS_ERR_PEVENT_NULL);
   \   0000000C   0420               MOVS     R0,#+4
   \   0000000E   31E0               B        ??OSMboxPostOpt_1
    399              }
    400              if (msg == (void *)0) {                           /* Make sure we are not posting a NULL pointer   */
   \                     ??OSMboxPostOpt_0:
   \   00000010   002D               CMP      R5,#+0
   \   00000012   01D1               BNE      ??OSMboxPostOpt_2
    401                  return (OS_ERR_POST_NULL_PTR);
   \   00000014   0320               MOVS     R0,#+3
   \   00000016   2DE0               B        ??OSMboxPostOpt_1
    402              }
    403          #endif
    404              if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
   \                     ??OSMboxPostOpt_2:
   \   00000018   2078               LDRB     R0,[R4, #+0]
   \   0000001A   0128               CMP      R0,#+1
   \   0000001C   01D0               BEQ      ??OSMboxPostOpt_3
    405                  return (OS_ERR_EVENT_TYPE);
   \   0000001E   0120               MOVS     R0,#+1
   \   00000020   28E0               B        ??OSMboxPostOpt_1
    406              }
    407              OS_ENTER_CRITICAL();
   \                     ??OSMboxPostOpt_3:
   \   00000022   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000026   0700               MOVS     R7,R0
    408              if (pevent->OSEventGrp != 0x00) {                 /* See if any task pending on mailbox            */
   \   00000028   6078               LDRB     R0,[R4, #+1]
   \   0000002A   0028               CMP      R0,#+0
   \   0000002C   15D0               BEQ      ??OSMboxPostOpt_4
    409                  if ((opt & OS_POST_OPT_BROADCAST) != 0x00) {  /* Do we need to post msg to ALL waiting tasks ? */
   \   0000002E   F007               LSLS     R0,R6,#+31
   \   00000030   08D5               BPL      ??OSMboxPostOpt_5
    410                      while (pevent->OSEventGrp != 0x00) {      /* Yes, Post to ALL tasks waiting on mailbox     */           
    411                          OS_EventTaskRdy(pevent, msg, OS_STAT_MBOX);    
   \                     ??OSMboxPostOpt_6:
   \   00000032   0222               MOVS     R2,#+2
   \   00000034   2900               MOVS     R1,R5
   \   00000036   2000               MOVS     R0,R4
   \   00000038   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    412                      }
   \   0000003C   6078               LDRB     R0,[R4, #+1]
   \   0000003E   0028               CMP      R0,#+0
   \   00000040   F7D1               BNE      ??OSMboxPostOpt_6
   \   00000042   04E0               B        ??OSMboxPostOpt_7
    413                  } else {
    414                      OS_EventTaskRdy(pevent, msg, OS_STAT_MBOX);    /* No,  Post to HPT waiting on mbox         */
   \                     ??OSMboxPostOpt_5:
   \   00000044   0222               MOVS     R2,#+2
   \   00000046   2900               MOVS     R1,R5
   \   00000048   2000               MOVS     R0,R4
   \   0000004A   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    415                  }
    416                  OS_EXIT_CRITICAL();
   \                     ??OSMboxPostOpt_7:
   \   0000004E   3800               MOVS     R0,R7
   \   00000050   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    417                  OS_Sched();                                        /* Find highest priority task ready to run  */

⌨️ 快捷键说明

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