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

📄 os_mem.lst

📁 ARM仿真案例
💻 LST
📖 第 1 页 / 共 3 页
字号:
   \   00000018   6E68               LDR      R6,[R5, #+4]
    137                  pmem->OSMemFreeList = *(void **)pblk;         /*      Adjust pointer to new free list          */
   \   0000001A   3168               LDR      R1,[R6, #+0]
   \   0000001C   6960               STR      R1,[R5, #+4]
    138                  pmem->OSMemNFree--;                           /*      One less memory block in this partition  */
   \   0000001E   2969               LDR      R1,[R5, #+16]
   \   00000020   491E               SUBS     R1,R1,#+1
   \   00000022   2961               STR      R1,[R5, #+16]
    139                  OS_EXIT_CRITICAL();
   \   00000024   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    140                  *err = OS_NO_ERR;                             /*      No error                                 */
   \   00000028   0020               MOVS     R0,#+0
   \   0000002A   2070               STRB     R0,[R4, #+0]
    141                  return (pblk);                                /*      Return memory block to caller            */
   \   0000002C   3000               MOVS     R0,R6
   \   0000002E   04E0               B        ??OSMemGet_3
    142              }
    143              OS_EXIT_CRITICAL();
   \                     ??OSMemGet_2:
   \   00000030   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    144              *err = OS_MEM_NO_FREE_BLKS;                       /* No,  Notify caller of empty memory partition  */
   \   00000034   7120               MOVS     R0,#+113
   \                     ??OSMemGet_1:
   \   00000036   2070               STRB     R0,[R4, #+0]
    145              return ((void *)0);                               /*      Return NULL pointer to caller            */
   \   00000038   0020               MOVS     R0,#+0
   \                     ??OSMemGet_3:
   \   0000003A   70BC               POP      {R4-R6}
   \   0000003C   02BC               POP      {R1}
   \   0000003E   0847               BX       R1               ;; return
    146          }
    147          
    148          /*
    149          *********************************************************************************************************
    150          *                                   GET THE NAME OF A MEMORY PARTITION
    151          *
    152          * Description: This function is used to obtain the name assigned to a memory partition.
    153          *
    154          * Arguments  : pmem      is a pointer to the memory partition
    155          *
    156          *              pname     is a pointer to an ASCII string that will receive the name of the memory partition.
    157          *
    158          *              err       is a pointer to an error code that can contain one of the following values:
    159          *
    160          *                        OS_NO_ERR                  if the name was copied to 'pname'
    161          *                        OS_MEM_INVALID_PMEM        if you passed a NULL pointer for 'pmem'
    162          *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
    163          *
    164          * Returns    : The length of the string or 0 if 'pmem' is a NULL pointer.
    165          *********************************************************************************************************
    166          */
    167          
    168          #if OS_MEM_NAME_SIZE > 1

   \                                 In segment CODE, align 4, keep-with-next
    169          INT8U  OSMemNameGet (OS_MEM *pmem, char *pname, INT8U *err)
    170          {
   \                     OSMemNameGet:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
   \   00000002   0600               MOVS     R6,R0
   \   00000004   0F00               MOVS     R7,R1
   \   00000006   1400               MOVS     R4,R2
    171          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    172              OS_CPU_SR  cpu_sr;
    173          #endif
    174              INT8U      len;
    175          
    176          
    177              OS_ENTER_CRITICAL();
   \   00000008   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   0000000C   0500               MOVS     R5,R0
    178          #if OS_ARG_CHK_EN > 0
    179              if (pmem == (OS_MEM *)0) {                   /* Is 'pmem' a NULL pointer?                          */
   \   0000000E   002E               CMP      R6,#+0
   \   00000010   05D1               BNE      ??OSMemNameGet_0
    180                  OS_EXIT_CRITICAL();                      /* Yes                                                */
   \   00000012   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    181                  *err = OS_MEM_INVALID_PMEM;
   \   00000016   7420               MOVS     R0,#+116
   \                     ??OSMemNameGet_1:
   \   00000018   2070               STRB     R0,[R4, #+0]
    182                  return (0);
   \   0000001A   0020               MOVS     R0,#+0
   \   0000001C   11E0               B        ??OSMemNameGet_2
    183              }
    184              if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
   \                     ??OSMemNameGet_0:
   \   0000001E   002F               CMP      R7,#+0
   \   00000020   03D1               BNE      ??OSMemNameGet_3
    185                  OS_EXIT_CRITICAL();                      /* Yes                                                */
   \   00000022   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    186                  *err = OS_ERR_PNAME_NULL;
   \   00000026   0F20               MOVS     R0,#+15
   \   00000028   F6E7               B.N      ??OSMemNameGet_1
    187                  return (0);
    188              }
    189          #endif
    190              len  = OS_StrCopy(pname, pmem->OSMemName);   /* Copy name from OS_MEM                              */
   \                     ??OSMemNameGet_3:
   \   0000002A   1436               ADDS     R6,R6,#+20
   \   0000002C   3100               MOVS     R1,R6
   \   0000002E   3800               MOVS     R0,R7
   \   00000030   ........           _BLF     OS_StrCopy,??OS_StrCopy??rT
   \   00000034   0600               MOVS     R6,R0
    191              OS_EXIT_CRITICAL();
   \   00000036   2800               MOVS     R0,R5
   \   00000038   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    192              *err = OS_NO_ERR;
   \   0000003C   0020               MOVS     R0,#+0
   \   0000003E   2070               STRB     R0,[R4, #+0]
    193              return (len);
   \   00000040   3000               MOVS     R0,R6
   \                     ??OSMemNameGet_2:
   \   00000042   F0BC               POP      {R4-R7}
   \   00000044   02BC               POP      {R1}
   \   00000046   0847               BX       R1               ;; return
    194          }
    195          #endif
    196          
    197          
    198          /*
    199          *********************************************************************************************************
    200          *                                 ASSIGN A NAME TO A MEMORY PARTITION
    201          *
    202          * Description: This function assigns a name to a memory partition.
    203          *
    204          * Arguments  : pmem      is a pointer to the memory partition
    205          *
    206          *              pname     is a pointer to an ASCII string that contains the name of the memory partition.
    207          *
    208          *              err       is a pointer to an error code that can contain one of the following values:
    209          *
    210          *                        OS_NO_ERR                  if the name was copied to 'pname'
    211          *                        OS_MEM_INVALID_PMEM        if you passed a NULL pointer for 'pmem'
    212          *                        OS_ERR_PNAME_NULL          You passed a NULL pointer for 'pname'
    213          *						 OS_MEM_NAME_TOO_LONG       if the name doesn't fit in the storage area
    214          *
    215          * Returns    : None
    216          *********************************************************************************************************
    217          */
    218          
    219          #if OS_MEM_NAME_SIZE > 1

   \                                 In segment CODE, align 4, keep-with-next
    220          void  OSMemNameSet (OS_MEM *pmem, char *pname, INT8U *err)
    221          {
   \                     OSMemNameSet:
   \   00000000   F0B5               PUSH     {R4-R7,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
   \   00000006   1600               MOVS     R6,R2
    222          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    223              OS_CPU_SR  cpu_sr;
    224          #endif
    225              INT8U      len;
    226          
    227          
    228              OS_ENTER_CRITICAL();
   \   00000008   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
   \   0000000C   0700               MOVS     R7,R0
    229          #if OS_ARG_CHK_EN > 0
    230              if (pmem == (OS_MEM *)0) {                   /* Is 'pmem' a NULL pointer?                          */
   \   0000000E   002C               CMP      R4,#+0
   \   00000010   03D1               BNE      ??OSMemNameSet_0
    231                  OS_EXIT_CRITICAL();                      /* Yes                                                */
   \   00000012   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    232                  *err = OS_MEM_INVALID_PMEM;
   \   00000016   7420               MOVS     R0,#+116
   \   00000018   3070               STRB     R0,[R6, #+0]
    233              }
    234              if (pname == (char *)0) {                    /* Is 'pname' a NULL pointer?                         */
   \                     ??OSMemNameSet_0:
   \   0000001A   002D               CMP      R5,#+0
   \   0000001C   04D1               BNE      ??OSMemNameSet_1
    235                  OS_EXIT_CRITICAL();                      /* Yes                                                */
   \   0000001E   3800               MOVS     R0,R7
   \   00000020   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    236                  *err = OS_ERR_PNAME_NULL;
   \   00000024   0F20               MOVS     R0,#+15
   \   00000026   12E0               B.N      ??OSMemNameSet_2
    237                  return;
    238              }
    239          #endif
    240              len = OS_StrLen(pname);                      /* Can we fit the string in the storage area?         */
   \                     ??OSMemNameSet_1:
   \   00000028   2800               MOVS     R0,R5
   \   0000002A   ........           _BLF     OS_StrLen,??OS_StrLen??rT
    241              if (len > (OS_MEM_NAME_SIZE - 1)) {          /* No                                                 */
   \   0000002E   2028               CMP      R0,#+32
   \   00000030   04D3               BCC      ??OSMemNameSet_3
    242                  OS_EXIT_CRITICAL();
   \   00000032   3800               MOVS     R0,R7
   \   00000034   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    243                  *err = OS_MEM_NAME_TOO_LONG;
   \   00000038   7720               MOVS     R0,#+119
   \   0000003A   08E0               B.N      ??OSMemNameSet_2
    244                  return;
    245              } 
    246              (void)OS_StrCopy(pmem->OSMemName, pname);    /* Yes, copy name to the memory partition header      */
   \                     ??OSMemNameSet_3:
   \   0000003C   2900               MOVS     R1,R5
   \   0000003E   1434               ADDS     R4,R4,#+20
   \   00000040   2000               MOVS     R0,R4
   \   00000042   ........           _BLF     OS_StrCopy,??OS_StrCopy??rT
    247              OS_EXIT_CRITICAL();
   \   00000046   3800               MOVS     R0,R7
   \   00000048   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
    248              *err = OS_NO_ERR;
   \   0000004C   0020               MOVS     R0,#+0
   \                     ??OSMemNameSet_2:
   \   0000004E   3070               STRB     R0,[R6, #+0]
    249          }
   \   00000050   F0BC               POP      {R4-R7}
   \   00000052   01BC               POP      {R0}
   \   00000054   0047               BX       R0               ;; return
    250          #endif
    251          
    252          
    253          /*
    254          *********************************************************************************************************
    255          *                                         RELEASE A MEMORY BLOCK
    256          *
    257          * Description : Returns a memory block to a partition
    258          *
    259          * Arguments   : pmem    is a pointer to the memory partition control block
    260          *
    261          *               pblk    is a pointer to the memory block being released.
    262          *
    263          * Returns     : OS_NO_ERR            if the memory block was inserted into the partition
    264          *               OS_MEM_FULL          if you are returning a memory block to an already FULL memory 
    265          *                                    partition (You freed more blocks than you allocated!)
    266          *               OS_MEM_INVALID_PMEM  if you passed a NULL pointer for 'pmem'
    267          *               OS_MEM_INVALID_PBLK  if you passed a NULL pointer for the block to release.
    268          *********************************************************************************************************
    269          */
    270          

   \                                 In segment CODE, align 4, keep-with-next
    271          INT8U  OSMemPut (OS_MEM *pmem, void *pblk)
    272          {
   \                     OSMemPut:
   \   00000000   30B5               PUSH     {R4,R5,LR}
   \   00000002   0400               MOVS     R4,R0
   \   00000004   0D00               MOVS     R5,R1
    273          #if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    274              OS_CPU_SR  cpu_sr;
    275          #endif    
    276              
    277              
    278          #if OS_ARG_CHK_EN > 0
    279              if (pmem == (OS_MEM *)0) {                   /* Must point to a valid memory partition             */
   \   00000006   002C               CMP      R4,#+0
   \   00000008   01D1               BNE      ??OSMemPut_0
    280                  return (OS_MEM_INVALID_PMEM);

⌨️ 快捷键说明

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