add/clean big-endian packed structs (struct_endianess.py)

Change-Id: If408153af472a41dcea8d6f6aedd22adb16963d5
This commit is contained in:
Neels Hofmeyr 2018-11-16 00:18:08 +01:00 committed by laforge
parent 5ed1a3c85c
commit 63e33ab84c
3 changed files with 16 additions and 27 deletions

View File

@ -43,16 +43,7 @@
*/
struct amr_hdr {
#if OSMO_IS_BIG_ENDIAN
/* Payload Header */
uint8_t cmr:4, /* Codec Mode Request */
pad1:4;
/* Table of Contents */
uint8_t f:1, /* followed by another speech frame? */
ft:4, /* coding mode */
q:1, /* OK (not damaged) at origin? */
pad2:2;
#elif OSMO_IS_LITTLE_ENDIAN
#if OSMO_IS_LITTLE_ENDIAN
/* Payload Header */
uint8_t pad1:4,
cmr:4; /* Codec Mode Request */
@ -61,6 +52,10 @@ struct amr_hdr {
q:1, /* OK (not damaged) at origin? */
ft:4, /* coding mode */
f:1; /* followed by another speech frame? */
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t cmr:4, pad1:4;
uint8_t f:1, ft:4, q:1, pad2:2;
#endif
} __attribute__((packed));

View File

@ -30,28 +30,25 @@
#define OSMUX_FT_DUMMY 2
struct osmux_hdr {
#if OSMO_IS_BIG_ENDIAN
uint8_t rtp_m:1,
ft:2,
ctr:3,
amr_f:1,
amr_q:1;
#elif OSMO_IS_LITTLE_ENDIAN
#if OSMO_IS_LITTLE_ENDIAN
uint8_t amr_q:1,
amr_f:1,
ctr:3,
ft:2,
rtp_m:1;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t rtp_m:1, ft:2, ctr:3, amr_f:1, amr_q:1;
#endif
uint8_t seq;
#define OSMUX_CID_MAX 255 /* determined by circuit_id */
uint8_t circuit_id;
#if OSMO_IS_BIG_ENDIAN
uint8_t amr_ft:4,
amr_cmr:4;
#elif OSMO_IS_LITTLE_ENDIAN
#if OSMO_IS_LITTLE_ENDIAN
uint8_t amr_cmr:4,
amr_ft:4;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t amr_ft:4, amr_cmr:4;
#endif
} __attribute__((packed));

View File

@ -13,12 +13,9 @@ struct rtp_hdr {
uint8_t payload_type:7,
marker:1;
#elif OSMO_IS_BIG_ENDIAN
uint8_t version:2,
padding:1,
extension:1,
csrc_count:4;
uint8_t marker:1,
payload_type:7;
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t version:2, padding:1, extension:1, csrc_count:4;
uint8_t marker:1, payload_type:7;
#endif
uint16_t sequence;
uint32_t timestamp;