[libosmocore] 01/02: Patched struct for big-endian architectures

Ruben Undheim rubund-guest at moszumanska.debian.org
Tue Dec 8 20:29:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch master
in repository libosmocore.

commit 6c61dd2448f6209ea260bdc6f6cb43cdf12c779d
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date:   Mon Dec 7 19:34:28 2015 +0100

    Patched struct for big-endian architectures
---
 include/osmocom/gsm/protocol/gsm_03_41.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h b/include/osmocom/gsm/protocol/gsm_03_41.h
index 0ece6cc..40051cd 100644
--- a/include/osmocom/gsm/protocol/gsm_03_41.h
+++ b/include/osmocom/gsm/protocol/gsm_03_41.h
@@ -2,8 +2,13 @@
 
 #include <stdint.h>
 
+#include <osmocom/core/endian.h>
 #include <osmocom/gsm/protocol/gsm_04_12.h>
 
+#ifndef OSMO_IS_LITTLE_ENDIAN
+ #define OSMO_IS_LITTLE_ENDIAN 0
+#endif
+
 /* GSM TS 03.41 definitions also TS 23.041*/
 
 #define GSM341_MAX_PAYLOAD	(GSM412_MSG_LEN-sizeof(struct gsm341_ms_message))
@@ -13,19 +18,36 @@
 /* Chapter 9.3.2 */
 struct gsm341_ms_message {
 	struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
 		uint8_t code_hi:6;
 		uint8_t gs:2;
 		uint8_t update:4;
 		uint8_t code_lo:4;
+#else
+		uint8_t gs:2;
+		uint8_t code_hi:6;
+		uint8_t code_lo:4;
+		uint8_t update:4;
+#endif
 	} serial;
 	uint16_t msg_id;
 	struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
 		uint8_t language:4;
 		uint8_t group:4;
+#else
+		uint8_t group:4;
+		uint8_t language:4;
+#endif
 	} dcs;
 	struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
 		uint8_t total:4;
 		uint8_t current:4;
+#else
+		uint8_t current:4;
+		uint8_t total:4;
+#endif
 	} page;
 	uint8_t data[0];
 } __attribute__((packed));
@@ -33,12 +55,21 @@ struct gsm341_ms_message {
 /* Chapter 9.4.1.3 */
 struct gsm341_etws_message {
 	struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
 		uint8_t code_hi:4;
 		uint8_t popup:1;
 		uint8_t alert:1;
 		uint8_t gs:2;
 		uint8_t update:4;
 		uint8_t code_lo:4;
+#else
+		uint8_t gs:2;
+		uint8_t alert:1;
+		uint8_t popup:1;
+		uint8_t code_hi:4;
+		uint8_t code_lo:4;
+		uint8_t update:4;
+#endif
 	} serial;
 	uint16_t msg_id;
 	uint16_t warning_type;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libosmocore.git



More information about the debian-science-commits mailing list