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

📄 os_mem.lst

📁 针对STM32F103的UCOS移植
💻 LST
📖 第 1 页 / 共 4 页
字号:
##############################################################################
#                                                                            #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 KICKSTART     13/Mar/2009  16:01:00 #
# Copyright 1999-2005 IAR Systems. All rights reserved.                      #
#                                                                            #
#    Cpu mode        =  thumb                                                #
#    Endian          =  little                                               #
#    Stack alignment =  4                                                    #
#    Source file     =  E:\UC_OS\Micrium\Software\uCOS-II\Source\os_mem.c    #
#    Command line    =  E:\UC_OS\Micrium\Software\uCOS-II\Source\os_mem.c    #
#                       -lCN E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210 #
#                       B-EVAL\IAR\OS-Probe\Flash\List\ -o                   #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\Flash\Obj\ -z6 --no_unroll            #
#                       --no_inline --no_tbaa --no_scheduling --debug        #
#                       --cpu_mode thumb --endian little --cpu cortex-M3     #
#                       --stack_align 4 -e --fpu None --dlib_config          #
#                       "C:\Program Files\IAR Systems\Embedded Workbench     #
#                       4.0 Kickstart\arm\LIB\dl7mptnnl8n.h" -I              #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\ -I E:\UC_OS\Micrium\Software\EvalBoa #
#                       rds\ST\STM3210B-EVAL\IAR\OS-Probe\..\..\..\..\..\uco #
#                       s-ii\ports\arm-cortex-m3\generic\iar\ -I             #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\ucos-ii\source\ -I     #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uc-lib\ -I             #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uc-cpu\ -I             #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uc-cpu\ARM-Cortex-M3\I #
#                       AR\ -I E:\UC_OS\Micrium\Software\EvalBoards\ST\STM32 #
#                       10B-EVAL\IAR\OS-Probe\..\..\..\..\..\cpu\st\stm32\in #
#                       c\ -I E:\UC_OS\Micrium\Software\EvalBoards\ST\STM321 #
#                       0B-EVAL\IAR\OS-Probe\..\BSP\ -I                      #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Commun #
#                       ication\Generic\RS-232\Source\ -I                    #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Commun #
#                       ication\Generic\RS-232\Ports\ST\STM32\ -I            #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Commun #
#                       ication\Generic\Source\ -I                           #
#                       E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\..\..\..\..\..\uC-Probe\Target\Plugin #
#                       s\uCOS-II\ -I "C:\Program Files\IAR                  #
#                       Systems\Embedded Workbench 4.0 Kickstart\arm\INC\"   #
#    List file       =  E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\Flash\List\os_mem.lst                 #
#    Object file     =  E:\UC_OS\Micrium\Software\EvalBoards\ST\STM3210B-EVA #
#                       L\IAR\OS-Probe\Flash\Obj\os_mem.r79                  #
#                                                                            #
#                                                                            #
##############################################################################

