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:
parent
7a1b33bb29
commit
99bb7d9f88
4 changed files with 15 additions and 18 deletions
|
@ -13,8 +13,8 @@
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#define _BSD_SOURCE 1
|
#define _BSD_SOURCE 1
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#elif !defined(BYTE_ORDER)
|
#elif defined(__PPC__) /* Xilinx toolchain */
|
||||||
#error "Please define BYTE_ORDER"
|
#include <lwip/arch.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -37,6 +37,8 @@
|
||||||
#define MSG_ENDIAN_HOST MSG_ENDIAN_LITTLE
|
#define MSG_ENDIAN_HOST MSG_ENDIAN_LITTLE
|
||||||
#elif BYTE_ORDER == BIG_ENDIAN
|
#elif BYTE_ORDER == BIG_ENDIAN
|
||||||
#define MSG_ENDIAN_HOST MSG_ENDIAN_BIG
|
#define MSG_ENDIAN_HOST MSG_ENDIAN_BIG
|
||||||
|
#else
|
||||||
|
#error "Unknown byte order!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** The total length of a message */
|
/** The total length of a message */
|
||||||
|
|
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
#elif defined(__powerpc__)
|
#elif defined(__PPC__) /* Xilinx toolchain */
|
||||||
#include <xil_io.h>
|
#include <xil_io.h>
|
||||||
|
#define bswap_32(x) Xil_EndianSwap32(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
@ -15,13 +16,8 @@
|
||||||
void msg_swap(struct msg *m)
|
void msg_swap(struct msg *m)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m->length; i++) {
|
for (i = 0; i < m->length; i++)
|
||||||
#ifdef __linux__
|
|
||||||
m->data[i].i = bswap_32(m->data[i].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;
|
m->endian ^= 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#define _BSD_SOURCE 1
|
#define _BSD_SOURCE 1
|
||||||
#include <endian.h>
|
#include <endian.h>
|
||||||
#elif !defined(BYTE_ORDER)
|
#elif defined(__PPC__) /* Xilinx toolchain */
|
||||||
#error "Please define BYTE_ORDER"
|
#include <lwip/arch.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -37,6 +37,8 @@
|
||||||
#define MSG_ENDIAN_HOST MSG_ENDIAN_LITTLE
|
#define MSG_ENDIAN_HOST MSG_ENDIAN_LITTLE
|
||||||
#elif BYTE_ORDER == BIG_ENDIAN
|
#elif BYTE_ORDER == BIG_ENDIAN
|
||||||
#define MSG_ENDIAN_HOST MSG_ENDIAN_BIG
|
#define MSG_ENDIAN_HOST MSG_ENDIAN_BIG
|
||||||
|
#else
|
||||||
|
#error "Unknown byte order!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** The total length of a message */
|
/** The total length of a message */
|
||||||
|
|
|
@ -10,8 +10,9 @@
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
#elif defined(__powerpc__)
|
#elif defined(__PPC__) /* Xilinx toolchain */
|
||||||
#include <xil_io.h>
|
#include <xil_io.h>
|
||||||
|
#define bswap_32(x) Xil_EndianSwap32(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
@ -20,13 +21,9 @@
|
||||||
|
|
||||||
void msg_swap(struct msg *m)
|
void msg_swap(struct msg *m)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m->length; i++) {
|
int i;
|
||||||
#ifdef __linux__
|
for (i = 0; i < m->length; i++)
|
||||||
m->data[i].i = bswap_32(m->data[i].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;
|
m->endian ^= 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue