include/sysdep.h
author mwildbolz
Mon, 01 Oct 2012 17:09:55 +0200
changeset 752 48a0ebbefa74
parent 200 930be51ddc24
permissions -rw-r--r--
Removed auto-generated object dictionary files from example folders
Updated .hgignore file (generated Makefiles, auto-generated OD files)
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