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

📄 os_sem.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
    444          *                                  signalled the semaphore more often than you waited on it with either
    445          *                                  OSSemAccept() or OSSemPend().
    446          *              OS_ERR_EVENT_TYPE   If you didn't pass a pointer to a semaphore
    447          *              OS_ERR_PEVENT_NULL  If 'pevent' is a NULL pointer.
    448          *********************************************************************************************************
    449          */
    450          

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

   \                                 In segment CODE, align 4, keep-with-next
    505          INT8U  OSSemQuery (OS_EVENT *pevent, OS_SEM_DATA *p_sem_data)
    506          {
   \                     OSSemQuery:
   \   00000000   70B5               PUSH     {R4-R6,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
    507          #if OS_LOWEST_PRIO <= 63
    508              INT8U     *psrc;
    509              INT8U     *pdest;
    510          #else
    511              INT16U    *psrc;
    512              INT16U    *pdest;
    513          #endif
    514              INT8U      i;
    515          #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
    516              OS_CPU_SR  cpu_sr = 0;
    517          #endif
    518          
    519          
    520          
    521          #if OS_ARG_CHK_EN > 0
    522              if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
   \   00000006   002C               CMP      R4,#+0
   \   00000008   01D1               BNE.N    ??OSSemQuery_0
    523                  return (OS_ERR_PEVENT_NULL);
   \   0000000A   0420               MOVS     R0,#+4
   \   0000000C   70BD               POP      {R4-R6,PC}
    524              }
    525              if (p_sem_data == (OS_SEM_DATA *)0) {                  /* Validate 'p_sem_data'                    */
   \                     ??OSSemQuery_0:
   \   0000000E   002D               CMP      R5,#+0
   \   00000010   01D1               BNE.N    ??OSSemQuery_1
    526                  return (OS_ERR_PDATA_NULL);
   \   00000012   0920               MOVS     R0,#+9
   \   00000014   70BD               POP      {R4-R6,PC}
    527              }
    528          #endif
    529              if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
   \                     ??OSSemQuery_1:
   \   00000016   2078               LDRB     R0,[R4, #+0]
   \   00000018   0328               CMP      R0,#+3
   \   0000001A   01D0               BEQ.N    ??OSSemQuery_2
    530                  return (OS_ERR_EVENT_TYPE);
   \   0000001C   0120               MOVS     R0,#+1
   \   0000001E   70BD               POP      {R4-R6,PC}
    531              }
    532              OS_ENTER_CRITICAL();
   \                     ??OSSemQuery_2:
   \   00000020   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    533              p_sem_data->OSEventGrp = pevent->OSEventGrp;           /* Copy message mailbox wait list           */
   \   00000024   A17A               LDRB     R1,[R4, #+10]
   \   00000026   A971               STRB     R1,[R5, #+6]
    534              psrc                   = &pevent->OSEventTbl[0];
   \   00000028   2100               MOVS     R1,R4
   \   0000002A   0B31               ADDS     R1,R1,#+11
    535              pdest                  = &p_sem_data->OSEventTbl[0];
   \   0000002C   2A00               MOVS     R2,R5
   \   0000002E   921C               ADDS     R2,R2,#+2
    536              for (i = 0; i < OS_EVENT_TBL_SIZE; i++) {
   \   00000030   0023               MOVS     R3,#+0
   \   00000032   05E0               B.N      ??OSSemQuery_3
    537                  *pdest++ = *psrc++;
   \                     ??OSSemQuery_4:
   \   00000034   0E78               LDRB     R6,[R1, #+0]
   \   00000036   1670               STRB     R6,[R2, #+0]
   \   00000038   491C               ADDS     R1,R1,#+1
   \   0000003A   521C               ADDS     R2,R2,#+1
    538              }
   \   0000003C   5B1C               ADDS     R3,R3,#+1
   \   0000003E   DBB2               UXTB     R3,R3
   \                     ??OSSemQuery_3:
   \   00000040   1E00               MOVS     R6,R3
   \   00000042   042E               CMP      R6,#+4
   \   00000044   F6D3               BCC.N    ??OSSemQuery_4
    539              p_sem_data->OSCnt = pevent->OSEventCnt;                /* Get semaphore count                      */
   \   00000046   2189               LDRH     R1,[R4, #+8]
   \   00000048   2980               STRH     R1,[R5, #+0]
    540              OS_EXIT_CRITICAL();
   \   0000004A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    541              return (OS_ERR_NONE);
   \   0000004E   0020               MOVS     R0,#+0
   \   00000050   70BD               POP      {R4-R6,PC}       ;; return
    542          }
    543          #endif                                                     /* OS_SEM_QUERY_EN                          */
    544          
    545          /*$PAGE*/
    546          /*
    547          *********************************************************************************************************
    548          *                                              SET SEMAPHORE
    549          *
    550          * Description: This function sets the semaphore count to the value specified as an argument.  Typically,
    551          *              this value would be 0.
    552          *
    553          *              You would typically use this function when a semaphore is used as a signaling mechanism
    554          *              an

⌨️ 快捷键说明

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