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

📄 os_mbox.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
    435          *
    436          * Description: This function sends a message to a mailbox
    437          *
    438          * Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
    439          *
    440          *              pmsg          is a pointer to the message to send.  You MUST NOT send a NULL pointer.
    441          *
    442          * Returns    : OS_ERR_NONE          The call was successful and the message was sent
    443          *              OS_ERR_MBOX_FULL     If the mailbox already contains a message.  You can can only send one
    444          *                                   message at a time and thus, the message MUST be consumed before you
    445          *                                   are allowed to send another one.
    446          *              OS_ERR_EVENT_TYPE    If you are attempting to post to a non mailbox.
    447          *              OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer
    448          *              OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
    449          *
    450          * Note(s)    : 1) HPT means Highest Priority Task
    451          *********************************************************************************************************
    452          */
    453          
    454          #if OS_MBOX_POST_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    455          INT8U  OSMboxPost (OS_EVENT *pevent, void *pmsg)
    456          {
   \                     OSMboxPost:
   \   00000000   70B5               PUSH     {R4-R6,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
    457          #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    458              OS_CPU_SR  cpu_sr = 0;
    459          #endif
    460          
    461          
    462          
    463          #if OS_ARG_CHK_EN > 0
    464              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
    465                  return (OS_ERR_PEVENT_NULL);
    466              }
    467              if (pmsg == (void *)0) {                          /* Make sure we are not posting a NULL pointer   */
    468                  return (OS_ERR_POST_NULL_PTR);
    469              }
    470          #endif
    471              if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
   \   00000006   2078               LDRB     R0,[R4, #+0]
   \   00000008   0128               CMP      R0,#+1
   \   0000000A   01D0               BEQ.N    ??OSMboxPost_0
    472                  return (OS_ERR_EVENT_TYPE);
   \   0000000C   0120               MOVS     R0,#+1
   \   0000000E   70BD               POP      {R4-R6,PC}
    473              }
    474              OS_ENTER_CRITICAL();
   \                     ??OSMboxPost_0:
   \   00000010   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000014   0600               MOVS     R6,R0
    475              if (pevent->OSEventGrp != 0) {                    /* See if any task pending on mailbox            */
   \   00000016   A07A               LDRB     R0,[R4, #+10]
   \   00000018   0028               CMP      R0,#+0
   \   0000001A   0CD0               BEQ.N    ??OSMboxPost_1
    476                                                                /* Ready HPT waiting on event                    */
    477                  (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_MBOX, OS_STAT_PEND_OK);
   \   0000001C   0023               MOVS     R3,#+0
   \   0000001E   0222               MOVS     R2,#+2
   \   00000020   2900               MOVS     R1,R5
   \   00000022   2000               MOVS     R0,R4
   \   00000024   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    478                  OS_EXIT_CRITICAL();
   \   00000028   3000               MOVS     R0,R6
   \   0000002A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    479                  OS_Sched();                                   /* Find highest priority task ready to run       */
   \   0000002E   ........           _BLF     OS_Sched,??OS_Sched??rT
    480                  return (OS_ERR_NONE);
   \   00000032   0020               MOVS     R0,#+0
   \   00000034   70BD               POP      {R4-R6,PC}
    481              }
    482              if (pevent->OSEventPtr != (void *)0) {            /* Make sure mailbox doesn't already have a msg  */
   \                     ??OSMboxPost_1:
   \   00000036   6068               LDR      R0,[R4, #+4]
   \   00000038   0028               CMP      R0,#+0
   \   0000003A   04D0               BEQ.N    ??OSMboxPost_2
    483                  OS_EXIT_CRITICAL();
   \   0000003C   3000               MOVS     R0,R6
   \   0000003E   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    484                  return (OS_ERR_MBOX_FULL);
   \   00000042   1420               MOVS     R0,#+20
   \   00000044   70BD               POP      {R4-R6,PC}
    485              }
    486              pevent->OSEventPtr = pmsg;                        /* Place message in mailbox                      */
   \                     ??OSMboxPost_2:
   \   00000046   6560               STR      R5,[R4, #+4]
    487              OS_EXIT_CRITICAL();
   \   00000048   3000               MOVS     R0,R6
   \   0000004A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    488              return (OS_ERR_NONE);
   \   0000004E   0020               MOVS     R0,#+0
   \   00000050   70BD               POP      {R4-R6,PC}       ;; return
    489          }
    490          #endif
    491          
    492          /*$PAGE*/
    493          /*
    494          *********************************************************************************************************
    495          *                                       POST MESSAGE TO A MAILBOX
    496          *
    497          * Description: This function sends a message to a mailbox
    498          *
    499          * Arguments  : pevent        is a pointer to the event control block associated with the desired mailbox
    500          *
    501          *              pmsg          is a pointer to the message to send.  You MUST NOT send a NULL pointer.
    502          *
    503          *              opt           determines the type of POST performed:
    504          *                            OS_POST_OPT_NONE         POST to a single waiting task
    505          *                                                     (Identical to OSMboxPost())
    506          *                            OS_POST_OPT_BROADCAST    POST to ALL tasks that are waiting on the mailbox
    507          *
    508          *                            OS_POST_OPT_NO_SCHED     Indicates that the scheduler will NOT be invoked
    509          *
    510          * Returns    : OS_ERR_NONE          The call was successful and the message was sent
    511          *              OS_ERR_MBOX_FULL     If the mailbox already contains a message.  You can can only send one
    512          *                                   message at a time and thus, the message MUST be consumed before you
    513          *                                   are allowed to send another one.
    514          *              OS_ERR_EVENT_TYPE    If you are attempting to post to a non mailbox.
    515          *              OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer
    516          *              OS_ERR_POST_NULL_PTR If you are attempting to post a NULL pointer
    517          *
    518          * Note(s)    : 1) HPT means Highest Priority Task
    519          *
    520          * Warning    : Interrupts can be disabled for a long time if you do a 'broadcast'.  In fact, the
    521          *              interrupt disable time is proportional to the number of tasks waiting on the mailbox.
    522          *********************************************************************************************************
    523          */
    524          
    525          #if OS_MBOX_POST_OPT_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    526          INT8U  OSMboxPostOpt (OS_EVENT *pevent, void *pmsg, INT8U opt)
    527          {
   \                     OSMboxPostOpt:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
   \   00000006   1600               MOVS     R6,R2
    528          #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    529              OS_CPU_SR  cpu_sr = 0;
    530          #endif
    531          
    532          
    533          
    534          #if OS_ARG_CHK_EN > 0
    535              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
    536                  return (OS_ERR_PEVENT_NULL);
    537              }
    538              if (pmsg == (void *)0) {                          /* Make sure we are not posting a NULL pointer   */
    539                  return (OS_ERR_POST_NULL_PTR);
    540              }
    541          #endif
    542              if (pevent->OSEventType != OS_EVENT_TYPE_MBOX) {  /* Validate event block type                     */
   \   00000008   2078               LDRB     R0,[R4, #+0]
   \   0000000A   0128               CMP      R0,#+1
   \   0000000C   01D0               BEQ.N    ??OSMboxPostOpt_0
    543                  return (OS_ERR_EVENT_TYPE);
   \   0000000E   0120               MOVS     R0,#+1
   \   00000010   F0BD               POP      {R4-R7,PC}
    544              }
    545              OS_ENTER_CRITICAL();
   \                     ??OSMboxPostOpt_0:
   \   00000012   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000016   0700               MOVS     R7,R0
    546              if (pevent->OSEventGrp != 0) {                    /* See if any task pending on mailbox            */
   \   00000018   A07A               LDRB     R0,[R4, #+10]
   \   0000001A   0028               CMP      R0,#+0
   \   0000001C   1AD0               BEQ.N    ??OSMboxPostOpt_1
    547                  if ((opt & OS_POST_OPT_BROADCAST) != 0x00) {  /* Do we need to post msg to ALL waiting tasks ? */
   \   0000001E   F007               LSLS     R0,R6,#+31
   \   00000020   09D5               BPL.N    ??OSMboxPostOpt_2
    548                      while (pevent->OSEventGrp != 0) {         /* Yes, Post to ALL tasks waiting on mailbox     */
   \                     ??OSMboxPostOpt_3:
   \   00000022   A07A               LDRB     R0,[R4, #+10]
   \   00000024   0028               CMP      R0,#+0
   \   00000026   0CD0               BEQ.N    ??OSMboxPostOpt_4
    549                          (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_MBOX, OS_STAT_PEND_OK);
   \   00000028   0023               MOVS     R3,#+0
   \   0000002A   0222               MOVS     R2,#+2
   \   0000002C   2900               MOVS     R1,R5
   \   0000002E   2000               MOVS     R0,R4
   \   00000030   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
   \   00000034   F5E7               B.N      ??OSMboxPostOpt_3
    550                      }
    551                  } else {                                      /* No,  Post to HPT waiting on mbox              */
    552                      (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_MBOX, OS_STAT_PEND_OK);
   \                     ??OSMboxPostOpt_2:
   \   00000036   0023               MOVS     R3,#+0
   \   00000038   0222               MOVS     R2,#+2
   \   0000003A   2900               MOVS     R1,R5
   \   0000003C   2000               MOVS     R0,R4
   \   0000003E   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    553                  }
    554                  OS_EXIT_CRITICAL();
   \                     ??OSMboxPostOpt_4:
   \   00000042   3800               MOVS     R0,R7
   \   00000044   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    555                  if ((opt & OS_POST_OPT_NO_SCHED) == 0) {	  /* See if scheduler needs to be invoked          */
   \   00000048   7007  

⌨️ 快捷键说明

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