diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-11-16 00:20:39 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2018-12-19 18:40:03 +0000 |
commit | b26003963e82805bfd73b13315ae85d478605383 (patch) | |
tree | a54c4b111f2fee0c146ba9c4eb204dabf599bc0b /include/osmocom/gprs/protocol | |
parent | 036012b5080e15b1e6579e5422c9d1bc8c63e2fb (diff) |
add/clean big-endian packed structs (struct_endianess.py)
This is 1:1 the result of doing
cd libosmocore
./contrib/struct_endianess.py
git commit -a
Running struct_endianess.py again should result in no changes.
That means we could include such a check in the gerrit verification job now.
Change-Id: Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2
Diffstat (limited to 'include/osmocom/gprs/protocol')
-rw-r--r-- | include/osmocom/gprs/protocol/gsm_04_60.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/include/osmocom/gprs/protocol/gsm_04_60.h b/include/osmocom/gprs/protocol/gsm_04_60.h index 96e9ab78..5d5fca9a 100644 --- a/include/osmocom/gprs/protocol/gsm_04_60.h +++ b/include/osmocom/gprs/protocol/gsm_04_60.h @@ -7,10 +7,12 @@ #pragma once #include <stdint.h> +#include <osmocom/core/endian.h> #if OSMO_IS_LITTLE_ENDIAN == 1 /* TS 04.60 10.3a.4.1.1 */ struct gprs_rlc_ul_header_egprs_1 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t r:1, si:1, cv:4, @@ -26,10 +28,20 @@ struct gprs_rlc_ul_header_egprs_1 { spare_hi:1; uint8_t spare_lo:6, dummy:2; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t tfi_hi:2, cv:4, si:1, r:1; + uint8_t bsn1_hi:5, tfi_lo:3; + uint8_t bsn2_hi:2, bsn1_lo:6; + uint8_t bsn2_lo:8; + uint8_t spare_hi:1, pi:1, rsb:1, cps:5; + uint8_t dummy:2, spare_lo:6; +#endif } __attribute__ ((packed)); /* TS 04.60 10.3a.4.2.1 */ struct gprs_rlc_ul_header_egprs_2 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t r:1, si:1, cv:4, @@ -44,10 +56,19 @@ struct gprs_rlc_ul_header_egprs_2 { spare_hi:5; uint8_t spare_lo:5, dummy:3; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t tfi_hi:2, cv:4, si:1, r:1; + uint8_t bsn1_hi:5, tfi_lo:3; + uint8_t cps_hi:2, bsn1_lo:6; + uint8_t spare_hi:5, pi:1, rsb:1, cps_lo:1; + uint8_t dummy:3, spare_lo:5; +#endif } __attribute__ ((packed)); /* TS 04.60 10.3a.4.3.1 */ struct gprs_rlc_ul_header_egprs_3 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t r:1, si:1, cv:4, @@ -62,9 +83,17 @@ struct gprs_rlc_ul_header_egprs_3 { pi:1, spare:1, dummy:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t tfi_hi:2, cv:4, si:1, r:1; + uint8_t bsn1_hi:5, tfi_lo:3; + uint8_t cps_hi:2, bsn1_lo:6; + uint8_t dummy:1, spare:1, pi:1, rsb:1, spb:2, cps_lo:2; +#endif } __attribute__ ((packed)); struct gprs_rlc_dl_header_egprs_1 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t usf:3, es_p:2, rrbp:2, @@ -77,9 +106,18 @@ struct gprs_rlc_dl_header_egprs_1 { bsn2_hi:7; uint8_t bsn2_lo:3, cps:5; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t tfi_hi:1, rrbp:2, es_p:2, usf:3; + uint8_t bsn1_hi:2, pr:2, tfi_lo:4; + uint8_t bsn1_mid:8; + uint8_t bsn2_hi:7, bsn1_lo:1; + uint8_t cps:5, bsn2_lo:3; +#endif } __attribute__ ((packed)); struct gprs_rlc_dl_header_egprs_2 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t usf:3, es_p:2, rrbp:2, @@ -91,9 +129,17 @@ struct gprs_rlc_dl_header_egprs_2 { uint8_t bsn1_lo:1, cps:3, dummy:4; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t tfi_hi:1, rrbp:2, es_p:2, usf:3; + uint8_t bsn1_hi:2, pr:2, tfi_lo:4; + uint8_t bsn1_mid:8; + uint8_t dummy:4, cps:3, bsn1_lo:1; +#endif } __attribute__ ((packed)); struct gprs_rlc_dl_header_egprs_3 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t usf:3, es_p:2, rrbp:2, @@ -106,10 +152,18 @@ struct gprs_rlc_dl_header_egprs_3 { cps:4, spb:2, dummy:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t tfi_hi:1, rrbp:2, es_p:2, usf:3; + uint8_t bsn1_hi:2, pr:2, tfi_lo:4; + uint8_t bsn1_mid:8; + uint8_t dummy:1, spb:2, cps:4, bsn1_lo:1; +#endif } __attribute__ ((packed)); #else /* TS 04.60 10.3a.4.1.1 */ struct gprs_rlc_ul_header_egprs_1 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t tfi_hi:2, cv:4, si:1, @@ -125,10 +179,20 @@ struct gprs_rlc_ul_header_egprs_1 { cps:5; uint8_t dummy:2, spare_lo:6; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t r:1, si:1, cv:4, tfi_hi:2; + uint8_t tfi_lo:3, bsn1_hi:5; + uint8_t bsn1_lo:6, bsn2_hi:2; + uint8_t bsn2_lo:8; + uint8_t cps:5, rsb:1, pi:1, spare_hi:1; + uint8_t spare_lo:6, dummy:2; +#endif } __attribute__ ((packed)); /* TS 04.60 10.3a.4.2.1 */ struct gprs_rlc_ul_header_egprs_2 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t tfi_hi:2, cv:4, si:1, @@ -143,10 +207,19 @@ struct gprs_rlc_ul_header_egprs_2 { cps_lo:1; uint8_t dummy:3, spare_lo:5; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t r:1, si:1, cv:4, tfi_hi:2; + uint8_t tfi_lo:3, bsn1_hi:5; + uint8_t bsn1_lo:6, cps_hi:2; + uint8_t cps_lo:1, rsb:1, pi:1, spare_hi:5; + uint8_t spare_lo:5, dummy:3; +#endif } __attribute__ ((packed)); /* TS 04.60 10.3a.4.3.1 */ struct gprs_rlc_ul_header_egprs_3 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t tfi_hi:2, cv:4, si:1, @@ -161,9 +234,17 @@ struct gprs_rlc_ul_header_egprs_3 { rsb:1, spb:2, cps_lo:2; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t r:1, si:1, cv:4, tfi_hi:2; + uint8_t tfi_lo:3, bsn1_hi:5; + uint8_t bsn1_lo:6, cps_hi:2; + uint8_t cps_lo:2, spb:2, rsb:1, pi:1, spare:1, dummy:1; +#endif } __attribute__ ((packed)); struct gprs_rlc_dl_header_egprs_1 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t tfi_hi:1, rrbp:2, es_p:2, @@ -176,9 +257,18 @@ struct gprs_rlc_dl_header_egprs_1 { bsn1_lo:1; uint8_t cps:5, bsn2_lo:3; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t usf:3, es_p:2, rrbp:2, tfi_hi:1; + uint8_t tfi_lo:4, pr:2, bsn1_hi:2; + uint8_t bsn1_mid:8; + uint8_t bsn1_lo:1, bsn2_hi:7; + uint8_t bsn2_lo:3, cps:5; +#endif } __attribute__ ((packed)); struct gprs_rlc_dl_header_egprs_2 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t tfi_hi:1, rrbp:2, es_p:2, @@ -190,9 +280,17 @@ struct gprs_rlc_dl_header_egprs_2 { uint8_t dummy:4, cps:3, bsn1_lo:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t usf:3, es_p:2, rrbp:2, tfi_hi:1; + uint8_t tfi_lo:4, pr:2, bsn1_hi:2; + uint8_t bsn1_mid:8; + uint8_t bsn1_lo:1, cps:3, dummy:4; +#endif } __attribute__ ((packed)); struct gprs_rlc_dl_header_egprs_3 { +#if OSMO_IS_LITTLE_ENDIAN uint8_t tfi_hi:1, rrbp:2, es_p:2, @@ -205,5 +303,12 @@ struct gprs_rlc_dl_header_egprs_3 { spb:2, cps:4, bsn1_lo:1; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t usf:3, es_p:2, rrbp:2, tfi_hi:1; + uint8_t tfi_lo:4, pr:2, bsn1_hi:2; + uint8_t bsn1_mid:8; + uint8_t bsn1_lo:1, cps:4, spb:2, dummy:1; +#endif } __attribute__ ((packed)); #endif |