DSMCC  17.9.0
 All Data Structures Files Functions Typedefs
defMemUtilsMgd.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  * Copyright © 2001 Koninklijke Philips Electronics N.V
5  *
6  * This file is part of a DTVKit Software Component
7  * You are permitted to copy, modify or distribute this file subject to the terms
8  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
9  *
10  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * If you or your organisation is not a member of DTVKit then you have access
15  * to this source code outside of the terms of the licence agreement
16  * and you are expected to delete this and any associated files immediately.
17  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
18  *******************************************************************************/
25 #ifdef MEM_CONTIGUOUS
26 
27 /*
28 -- Managed memory is CONTIGUOUS so can access via standard pointer
29 -- manipulation
30 */
31  #include "defMemUtilsContig.h"
32 
33 #else
34 
35 /* -- SET STANDARD MACROS TO ACCESS MANAGED/MEMSEQ MEMORY */
36 
37  #undef MemPtr
38  #undef MemPos
39  #undef MEMPTR_SEQ_OPEN
40  #undef MEMPTR_SEQ_CLOSE
41  #undef MEMPTR_OPEN
42  #undef MEMPTR_CLOSE
43  #undef MEMPTR_GET_DIFF
44  #undef MEMPTR_DATA_COMPARE
45  #undef MEMPTR_READ
46  #undef MEMPTR_WRITE
47  #undef MEMPTR_COPY
48  #undef SET_POS_REL
49  #undef SET_POS_ABS
50  #undef GET_POS
51  #undef READ_UINT8
52  #undef READ_UINT16
53  #undef READ_UINT32
54  #undef GET_UINT8
55  #undef GET_UINT16
56  #undef GET_UINT32
57  #undef READ_OBJECT_KEY
58 
59 
60  #define MemPtr MemSeqRef
61  #define MemPos U32BIT
62 
63  #define MEMPTR_SEQ_OPEN( context, memArea, offset, length, async, memPtr ) \
64  CHECK_MEM_ERR( \
65  memSeqOpen(context, memArea, offset, length, async, &(memPtr)))
66 
67  #define MEMPTR_SEQ_CLOSE( context, memArea, memPtr ) \
68  memSeqClose( memPtr )
69 
70  #define MEMPTR_OPEN( seqMemPtr, memPtr ) \
71  CHECK_MEM_ERR(memSeqOpenClone( seqMemPtr, &(memPtr)))
72 
73  #define MEMPTR_CLOSE( memPtr ) memSeqClose( memPtr )
74 
75  #define MEMPTR_GET_DIFF( memPtr1, memPtr2, i32 ) \
76  { \
77  U32BIT pos1, pos2; \
78  memSeqReadPos( memPtr1, &(pos1)); \
79  memSeqReadPos( memPtr2, &(pos2)); \
80  i32 = pos2 - pos1; \
81  }
82 
83  #define MEMPTR_DATA_COMPARE( ui8Ptr, memPtr, length, equal ) \
84  CHECK_MEM_ERR(memSeqCompContig( ui8Ptr, memPtr, length, &(equal)))
85 
86  #define MEMPTR_READ( srcMemPtr, destUi8Ptr, numbytes ) \
87  { \
88  U32BIT dummy; \
89  CHECK_MEM_ERR(memSeqRead( srcMemPtr, destUi8Ptr, numbytes, &dummy )); \
90  }
91 
92  #define MEMPTR_WRITE( srcUi8Ptr, destMemPtr, numbytes ) \
93  { \
94  U32BIT dummy; \
95  CHECK_MEM_ERR(memSeqWrite( srcUi8Ptr, destMemPtr, numbytes, &dummy )); \
96  }
97 
98  #define MEMPTR_COPY( srcMemPtr, destMemPtr, numbytes ) \
99  { \
100  U32BIT dummy; \
101  CHECK_MEM_ERR(memSeqCopy( srcMemPtr, destMemPtr, numbytes, &dummy )); \
102  }
103 
104  #define SET_POS_REL( memPtr, offset ) \
105  CHECK_MEM_ERR(memSeqSetPosRel( memPtr, offset ))
106 
107  #define SET_POS_ABS( memPtr, memPos ) \
108  CHECK_MEM_ERR(memSeqSetPosAbs( memPtr, memPos ))
109 
110  #define GET_POS( memPtr, memPos ) \
111  memSeqReadPos( memPtr, &(memPos))
112 
113  #define READ_UINT8( memPtr, ui8 ) \
114  CHECK_MEM_ERR(memSeqReadByte( memPtr, &(ui8)))
115 
116  #define READ_UINT16( memPtr, ui16 ) readUInt16Seq( memPtr, &(ui16))
117  #define READ_UINT32( memPtr, ui32 ) readUInt32Seq( memPtr, &(ui32))
118  #define GET_UINT8( memPtr, ui8 ) getUInt8Seq( memPtr, &(ui8))
119  #define GET_UINT16( memPtr, ui16 ) getUInt16Seq( memPtr, &(ui16))
120  #define GET_UINT32( memPtr, ui32 ) getUInt32Seq( memPtr, &(ui32))
121 
122  #define READ_OBJECT_KEY( memPtr, objKey, valid ) \
123  readObjectKeySeq( memPtr, &(objKey), &(valid))
124 
125 
126 #endif
127 
128 /*----------------------------------------------------------------------------*/
129 
Defines memory access utils to work with contiguous memory.