Skip to contentSkip to conversation

Added structs for AVRCP baseline messages

PATCH In review David Stockwell 1 participant 1 message Aug 11, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 Added structs for AVRCP baseline messages

Added structs for AVRCP baseline messages:
UnitInfo, SubUnitInfo, Passthrough and Vendor Dependent

Based on Release 4.96

---
 audio/control.c |   92 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 92 insertions(+), 0 deletions(-)
audio/control.c +92 -0
index 188297a..8ddcc10 100644
@@ -282,6 +282,98 @@ struct avrcp_spec_avc_pdu {
 #error "Unknown byte order"
 #endif
 
+/* structs for AVRCP UnitInfo, SubUnitInfo, and Passthrough messages. */
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
+struct	avrcp_unitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		ext_code;
+	uint8_t		unit:3;
+	uint8_t		unit_type:5;
+	uint8_t		company_id[3];
+} __attribute__ ((packed));
+
+struct	avrcp_subunit {
+	uint8_t		subunit_id_max:3;
+	uint8_t		subunit_type:5;
+} __attribute__ ((packed));
+
+struct	avrcp_subunitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		extension:3;
+	uint8_t		_rs1:1;
+	uint8_t		page:3;
+	uint8_t		_rs0:1;
+	struct avrcp_subunit subunit[4];
+} __attribute__ ((packed));
+
+struct	avrcp_passthru {
+	struct avrcp_header	hdr;
+	uint8_t		key:7;
+	uint8_t		key_state:1;
+	uint8_t		op_len;	/* =length(company_id+op_data) */
+	uint8_t		company_id[3];
+	uint8_t		op_data[];
+} __attribute__ ((packed));
+
+struct	avrcp_vendor_dep {
+	struct avrcp_header	hdr;
+	uint8_t		company_id[3];
+	uint8_t		pdu_id;
+	uint8_t		packet_type:2;
+	uint8_t		_reserved:6;
+	uint16_t	length;
+	uint8_t		pdu_data[];
+} __attribute__ ((packed));
+
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct	avrcp_unitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		ext_code;
+	uint8_t		unit_type:5;
+	uint8_t		unit:3;
+	uint8_t		company_id[3];
+} __attribute__ ((packed));
+
+struct	avrcp_subunit {
+	uint8_t		subunit_type:5;
+	uint8_t		subunit_id_max:3;
+} __attribute__ ((packed));
+
+struct	avrcp_subunitinfo {
+	struct avrcp_header	hdr;
+	uint8_t		_rs0:1;
+	uint8_t		page:3;
+	uint8_t		_rs1:1;
+	uint8_t		extension:3;
+	struct avrcp_subunit subunit[4];
+} __attribute__ ((packed));
+
+struct	avrcp_passthru {
+	struct avrcp_header	hdr;
+	uint8_t		key_state:1;
+	uint8_t		key:7;
+	uint8_t		op_len;	/* =length(company_id+op_data) */
+	uint8_t		company_id[3];
+	uint8_t		op_data[];
+} __attribute__ ((packed));
+
+struct	avrcp_vendor_dep {
+	struct avrcp_header	hdr;
+	uint8_t		company_id[3];
+	uint8_t		pdu_id;
+	uint8_t		_reserved:6;
+	uint8_t		packet_type:2;
+	uint16_t	length;
+	uint8_t		pdu_data[];
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
 struct avctp_state_callback {
 	avctp_state_cb cb;
 	void *user_data;
Signature · 1 line
1.7.4.4