aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-11-16 00:16:57 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-11-23 04:11:11 +0100
commit8de3ffd4cb0fb1a1c01e6e2e8c3d55493aff799f (patch)
tree707758aaad8adc0cd803c88970122507540e8711
parentde5758d307f6794b4126c6cf5251a5c5a8b9f193 (diff)
add/clean big-endian packed structs (struct_endianess.py)neels/big_endian
-rw-r--r--src/e1_input.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/e1_input.c b/src/e1_input.c
index 4717830..6d264d0 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -42,6 +42,7 @@
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/signal.h>
+#include <osmocom/core/endian.h>
#include <osmocom/abis/e1_input.h>
#define NUM_E1_TS 32
@@ -115,12 +116,19 @@ struct fake_linux_lapd_header {
} __attribute__((packed));
struct lapd_header {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t ea1 : 1;
uint8_t cr : 1;
uint8_t sapi : 6;
uint8_t ea2 : 1;
uint8_t tei : 7;
uint8_t control_foo; /* fake UM's ... */
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t sapi:6, cr:1, ea1:1;
+ uint8_t tei:7, ea2:1;
+ uint8_t control_foo;
+#endif
} __attribute__((packed));
osmo_static_assert(offsetof(struct fake_linux_lapd_header, hatype) == 2, hatype_offset);