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

📄 os_core.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 5 页
字号:
    153          *              pname     is a pointer to an ASCII string that will be used as the name of the semaphore,
    154          *                        mutex, mailbox or queue.  The string must be able to hold at least 
    155          *                        OS_EVENT_NAME_SIZE characters.
    156          *
    157          *              err       is a pointer to an error code that can contain one of the following values:
    158          *
    159          *                        OS_NO_ERR                  if the requested task is resumed
    160          *                        OS_ERR_EVENT_TYPE          if 'pevent' is not pointing to the proper event 
    161          *                                                   control block type.
    162          *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
    163          *                        OS_ERR_PEVENT_NULL         if you passed a NULL pointer for 'pevent'
    164          *
    165          * Returns    : None
    166          *********************************************************************************************************
    167          */
    168          
    169          #if OS_EVENT_NAME_SIZE > 1

   \                                 In segment CODE, align 4, keep-with-next
    170          void  OSEventNameSet (OS_EVENT *pevent, char *pname, INT8U *err)
    171          {
   \                     OSEventNameSet:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
   \   00000002   0500               MOVS     R5,R0
   \   00000004   0E00               MOVS     R6,R1
   \   00000006   1400               MOVS     R4,R2
    172          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    173              OS_CPU_SR  cpu_sr;
    174          #endif
    175              INT8U      len;
    176          
    177          
    178              OS_ENTER_CRITICAL();
   \   00000008   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   0000000C   0700               MOVS     R7,R0
    179          #if OS_ARG_CHK_EN > 0
    180              if (pevent == (OS_EVENT *)0) {               /* Is 'pevent' a NULL pointer?                        */
   \   0000000E   002D               CMP      R5,#+0
   \   00000010   03D1               BNE      ??OSEventNameSet_0
    181                  OS_EXIT_CRITICAL();                      /* Yes                                                */
   \   00000012   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    182                  *err = OS_ERR_PEVENT_NULL;
   \   00000016   0420               MOVS     R0,#+4
   \   00000018   21E0               B.N      ??OSEventNameSet_1
    183                  return;
    184              }
    185              if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
   \                     ??OSEventNameSet_0:
   \   0000001A   002E               CMP      R6,#+0
   \   0000001C   03D1               BNE      ??OSEventNameSet_2
    186                  OS_EXIT_CRITICAL();                      /* Yes                                                */
   \   0000001E   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    187                  *err = OS_ERR_PNAME_NULL;
   \   00000022   0F20               MOVS     R0,#+15
   \   00000024   1BE0               B.N      ??OSEventNameSet_1
    188                  return;
    189              }
    190          #endif
    191              switch (pevent->OSEventType) {
   \                     ??OSEventNameSet_2:
   \   00000026   2878               LDRB     R0,[R5, #+0]
   \   00000028   401E               SUBS     R0,R0,#+1
   \   0000002A   0328               CMP      R0,#+3
   \   0000002C   09D8               BHI      ??OSEventNameSet_3
    192                  case OS_EVENT_TYPE_SEM:
    193                  case OS_EVENT_TYPE_MUTEX:
    194                  case OS_EVENT_TYPE_MBOX:
    195                  case OS_EVENT_TYPE_Q:
    196                       break;
    197          
    198                  default:
    199                       OS_EXIT_CRITICAL();
    200                       *err = OS_ERR_EVENT_TYPE;
    201                       return;
    202              }
    203              len = OS_StrLen(pname);                           /* Can we fit the string in the storage area?    */
   \   0000002E   3000               MOVS     R0,R6
   \   00000030   ........           BL       OS_StrLen
    204              if (len > (OS_EVENT_NAME_SIZE - 1)) {             /* No                                            */
   \   00000034   2028               CMP      R0,#+32
   \   00000036   09D3               BCC      ??OSEventNameSet_4
    205                  OS_EXIT_CRITICAL();
   \   00000038   3800               MOVS     R0,R7
   \   0000003A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    206                  *err = OS_ERR_EVENT_NAME_TOO_LONG;
   \   0000003E   0C20               MOVS     R0,#+12
   \   00000040   0DE0               B.N      ??OSEventNameSet_1
    207                  return;
    208              } 
   \                     ??OSEventNameSet_3:
   \   00000042   3800               MOVS     R0,R7
   \   00000044   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
   \   00000048   0120               MOVS     R0,#+1
   \   0000004A   08E0               B.N      ??OSEventNameSet_1
    209              (void)OS_StrCopy(pevent->OSEventName, pname);     /* Yes, copy name to the event control block     */
   \                     ??OSEventNameSet_4:
   \   0000004C   3100               MOVS     R1,R6
   \   0000004E   1035               ADDS     R5,R5,#+16
   \   00000050   2800               MOVS     R0,R5
   \   00000052   ........           BL       OS_StrCopy
    210              OS_EXIT_CRITICAL();
   \   00000056   3800               MOVS     R0,R7
   \   00000058   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    211              *err = OS_NO_ERR;
   \   0000005C   0020               MOVS     R0,#+0
   \                     ??OSEventNameSet_1:
   \   0000005E   2070               STRB     R0,[R4, #+0]
    212          }
   \   00000060   F0BC               POP      {R4-R7}
   \   00000062   01BC               POP      {R0}
   \   00000064   0047               BX       R0               ;; return
    213          #endif
    214          
    215          /*$PAGE*/
    216          /*
    217          *********************************************************************************************************
    218          *                                             INITIALIZATION
    219          *
    220          * Description: This function is used to initialize the internals of uC/OS-II and MUST be called prior to
    221          *              creating any uC/OS-II object and, prior to calling OSStart().
    222          *
    223          * Arguments  : none
    224          *
    225          * Returns    : none
    226          *********************************************************************************************************
    227          */
    228          

   \                                 In segment CODE, align 4, keep-with-next
    229          void  OSInit (void)
    230          {
   \                     OSInit:
   \   00000000   00B5               PUSH     {LR}
    231          #if OS_VERSION >= 204
    232              OSInitHookBegin();                                           /* Call port specific initialization code   */
   \   00000002   ........           _BLF     OSInitHookBegin,??OSInitHookBegin??rT
    233          #endif
    234          
    235              OS_InitMisc();                                               /* Initialize miscellaneous variables       */
   \   00000006   ........           BL       OS_InitMisc
    236          
    237              OS_InitRdyList();                                            /* Initialize the Ready List                */
   \   0000000A   ........           BL       OS_InitRdyList
    238          
    239              OS_InitTCBList();                                            /* Initialize the free list of OS_TCBs      */
   \   0000000E   ........           BL       OS_InitTCBList
    240          
    241              OS_InitEventList();                                          /* Initialize the free list of OS_EVENTs    */
   \   00000012   ........           BL       OS_InitEventList
    242          
    243          #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
    244              OS_FlagInit();                                               /* Initialize the event flag structures     */
   \   00000016   ........           _BLF     OS_FlagInit,??OS_FlagInit??rT
    245          #endif
    246          
    247          #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
    248              OS_MemInit();                                                /* Initialize the memory manager            */
   \   0000001A   ........           _BLF     OS_MemInit,??OS_MemInit??rT
    249          #endif
    250          
    251          #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
    252              OS_QInit();                                                  /* Initialize the message queue structures  */
   \   0000001E   ........           _BLF     OS_QInit,??OS_QInit??rT
    253          #endif
    254          
    255              OS_InitTaskIdle();                                           /* Create the Idle Task                     */
   \   00000022   ........           BL       OS_InitTaskIdle
    256          #if OS_TASK_STAT_EN > 0
    257              OS_InitTaskStat();                                           /* Create the Statistic Task                */
   \   00000026   ........           BL       OS_InitTaskStat
    258          #endif
    259          
    260          #if OS_VERSION >= 204
    261              OSInitHookEnd();                                             /* Call port specific init. code            */
   \   0000002A   ........           _BLF     OSInitHookEnd,??OSInitHookEnd??rT
    262          #endif
    263          
    264          #if OS_VERSION >= 270 && OS_DEBUG_EN > 0
    265              OSDebugInit();
   \   0000002E   ........           _BLF     OSDebugInit,??OSDebugInit??rT
    266          #endif
    267          }
   \   00000032   01BC               POP      {R0}
   \   00000034   0047               BX       R0               ;; return
    268          /*$PAGE*/
    269          /*
    270          *********************************************************************************************************
    271          *                                              ENTER ISR
    272          *
    273          * Description: This function is used to notify uC/OS-II that you are about to service an interrupt
    274          *              service routine (ISR).  This allows uC/OS-II to keep track of interrupt nesting and thus
    275          *              only perform rescheduling at the last nested ISR.
    276          *
    277          * Arguments  : none
    278          *
    279          * Returns    : none
    280          *
    281          * Notes      : 1) This function should be called ith interrupts already disabled
    282          *              2) Your ISR can directly increment OSIntNesting without calling this function because
    283          *                 OSIntNesting has been declared 'global'.  
    284          *              3) You MUST still call OSIntExit() even though you increment OSIntNesting directly.
    285          *              4) You MUST invoke OSIntEnter() and OSIntExit() in pair.  In other words, for every call
    286          *                 to OSIntEnter() at the beginning of the ISR you MUST have a call to OSIntExit() at the
    287          *                 end of the ISR.
    288          *              5) You are allowed to nest interrupts up to 255 levels deep.
    289          *              6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the increment because
    290          *                 OSIntEnter() is always called with interrupts disabled.
    291          *********************************************************************************************************
    292          */
    293          

   \                                 In segment CODE, align 4, keep-with-next
    294          void  OSIntEnter (void)
    295          {
   \                     OSIntEnter:
   \   00000000   00B5               PUSH     {LR}
    296              if (OSRunning == TRUE) {
   \   00000002   ....               LDR      R0,??DataTable51  ;; OSRunning
   \   00000004   0078               LDRB     R0,[R0, #+0]
   \   00000006   0128               CMP      R0,#+1
   \   00000008   08D1               BNE      ??OSIntEnter_0
    297                  if (OSIntNesting < 255u) {
   \   0000000A   ....               LDR      R0,??DataTable29  ;; OSIntNesting
   \   0000000C   0078               LDRB     R0,[R0, #+0]
   \   0000000E   FF28               CMP      R0,#+255
   \   00000010   04D0               BEQ      ??OSIntEnter_0

⌨️ 快捷键说明

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