📄 lib_mem.h
字号:
/*
*********************************************************************************************************
* uC/LIB
* CUSTOM LIBRARY MODULES
*
* (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL
*
* All rights reserved. Protected by international copyright laws.
*
* uC/LIB is provided in source form to registered licensees ONLY. It is
* illegal to distribute this source code to any third party unless you receive
* written permission by an authorized Micrium representative. Knowledge of
* the source code may NOT be used to develop a similar product.
*
* Please help us continue to provide the Embedded community with the finest
* software available. Your honesty is greatly appreciated.
*
* You can contact us at www.micrium.com.
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* STANDARD MEMORY OPERATIONS
*
* Filename : lib_mem.h
* Version : V1.35.00
* Programmer(s) : ITJ
*********************************************************************************************************
* Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software.
*
* (a) ALL standard library functions are implemented in the custom library modules :
*
* (1) \<Custom Library Directory>\lib_*.*
*
* (2) \<Custom Library Directory>\Ports\<cpu>\<compiler>\lib*_a.*
*
* where
* <Custom Library Directory> directory path for custom library software
* <cpu> directory name for specific processor (CPU)
* <compiler> directory name for specific compiler
*
* (b) Product-specific library functions are implemented in individual products.
*
* (2) Assumes the following versions (or more recent) of software modules are included in
* the project build :
*
* (a) uC/CPU V1.27
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*
* Note(s) : (1) This memory library header file is protected from multiple pre-processor inclusion through
* use of the memory library module present pre-processor macro definition.
*********************************************************************************************************
*/
#ifndef LIB_MEM_MODULE_PRESENT /* See Note #1. */
#define LIB_MEM_MODULE_PRESENT
/*$PAGE*/
/*
*********************************************************************************************************
* INCLUDE FILES
*
* Note(s) : (1) The custom library software files are located in the following directories :
*
* (a) \<Your Product Application>\app_cfg.h
*
* (b) \<Custom Library Directory>\lib_*.*
*
* where
* <Your Product Application> directory path for Your Product's Application
* <Custom Library Directory> directory path for custom library software
*
* (2) CPU-configuration software files are located in the following directories :
*
* (a) \<CPU-Compiler Directory>\cpu_*.*
* (b) \<CPU-Compiler Directory>\<cpu>\<compiler>\cpu*.*
*
* where
* <CPU-Compiler Directory> directory path for common CPU-compiler software
* <cpu> directory name for specific processor (CPU)
* <compiler> directory name for specific compiler
*
* (3) Compiler MUST be configured to include as additional include path directories :
*
* (a) '\<Your Product Application>\' directory See Note #1a
*
* (b) '\<Custom Library Directory>\' directory See Note #1b
*
* (c) (1) '\<CPU-Compiler Directory>\' directory See Note #2a
* (2) '\<CPU-Compiler Directory>\<cpu>\<compiler>\' directory See Note #2b
*
* (4) NO compiler-supplied standard library functions SHOULD be used.
*********************************************************************************************************
*/
#include <cpu.h>
#include <cpu_core.h>
#include <lib_def.h>
#include <app_cfg.h>
/*
*********************************************************************************************************
* EXTERNS
*********************************************************************************************************
*/
#ifdef LIB_MEM_MODULE
#define LIB_MEM_EXT
#else
#define LIB_MEM_EXT extern
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* DEFAULT CONFIGURATION
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MEMORY LIBRARY ARGUMENT CHECK CONFIGURATION
*
* Note(s) : (1) Configure LIB_MEM_CFG_ARG_CHK_EXT_EN to enable/disable the memory library suite external
* argument check feature :
*
* (a) When ENABLED, arguments received from any port interface provided by the developer
* or application are checked/validated.
*
* (b) When DISABLED, NO arguments received from any port interface provided by the developer
* or application are checked/validated.
*********************************************************************************************************
*/
/* Configure external argument check feature (see Note #1) : */
#ifndef LIB_MEM_CFG_ARG_CHK_EXT_EN
#define LIB_MEM_CFG_ARG_CHK_EXT_EN DEF_DISABLED
/* DEF_DISABLED Argument check DISABLED */
/* DEF_ENABLED Argument check ENABLED */
#endif
/*
*********************************************************************************************************
* MEMORY LIBRARY ASSEMBLY OPTIMIZATION CONFIGURATION
*
* Note(s) : (1) Configure LIB_MEM_CFG_OPTIMIZE_ASM_EN to enable/disable assembly-optimized memory functions.
*********************************************************************************************************
*/
/* Configure assembly-optimized function(s) [see Note #1] : */
#ifndef LIB_MEM_CFG_OPTIMIZE_ASM_EN
#define LIB_MEM_CFG_OPTIMIZE_ASM_EN DEF_DISABLED
/* DEF_DISABLED Assembly-optimized function(s) DISABLED */
/* DEF_ENABLED Assembly-optimized function(s) ENABLED */
#endif
/*
*********************************************************************************************************
* MEMORY ALLOCATION CONFIGURATION
*
* Note(s) : (1) Configure LIB_MEM_CFG_ALLOC_EN to enable/disable memory allocation functions.
*********************************************************************************************************
*/
/* Configure memory allocation feature (see Note #1) : */
#ifndef LIB_MEM_CFG_ALLOC_EN
#define LIB_MEM_CFG_ALLOC_EN DEF_DISABLED
/* DEF_DISABLED Memory allocation DISABLED */
/* DEF_ENABLED Memory allocation ENABLED */
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LIBRARY MEMORY ERROR CODES
*********************************************************************************************************
*/
#define LIB_MEM_ERR_NONE 10000u
#define LIB_MEM_ERR_NULL_PTR 10001u /* Ptr arg(s) passed NULL ptr(s). */
#define LIB_MEM_ERR_INVALID_MEM_SIZE 10100u /* Invalid mem size. */
#define LIB_MEM_ERR_INVALID_MEM_ALIGN 10101u /* Invalid mem align. */
#define LIB_MEM_ERR_INVALID_SEG_SIZE 10110u /* Invalid mem seg size. */
#define LIB_MEM_ERR_INVALID_SEG_OVERLAP 10111u /* Invalid mem seg overlaps other mem seg(s). */
#define LIB_MEM_ERR_INVALID_POOL 10120u /* Invalid mem pool. */
#define LIB_MEM_ERR_INVALID_BLK_NBR 10130u /* Invalid mem pool blk nbr. */
#define LIB_MEM_ERR_INVALID_BLK_SIZE 10131u /* Invalid mem pool blk size. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -