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

📄 os_mem.lst

📁 lpc2478开发板基于IAR编译器移植ucos实验例程
💻 LST
📖 第 1 页 / 共 4 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION    12/Dec/2008  17:14:25 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  arm                                                  #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
#                       \Source\os_mem.c                                     #
#    Command line    =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
#                       \Source\os_mem.c -lCN E:\IAR_2478\IAR_2478\26uCOS\Sr #
#                       c\uCOS\RAM_Debug\List\ -o                            #
#                       E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\  #
#                       -z2 --no_cse --no_unroll --no_inline                 #
#                       --no_code_motion --no_tbaa --no_clustering           #
#                       --no_scheduling --debug --cpu_mode arm --endian      #
#                       little --cpu ARM7TDMI-S --stack_align 4 -e --fpu     #
#                       None --dlib_config "C:\Program Files\IAR             #
#                       Systems\Embedded Workbench 4.0                       #
#                       Evaluation\arm\LIB\dl4tpannl8n.h" -I                 #
#                       E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\include\ -I     #
#                       E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ucos-ii\include #
#                       \ -I "C:\Program Files\IAR Systems\Embedded          #
#                       Workbench 4.0 Evaluation\arm\INC\"                   #
#    List file       =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\List\ #
#                       os_mem.lst                                           #
#    Object file     =  E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
#                       s_mem.r79                                            #
#                                                                            #
#                                                                            #
##############################################################################

