Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

MemoryOS.h

Go to the documentation of this file.
00001 /** 
00002  *  @file   MemoryOS.h
00003  *
00004  *  @brief      Memory abstraction APIs for local memory allocation.
00005  *
00006  *              This provides a direct access to local memory allocation, which
00007  *              does not require creation of a Heap.
00008  *
00009  *
00010  *  @ver        02.00.00.68_beta1
00011  *  
00012  *  ============================================================================
00013  *  
00014  *  Copyright (c) 2008-2009, Texas Instruments Incorporated
00015  *
00016  *  Redistribution and use in source and binary forms, with or without
00017  *  modification, are permitted provided that the following conditions
00018  *  are met:
00019  *  
00020  *  *  Redistributions of source code must retain the above copyright
00021  *     notice, this list of conditions and the following disclaimer.
00022  *  
00023  *  *  Redistributions in binary form must reproduce the above copyright
00024  *     notice, this list of conditions and the following disclaimer in the
00025  *     documentation and/or other materials provided with the distribution.
00026  *  
00027  *  *  Neither the name of Texas Instruments Incorporated nor the names of
00028  *     its contributors may be used to endorse or promote products derived
00029  *     from this software without specific prior written permission.
00030  *  
00031  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00032  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00033  *  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00034  *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00035  *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00036  *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00037  *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00038  *  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00039  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00040  *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00041  *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00042  *  Contact information for paper mail:
00043  *  Texas Instruments
00044  *  Post Office Box 655303
00045  *  Dallas, Texas 75265
00046  *  Contact information: 
00047  *  http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
00048  *  DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
00049  *  ============================================================================
00050  *  
00051  */
00052 
00053 
00054 #ifndef MEMORYOS_H_0x97D2
00055 #define MEMORYOS_H_0x97D2
00056 
00057 /* OSAL and utils */
00058 #include <ti/syslink/utils/MemoryDefs.h>
00059 
00060 #if defined (__cplusplus)
00061 extern "C" {
00062 #endif
00063 
00064 /*!
00065  *  @def    MEMORYOS_MODULEID
00066  *  @brief  Module ID for Memory OSAL module.
00067  */
00068 #define MEMORYOS_MODULEID                 (UInt16) 0x97D2
00069 
00070 /* =============================================================================
00071  *  All success and failure codes for the module
00072  * =============================================================================
00073  */
00074 /*!
00075  * @def   MEMORYOS_STATUSCODEBASE
00076  * @brief Stauts code base for MEMORY module.
00077  */
00078 #define MEMORYOS_STATUSCODEBASE            (MEMORYOS_MODULEID << 12u)
00079 
00080 /*!
00081  * @def   MEMORYOS_MAKE_FAILURE
00082  * @brief Convert to failure code.
00083  */
00084 #define MEMORYOS_MAKE_FAILURE(x)          ((Int) (0x80000000  \
00085                                            + (MEMORYOS_STATUSCODEBASE + (x))))
00086 /*!
00087  * @def   MEMORYOS_MAKE_SUCCESS
00088  * @brief Convert to success code.
00089  */
00090 #define MEMORYOS_MAKE_SUCCESS(x)            (MEMORYOS_STATUSCODEBASE + (x))
00091 
00092 /*!
00093  * @def   MEMORYOS_E_MEMORY
00094  * @brief Indicates Memory alloc/free failure.
00095  */
00096 #define MEMORYOS_E_MEMORY                   MEMORYOS_MAKE_FAILURE(1)
00097 
00098 /*!
00099  * @def   MEMORYOS_E_INVALIDARG
00100  * @brief Invalid argument provided.
00101  */
00102 #define MEMORYOS_E_INVALIDARG               MEMORYOS_MAKE_FAILURE(2)
00103 
00104 /*!
00105  * @def   MEMORYOS_E_MAP
00106  * @brief Failed to map to host address space.
00107  */
00108 #define MEMORYOS_E_MAP                      MEMORYOS_MAKE_FAILURE(3)
00109 
00110 /*!
00111  * @def   MEMORYOS_E_UNMAP
00112  * @brief Failed to unmap from host address space.
00113  */
00114 #define MEMORYOS_E_UNMAP                    MEMORYOS_MAKE_FAILURE(4)
00115 
00116 /*!
00117  * @def   MEMORYOS_E_INVALIDSTATE
00118  * @brief Module is in invalidstate.
00119  */
00120 #define MEMORYOS_E_INVALIDSTATE             MEMORYOS_MAKE_FAILURE(5)
00121 
00122 /*!
00123  * @def   MEMORYOS_E_FAIL
00124  * @brief Genral failure.
00125  */
00126 #define MEMORYOS_E_FAIL                     MEMORYOS_MAKE_FAILURE(6)
00127 
00128 /*!
00129  * @def   MEMORYOS_SUCCESS
00130  * @brief Operation successfully completed
00131  */
00132 #define MEMORYOS_SUCCESS                    MEMORYOS_MAKE_SUCCESS(0)
00133 
00134 /*!
00135  * @def   MEMORYOS_S_ALREADYSETUP
00136  * @brief Module already initialized
00137  */
00138 #define MEMORYOS_S_ALREADYSETUP             MEMORYOS_MAKE_SUCCESS(1)
00139 
00140 
00141 /* =============================================================================
00142  *  Macros and types
00143  *  See MemoryDefs.h
00144  * =============================================================================
00145  */
00146 /* =============================================================================
00147  *  APIs
00148  * =============================================================================
00149  */
00150 /* Initialize the memory os module. */
00151 Int32 MemoryOS_setup (void);
00152 
00153 /* Finalize the memory os module. */
00154 Int32 MemoryOS_destroy (void);
00155 
00156 /* Allocates the specified number of bytes of type specified through flags. */
00157 Ptr MemoryOS_alloc (UInt32 size, UInt32 align, UInt32 flags);
00158 
00159 /* Allocates the specified number of bytes and memory is set to zero. */
00160 Ptr MemoryOS_calloc (UInt32 size, UInt32 align, UInt32 flags);
00161 
00162 /* Frees local memory */
00163 Void MemoryOS_free (Ptr ptr, UInt32 size, UInt32 flags);
00164 
00165 /* Maps a memory area into virtual space. */
00166 Int MemoryOS_map (Memory_MapInfo * mapInfo);
00167 
00168 /* UnMaps a memory area into virtual space. */
00169 Int MemoryOS_unmap (Memory_UnmapInfo * unmapInfo);
00170 
00171 /* Copies the data between memory areas. Returns the number of bytes copied. */
00172 Ptr MemoryOS_copy (Ptr dst, Ptr src, UInt32 len);
00173 
00174 /* Set the specified values to the allocated  memory area */
00175 Ptr MemoryOS_set (Ptr buf, Int value, UInt32 len);
00176 
00177 /* Translate API */
00178 Ptr MemoryOS_translate (Ptr srcAddr, Memory_XltFlags flags);
00179 
00180 /* TBD: Add APIs for Memory_move, Scatter-Gather & translateAddr. */
00181 
00182 
00183 #if defined (__cplusplus)
00184 }
00185 #endif /* defined (__cplusplus) */
00186 
00187 #endif /* ifndef MEMORYOS_H_0x97D2 */

Generated on Mon Mar 14 11:59:45 2011 for Syslink by  doxygen 1.4.4