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

📄 os_sem.lst

📁 编译环境是 iar EWARM ,STM32 下的UCOSII
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \                                 In segment CODE, align 4, keep-with-next
    453          INT8U  OSSemPost (OS_EVENT *pevent)
    454          {
   \                     OSSemPost:
   \   00000000   30B5               PUSH     {R4,R5,LR}
   \   00000002   0400               MOVS     R4,R0
    455          #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
    456              OS_CPU_SR  cpu_sr = 0;
    457          #endif
    458          
    459          
    460          
    461          #if OS_ARG_CHK_EN > 0
    462              if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
    463                  return (OS_ERR_PEVENT_NULL);
    464              }
    465          #endif
    466              if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {   /* Validate event block type                     */
   \   00000004   2078               LDRB     R0,[R4, #+0]
   \   00000006   0328               CMP      R0,#+3
   \   00000008   01D0               BEQ.N    ??OSSemPost_0
    467                  return (OS_ERR_EVENT_TYPE);
   \   0000000A   0120               MOVS     R0,#+1
   \   0000000C   30BD               POP      {R4,R5,PC}
    468              }
    469              OS_ENTER_CRITICAL();
   \                     ??OSSemPost_0:
   \   0000000E   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000012   0500               MOVS     R5,R0
    470              if (pevent->OSEventGrp != 0) {                    /* See if any task waiting for semaphore         */
   \   00000014   A07A               LDRB     R0,[R4, #+10]
   \   00000016   0028               CMP      R0,#+0
   \   00000018   0CD0               BEQ.N    ??OSSemPost_1
    471                                                                /* Ready HPT waiting on event                    */
    472                  (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_OK);
   \   0000001A   0023               MOVS     R3,#+0
   \   0000001C   0122               MOVS     R2,#+1
   \   0000001E   1946               MOV      R1,R3
   \   00000020   2000               MOVS     R0,R4
   \   00000022   ........           _BLF     OS_EventTaskRdy,??OS_EventTaskRdy??rT
    473                  OS_EXIT_CRITICAL();
   \   00000026   2800               MOVS     R0,R5
   \   00000028   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    474                  OS_Sched();                                   /* Find HPT ready to run                         */
   \   0000002C   ........           _BLF     OS_Sched,??OS_Sched??rT
    475                  return (OS_ERR_NONE);
   \   00000030   0020               MOVS     R0,#+0
   \   00000032   30BD               POP      {R4,R5,PC}
    476              }
    477              if (pevent->OSEventCnt < 65535u) {                /* Make sure semaphore will not overflow         */
   \                     ??OSSemPost_1:
   \   00000034   2089               LDRH     R0,[R4, #+8]
   \   00000036   0749               LDR.N    R1,??OSSemPost_2  ;; 0xffff
   \   00000038   8842               CMP      R0,R1
   \   0000003A   06D0               BEQ.N    ??OSSemPost_3
    478                  pevent->OSEventCnt++;                         /* Increment semaphore count to register event   */
   \   0000003C   401C               ADDS     R0,R0,#+1
   \   0000003E   2081               STRH     R0,[R4, #+8]
    479                  OS_EXIT_CRITICAL();
   \   00000040   2800               MOVS     R0,R5
   \   00000042   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    480                  return (OS_ERR_NONE);
   \   00000046   0020               MOVS     R0,#+0
   \   00000048   30BD               POP      {R4,R5,PC}
    481              }
    482              OS_EXIT_CRITICAL();                               /* Semaphore value has reached its maximum       */
   \                     ??OSSemPost_3:
   \   0000004A   2800               MOVS     R0,R5
   \   0000004C   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    483              return (OS_ERR_SEM_OVF);
   \   00000050   3220               MOVS     R0,#+50
   \   00000052   30BD               POP      {R4,R5,PC}       ;; return
   \                     ??OSSemPost_2:
   \   00000054   FFFF0000           DC32     0xffff
    484          }
    485          
    486          /*$PAGE*/
    487          /*
    488          *********************************************************************************************************
    489          *                                          QUERY A SEMAPHORE
    490          *
    491          * Description: This function obtains information about a semaphore
    492          *
    493          * Arguments  : pevent        is a pointer to the event control block associated with the desired
    494          *                            semaphore
    495          *
    496          *              p_sem_data    is a pointer to a structure that will contain information about the
    497          *                            semaphore.
    498          *
    499          * Returns    : OS_ERR_NONE         The call was successful and the message was sent
    500          *              OS_ERR_EVENT_TYPE   If you are attempting to obtain data from a non semaphore.
    501          *              OS_ERR_PEVENT_NULL  If 'pevent'     is a NULL pointer.
    502          *              OS_ERR_PDATA_NULL   If 'p_sem_data' is a NULL pointer
    503          *********************************************************************************************************
    504          */
    505          
    506          #if OS_SEM_QUERY_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    507          INT8U  OSSemQuery (OS_EVENT *pevent, OS_SEM_DATA *p_sem_data)
    508          {
   \                     OSSemQuery:
   \   00000000   70B5               PUSH     {R4-R6,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
    509          #if OS_LOWEST_PRIO <= 63
    510              INT8U     *psrc;
    511              INT8U     *pdest;
    512          #else
    513              INT16U    *psrc;
    514              INT16U    *pdest;
    515          #endif
    516              INT8U      i;
    517          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    518              OS_CPU_SR  cpu_sr = 0;
    519          #endif
    520          
    521          
    522          
    523          #if OS_ARG_CHK_EN > 0
    524              if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
    525                  return (OS_ERR_PEVENT_NULL);
    526              }
    527              if (p_sem_data == (OS_SEM_DATA *)0) {                  /* Validate 'p_sem_data'                    */
    528                  return (OS_ERR_PDATA_NULL);
    529              }
    530          #endif
    531              if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
   \   00000006   2078               LDRB     R0,[R4, #+0]
   \   00000008   0328               CMP      R0,#+3
   \   0000000A   01D0               BEQ.N    ??OSSemQuery_0
    532                  return (OS_ERR_EVENT_TYPE);
   \   0000000C   0120               MOVS     R0,#+1
   \   0000000E   70BD               POP      {R4-R6,PC}
    533              }
    534              OS_ENTER_CRITICAL();
   \                     ??OSSemQuery_0:
   \   00000010   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    535              p_sem_data->OSEventGrp = pevent->OSEventGrp;           /* Copy message mailbox wait list           */
   \   00000014   A17A               LDRB     R1,[R4, #+10]
   \   00000016   A971               STRB     R1,[R5, #+6]
    536              psrc                   = &pevent->OSEventTbl[0];
   \   00000018   2100               MOVS     R1,R4
   \   0000001A   0B31               ADDS     R1,R1,#+11
    537              pdest                  = &p_sem_data->OSEventTbl[0];
   \   0000001C   2A00               MOVS     R2,R5
   \   0000001E   921C               ADDS     R2,R2,#+2
    538              for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
   \   00000020   0023               MOVS     R3,#+0
   \   00000022   05E0               B.N      ??OSSemQuery_1
    539                  *pdest++ = *psrc++;
   \                     ??OSSemQuery_2:
   \   00000024   0E78               LDRB     R6,[R1, #+0]
   \   00000026   1670               STRB     R6,[R2, #+0]
   \   00000028   491C               ADDS     R1,R1,#+1
   \   0000002A   521C               ADDS     R2,R2,#+1
    540              }
   \   0000002C   5B1C               ADDS     R3,R3,#+1
   \   0000002E   DBB2               UXTB     R3,R3
   \                     ??OSSemQuery_1:
   \   00000030   1E00               MOVS     R6,R3
   \   00000032   042E               CMP      R6,#+4
   \   00000034   F6D3               BCC.N    ??OSSemQuery_2
    541              p_sem_data->OSCnt = pevent->OSEventCnt;                /* Get semaphore count                      */
   \   00000036   2189               LDRH     R1,[R4, #+8]
   \   00000038   2980               STRH     R1,[R5, #+0]
    542              OS_EXIT_CRITICAL();
   \   0000003A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    543              return (OS_ERR_NONE);
   \   0000003E   0020               MOVS     R0,#+0
   \   00000040   70BD               POP      {R4-R6,PC}       ;; return
    544          }
    545          #endif                                                     /* OS_SEM_QUERY_EN                          */
    546          
    547          /*$PAGE*/
    548          /*
    549          *********************************************************************************************************
    550          *                                              SET SEMAPHORE
    551          *
    552          * Description: This function sets the semaphore count to the value specified as an argument.  Typically,
    553          *              this value would be 0.
    554          *
    555          *              You would typically use this function when a semaphore is used as a signaling mechanism
    556          *              and, you want to reset the count value.
    557          *
    558          * Arguments  : pevent     is a pointer to the event control block
    559          *
    560          *              cnt        is the new value for the semaphore count.  You would pass 0 to reset the
    561          *                         semaphore count.
    562          *
    563          *              perr       is a pointer to an error code returned by the function as follows:
    564          *
    565          *                            OS_ERR_NONE          The call was successful and the semaphore value was set.
    566          *                            OS_ERR_EVENT_TYPE    If you didn't pass a pointer to a semaphore.
    567          *                            OS_ERR_PEVENT_NULL   If 'pevent' is a NULL pointer.
    568          *                            OS_ERR_TASK_WAITING  If tasks are waiting on the semaphore.
    569          *********************************************************************************************************
    570          */
    571          
    572          #if OS_SEM_SET_EN > 0

   \                                 In segment CODE, align 4, keep-with-next
    573          void  OSSemSet (OS_EVENT *pevent, INT16U cnt, INT8U *perr)
    574          {
   \                     OSSemSet:
   \   00000000   70B5               PUSH     {R4-R6,LR}
   \   00000002   0500               MOVS     R5,R

⌨️ 快捷键说明

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