1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00

more merging

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@198 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-09-04 13:25:21 +00:00
parent 7a1b33bb29
commit 99bb7d9f88
4 changed files with 15 additions and 18 deletions

View file

@ -13,8 +13,8 @@
#ifdef __linux__
#define _BSD_SOURCE 1
#include <endian.h>
#elif !defined(BYTE_ORDER)
#error "Please define BYTE_ORDER"
#elif defined(__PPC__) /* Xilinx toolchain */
#include <lwip/arch.h>
#endif
#include "config.h"
@ -37,6 +37,8 @@
#define MSG_ENDIAN_HOST MSG_ENDIAN_LITTLE
#elif BYTE_ORDER == BIG_ENDIAN
#define MSG_ENDIAN_HOST MSG_ENDIAN_BIG
#else
#error "Unknown byte order!"
#endif
/** The total length of a message */

View file

@ -6,8 +6,9 @@
#ifdef __linux__
#include <byteswap.h>
#elif defined(__powerpc__)
#elif defined(__PPC__) /* Xilinx toolchain */
#include <xil_io.h>
#define bswap_32(x) Xil_EndianSwap32(x)
#endif
#include "msg.h"
@ -15,13 +16,8 @@
void msg_swap(struct msg *m)
{
int i;
for (i = 0; i < m->length; i++) {
#ifdef __linux__
for (i = 0; i < m->length; i++)
m->data[i].i = bswap_32(m->data[i].i);
#elif defined(__powerpc__)
m->data[i].i = Xil_EndianSwap32(m->data[i].i);
#endif
}
m->endian ^= 1;
}

View file

@ -13,8 +13,8 @@
#ifdef __linux__
#define _BSD_SOURCE 1
#include <endian.h>
#elif !defined(BYTE_ORDER)
#error "Please define BYTE_ORDER"
#elif defined(__PPC__) /* Xilinx toolchain */
#include <lwip/arch.h>
#endif
#include "config.h"
@ -37,6 +37,8 @@
#define MSG_ENDIAN_HOST MSG_ENDIAN_LITTLE
#elif BYTE_ORDER == BIG_ENDIAN
#define MSG_ENDIAN_HOST MSG_ENDIAN_BIG
#else
#error "Unknown byte order!"
#endif
/** The total length of a message */

View file

@ -10,8 +10,9 @@
#ifdef __linux__
#include <byteswap.h>
#elif defined(__powerpc__)
#elif defined(__PPC__) /* Xilinx toolchain */
#include <xil_io.h>
#define bswap_32(x) Xil_EndianSwap32(x)
#endif
#include "msg.h"
@ -20,13 +21,9 @@
void msg_swap(struct msg *m)
{
for (int i = 0; i < m->length; i++) {
#ifdef __linux__
int i;
for (i = 0; i < m->length; i++)
m->data[i].i = bswap_32(m->data[i].i);
#elif defined(__powerpc__)
m->data[i].i = Xil_EndianSwap32(m->data[i].i);
#endif
}
m->endian ^= 1;
}