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

📄 os_mem.lst

📁 stm32+ucos-ii
💻 LST
📖 第 1 页 / 共 4 页
字号:
###############################################################################
#                                                                             #
# IAR ANSI C/C++ Compiler V6.10.2.52244/W32 for ARM     07/Aug/2011  12:10:29 #
# Copyright 1999-2010 IAR Systems AB.                                         #
#                                                                             #
#    Cpu mode     =  thumb                                                    #
#    Endian       =  little                                                   #
#    Source file  =  F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_mem #
#                    .c                                                       #
#    Command line =  F:\stm32\我的程序\Micrium\Software\uCOS-II\Source\os_mem #
#                    .c -D USE_STDPERIPH_DRIVER -D STM32F10X_CL -lCN          #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Lis #
#                    t\ -o F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Fla #
#                    sh\Obj\ --no_cse --no_unroll --no_inline                 #
#                    --no_code_motion --no_tbaa --no_clustering               #
#                    --no_scheduling --debug --endian=little --cpu=Cortex-M3  #
#                    -e --fpu=None --dlib_config                              #
#                    D:\arm\INC\c\DLib_Config_Normal.h -I                     #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\APP\ -I   #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\   #
#                    -I F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP #
#                    \ST\CMSIS\CM3\CoreSupport\ -I                            #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\ST #
#                    \CMSIS\CM3\DeviceSupport\ST\STM32F10x\ -I                #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\ST #
#                    \STM32F10x_StdPeriph_Driver\inc\ -I                      #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\BSP\uC #
#                    OS-II\ -I F:\stm32\我的程序\Micrium\Software\EWARM\OS-II #
#                    \..\..\uCOS-II\Ports\ARM-Cortex-M3\Generic\IAR\ -I       #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\..\uCO #
#                    S-II\Source\ -I F:\stm32\我的程序\Micrium\Software\EWARM #
#                    \OS-II\..\..\uC-LIB\ -I F:\stm32\我的程序\Micrium\Softwa #
#                    re\EWARM\OS-II\..\..\uC-LIB\Ports\ARM-Cortex-M3\IAR\ -I  #
#                    F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\..\..\uC- #
#                    CPU\ -I F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\. #
#                    .\..\uC-CPU\ARM-Cortex-M3\IAR\ -On --use_c++_inline      #
#    List file    =  F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Lis #
#                    t\os_mem.lst                                             #
#    Object file  =  F:\stm32\我的程序\Micrium\Software\EWARM\OS-II\Flash\Obj #
#                    \os_mem.o                                                #
#                                                                             #
#                                                                             #
###############################################################################