E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\Source\os_mem.c
      1          /*
      2          *********************************************************************************************************
      3          *                                                uC/OS-II
      4          *                                          The Real-Time Kernel
      5          *                                            MEMORY MANAGEMENT
      6          *
      7          *                          (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
      8          *                                           All Rights Reserved
      9          *
     10          * File    : OS_MEM.C
     11          * By      : Jean J. Labrosse
     12          * Version : V2.84
     13          *
     14          * LICENSING TERMS:
     15          * ---------------
     16          *   uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.  
     17          * If you plan on using  uC/OS-II  in a commercial product you need to contact Micri祄 to properly license 
     18          * its use in your product. We provide ALL the source code for your convenience and to help you experience 
     19          * uC/OS-II.   The fact that the  source is provided does  NOT  mean that you can use it without  paying a 
     20          * licensing fee.
     21          *********************************************************************************************************
     22          */
     23          
     24          #ifndef  OS_MASTER_FILE
     25          #include <ucos_ii.h>
     26          #endif
     27          
     28          #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
     29          /*
     30          *********************************************************************************************************
     31          *                                        CREATE A MEMORY PARTITION
     32          *
     33          * Description : Create a fixed-sized memory partition that will be managed by uC/OS-II.
     34          *
     35          * Arguments   : addr     is the starting address of the memory partition
     36          *
     37          *               nblks    is the number of memory blocks to create from the partition.
     38          *
     39          *               blksize  is the size (in bytes) of each block in the memory partition.
     40          *
     41          *               err      is a pointer to a variable containing an error message which will be set by
     42          *                        this function to either:
     43          *
     44          *                        OS_ERR_NONE              if the memory partition has been created correctly.
     45          *                        OS_ERR_MEM_INVALID_ADDR  if you are specifying an invalid address for the memory
     46          *                                                 storage of the partition or, the block does not align
     47          *                                                 on a pointer boundary
     48          *                        OS_ERR_MEM_INVALID_PART  no free partitions available
     49          *                        OS_ERR_MEM_INVALID_BLKS  user specified an invalid number of blocks (must be >= 2)
     50          *                        OS_ERR_MEM_INVALID_SIZE  user specified an invalid block size
     51          *                                                   - must be greater than the size of a pointer
     52          *                                                   - must be able to hold an integral number of pointers
     53          * Returns    : != (OS_MEM *)0  is the partition was created
     54          *              == (OS_MEM *)0  if the partition was not created because of invalid arguments or, no
     55          *                              free partition is available.
     56          *********************************************************************************************************
     57          */
     58          

   \                                 In segment CODE, align 4, keep-with-next
     59          OS_MEM  *OSMemCreate (void *addr, INT32U nblks, INT32U blksize, INT8U *err)
     60          {
   \                     OSMemCreate:
   \   00000000   F04F2DE9           PUSH     {R4-R11,LR}
   \   00000004   04D04DE2           SUB      SP,SP,#+4
   \   00000008   0040B0E1           MOVS     R4,R0
   \   0000000C   0150B0E1           MOVS     R5,R1
   \   00000010   0260B0E1           MOVS     R6,R2
   \   00000014   0370B0E1           MOVS     R7,R3
     61              OS_MEM    *pmem;
     62              INT8U     *pblk;
     63              void     **plink;
     64              INT32U     i;
     65          #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
     66              OS_CPU_SR  cpu_sr = 0;
   \   00000018   0010A0E3           MOV      R1,#+0
   \   0000001C   00108DE5           STR      R1,[SP, #+0]
     67          #endif
     68          
     69          
     70          
     71          #if OS_ARG_CHK_EN > 0              
     72              if (err == (INT8U *)0) {                          /* Validate 'err'                                */
   \   00000020   000057E3           CMP      R7,#+0
   \   00000024   0100001A           BNE      ??OSMemCreate_0
     73                  return ((OS_MEM *)0);
   \   00000028   0000A0E3           MOV      R0,#+0
   \   0000002C   4B0000EA           B        ??OSMemCreate_1
     74              }
     75              if (addr == (void *)0) {                          /* Must pass a valid address for the memory part.*/
   \                     ??OSMemCreate_0:
   \   00000030   000054E3           CMP      R4,#+0
   \   00000034   0300001A           BNE      ??OSMemCreate_2
     76                  *err = OS_ERR_MEM_INVALID_ADDR;
   \   00000038   6200A0E3           MOV      R0,#+98
   \   0000003C   0000C7E5           STRB     R0,[R7, #+0]
     77                  return ((OS_MEM *)0);
   \   00000040   0000A0E3           MOV      R0,#+0
   \   00000044   450000EA           B        ??OSMemCreate_1
     78              }
     79              if (((INT32U)addr & (sizeof(void *) - 1)) != 0){  /* Must be pointer size aligned                  */
   \                     ??OSMemCreate_2:
   \   00000048   030014E3           TST      R4,#0x3
   \   0000004C   0300000A           BEQ      ??OSMemCreate_3
     80                  *err = OS_ERR_MEM_INVALID_ADDR;
   \   00000050   6200A0E3           MOV      R0,#+98
   \   00000054   0000C7E5           STRB     R0,[R7, #+0]
     81                  return ((OS_MEM *)0);
   \   00000058   0000A0E3           MOV      R0,#+0
   \   0000005C   3F0000EA           B        ??OSMemCreate_1
     82              }
     83              if (nblks < 2) {                                  /* Must have at least 2 blocks per partition     */
   \                     ??OSMemCreate_3:
   \   00000060   020055E3           CMP      R5,#+2
   \   00000064   0300002A           BCS      ??OSMemCreate_4
     84                  *err = OS_ERR_MEM_INVALID_BLKS;
   \   00000068   5B00A0E3           MOV      R0,#+91
   \   0000006C   0000C7E5           STRB     R0,[R7, #+0]
     85                  return ((OS_MEM *)0);
   \   00000070   0000A0E3           MOV      R0,#+0
   \   00000074   390000EA           B        ??OSMemCreate_1
     86              }
     87              if (blksize < sizeof(void *)) {                   /* Must contain space for at least a pointer     */
   \                     ??OSMemCreate_4:
   \   00000078   040056E3           CMP      R6,#+4
   \   0000007C   0300002A           BCS      ??OSMemCreate_5
     88                  *err = OS_ERR_MEM_INVALID_SIZE;
   \   00000080   5C00A0E3           MOV      R0,#+92
   \   00000084   0000C7E5           STRB     R0,[R7, #+0]
     89                  return ((OS_MEM *)0);
   \   00000088   0000A0E3           MOV      R0,#+0
   \   0000008C   330000EA           B        ??OSMemCreate_1
     90              }
     91              if ((blksize % sizeof(void *)) != 0) {            /* Must contain space for an integral number ... */
   \                     ??OSMemCreate_5:
   \   00000090   030016E2           ANDS     R0,R6,#0x3       ;; Zero extend
   \   00000094   000050E3           CMP      R0,#+0
   \   00000098   0300000A           BEQ      ??OSMemCreate_6
     92                  *err = OS_ERR_MEM_INVALID_SIZE;               /* ... of pointer sized items                    */
   \   0000009C   5C00A0E3           MOV      R0,#+92
   \   000000A0   0000C7E5           STRB     R0,[R7, #+0]
     93                  return ((OS_MEM *)0);
   \   000000A4   0000A0E3           MOV      R0,#+0
   \   000000A8   2C0000EA           B        ??OSMemCreate_1
     94              }
     95          #endif
     96              OS_ENTER_CRITICAL();
   \                     ??OSMemCreate_6:
   \   000000AC   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rA
   \   000000B0   00008DE5           STR      R0,[SP, #+0]
     97              pmem = OSMemFreeList;                             /* Get next free memory partition                */
   \   000000B4   ........           LDR      R0,??DataTable4  ;; OSMemFreeList
   \   000000B8   000090E5           LDR      R0,[R0, #+0]
   \   000000BC   0080B0E1           MOVS     R8,R0
     98              if (OSMemFreeList != (OS_MEM *)0) {               /* See if pool of free partitions was empty      */
   \   000000C0   ........           LDR      R0,??DataTable4  ;; OSMemFreeList
   \   000000C4   000090E5           LDR      R0,[R0, #+0]
   \   000000C8   000050E3           CMP      R0,#+0
   \   000000CC   0400000A           BEQ      ??OSMemCreate_7
     99                  OSMemFreeList = (OS_MEM *)OSMemFreeList->OSMemFreeList;
   \   000000D0   ........           LDR      R0,??DataTable4  ;; OSMemFreeList
   \   000000D4   ........           LDR      R1,??DataTable4  ;; OSMemFreeList
   \   000000D8   001091E5           LDR      R1,[R1, #+0]
   \   000000DC   041091E5           LDR      R1,[R1, #+4]
   \   000000E0   001080E5           STR      R1,[R0, #+0]
    100              }
    101              OS_EXIT_CRITICAL();
   \                     ??OSMemCreate_7:
   \   000000E4   00009DE5           LDR      R0,[SP, #+0]
   \   000000E8   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rA
    102              if (pmem == (OS_MEM *)0) {                        /* See if we have a memory partition             */
   \   000000EC   000058E3           CMP      R8,#+0
   \   000000F0   0300001A           BNE      ??OSMemCreate_8
    103                  *err = OS_ERR_MEM_INVALID_PART;
   \   000000F4   5A00A0E3           MOV      R0,#+90
   \   000000F8   0000C7E5           STRB     R0,[R7, #+0]
    104                  return ((OS_MEM *)0);
   \   000000FC   0000A0E3           MOV      R0,#+0
   \   00000100   160000EA           B        ??OSMemCreate_1
    105              }
    106              plink = (void **)addr;                            /* Create linked list of free memory blocks      */
   \                     ??OSMemCreate_8:
   \   00000104   04A0B0E1           MOVS     R10,R4
    107              pblk  = (INT8U *)((INT32U)addr + blksize);
   \   00000108   040096E0           ADDS     R0,R6,R4
   \   0000010C   0090B0E1           MOVS     R9,R0
    108              for (i = 0; i < (nblks - 1); i++) {

⌨️ 快捷键说明

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