HID: fix bus endianity in file2alias
[linux-2.6/mini2440.git] / drivers / staging / epl / EplAmi.h
blob6fa04a4f0a130978395d74680c7f590a5cc4c32a
1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
6 Project: openPOWERLINK
8 Description: Definitions for Abstract Memory Interface
10 License:
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions
14 are met:
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.
41 Severability Clause:
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 $
54 $Author: D.Krueger $
56 $Revision: 1.2 $ $Date: 2008/04/17 21:36:32 $
58 $State: Exp $
60 Build Environment:
61 GCC
63 -------------------------------------------------------------------------
65 Revision History:
67 06.03.2000 -rs
68 Implementation
70 16.09.2002 -as
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
74 functions.
76 23.02.2005 r.d.:
77 Functions included for extended data types such as UNSIGNED24,
78 UNSIGNED40, ...
80 13.06.2006 d.k.:
81 Extended the interface for EPL with the different functions
82 for little endian and big endian
84 ****************************************************************************/
86 #ifndef _EPLAMI_H_
87 #define _EPLAMI_H_
89 #if ((DEV_SYSTEM & _DEV_64BIT_SUPPORT_) == 0)
90 // #ifdef USE_VAR64
91 #error 'ERROR: development system does not support 64 bit operations!'
92 // #endif
93 #endif
95 //---------------------------------------------------------------------------
96 // types
97 //---------------------------------------------------------------------------
99 //---------------------------------------------------------------------------
100 // Prototypen
101 //---------------------------------------------------------------------------
103 #ifdef __cplusplus
104 extern "C" {
105 #endif
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"
114 #endif
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"
124 #endif
125 #endif
126 #endif
128 //---------------------------------------------------------------------------
130 // write functions
132 // To save code space the function AmiSetByte is replaced by
133 // an macro.
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);
144 #endif
146 //---------------------------------------------------------------------------
148 // read functions
150 // To save code space the function AmiGetByte is replaced by
151 // an macro.
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
173 // Return: void
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);
195 //#ifdef USE_VAR64
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
206 // Return: void
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
221 // Return: QWORD
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
237 // Return: void
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
252 // Return: QWORD
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
268 // Return: void
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
283 // Return: QWORD
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
299 // Return: void
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
314 // Return: void
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
330 // Return: void
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
346 // Return: void
348 //---------------------------------------------------------------------------
350 void PUBLIC AmiGetTimeOfDay(void FAR * pAddr_p,
351 tTimeOfDay FAR * pTimeOfDay_p);
353 #endif
355 #undef INLINE_ENABLED // disable actual inlining of functions
356 #define EPL_AMI_INCLUDED
358 #ifdef __cplusplus
360 #endif
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).