E:\UC_OS\Micrium\Software\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.85
     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          *               perr     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 *perr)
     60          {
   \                     OSMemCreate:
   \   00000000   2DE9F043           PUSH     {R4-R9,LR}
   \   00000004   8846               MOV      R8,R1
   \   00000006   9146               MOV      R9,R2
   \   00000008   0400               MOVS     R4,R0
   \   0000000A   1D00               MOVS     R5,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;
     67          #endif
     68          
     69          
     70          
     71          #if OS_ARG_CHK_EN > 0              
     72              if (perr == (INT8U *)0) {                         /* Validate 'perr'                               */
   \   0000000C   01D1               BNE.N    ??OSMemCreate_0
     73                  return ((OS_MEM *)0);
   \                     ??OSMemCreate_1:
   \   0000000E   0020               MOVS     R0,#+0
   \   00000010   3BE0               B.N      ??OSMemCreate_2
     74              }
     75              if (addr == (void *)0) {                          /* Must pass a valid address for the memory part.*/
   \                     ??OSMemCreate_0:
   \   00000012   002C               CMP      R4,#+0
   \   00000014   02D1               BNE.N    ??OSMemCreate_3
     76                  *perr = OS_ERR_MEM_INVALID_ADDR;
   \                     ??OSMemCreate_4:
   \   00000016   6220               MOVS     R0,#+98
   \   00000018   2870               STRB     R0,[R5, #+0]
   \   0000001A   F8E7               B.N      ??OSMemCreate_1
     77                  return ((OS_MEM *)0);
     78              }
     79              if (((INT32U)addr & (sizeof(void *) - 1)) != 0){  /* Must be pointer size aligned                  */
   \                     ??OSMemCreate_3:
   \   0000001C   8007               LSLS     R0,R0,#+30
   \   0000001E   FAD1               BNE.N    ??OSMemCreate_4
     80                  *perr = OS_ERR_MEM_INVALID_ADDR;
     81                  return ((OS_MEM *)0);
     82              }
     83              if (nblks < 2) {                                  /* Must have at least 2 blocks per partition     */
   \   00000020   4046               MOV      R0,R8
   \   00000022   0228               CMP      R0,#+2
   \   00000024   02D2               BCS.N    ??OSMemCreate_5
     84                  *perr = OS_ERR_MEM_INVALID_BLKS;
   \   00000026   5B20               MOVS     R0,#+91
   \   00000028   2870               STRB     R0,[R5, #+0]
   \   0000002A   F0E7               B.N      ??OSMemCreate_1
     85                  return ((OS_MEM *)0);
     86              }
     87              if (blksize < sizeof(void *)) {                   /* Must contain space for at least a pointer     */
   \                     ??OSMemCreate_5:
   \   0000002C   4846               MOV      R0,R9
   \   0000002E   0428               CMP      R0,#+4
   \   00000030   02D2               BCS.N    ??OSMemCreate_6
     88                  *perr = OS_ERR_MEM_INVALID_SIZE;
   \   00000032   5C20               MOVS     R0,#+92
   \   00000034   2870               STRB     R0,[R5, #+0]
   \   00000036   EAE7               B.N      ??OSMemCreate_1
     89                  return ((OS_MEM *)0);
     90              }
     91          #endif
     92              OS_ENTER_CRITICAL();
   \                     ??OSMemCreate_6:
   \   00000038   ........           _BLF     OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
     93              pmem = OSMemFreeList;                             /* Get next free memory partition                */
   \   0000003C   ....               LDR.N    R1,??DataTable3  ;; OSMemFreeList
   \   0000003E   0A68               LDR      R2,[R1, #+0]
   \   00000040   1600               MOVS     R6,R2
     94              if (OSMemFreeList != (OS_MEM *)0) {               /* See if pool of free partitions was empty      */
   \   00000042   01D0               BEQ.N    ??OSMemCreate_7
     95                  OSMemFreeList = (OS_MEM *)OSMemFreeList->OSMemFreeList;
   \   00000044   5268               LDR      R2,[R2, #+4]
   \   00000046   0A60               STR      R2,[R1, #+0]
     96              }
     97              OS_EXIT_CRITICAL();
   \                     ??OSMemCreate_7:
   \   00000048   ........           _BLF     OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
     98              if (pmem == (OS_MEM *)0) {                        /* See if we have a memory partition             */
   \   0000004C   002E               CMP      R6,#+0
   \   0000004E   02D1               BNE.N    ??OSMemCreate_8
     99                  *perr = OS_ERR_MEM_INVALID_PART;
   \   00000050   5A20               MOVS     R0,#+90
   \   00000052   2870               STRB     R0,[R5, #+0]
   \   00000054   DBE7               B.N      ??OSMemCreate_1
    100                  return ((OS_MEM *)0);
    101              }
    102              plink = (void **)addr;                            /* Create linked list of free memory blocks      */
   \                     ??OSMemCreate_8:
   \   00000056   2000               MOVS     R0,R4
    103              pblk  = (INT8U *)((INT32U)addr + blksize);
   \   00000058   19EB0401           ADDS     R1,R9,R4

⌨️ 快捷键说明

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