1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
8 Description: Definitions for Abstract Memory Interface
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
16 1. Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
23 3. Neither the name of SYSTEC electronic GmbH nor the names of its
24 contributors may be used to endorse or promote products derived
25 from this software without prior written permission. For written
26 permission, please contact info@systec-electronic.com.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 POSSIBILITY OF SUCH DAMAGE.
43 If a provision of this License is or becomes illegal, invalid or
44 unenforceable in any jurisdiction, that shall not affect:
45 1. the validity or enforceability in that jurisdiction of any other
46 provision of this License; or
47 2. the validity or enforceability in other jurisdictions of that or
48 any other provision of this License.
50 -------------------------------------------------------------------------
52 $RCSfile: EplAmi.h,v $
56 $Revision: 1.2 $ $Date: 2008/04/17 21:36:32 $
63 -------------------------------------------------------------------------
71 To save code space the functions AmiSetByte and AmiGetByte
72 are replaced by macros. For targets which assign u8 by
73 an 16Bit type, the definition of macros must changed to
77 Functions included for extended data types such as UNSIGNED24,
81 Extended the interface for EPL with the different functions
82 for little endian and big endian
84 ****************************************************************************/
90 //---------------------------------------------------------------------------
92 //---------------------------------------------------------------------------
94 //---------------------------------------------------------------------------
96 //---------------------------------------------------------------------------
102 //---------------------------------------------------------------------------
106 // To save code space the function AmiSetByte is replaced by
108 // void AmiSetByte (void * pAddr_p, u8 bByteVal_p);
110 #define AmiSetByteToBe(pAddr_p, bByteVal_p) {*(u8 *)(pAddr_p) = (bByteVal_p);}
111 #define AmiSetByteToLe(pAddr_p, bByteVal_p) {*(u8 *)(pAddr_p) = (bByteVal_p);}
113 void AmiSetWordToBe(void *pAddr_p, u16 wWordVal_p);
114 void AmiSetDwordToBe(void *pAddr_p, u32 dwDwordVal_p);
115 void AmiSetWordToLe(void *pAddr_p, u16 wWordVal_p);
116 void AmiSetDwordToLe(void *pAddr_p, u32 dwDwordVal_p);
118 //---------------------------------------------------------------------------
122 // To save code space the function AmiGetByte is replaced by
124 // u8 AmiGetByte (void * pAddr_p);
126 #define AmiGetByteFromBe(pAddr_p) (*(u8 *)(pAddr_p))
127 #define AmiGetByteFromLe(pAddr_p) (*(u8 *)(pAddr_p))
129 u16 AmiGetWordFromBe(void *pAddr_p);
130 u32 AmiGetDwordFromBe(void *pAddr_p);
131 u16 AmiGetWordFromLe(void *pAddr_p);
132 u32 AmiGetDwordFromLe(void *pAddr_p);
134 //---------------------------------------------------------------------------
136 // Function: AmiSetDword24()
138 // Description: sets a 24 bit value to a buffer
140 // Parameters: pAddr_p = pointer to destination buffer
141 // dwDwordVal_p = value to set
145 //---------------------------------------------------------------------------
147 void AmiSetDword24ToBe(void *pAddr_p, u32 dwDwordVal_p);
148 void AmiSetDword24ToLe(void *pAddr_p, u32 dwDwordVal_p);
150 //---------------------------------------------------------------------------
152 // Function: AmiGetDword24()
154 // Description: reads a 24 bit value from a buffer
156 // Parameters: pAddr_p = pointer to source buffer
158 // Return: u32 = read value
160 //---------------------------------------------------------------------------
162 u32 AmiGetDword24FromBe(void *pAddr_p);
163 u32 AmiGetDword24FromLe(void *pAddr_p);
167 //---------------------------------------------------------------------------
169 // Function: AmiSetQword40()
171 // Description: sets a 40 bit value to a buffer
173 // Parameters: pAddr_p = pointer to destination buffer
174 // qwQwordVal_p = quadruple word value
178 //---------------------------------------------------------------------------
180 void AmiSetQword40ToBe(void *pAddr_p, u64 qwQwordVal_p);
181 void AmiSetQword40ToLe(void *pAddr_p, u64 qwQwordVal_p);
183 //---------------------------------------------------------------------------
185 // Function: AmiGetQword40()
187 // Description: reads a 40 bit value from a buffer
189 // Parameters: pAddr_p = pointer to source buffer
193 //---------------------------------------------------------------------------
195 u64 AmiGetQword40FromBe(void *pAddr_p);
196 u64 AmiGetQword40FromLe(void *pAddr_p);
198 //---------------------------------------------------------------------------
200 // Function: AmiSetQword48()
202 // Description: sets a 48 bit value to a buffer
204 // Parameters: pAddr_p = pointer to destination buffer
205 // qwQwordVal_p = quadruple word value
209 //---------------------------------------------------------------------------
211 void AmiSetQword48ToBe(void *pAddr_p, u64 qwQwordVal_p);
212 void AmiSetQword48ToLe(void *pAddr_p, u64 qwQwordVal_p);
214 //---------------------------------------------------------------------------
216 // Function: AmiGetQword48()
218 // Description: reads a 48 bit value from a buffer
220 // Parameters: pAddr_p = pointer to source buffer
224 //---------------------------------------------------------------------------
226 u64 AmiGetQword48FromBe(void *pAddr_p);
227 u64 AmiGetQword48FromLe(void *pAddr_p);
229 //---------------------------------------------------------------------------
231 // Function: AmiSetQword56()
233 // Description: sets a 56 bit value to a buffer
235 // Parameters: pAddr_p = pointer to destination buffer
236 // qwQwordVal_p = quadruple word value
240 //---------------------------------------------------------------------------
242 void AmiSetQword56ToBe(void *pAddr_p, u64 qwQwordVal_p);
243 void AmiSetQword56ToLe(void *pAddr_p, u64 qwQwordVal_p);
245 //---------------------------------------------------------------------------
247 // Function: AmiGetQword56()
249 // Description: reads a 56 bit value from a buffer
251 // Parameters: pAddr_p = pointer to source buffer
255 //---------------------------------------------------------------------------
257 u64 AmiGetQword56FromBe(void *pAddr_p);
258 u64 AmiGetQword56FromLe(void *pAddr_p);
260 //---------------------------------------------------------------------------
262 // Function: AmiSetQword64()
264 // Description: sets a 64 bit value to a buffer
266 // Parameters: pAddr_p = pointer to destination buffer
267 // qwQwordVal_p = quadruple word value
271 //---------------------------------------------------------------------------
273 void AmiSetQword64ToBe(void *pAddr_p, u64 qwQwordVal_p);
274 void AmiSetQword64ToLe(void *pAddr_p, u64 qwQwordVal_p);
276 //---------------------------------------------------------------------------
278 // Function: AmiGetQword64()
280 // Description: reads a 64 bit value from a buffer
282 // Parameters: pAddr_p = pointer to source buffer
286 //---------------------------------------------------------------------------
288 u64 AmiGetQword64FromBe(void *pAddr_p);
289 u64 AmiGetQword64FromLe(void *pAddr_p);
291 //---------------------------------------------------------------------------
293 // Function: AmiSetTimeOfDay()
295 // Description: sets a TIME_OF_DAY (CANopen) value to a buffer
297 // Parameters: pAddr_p = pointer to destination buffer
298 // pTimeOfDay_p = pointer to struct TIME_OF_DAY
302 //---------------------------------------------------------------------------
303 void AmiSetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p);
305 //---------------------------------------------------------------------------
307 // Function: AmiGetTimeOfDay()
309 // Description: reads a TIME_OF_DAY (CANopen) value from a buffer
311 // Parameters: pAddr_p = pointer to source buffer
312 // pTimeOfDay_p = pointer to struct TIME_OF_DAY
316 //---------------------------------------------------------------------------
317 void AmiGetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p);
322 #endif // ifndef _EPLAMI_H_
323 // Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler// damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).