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

📄 os_mem.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 4 页
字号:
    220              len   = OS_StrCopy(pname, pmem->OSMemName);  /* Copy name from OS_MEM                              */
   \   0000003C   1436               ADDS     R6,R6,#+20
   \   0000003E   3100               MOVS     R1,R6
   \   00000040   3800               MOVS     R0,R7
   \   00000042   ........           _BLF     OS_StrCopy,??OS_StrCopy??rT
   \   00000046   0600               MOVS     R6,R0
    221              OS_EXIT_CRITICAL();
   \   00000048   2800               MOVS     R0,R5
   \   0000004A   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    222              *perr = OS_ERR_NONE;
   \   0000004E   0020               MOVS     R0,#+0
   \   00000050   2070               STRB     R0,[R4, #+0]
    223              return (len);
   \   00000052   3000               MOVS     R0,R6
   \   00000054   F0BD               POP      {R4-R7,PC}       ;; return
    224          }
    225          #endif
    226          
    227          /*$PAGE*/
    228          /*
    229          *********************************************************************************************************
    230          *                                 ASSIGN A NAME TO A MEMORY PARTITION
    231          *
    232          * Description: This function assigns a name to a memory partition.
    233          *
    234          * Arguments  : pmem      is a pointer to the memory partition
    235          *
    236          *              pname     is a pointer to an ASCII string that contains the name of the memory partition.
    237          *
    238          *              perr      is a pointer to an error code that can contain one of the following values:
    239          *
    240          *                        OS_ERR_NONE                if the name was copied to 'pname'
    241          *                        OS_ERR_MEM_INVALID_PMEM    if you passed a NULL pointer for 'pmem'
    242          *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
    243          *                        OS_ERR_MEM_NAME_TOO_LONG   if the name doesn't fit in the storage area
    244          *                        OS_ERR_NAME_SET_ISR        if you called this function from an ISR
    245          *
    246          * Returns    : None
    247          *********************************************************************************************************
    248          */
    249          
    250          #if OS_MEM_NAME_SIZE > 1

   \                                 In segment CODE, align 4, keep-with-next
    251          void  OSMemNameSet (OS_MEM *pmem, INT8U *pname, INT8U *perr)
    252          {
   \                     OSMemNameSet:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
   \   00000002   0500               MOVS     R5,R0
   \   00000004   0E00               MOVS     R6,R1
   \   00000006   1400               MOVS     R4,R2
    253              INT8U      len;
    254          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    255              OS_CPU_SR  cpu_sr = 0;
    256          #endif
    257          
    258          
    259          
    260          #if OS_ARG_CHK_EN > 0
    261              if (perr == (INT8U *)0) {                    /* Validate 'perr'                                    */
   \   00000008   28D0               BEQ.N    ??OSMemNameSet_0
    262                  return;
    263              }
    264              if (pmem == (OS_MEM *)0) {                   /* Is 'pmem' a NULL pointer?                          */
   \   0000000A   002D               CMP      R5,#+0
   \   0000000C   02D1               BNE.N    ??OSMemNameSet_1
    265                  *perr = OS_ERR_MEM_INVALID_PMEM;
   \   0000000E   6020               MOVS     R0,#+96
   \   00000010   2070               STRB     R0,[R4, #+0]
    266                  return;
   \   00000012   F0BD               POP      {R4-R7,PC}
    267              }
    268              if (pname == (INT8U *)0) {                   /* Is 'pname' a NULL pointer?                         */
   \                     ??OSMemNameSet_1:
   \   00000014   002E               CMP      R6,#+0
   \   00000016   02D1               BNE.N    ??OSMemNameSet_2
    269                  *perr = OS_ERR_PNAME_NULL;
   \   00000018   0C20               MOVS     R0,#+12
   \   0000001A   2070               STRB     R0,[R4, #+0]
    270                  return;
   \   0000001C   F0BD               POP      {R4-R7,PC}
    271              }
    272          #endif
    273              if (OSIntNesting > 0) {                      /* See if trying to call from an ISR                  */
   \                     ??OSMemNameSet_2:
   \   0000001E   ....               LDR.N    R0,??DataTable2  ;; OSIntNesting
   \   00000020   0078               LDRB     R0,[R0, #+0]
   \   00000022   0028               CMP      R0,#+0
   \   00000024   02D0               BEQ.N    ??OSMemNameSet_3
    274                  *perr = OS_ERR_NAME_SET_ISR;
   \   00000026   1220               MOVS     R0,#+18
   \   00000028   2070               STRB     R0,[R4, #+0]
    275                  return;
   \   0000002A   F0BD               POP      {R4-R7,PC}
    276              }
    277              OS_ENTER_CRITICAL();
   \                     ??OSMemNameSet_3:
   \   0000002C   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   00000030   0700               MOVS     R7,R0
    278              len = OS_StrLen(pname);                      /* Can we fit the string in the storage area?         */
   \   00000032   3000               MOVS     R0,R6
   \   00000034   ........           _BLF     OS_StrLen,??OS_StrLen??rT
    279              if (len > (OS_MEM_NAME_SIZE - 1)) {          /* No                                                 */
   \   00000038   1028               CMP      R0,#+16
   \   0000003A   05D3               BCC.N    ??OSMemNameSet_4
    280                  OS_EXIT_CRITICAL();
   \   0000003C   3800               MOVS     R0,R7
   \   0000003E   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    281                  *perr = OS_ERR_MEM_NAME_TOO_LONG;
   \   00000042   6320               MOVS     R0,#+99
   \   00000044   2070               STRB     R0,[R4, #+0]
    282                  return;
   \   00000046   F0BD               POP      {R4-R7,PC}
    283              }
    284              (void)OS_StrCopy(pmem->OSMemName, pname);    /* Yes, copy name to the memory partition header      */
   \                     ??OSMemNameSet_4:
   \   00000048   3100               MOVS     R1,R6
   \   0000004A   1435               ADDS     R5,R5,#+20
   \   0000004C   2800               MOVS     R0,R5
   \   0000004E   ........           _BLF     OS_StrCopy,??OS_StrCopy??rT
    285              OS_EXIT_CRITICAL();
   \   00000052   3800               MOVS     R0,R7
   \   00000054   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    286              *perr = OS_ERR_NONE;
   \   00000058   0020               MOVS     R0,#+0
   \   0000005A   2070               STRB     R0,[R4, #+0]
    287          }
   \                     ??OSMemNameSet_0:
   \   0000005C   F0BD               POP      {R4-R7,PC}       ;; return
    288          #endif
    289          
    290          /*$PAGE*/
    291          /*
    292          *********************************************************************************************************
    293          *                                         RELEASE A MEMORY BLOCK
    294          *
    295          * Description : Returns a memory block to a partition
    296          *
    297          * Arguments   : pmem    is a pointer to the memory partition control block
    298          *
    299          *               pblk    is a pointer to the memory block being released.
    300          *
    301          * Returns     : OS_ERR_NONE              if the memory block was inserted into the partition
    302          *               OS_ERR_MEM_FULL          if you are returning a memory block to an already FULL memory
    303          *                                        partition (You freed more blocks than you allocated!)
    304          *               OS_ERR_MEM_INVALID_PMEM  if you passed a NULL pointer for 'pmem'
    305          *               OS_ERR_MEM_INVALID_PBLK  if you passed a NULL pointer for the block to release.
    306          *********************************************************************************************************
    307          */
    308          

   \                                 In segment CODE, align 4, keep-with-next
    309          INT8U  OSMemPut (OS_MEM *pmem, void *pblk)
    310          {
   \                     OSMemPut:
   \   00000000   30B5               PUSH     {R4,R5,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
    311          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    312              OS_CPU_SR  cpu_sr = 0;
    313          #endif
    314          
    315          
    316          
    317          #if OS_ARG_CHK_EN > 0
    318              if (pmem == (OS_MEM *)0) {                   /* Must point to a valid memory partition             */
   \   00000006   002C               CMP      R4,#+0
   \   00000008   01D1               BNE.N    ??OSMemPut_0
    319                  return (OS_ERR_MEM_INVALID_PMEM);
   \   0000000A   6020               MOVS     R0,#+96
   \   0000000C   30BD               POP      {R4,R5,PC}
    320              }
    321              if (pblk == (void *)0) {                     /* Must release a valid block                         */
   \                     ??OSMemPut_0:
   \   0000000E   002D               CMP      R5,#+0
   \   00000010   01D1               BNE.N    ??OSMemPut_1
    322                  return (OS_ERR_MEM_INVALID_PBLK);
   \   00000012   5F20               MOVS     R0,#+95
   \   00000014   30BD               POP      {R4,R5,PC}
    323              }
    324          #endif
    325              OS_ENTER_CRITICAL();
   \                     ??OSMemPut_1:
   \   00000016   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
    326              if (pmem->OSMemNFree >= pmem->OSMemNBlks) {  /* Make sure all blocks not already returned          */
   \   0000001A   2169               LDR      R1,[R4, #+16]
   \   0000001C   E268               LDR      R2,[R4, #+12]
   \   0000001E   9142               CMP      R1,R2
   \   00000020   03D3               BCC.N    ??OSMemPut_2
    327                  OS_EXIT_CRITICAL();
   \   00000022   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    328                  return (OS_ERR_MEM_FULL);
   \   00000026   5E20               MOVS     R0,#+94
   \   00000028   30BD               POP      {R4,R5,PC}
    329              }
    330              *(void **)pblk      = pmem->OSMemFreeList;   /* Insert released block into free block list         */
   \                     ??OSMemPut_2:
   \   0000002A   6168               LDR      R1,[R4, #+4]
   \   0000002C   2960               STR      R1,[R5, #+0]
    331              pmem->OSMemFreeList = pblk;
   \   0000002E   6560               STR      R5,[R4, #+4]
    332              pmem->OSMemNFree++;                          /* One more memory block in this partition            */
   \   00000030   2169               LDR      R1,[R4, #+16]
   \   00000032   491C               ADDS     R1,R1,#+1
   \   00000034   2161               STR      R1,[R4, #+16]
    333              OS_EXIT_CRITICAL();
   \   00000036   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    334              return (OS_ERR_NONE);                        /* Notify caller that memory block was released       */
   \   0000003A   0020               MOVS     R0,#+0
   \   0000003C   30BD               POP      {R4,R5,PC}       ;; return
    335          }
    336          /*$PAGE*/
    337          /*

⌨️ 快捷键说明

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