DSMCC  15.3.1
source/dscore/src/defMemUtilsMgd.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  * Copyright © 2001 Koninklijke Philips Electronics N.V
00005  *
00006  * This file is part of a DTVKit Software Component
00007  * You are permitted to copy, modify or distribute this file subject to the terms
00008  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00009  * 
00010  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00011  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00012  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  * If you or your organisation is not a member of DTVKit then you have access
00015  * to this source code outside of the terms of the licence agreement
00016  * and you are expected to delete this and any associated files immediately.
00017  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00018  *******************************************************************************/
00025 #ifdef MEM_CONTIGUOUS
00026 
00027     /*
00028     -- Managed memory is CONTIGUOUS so can access via standard pointer
00029     -- manipulation
00030     */
00031     #include "defMemUtilsContig.h"
00032 
00033 #else
00034 
00035     /* -- SET STANDARD MACROS TO ACCESS MANAGED/MEMSEQ MEMORY */
00036 
00037     #undef  MemPtr
00038     #undef  MemPos
00039     #undef  MEMPTR_SEQ_OPEN
00040     #undef  MEMPTR_SEQ_CLOSE
00041     #undef  MEMPTR_OPEN
00042     #undef  MEMPTR_CLOSE
00043     #undef  MEMPTR_GET_DIFF
00044     #undef  MEMPTR_DATA_COMPARE
00045     #undef  MEMPTR_READ
00046     #undef  MEMPTR_WRITE
00047     #undef  MEMPTR_COPY
00048     #undef  SET_POS_REL
00049     #undef  SET_POS_ABS
00050     #undef  GET_POS
00051     #undef  READ_UINT8
00052     #undef  READ_UINT16
00053     #undef  READ_UINT32
00054     #undef  GET_UINT8
00055     #undef  GET_UINT16
00056     #undef  GET_UINT32
00057     #undef  READ_OBJECT_KEY
00058 
00059 
00060     #define MemPtr  MemSeqRef
00061     #define MemPos  U32BIT
00062 
00063     #define MEMPTR_SEQ_OPEN( context, memArea, offset, length, async, memPtr )\
00064         CHECK_MEM_ERR(                                                        \
00065             memSeqOpen(context, memArea, offset, length, async, &(memPtr) ))
00066 
00067     #define MEMPTR_SEQ_CLOSE( context, memArea, memPtr )    \
00068         memSeqClose( memPtr )
00069 
00070     #define MEMPTR_OPEN( seqMemPtr, memPtr )                \
00071         CHECK_MEM_ERR(memSeqOpenClone( seqMemPtr, &(memPtr) ))
00072 
00073     #define MEMPTR_CLOSE( memPtr )  memSeqClose( memPtr )
00074 
00075     #define MEMPTR_GET_DIFF( memPtr1, memPtr2, i32 )        \
00076         {                                                   \
00077             U32BIT  pos1, pos2;                             \
00078             memSeqReadPos( memPtr1, &(pos1) );                \
00079             memSeqReadPos( memPtr2, &(pos2) );                \
00080             i32 = pos2 - pos1;                              \
00081         }
00082 
00083     #define MEMPTR_DATA_COMPARE( ui8Ptr, memPtr, length, equal )                    \
00084         CHECK_MEM_ERR(memSeqCompContig( ui8Ptr, memPtr, length, &(equal) ))
00085 
00086     #define MEMPTR_READ( srcMemPtr, destUi8Ptr, numbytes )                          \
00087         {                                                                           \
00088             U32BIT dummy;                                                           \
00089             CHECK_MEM_ERR(memSeqRead( srcMemPtr, destUi8Ptr, numbytes, &dummy ));   \
00090         }
00091 
00092     #define MEMPTR_WRITE( srcUi8Ptr, destMemPtr, numbytes )                         \
00093         {                                                                           \
00094             U32BIT dummy;                                                           \
00095             CHECK_MEM_ERR(memSeqWrite( srcUi8Ptr, destMemPtr, numbytes, &dummy ));  \
00096         }
00097 
00098     #define MEMPTR_COPY( srcMemPtr, destMemPtr, numbytes )                          \
00099         {                                                                           \
00100             U32BIT dummy;                                                           \
00101             CHECK_MEM_ERR(memSeqCopy( srcMemPtr, destMemPtr, numbytes, &dummy ));   \
00102         }
00103 
00104     #define SET_POS_REL( memPtr, offset )                   \
00105         CHECK_MEM_ERR(memSeqSetPosRel( memPtr, offset ))
00106 
00107     #define SET_POS_ABS( memPtr, memPos )                   \
00108         CHECK_MEM_ERR(memSeqSetPosAbs( memPtr, memPos ))
00109 
00110     #define GET_POS( memPtr, memPos )                       \
00111         memSeqReadPos( memPtr, &(memPos) )
00112 
00113     #define READ_UINT8( memPtr, ui8 )                       \
00114         CHECK_MEM_ERR(memSeqReadByte( memPtr, &(ui8) ))
00115 
00116     #define READ_UINT16( memPtr, ui16 )     readUInt16Seq( memPtr, &(ui16) )
00117     #define READ_UINT32( memPtr, ui32 )     readUInt32Seq( memPtr, &(ui32) )
00118     #define GET_UINT8( memPtr, ui8 )        getUInt8Seq( memPtr, &(ui8) )
00119     #define GET_UINT16( memPtr, ui16 )      getUInt16Seq( memPtr, &(ui16) )
00120     #define GET_UINT32( memPtr, ui32 )      getUInt32Seq( memPtr, &(ui32) )
00121 
00122     #define READ_OBJECT_KEY( memPtr, objKey, valid )          \
00123         readObjectKeySeq( memPtr, &(objKey), &(valid) )
00124 
00125 
00126 #endif
00127 
00128 /*----------------------------------------------------------------------------*/
00129 
 All Data Structures Files Functions Typedefs