summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-08-26 16:20:14 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-08-26 16:20:14 +0000
commit66649800c48fc698130d469bf3f38b7361e89e73 (patch)
tree7d2b40a9d46007668b82a7e6c6f432b79139e4fd /audio
parent2b3b216ea155915f1b3283cba818db8be993cf4a (diff)
First attempt to make this endian safe
Diffstat (limited to 'audio')
-rw-r--r--audio/avdtp.c101
1 files changed, 91 insertions, 10 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index b90c57b8..a967be76 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -87,6 +87,8 @@ typedef enum {
AVDTP_SESSION_STATE_CONNECTED
} avdtp_session_state_t;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
struct avdtp_header {
uint8_t message_type:2;
uint8_t packet_type:2;
@@ -109,6 +111,34 @@ struct seid {
uint8_t seid:6;
} __attribute__ ((packed));
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct avdtp_header {
+ uint8_t transaction:4;
+ uint8_t packet_type:2;
+ uint8_t message_type:2;
+ uint8_t rfa0:2;
+ uint8_t signal_id:6;
+} __attribute__ ((packed));
+
+struct seid_info {
+ uint8_t seid:6;
+ uint8_t inuse:1;
+ uint8_t rfa0:1;
+ uint8_t media_type:4;
+ uint8_t type:1;
+ uint8_t rfa2:3;
+} __attribute__ ((packed));
+
+struct seid {
+ uint8_t seid:6;
+ uint8_t rfa0:2;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
/* packets */
struct gen_req {
@@ -141,17 +171,25 @@ struct suspend_req {
struct seid other_seids[0];
} __attribute__ ((packed));
-struct seid_req {
+struct seid_rej {
struct avdtp_header header;
- uint8_t rfa0:2;
- uint8_t acp_seid:6;
+ uint8_t error;
} __attribute__ ((packed));
-struct seid_rej {
+struct conf_rej {
struct avdtp_header header;
+ uint8_t category;
uint8_t error;
} __attribute__ ((packed));
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct seid_req {
+ struct avdtp_header header;
+ uint8_t rfa0:2;
+ uint8_t acp_seid:6;
+} __attribute__ ((packed));
+
struct setconf_req {
struct avdtp_header header;
@@ -163,12 +201,6 @@ struct setconf_req {
uint8_t caps[0];
} __attribute__ ((packed));
-struct conf_rej {
- struct avdtp_header header;
- uint8_t category;
- uint8_t error;
-} __attribute__ ((packed));
-
struct stream_rej {
struct avdtp_header header;
uint8_t rfa0:2;
@@ -195,6 +227,55 @@ struct avdtp_general_rej {
uint8_t rfa0;
} __attribute__ ((packed));
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct seid_req {
+ struct avdtp_header header;
+ uint8_t acp_seid:6;
+ uint8_t rfa0:2;
+} __attribute__ ((packed));
+
+struct setconf_req {
+ struct avdtp_header header;
+
+ uint8_t int_seid:6;
+ uint8_t rfa1:2;
+ uint8_t acp_seid:6;
+ uint8_t rfa0:2;
+
+ uint8_t caps[0];
+} __attribute__ ((packed));
+
+struct stream_rej {
+ struct avdtp_header header;
+ uint8_t acp_seid:6;
+ uint8_t rfa0:2;
+ uint8_t error;
+} __attribute__ ((packed));
+
+struct reconf_req {
+ struct avdtp_header header;
+
+ uint8_t acp_seid:6;
+ uint8_t rfa0:2;
+
+ uint8_t serv_cap;
+ uint8_t serv_cap_len;
+
+ uint8_t caps[0];
+} __attribute__ ((packed));
+
+struct avdtp_general_rej {
+ uint8_t transaction:4;
+ uint8_t packet_type:2;
+ uint8_t message_type:2;
+ uint8_t rfa0;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
struct pending_req {
struct avdtp_header *msg;
int msg_size;