ASoC: Remove duplicate ADC/DAC widgets from wm_hubs.c
[linux/fpc-iii.git] / drivers / staging / epl / amix86.c
blobd40ad918d3b9e540e21930a9940ec8b4f49781d0
1 /****************************************************************************
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
6 Project: openPOWERLINK
8 Description: Abstract Memory Interface for x86 compatible
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: amix86.c,v $
54 $Author: D.Krueger $
56 $Revision: 1.3 $ $Date: 2008/04/17 21:36:32 $
58 $State: Exp $
60 Build Environment:
61 ...
63 -------------------------------------------------------------------------
65 Revision History:
67 r.s.: first implemetation
69 2006-06-13 d.k.: duplicate functions for little endian and big endian
71 ****************************************************************************/
73 //#include "global.h"
74 //#include "EplAmi.h"
75 #include "EplInc.h"
77 //---------------------------------------------------------------------------
78 // typedef
79 //---------------------------------------------------------------------------
81 typedef struct {
82 u16 m_wWord;
84 } twStruct;
86 typedef struct {
87 u32 m_dwDword;
89 } tdwStruct;
91 typedef struct {
92 u64 m_qwQword;
94 } tqwStruct;
96 //=========================================================================//
97 // //
98 // P U B L I C F U N C T I O N S //
99 // //
100 //=========================================================================//
102 //---------------------------------------------------------------------------
104 // Function: AmiSetXXXToBe()
106 // Description: writes the specified value to the absolute address in
107 // big endian
109 // Parameters: pAddr_p = absolute address
110 // xXXXVal_p = value
112 // Returns: (none)
114 // State:
116 //---------------------------------------------------------------------------
118 //------------< write u8 in big endian >--------------------------
120 void AmiSetByteToBe (void *pAddr_p, u8 bByteVal_p)
123 *(u8 *)pAddr_p = bByteVal_p;
128 //------------< write u16 in big endian >--------------------------
130 void AmiSetWordToBe(void * pAddr_p, u16 wWordVal_p)
132 twStruct *pwStruct;
133 twStruct wValue;
135 wValue.m_wWord = (u16) ((wWordVal_p & 0x00FF) << 8); //LSB to MSB
136 wValue.m_wWord |= (u16) ((wWordVal_p & 0xFF00) >> 8); //MSB to LSB
138 pwStruct = (twStruct *) pAddr_p;
139 pwStruct->m_wWord = wValue.m_wWord;
143 //------------< write u32 in big endian >-------------------------
145 void AmiSetDwordToBe(void *pAddr_p, u32 dwDwordVal_p)
147 tdwStruct *pdwStruct;
148 tdwStruct dwValue;
150 dwValue.m_dwDword = ((dwDwordVal_p & 0x000000FF) << 24); //LSB to MSB
151 dwValue.m_dwDword |= ((dwDwordVal_p & 0x0000FF00) << 8);
152 dwValue.m_dwDword |= ((dwDwordVal_p & 0x00FF0000) >> 8);
153 dwValue.m_dwDword |= ((dwDwordVal_p & 0xFF000000) >> 24); //MSB to LSB
155 pdwStruct = (tdwStruct *) pAddr_p;
156 pdwStruct->m_dwDword = dwValue.m_dwDword;
160 //---------------------------------------------------------------------------
162 // Function: AmiSetXXXToLe()
164 // Description: writes the specified value to the absolute address in
165 // little endian
167 // Parameters: pAddr_p = absolute address
168 // xXXXVal_p = value
170 // Returns: (none)
172 // State:
174 //---------------------------------------------------------------------------
176 //------------< write u8 in little endian >--------------------------
178 void AmiSetByteToLe (void *pAddr_p, u8 bByteVal_p)
181 *(u8 *)pAddr_p = bByteVal_p;
186 //------------< write u16 in little endian >--------------------------
188 void AmiSetWordToLe(void *pAddr_p, u16 wWordVal_p)
190 twStruct *pwStruct;
192 pwStruct = (twStruct *) pAddr_p;
193 pwStruct->m_wWord = wWordVal_p;
197 //------------< write u32 in little endian >-------------------------
199 void AmiSetDwordToLe(void *pAddr_p, u32 dwDwordVal_p)
201 tdwStruct *pdwStruct;
203 pdwStruct = (tdwStruct *) pAddr_p;
204 pdwStruct->m_dwDword = dwDwordVal_p;
208 //---------------------------------------------------------------------------
210 // Function: AmiGetXXXFromBe()
212 // Description: reads the specified value from the absolute address in
213 // big endian
215 // Parameters: pAddr_p = absolute address
217 // Returns: XXX = value
219 // State:
221 //---------------------------------------------------------------------------
223 //------------< read u8 in big endian >---------------------------
225 u8 AmiGetByteFromBe (void *pAddr_p)
228 return ( *(u8 *)pAddr_p );
233 //------------< read u16 in big endian >---------------------------
235 u16 AmiGetWordFromBe(void *pAddr_p)
237 twStruct *pwStruct;
238 twStruct wValue;
240 pwStruct = (twStruct *) pAddr_p;
242 wValue.m_wWord = (u16) ((pwStruct->m_wWord & 0x00FF) << 8); //LSB to MSB
243 wValue.m_wWord |= (u16) ((pwStruct->m_wWord & 0xFF00) >> 8); //MSB to LSB
245 return (wValue.m_wWord);
249 //------------< read u32 in big endian >--------------------------
251 u32 AmiGetDwordFromBe(void *pAddr_p)
253 tdwStruct *pdwStruct;
254 tdwStruct dwValue;
256 pdwStruct = (tdwStruct *) pAddr_p;
258 dwValue.m_dwDword = ((pdwStruct->m_dwDword & 0x000000FF) << 24); //LSB to MSB
259 dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0x0000FF00) << 8);
260 dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0x00FF0000) >> 8);
261 dwValue.m_dwDword |= ((pdwStruct->m_dwDword & 0xFF000000) >> 24); //MSB to LSB
263 return (dwValue.m_dwDword);
267 //---------------------------------------------------------------------------
269 // Function: AmiGetXXXFromLe()
271 // Description: reads the specified value from the absolute address in
272 // little endian
274 // Parameters: pAddr_p = absolute address
276 // Returns: XXX = value
278 // State:
280 //---------------------------------------------------------------------------
282 //------------< read u8 in little endian >---------------------------
284 u8 AmiGetByteFromLe (void *pAddr_p)
287 return ( *(u8 *)pAddr_p );
292 //------------< read u16 in little endian >---------------------------
294 u16 AmiGetWordFromLe(void *pAddr_p)
296 twStruct *pwStruct;
298 pwStruct = (twStruct *) pAddr_p;
299 return (pwStruct->m_wWord);
302 //------------< read u32 in little endian >--------------------------
304 u32 AmiGetDwordFromLe(void *pAddr_p)
306 tdwStruct *pdwStruct;
308 pdwStruct = (tdwStruct *) pAddr_p;
309 return (pdwStruct->m_dwDword);
312 //---------------------------------------------------------------------------
314 // Function: AmiSetDword24ToBe()
316 // Description: sets a 24 bit value to a buffer in big endian
318 // Parameters: pAddr_p = pointer to destination buffer
319 // dwDwordVal_p = value to set
321 // Return: void
323 // State: not tested
325 //---------------------------------------------------------------------------
327 void AmiSetDword24ToBe(void *pAddr_p, u32 dwDwordVal_p)
329 ((u8 *) pAddr_p)[0] = ((u8 *) & dwDwordVal_p)[2];
330 ((u8 *) pAddr_p)[1] = ((u8 *) & dwDwordVal_p)[1];
331 ((u8 *) pAddr_p)[2] = ((u8 *) & dwDwordVal_p)[0];
334 //---------------------------------------------------------------------------
336 // Function: AmiSetDword24ToLe()
338 // Description: sets a 24 bit value to a buffer in little endian
340 // Parameters: pAddr_p = pointer to destination buffer
341 // dwDwordVal_p = value to set
343 // Return: void
345 // State: not tested
347 //---------------------------------------------------------------------------
349 void AmiSetDword24ToLe(void *pAddr_p, u32 dwDwordVal_p)
351 ((u8 *) pAddr_p)[0] = ((u8 *) & dwDwordVal_p)[0];
352 ((u8 *) pAddr_p)[1] = ((u8 *) & dwDwordVal_p)[1];
353 ((u8 *) pAddr_p)[2] = ((u8 *) & dwDwordVal_p)[2];
356 //---------------------------------------------------------------------------
358 // Function: AmiGetDword24FromBe()
360 // Description: reads a 24 bit value from a buffer in big endian
362 // Parameters: pAddr_p = pointer to source buffer
364 // Return: u32 = read value
366 // State: not tested
368 //---------------------------------------------------------------------------
369 u32 AmiGetDword24FromBe(void *pAddr_p)
371 tdwStruct dwStruct;
373 dwStruct.m_dwDword = AmiGetDwordFromBe(pAddr_p);
374 dwStruct.m_dwDword >>= 8;
376 return (dwStruct.m_dwDword);
379 //---------------------------------------------------------------------------
381 // Function: AmiGetDword24FromLe()
383 // Description: reads a 24 bit value from a buffer in little endian
385 // Parameters: pAddr_p = pointer to source buffer
387 // Return: u32 = read value
389 // State: not tested
391 //---------------------------------------------------------------------------
392 u32 AmiGetDword24FromLe(void *pAddr_p)
394 tdwStruct dwStruct;
396 dwStruct.m_dwDword = AmiGetDwordFromLe(pAddr_p);
397 dwStruct.m_dwDword &= 0x00FFFFFF;
399 return (dwStruct.m_dwDword);
402 //#ifdef USE_VAR64
404 //---------------------------------------------------------------------------
406 // Function: AmiSetQword64ToBe()
408 // Description: sets a 64 bit value to a buffer in big endian
410 // Parameters: pAddr_p = pointer to destination buffer
411 // qwQwordVal_p = quadruple word value
413 // Return: void
415 // State: not tested
417 //---------------------------------------------------------------------------
418 void AmiSetQword64ToBe(void *pAddr_p, u64 qwQwordVal_p)
420 ((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[7];
421 ((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[6];
422 ((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[5];
423 ((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[4];
424 ((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[3];
425 ((u8 *) pAddr_p)[5] = ((u8 *) & qwQwordVal_p)[2];
426 ((u8 *) pAddr_p)[6] = ((u8 *) & qwQwordVal_p)[1];
427 ((u8 *) pAddr_p)[7] = ((u8 *) & qwQwordVal_p)[0];
430 //---------------------------------------------------------------------------
432 // Function: AmiSetQword64ToLe()
434 // Description: sets a 64 bit value to a buffer in little endian
436 // Parameters: pAddr_p = pointer to destination buffer
437 // qwQwordVal_p = quadruple word value
439 // Return: void
441 // State: not tested
443 //---------------------------------------------------------------------------
444 void AmiSetQword64ToLe(void *pAddr_p, u64 qwQwordVal_p)
446 u64 *pqwDst;
448 pqwDst = (u64 *) pAddr_p;
449 *pqwDst = qwQwordVal_p;
452 //---------------------------------------------------------------------------
454 // Function: AmiGetQword64FromBe()
456 // Description: reads a 64 bit value from a buffer in big endian
458 // Parameters: pAddr_p = pointer to source buffer
460 // Return: void
462 // State: not tested
464 //---------------------------------------------------------------------------
465 u64 AmiGetQword64FromBe(void *pAddr_p)
467 tqwStruct qwStruct;
469 ((u8 *) & qwStruct.m_qwQword)[0] = ((u8 *) pAddr_p)[7];
470 ((u8 *) & qwStruct.m_qwQword)[1] = ((u8 *) pAddr_p)[6];
471 ((u8 *) & qwStruct.m_qwQword)[2] = ((u8 *) pAddr_p)[5];
472 ((u8 *) & qwStruct.m_qwQword)[3] = ((u8 *) pAddr_p)[4];
473 ((u8 *) & qwStruct.m_qwQword)[4] = ((u8 *) pAddr_p)[3];
474 ((u8 *) & qwStruct.m_qwQword)[5] = ((u8 *) pAddr_p)[2];
475 ((u8 *) & qwStruct.m_qwQword)[6] = ((u8 *) pAddr_p)[1];
476 ((u8 *) & qwStruct.m_qwQword)[7] = ((u8 *) pAddr_p)[0];
478 return (qwStruct.m_qwQword);
481 //---------------------------------------------------------------------------
483 // Function: AmiGetQword64FromLe()
485 // Description: reads a 64 bit value from a buffer in little endian
487 // Parameters: pAddr_p = pointer to source buffer
489 // Return: void
491 // State: not tested
493 //---------------------------------------------------------------------------
494 u64 AmiGetQword64FromLe(void *pAddr_p)
496 tqwStruct *pqwStruct;
497 tqwStruct qwStruct;
499 pqwStruct = (tqwStruct *) pAddr_p;
500 qwStruct.m_qwQword = pqwStruct->m_qwQword;
502 return (qwStruct.m_qwQword);
505 //---------------------------------------------------------------------------
507 // Function: AmiSetQword40ToBe()
509 // Description: sets a 40 bit value to a buffer in big endian
511 // Parameters: pAddr_p = pointer to destination buffer
512 // qwQwordVal_p = quadruple word value
514 // Return: void
516 // State: not tested
518 //---------------------------------------------------------------------------
520 void AmiSetQword40ToBe(void *pAddr_p, u64 qwQwordVal_p)
523 ((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[4];
524 ((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[3];
525 ((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[2];
526 ((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[1];
527 ((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[0];
531 //---------------------------------------------------------------------------
533 // Function: AmiSetQword40ToLe()
535 // Description: sets a 40 bit value to a buffer in little endian
537 // Parameters: pAddr_p = pointer to destination buffer
538 // qwQwordVal_p = quadruple word value
540 // Return: void
542 // State: not tested
544 //---------------------------------------------------------------------------
546 void AmiSetQword40ToLe(void *pAddr_p, u64 qwQwordVal_p)
549 ((u32 *) pAddr_p)[0] = ((u32 *) & qwQwordVal_p)[0];
550 ((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[4];
554 //---------------------------------------------------------------------------
556 // Function: AmiGetQword40FromBe()
558 // Description: reads a 40 bit value from a buffer in big endian
560 // Parameters: pAddr_p = pointer to source buffer
562 // Return: u64
564 // State: not tested
566 //---------------------------------------------------------------------------
568 u64 AmiGetQword40FromBe(void *pAddr_p)
571 tqwStruct qwStruct;
573 qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
574 qwStruct.m_qwQword >>= 24;
576 return (qwStruct.m_qwQword);
580 //---------------------------------------------------------------------------
582 // Function: AmiGetQword40FromLe()
584 // Description: reads a 40 bit value from a buffer in little endian
586 // Parameters: pAddr_p = pointer to source buffer
588 // Return: u64
590 // State: not tested
592 //---------------------------------------------------------------------------
594 u64 AmiGetQword40FromLe(void *pAddr_p)
597 tqwStruct qwStruct;
599 qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
600 qwStruct.m_qwQword &= 0x000000FFFFFFFFFFLL;
602 return (qwStruct.m_qwQword);
606 //---------------------------------------------------------------------------
608 // Function: AmiSetQword48ToBe()
610 // Description: sets a 48 bit value to a buffer in big endian
612 // Parameters: pAddr_p = pointer to destination buffer
613 // qwQwordVal_p = quadruple word value
615 // Return: void
617 // State: not tested
619 //---------------------------------------------------------------------------
621 void AmiSetQword48ToBe(void *pAddr_p, u64 qwQwordVal_p)
624 ((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[5];
625 ((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[4];
626 ((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[3];
627 ((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[2];
628 ((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[1];
629 ((u8 *) pAddr_p)[5] = ((u8 *) & qwQwordVal_p)[0];
633 //---------------------------------------------------------------------------
635 // Function: AmiSetQword48ToLe()
637 // Description: sets a 48 bit value to a buffer in little endian
639 // Parameters: pAddr_p = pointer to destination buffer
640 // qwQwordVal_p = quadruple word value
642 // Return: void
644 // State: not tested
646 //---------------------------------------------------------------------------
648 void AmiSetQword48ToLe(void *pAddr_p, u64 qwQwordVal_p)
651 ((u32 *) pAddr_p)[0] = ((u32 *) & qwQwordVal_p)[0];
652 ((u16 *) pAddr_p)[2] = ((u16 *) & qwQwordVal_p)[2];
656 //---------------------------------------------------------------------------
658 // Function: AmiGetQword48FromBe()
660 // Description: reads a 48 bit value from a buffer in big endian
662 // Parameters: pAddr_p = pointer to source buffer
664 // Return: u64
666 // State: not tested
668 //---------------------------------------------------------------------------
670 u64 AmiGetQword48FromBe(void *pAddr_p)
673 tqwStruct qwStruct;
675 qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
676 qwStruct.m_qwQword >>= 16;
678 return (qwStruct.m_qwQword);
682 //---------------------------------------------------------------------------
684 // Function: AmiGetQword48FromLe()
686 // Description: reads a 48 bit value from a buffer in little endian
688 // Parameters: pAddr_p = pointer to source buffer
690 // Return: u64
692 // State: not tested
694 //---------------------------------------------------------------------------
696 u64 AmiGetQword48FromLe(void *pAddr_p)
699 tqwStruct qwStruct;
701 qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
702 qwStruct.m_qwQword &= 0x0000FFFFFFFFFFFFLL;
704 return (qwStruct.m_qwQword);
708 //---------------------------------------------------------------------------
710 // Function: AmiSetQword56ToBe()
712 // Description: sets a 56 bit value to a buffer in big endian
714 // Parameters: pAddr_p = pointer to destination buffer
715 // qwQwordVal_p = quadruple word value
717 // Return: void
719 // State: not tested
721 //---------------------------------------------------------------------------
723 void AmiSetQword56ToBe(void *pAddr_p, u64 qwQwordVal_p)
726 ((u8 *) pAddr_p)[0] = ((u8 *) & qwQwordVal_p)[6];
727 ((u8 *) pAddr_p)[1] = ((u8 *) & qwQwordVal_p)[5];
728 ((u8 *) pAddr_p)[2] = ((u8 *) & qwQwordVal_p)[4];
729 ((u8 *) pAddr_p)[3] = ((u8 *) & qwQwordVal_p)[3];
730 ((u8 *) pAddr_p)[4] = ((u8 *) & qwQwordVal_p)[2];
731 ((u8 *) pAddr_p)[5] = ((u8 *) & qwQwordVal_p)[1];
732 ((u8 *) pAddr_p)[6] = ((u8 *) & qwQwordVal_p)[0];
736 //---------------------------------------------------------------------------
738 // Function: AmiSetQword56ToLe()
740 // Description: sets a 56 bit value to a buffer in little endian
742 // Parameters: pAddr_p = pointer to destination buffer
743 // qwQwordVal_p = quadruple word value
745 // Return: void
747 // State: not tested
749 //---------------------------------------------------------------------------
751 void AmiSetQword56ToLe(void *pAddr_p, u64 qwQwordVal_p)
754 ((u32 *) pAddr_p)[0] = ((u32 *) & qwQwordVal_p)[0];
755 ((u16 *) pAddr_p)[2] = ((u16 *) & qwQwordVal_p)[2];
756 ((u8 *) pAddr_p)[6] = ((u8 *) & qwQwordVal_p)[6];
760 //---------------------------------------------------------------------------
762 // Function: AmiGetQword56FromBe()
764 // Description: reads a 56 bit value from a buffer in big endian
766 // Parameters: pAddr_p = pointer to source buffer
768 // Return: u64
770 // State: not tested
772 //---------------------------------------------------------------------------
774 u64 AmiGetQword56FromBe(void *pAddr_p)
777 tqwStruct qwStruct;
779 qwStruct.m_qwQword = AmiGetQword64FromBe(pAddr_p);
780 qwStruct.m_qwQword >>= 8;
782 return (qwStruct.m_qwQword);
786 //---------------------------------------------------------------------------
788 // Function: AmiGetQword56FromLe()
790 // Description: reads a 56 bit value from a buffer in little endian
792 // Parameters: pAddr_p = pointer to source buffer
794 // Return: u64
796 // State: not tested
798 //---------------------------------------------------------------------------
800 u64 AmiGetQword56FromLe(void *pAddr_p)
803 tqwStruct qwStruct;
805 qwStruct.m_qwQword = AmiGetQword64FromLe(pAddr_p);
806 qwStruct.m_qwQword &= 0x00FFFFFFFFFFFFFFLL;
808 return (qwStruct.m_qwQword);
812 //---------------------------------------------------------------------------
814 // Function: AmiSetTimeOfDay()
816 // Description: sets a TIME_OF_DAY (CANopen) value to a buffer
818 // Parameters: pAddr_p = pointer to destination buffer
819 // pTimeOfDay_p = pointer to struct TIME_OF_DAY
821 // Return: void
823 // State: not tested
825 //---------------------------------------------------------------------------
827 void AmiSetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p)
830 AmiSetDwordToLe(((u8 *) pAddr_p), pTimeOfDay_p->m_dwMs & 0x0FFFFFFF);
831 AmiSetWordToLe(((u8 *) pAddr_p) + 4, pTimeOfDay_p->m_wDays);
835 //---------------------------------------------------------------------------
837 // Function: AmiGetTimeOfDay()
839 // Description: reads a TIME_OF_DAY (CANopen) value from a buffer
841 // Parameters: pAddr_p = pointer to source buffer
842 // pTimeOfDay_p = pointer to struct TIME_OF_DAY
844 // Return: void
846 // State: not tested
848 //---------------------------------------------------------------------------
850 void AmiGetTimeOfDay(void *pAddr_p, tTimeOfDay *pTimeOfDay_p)
853 pTimeOfDay_p->m_dwMs = AmiGetDwordFromLe(((u8 *) pAddr_p)) & 0x0FFFFFFF;
854 pTimeOfDay_p->m_wDays = AmiGetWordFromLe(((u8 *) pAddr_p) + 4);
858 // EOF
860 // Die letzte Zeile muß unbedingt eine leere Zeile sein, weil manche Compiler
861 // damit ein Problem haben, wenn das nicht so ist (z.B. GNU oder Borland C++ Builder).