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 BYTE 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 ****************************************************************************/
89 #if ((DEV_SYSTEM & _DEV_64BIT_SUPPORT_) == 0)
91 #error 'ERROR: development system does not support 64 bit operations!'
95 //---------------------------------------------------------------------------
97 //---------------------------------------------------------------------------
99 //---------------------------------------------------------------------------
101 //---------------------------------------------------------------------------
107 #if (TARGET_SYSTEM == _WIN32_)
108 #if defined(INLINE_FUNCTION_DEF)
109 #undef INLINE_FUNCTION
110 #define INLINE_FUNCTION INLINE_FUNCTION_DEF
111 #define INLINE_ENABLED TRUE
112 #define EPL_AMI_INLINED
113 #include "../EplStack/amix86.c"
116 #elif (TARGET_SYSTEM == _LINUX_)
117 #if defined(__m68k__) // it is an big endian machine
118 #if defined(INLINE_FUNCTION_DEF)
119 #undef INLINE_FUNCTION
120 #define INLINE_FUNCTION INLINE_FUNCTION_DEF
121 #define INLINE_ENABLED TRUE
122 #define EPL_AMI_INLINED
123 #include "../EplStack/amibe.c"
128 //---------------------------------------------------------------------------
132 // To save code space the function AmiSetByte is replaced by
134 // void PUBLIC AmiSetByte (void FAR* pAddr_p, BYTE bByteVal_p);
136 #define AmiSetByteToBe(pAddr_p, bByteVal_p) {*(BYTE FAR*)(pAddr_p) = (bByteVal_p);}
137 #define AmiSetByteToLe(pAddr_p, bByteVal_p) {*(BYTE FAR*)(pAddr_p) = (bByteVal_p);}
139 #if !defined(INLINE_ENABLED)
140 void PUBLIC
AmiSetWordToBe(void FAR
* pAddr_p
, WORD wWordVal_p
);
141 void PUBLIC
AmiSetDwordToBe(void FAR
* pAddr_p
, DWORD dwDwordVal_p
);
142 void PUBLIC
AmiSetWordToLe(void FAR
* pAddr_p
, WORD wWordVal_p
);
143 void PUBLIC
AmiSetDwordToLe(void FAR
* pAddr_p
, DWORD dwDwordVal_p
);
146 //---------------------------------------------------------------------------
150 // To save code space the function AmiGetByte is replaced by
152 // BYTE PUBLIC AmiGetByte (void FAR* pAddr_p);
154 #define AmiGetByteFromBe(pAddr_p) (*(BYTE FAR*)(pAddr_p))
155 #define AmiGetByteFromLe(pAddr_p) (*(BYTE FAR*)(pAddr_p))
157 #if !defined(INLINE_ENABLED)
159 WORD PUBLIC
AmiGetWordFromBe(void FAR
* pAddr_p
);
160 DWORD PUBLIC
AmiGetDwordFromBe(void FAR
* pAddr_p
);
161 WORD PUBLIC
AmiGetWordFromLe(void FAR
* pAddr_p
);
162 DWORD PUBLIC
AmiGetDwordFromLe(void FAR
* pAddr_p
);
164 //---------------------------------------------------------------------------
166 // Function: AmiSetDword24()
168 // Description: sets a 24 bit value to a buffer
170 // Parameters: pAddr_p = pointer to destination buffer
171 // dwDwordVal_p = value to set
175 //---------------------------------------------------------------------------
177 void PUBLIC
AmiSetDword24ToBe(void FAR
* pAddr_p
, DWORD dwDwordVal_p
);
178 void PUBLIC
AmiSetDword24ToLe(void FAR
* pAddr_p
, DWORD dwDwordVal_p
);
180 //---------------------------------------------------------------------------
182 // Function: AmiGetDword24()
184 // Description: reads a 24 bit value from a buffer
186 // Parameters: pAddr_p = pointer to source buffer
188 // Return: DWORD = read value
190 //---------------------------------------------------------------------------
192 DWORD PUBLIC
AmiGetDword24FromBe(void FAR
* pAddr_p
);
193 DWORD PUBLIC
AmiGetDword24FromLe(void FAR
* pAddr_p
);
197 //---------------------------------------------------------------------------
199 // Function: AmiSetQword40()
201 // Description: sets a 40 bit value to a buffer
203 // Parameters: pAddr_p = pointer to destination buffer
204 // qwQwordVal_p = quadruple word value
208 //---------------------------------------------------------------------------
210 void PUBLIC
AmiSetQword40ToBe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
211 void PUBLIC
AmiSetQword40ToLe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
213 //---------------------------------------------------------------------------
215 // Function: AmiGetQword40()
217 // Description: reads a 40 bit value from a buffer
219 // Parameters: pAddr_p = pointer to source buffer
223 //---------------------------------------------------------------------------
225 QWORD PUBLIC
AmiGetQword40FromBe(void FAR
* pAddr_p
);
226 QWORD PUBLIC
AmiGetQword40FromLe(void FAR
* pAddr_p
);
228 //---------------------------------------------------------------------------
230 // Function: AmiSetQword48()
232 // Description: sets a 48 bit value to a buffer
234 // Parameters: pAddr_p = pointer to destination buffer
235 // qwQwordVal_p = quadruple word value
239 //---------------------------------------------------------------------------
241 void PUBLIC
AmiSetQword48ToBe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
242 void PUBLIC
AmiSetQword48ToLe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
244 //---------------------------------------------------------------------------
246 // Function: AmiGetQword48()
248 // Description: reads a 48 bit value from a buffer
250 // Parameters: pAddr_p = pointer to source buffer
254 //---------------------------------------------------------------------------
256 QWORD PUBLIC
AmiGetQword48FromBe(void FAR
* pAddr_p
);
257 QWORD PUBLIC
AmiGetQword48FromLe(void FAR
* pAddr_p
);
259 //---------------------------------------------------------------------------
261 // Function: AmiSetQword56()
263 // Description: sets a 56 bit value to a buffer
265 // Parameters: pAddr_p = pointer to destination buffer
266 // qwQwordVal_p = quadruple word value
270 //---------------------------------------------------------------------------
272 void PUBLIC
AmiSetQword56ToBe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
273 void PUBLIC
AmiSetQword56ToLe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
275 //---------------------------------------------------------------------------
277 // Function: AmiGetQword56()
279 // Description: reads a 56 bit value from a buffer
281 // Parameters: pAddr_p = pointer to source buffer
285 //---------------------------------------------------------------------------
287 QWORD PUBLIC
AmiGetQword56FromBe(void FAR
* pAddr_p
);
288 QWORD PUBLIC
AmiGetQword56FromLe(void FAR
* pAddr_p
);
290 //---------------------------------------------------------------------------
292 // Function: AmiSetQword64()
294 // Description: sets a 64 bit value to a buffer
296 // Parameters: pAddr_p = pointer to destination buffer
297 // qwQwordVal_p = quadruple word value
301 //---------------------------------------------------------------------------
303 void PUBLIC
AmiSetQword64ToBe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
304 void PUBLIC
AmiSetQword64ToLe(void FAR
* pAddr_p
, QWORD qwQwordVal_p
);
306 //---------------------------------------------------------------------------
308 // Function: AmiGetQword64()
310 // Description: reads a 64 bit value from a buffer
312 // Parameters: pAddr_p = pointer to source buffer
316 //---------------------------------------------------------------------------
318 QWORD PUBLIC
AmiGetQword64FromBe(void FAR
* pAddr_p
);
319 QWORD PUBLIC
AmiGetQword64FromLe(void FAR
* pAddr_p
);
321 //---------------------------------------------------------------------------
323 // Function: AmiSetTimeOfDay()
325 // Description: sets a TIME_OF_DAY (CANopen) value to a buffer
327 // Parameters: pAddr_p = pointer to destination buffer
328 // pTimeOfDay_p = pointer to struct TIME_OF_DAY
332 //---------------------------------------------------------------------------
334 void PUBLIC
AmiSetTimeOfDay(void FAR
* pAddr_p
,
335 tTimeOfDay FAR
* pTimeOfDay_p
);
337 //---------------------------------------------------------------------------
339 // Function: AmiGetTimeOfDay()
341 // Description: reads a TIME_OF_DAY (CANopen) value from a buffer
343 // Parameters: pAddr_p = pointer to source buffer
344 // pTimeOfDay_p = pointer to struct TIME_OF_DAY
348 //---------------------------------------------------------------------------
350 void PUBLIC
AmiGetTimeOfDay(void FAR
* pAddr_p
,
351 tTimeOfDay FAR
* pTimeOfDay_p
);
355 #undef INLINE_ENABLED // disable actual inlining of functions
356 #define EPL_AMI_INCLUDED
361 #endif // ifndef _EPLAMI_H_
362 // 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).