include/sysdep.h
author Christian Taedcke
Fri, 28 Jan 2011 14:51:18 +0100
changeset 657 c0e68a63f600
parent 200 930be51ddc24
permissions -rw-r--r--
FIX: - if a sdo transfer timeout occurres, reset the sdo line even if the callback function does not.
200
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     1
#ifndef __sysdep_h__
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     2
#define __sysdep_h__
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     3
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     4
#include "config.h"
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     5
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     6
#ifdef CANOPEN_BIG_ENDIAN
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     7
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     8
/* Warning: the argument must not update pointers, e.g. *p++ */
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
     9
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    10
#define UNS16_LE(v)  ((((UNS16)(v) & 0xff00) >> 8) | \
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    11
		      (((UNS16)(v) & 0x00ff) << 8))
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    12
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    13
#define UNS32_LE(v)  ((((UNS32)(v) & 0xff000000) >> 24) |	\
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    14
		      (((UNS32)(v) & 0x00ff0000) >> 8)  |	\
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    15
		      (((UNS32)(v) & 0x0000ff00) << 8)  |	\
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    16
		      (((UNS32)(v) & 0x000000ff) << 24))
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    17
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    18
#else
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    19
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    20
#define UNS16_LE(v)  (v)
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    21
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    22
#define UNS32_LE(v)  (v)
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    23
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    24
#endif
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    25
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    26
#endif /* __sysdep_h__ */
930be51ddc24 Big Endian fixes.
etisserant
parents:
diff changeset
    27