Commit 3997479b authored by Vinayak Kariappa Chettimada's avatar Vinayak Kariappa Chettimada Committed by Carles Cufi
Browse files

Bluetooth: HCI: Rename to bt_hci_iso_sdu_hdr and bt_hci_iso_sdu_ts_hdr



Rename struct bt_hci_iso_data_hdr to bt_hci_iso_sdu_hdr, and
struct bt_hci_iso_ts_data_hdr to bt_hci_iso_sdu_ts_hdr.

Signed-off-by: default avatarVinayak Kariappa Chettimada <vich@nordicsemi.no>
parent e32c2ee2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ struct bt_buf_data {

/** Helper to calculate needed buffer size for HCI ISO packets. */
#define BT_BUF_ISO_SIZE(size) BT_BUF_SIZE(BT_HCI_ISO_HDR_SIZE + \
					  BT_HCI_ISO_TS_DATA_HDR_SIZE + \
					  BT_HCI_ISO_SDU_TS_HDR_SIZE + \
					  (size))

/** Data size needed for HCI ACL RX buffers */
+5 −5
Original line number Diff line number Diff line
@@ -108,17 +108,17 @@ struct bt_hci_acl_hdr {
#define bt_iso_pkt_flags(h)              ((h) >> 14)
#define bt_iso_pkt_len_pack(h, f)        (((h) & BIT_MASK(12)) | ((f) << 14))

struct bt_hci_iso_data_hdr {
struct bt_hci_iso_sdu_hdr {
	uint16_t sn;
	uint16_t slen; /* 12 bit len, 2 bit RFU, 2 bit packet status */
} __packed;
#define BT_HCI_ISO_DATA_HDR_SIZE	4
#define BT_HCI_ISO_SDU_HDR_SIZE          4

struct bt_hci_iso_ts_data_hdr {
struct bt_hci_iso_sdu_ts_hdr {
	uint32_t ts;
	struct bt_hci_iso_data_hdr data;
	struct bt_hci_iso_sdu_hdr sdu;
} __packed;
#define BT_HCI_ISO_TS_DATA_HDR_SIZE     8
#define BT_HCI_ISO_SDU_TS_HDR_SIZE       8

/* Bluetooth spec v5.4 Vol 4, Part E - 5.4.5 HCI ISO Data Packets */
struct bt_hci_iso_hdr {
+2 −2
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ config BT_ISO_TX_MTU
	help
	  Maximum MTU for Isochronous channels TX buffers.
	  This is the actual data payload. It doesn't include the optional
	  HCI ISO Data packet fields (e.g. `struct bt_hci_iso_ts_data_hdr`).
	  HCI ISO Data packet fields (e.g. `struct bt_hci_iso_sdu_ts_hdr`).
	  Set this value to 247 to fit 247 bytes of data within a single
	  HCI ISO Data packet with a size of 255, without utilizing timestamps.

@@ -128,7 +128,7 @@ config BT_ISO_RX_MTU
	help
	  Maximum MTU for Isochronous channels RX buffers.
	  This is the actual data payload. It doesn't include the optional
	  HCI ISO Data packet fields (e.g. `struct bt_hci_iso_ts_data_hdr`)
	  HCI ISO Data packet fields (e.g. `struct bt_hci_iso_sdu_ts_hdr`)

config BT_ISO_TEST_PARAMS
	bool "ISO test parameters support"
+6 −6
Original line number Diff line number Diff line
@@ -5709,7 +5709,7 @@ int hci_acl_handle(struct net_buf *buf, struct net_buf **evt)
#if defined(CONFIG_BT_CTLR_ADV_ISO) || defined(CONFIG_BT_CTLR_CONN_ISO)
int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
{
	struct bt_hci_iso_data_hdr *iso_data_hdr;
	struct bt_hci_iso_sdu_hdr *iso_sdu_hdr;
	struct isoal_sdu_tx sdu_frag_tx;
	struct bt_hci_iso_hdr *iso_hdr;
	uint32_t *time_stamp;
@@ -5719,7 +5719,7 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)
	uint8_t flags;
	uint16_t len;

	iso_data_hdr = NULL;
	iso_sdu_hdr = NULL;
	*evt  = NULL;

	if (buf->len < sizeof(*iso_hdr)) {
@@ -5770,11 +5770,11 @@ int hci_iso_handle(struct net_buf *buf, struct net_buf **evt)

	/* Extract ISO data header if included (PB_Flag 0b00 or 0b10) */
	if ((pb_flag & 0x01) == 0) {
		iso_data_hdr = net_buf_pull_mem(buf, sizeof(*iso_data_hdr));
		len -= sizeof(*iso_data_hdr);
		sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_data_hdr->sn);
		iso_sdu_hdr = net_buf_pull_mem(buf, sizeof(*iso_sdu_hdr));
		len -= sizeof(*iso_sdu_hdr);
		sdu_frag_tx.packet_sn = sys_le16_to_cpu(iso_sdu_hdr->sn);
		sdu_frag_tx.iso_sdu_length =
			sys_le16_to_cpu(bt_iso_pkt_len(iso_data_hdr->slen));
			sys_le16_to_cpu(bt_iso_pkt_len(iso_sdu_hdr->slen));
	} else {
		sdu_frag_tx.packet_sn = 0;
		sdu_frag_tx.iso_sdu_length = 0;
+7 −7
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ static int bt_recv_prio(struct net_buf *buf)

#if defined(CONFIG_BT_CTLR_ISO)

#define SDU_HCI_HDR_SIZE (BT_HCI_ISO_HDR_SIZE + BT_HCI_ISO_TS_DATA_HDR_SIZE)
#define SDU_HCI_HDR_SIZE (BT_HCI_ISO_HDR_SIZE + BT_HCI_ISO_SDU_TS_HDR_SIZE)

isoal_status_t sink_sdu_alloc_hci(const struct isoal_sink    *sink_ctx,
				  const struct isoal_pdu_rx  *valid_pdu,
@@ -167,7 +167,7 @@ isoal_status_t sink_sdu_emit_hci(const struct isoal_sink *sink_ctx,
				 const struct isoal_emitted_sdu_frag *sdu_frag,
				 const struct isoal_emitted_sdu      *sdu)
{
	struct bt_hci_iso_ts_data_hdr *data_hdr;
	struct bt_hci_iso_sdu_ts_hdr *sdu_hdr;
	uint16_t packet_status_flag;
	struct bt_hci_iso_hdr *hdr;
	uint16_t handle_packed;
@@ -230,14 +230,14 @@ isoal_status_t sink_sdu_emit_hci(const struct isoal_sink *sink_ctx,
		ts = (pb & 0x1) == 0x0;

		if (ts) {
			data_hdr = net_buf_push(buf, BT_HCI_ISO_TS_DATA_HDR_SIZE);
			sdu_hdr = net_buf_push(buf, BT_HCI_ISO_SDU_TS_HDR_SIZE);
			slen_packed = bt_iso_pkt_len_pack(total_len, packet_status_flag);

			data_hdr->ts = sys_cpu_to_le32((uint32_t) sdu_frag->sdu.timestamp);
			data_hdr->data.sn   = sys_cpu_to_le16((uint16_t) sdu_frag->sdu.sn);
			data_hdr->data.slen = sys_cpu_to_le16(slen_packed);
			sdu_hdr->ts = sys_cpu_to_le32((uint32_t) sdu_frag->sdu.timestamp);
			sdu_hdr->sdu.sn   = sys_cpu_to_le16((uint16_t) sdu_frag->sdu.sn);
			sdu_hdr->sdu.slen = sys_cpu_to_le16(slen_packed);

			len += BT_HCI_ISO_TS_DATA_HDR_SIZE;
			len += BT_HCI_ISO_SDU_TS_HDR_SIZE;
		}

		hdr = net_buf_push(buf, BT_HCI_ISO_HDR_SIZE);
Loading