F:\stm32\我的程序\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-2010, Micrium, Weston, FL
      8          *                                           All Rights Reserved
      9          *
     10          * File    : OS_MEM.C
     11          * By      : Jean J. Labrosse
     12          * Version : V2.92
     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 > 0u) && (OS_MAX_MEM_PART > 0u)
     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 section .text, align 2, keep-with-next
     59          OS_MEM  *OSMemCreate (void   *addr,
     60                                INT32U  nblks,
     61                                INT32U  blksize,
     62                                INT8U  *perr)
     63          {
   \                     OSMemCreate:
   \   00000000   2DE9F84F           PUSH     {R3-R11,LR}
   \   00000004   82B0               SUB      SP,SP,#+8
   \   00000006   0400               MOVS     R4,R0
   \   00000008   0D00               MOVS     R5,R1
   \   0000000A   1600               MOVS     R6,R2
     64              OS_MEM    *pmem;
     65              INT8U     *pblk;
     66              void     **plink;
     67              INT32U     loops;
     68              INT32U     i;
     69          #if OS_CRITICAL_METHOD == 3u                          /* Allocate storage for CPU status register      */
     70              OS_CPU_SR  cpu_sr = 0u;
   \   0000000C   5FF0000B           MOVS     R11,#+0
     71          #endif
     72          
     73          
     74          
     75          #ifdef OS_SAFETY_CRITICAL
     76              if (perr == (INT8U *)0) {
     77                  OS_SAFETY_CRITICAL_EXCEPTION();
     78                  return ((OS_MEM *)0);
     79              }
     80          #endif
     81          
     82          #ifdef OS_SAFETY_CRITICAL_IEC61508
     83              if (OSSafetyCriticalStartFlag == OS_TRUE) {
     84                  OS_SAFETY_CRITICAL_EXCEPTION();
     85                  return ((OS_MEM *)0);
     86              }
     87          #endif
     88          
     89          #if OS_ARG_CHK_EN > 0u
     90              if (addr == (void *)0) {                          /* Must pass a valid address for the memory part.*/
     91                  *perr = OS_ERR_MEM_INVALID_ADDR;
     92                  return ((OS_MEM *)0);
     93              }
     94              if (((INT32U)addr & (sizeof(void *) - 1u)) != 0u){  /* Must be pointer size aligned                */
     95                  *perr = OS_ERR_MEM_INVALID_ADDR;
     96                  return ((OS_MEM *)0);
     97              }
     98              if (nblks < 2u) {                                 /* Must have at least 2 blocks per partition     */
     99                  *perr = OS_ERR_MEM_INVALID_BLKS;
    100                  return ((OS_MEM *)0);
    101              }
    102              if (blksize < sizeof(void *)) {                   /* Must contain space for at least a pointer     */
    103                  *perr = OS_ERR_MEM_INVALID_SIZE;
    104                  return ((OS_MEM *)0);
    105              }
    106          #endif
    107              OS_ENTER_CRITICAL();
   \   00000010   ........           BL       OS_CPU_SR_Save
   \   00000014   8346               MOV      R11,R0
    108              pmem = OSMemFreeList;                             /* Get next free memory partition                */
   \   00000016   ....               LDR.N    R0,??DataTable4_1
   \   00000018   0068               LDR      R0,[R0, #+0]
   \   0000001A   0700               MOVS     R7,R0
    109              if (OSMemFreeList != (OS_MEM *)0) {               /* See if pool of free partitions was empty      */
   \   0000001C   ....               LDR.N    R0,??DataTable4_1
   \   0000001E   0068               LDR      R0,[R0, #+0]
   \   00000020   0028               CMP      R0,#+0
   \   00000022   04D0               BEQ.N    ??OSMemCreate_0
    110                  OSMemFreeList = (OS_MEM *)OSMemFreeList->OSMemFreeList;
   \   00000024   ....               LDR.N    R0,??DataTable4_1
   \   00000026   0068               LDR      R0,[R0, #+0]
   \   00000028   4068               LDR      R0,[R0, #+4]
   \   0000002A   ....               LDR.N    R1,??DataTable4_1
   \   0000002C   0860               STR      R0,[R1, #+0]
    111              }
    112              OS_EXIT_CRITICAL();
   \                     ??OSMemCreate_0:
   \   0000002E   5846               MOV      R0,R11
   \   00000030   ........           BL       OS_CPU_SR_Restore
    113              if (pmem == (OS_MEM *)0) {                        /* See if we have a memory partition             */
   \   00000034   002F               CMP      R7,#+0
   \   00000036   04D1               BNE.N    ??OSMemCreate_1
    114                  *perr = OS_ERR_MEM_INVALID_PART;
   \   00000038   0298               LDR      R0,[SP, #+8]
   \   0000003A   5A21               MOVS     R1,#+90
   \   0000003C   0170               STRB     R1,[R0, #+0]
    115                  return ((OS_MEM *)0);
   \   0000003E   0020               MOVS     R0,#+0
   \   00000040   1CE0               B.N      ??OSMemCreate_2
    116              }
    117              plink = (void **)addr;                            /* Create linked list of free memory blocks      */
   \                     ??OSMemCreate_1:
   \   00000042   A146               MOV      R9,R4
    118              pblk  = (INT8U *)addr;
   \   00000044   A046               MOV      R8,R4
    119              loops  = nblks - 1u;
   \   00000046   681E               SUBS     R0,R5,#+1
   \   00000048   0090               STR      R0,[SP, #+0]
    120              for (i = 0u; i < loops; i++) {
   \   0000004A   0020               MOVS     R0,#+0
   \   0000004C   8246               MOV      R10,R0

⌨️ 快捷键说明

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