You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2023/01/27 18:55:24 UTC
[mynewt-nimble] 01/09: nimble: Cleanup ISO HCI commands/events defs
This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
commit e72a20a1132fccd6e5d9097ff90f3617a5354133
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Fri Jan 27 12:42:19 2023 +0100
nimble: Cleanup ISO HCI commands/events defs
This updates names to conform with Core 5.3 and also makes naming
consistent for all commands/events.
Also removes #ifdefs since we do not need them for HCI defs.
---
nimble/controller/src/ble_ll.c | 6 +-
nimble/controller/src/ble_ll_hci.c | 2 +-
nimble/include/nimble/hci_common.h | 240 ++++++++++++++++++++-----------------
3 files changed, 137 insertions(+), 111 deletions(-)
diff --git a/nimble/controller/src/ble_ll.c b/nimble/controller/src/ble_ll.c
index d193b09d..9b9fc4e0 100644
--- a/nimble/controller/src/ble_ll.c
+++ b/nimble/controller/src/ble_ll.c
@@ -1484,7 +1484,7 @@ ble_ll_read_supp_features(void)
int
ble_ll_set_host_feat(const uint8_t *cmdbuf, uint8_t len)
{
- const struct ble_hci_le_set_host_feat_cp *cmd = (const void *) cmdbuf;
+ const struct ble_hci_le_set_host_feature_cp *cmd = (const void *) cmdbuf;
uint64_t mask;
if (len != sizeof(*cmd)) {
@@ -1497,7 +1497,7 @@ ble_ll_set_host_feat(const uint8_t *cmdbuf, uint8_t len)
}
#endif
- if ((cmd->bit_num > 0x3F) || (cmd->val > 1)) {
+ if ((cmd->bit_num > 0x3F) || (cmd->bit_val > 1)) {
return BLE_ERR_INV_HCI_CMD_PARMS;
}
@@ -1506,7 +1506,7 @@ ble_ll_set_host_feat(const uint8_t *cmdbuf, uint8_t len)
return BLE_ERR_UNSUPPORTED;
}
- if (cmd->val == 0) {
+ if (cmd->bit_val == 0) {
g_ble_ll_data.ll_supp_features &= ~(mask);
} else {
g_ble_ll_data.ll_supp_features |= mask;
diff --git a/nimble/controller/src/ble_ll_hci.c b/nimble/controller/src/ble_ll_hci.c
index dc95f0de..f36563b1 100644
--- a/nimble/controller/src/ble_ll_hci.c
+++ b/nimble/controller/src/ble_ll_hci.c
@@ -1285,7 +1285,7 @@ ble_ll_hci_le_cmd_proc(const uint8_t *cmdbuf, uint8_t len, uint16_t ocf,
break;
#endif
#if MYNEWT_VAL(BLE_VERSION) >= 52
- case BLE_HCI_OCF_LE_SET_HOST_FEAT:
+ case BLE_HCI_OCF_LE_SET_HOST_FEATURE:
rc = ble_ll_set_host_feat(cmdbuf, len);
break;
#endif
diff --git a/nimble/include/nimble/hci_common.h b/nimble/include/nimble/hci_common.h
index eadb0b0e..6c9d4061 100644
--- a/nimble/include/nimble/hci_common.h
+++ b/nimble/include/nimble/hci_common.h
@@ -835,112 +835,105 @@ struct ble_hci_le_set_default_periodic_sync_transfer_params_cp {
#define BLE_HCI_OCF_LE_GENERATE_DHKEY_V2 (0x005E)
#define BLE_HCI_OCF_LE_MODIFY_SCA (0x005F)
-#if MYNEWT_VAL(BLE_ISO)
#define BLE_HCI_OCF_LE_READ_ISO_TX_SYNC (0x0061)
struct ble_hci_le_read_iso_tx_sync_cp {
uint16_t conn_handle;
} __attribute__((packed));
-
struct ble_hci_le_read_iso_tx_sync_rp {
uint16_t conn_handle;
uint16_t packet_seq_num;
- uint32_t timestamp;
- uint8_t timeoffset[3];
+ uint32_t tx_timestamp;
+ uint8_t time_offset[3];
} __attribute__((packed));
-#define BLE_HCI_LE_SET_CIG_CIS_MAX_NUM (0x1F)
-#define BLE_HCI_OCF_LE_SET_CIG_PARAM (0x0062)
+#define BLE_HCI_OCF_LE_SET_CIG_PARAMS (0x0062)
struct ble_hci_le_cis_params {
uint8_t cis_id;
- uint16_t max_sdu_mtos;
- uint16_t max_sdu_stom;
- uint8_t phy_mtos;
- uint8_t phy_stom;
- uint8_t rnt_mtos;
- uint8_t rnt_stom;
+ uint16_t max_sdu_c_to_p;
+ uint16_t max_sdu_p_to_c;
+ uint8_t phy_c_to_p;
+ uint8_t phy_p_to_c;
+ uint8_t rnt_c_to_p;
+ uint8_t rnt_p_to_c;
} __attribute__((packed));
-
struct ble_hci_le_set_cig_params_cp {
uint8_t cig_id;
- uint8_t sdu_interval_mtos[3];
- uint8_t sdu_interval_stom[3];
- uint8_t sca;
+ uint8_t sdu_interval_c_to_p[3];
+ uint8_t sdu_interval_p_to_c[3];
+ uint8_t worst_sca;
uint8_t packing;
uint8_t framing;
- uint16_t max_latency_mtos;
- uint16_t max_latency_stom;
- uint8_t cis_cnt;
- struct ble_hci_le_cis_params cis_params[0];
+ uint16_t max_latency_c_to_p;
+ uint16_t max_latency_p_to_c;
+ uint8_t cis_count;
+ struct ble_hci_le_cis_params cis[0];
} __attribute__((packed));
-
struct ble_hci_le_set_cig_params_rp {
uint8_t cig_id;
- uint8_t cis_cnt;
- uint16_t cis_handle[0];
+ uint8_t cis_count;
+ uint16_t conn_handle[0];
} __attribute__((packed));
-#if MYNEWT_VAL(BLE_ISO_TEST)
-#define BLE_HCI_OCF_LE_SET_CIG_PARAM_TEST (0x0063)
+#define BLE_HCI_OCF_LE_SET_CIG_PARAMS_TEST (0x0063)
struct ble_hci_le_cis_params_test {
uint8_t cis_id;
uint8_t nse;
- uint16_t max_sdu_mtos;
- uint16_t max_sdu_stom;
- uint16_t max_pdu_mtos;
- uint16_t max_pdu_stom;
- uint8_t phy_mtos;
- uint8_t phy_stom;
- uint8_t bn_mtos;
- uint8_t bn_stom;
+ uint16_t max_sdu_c_to_p;
+ uint16_t max_sdu_p_to_c;
+ uint16_t max_pdu_c_to_p;
+ uint16_t max_pdu_p_to_c;
+ uint8_t phy_c_to_p;
+ uint8_t phy_p_to_c;
+ uint8_t bn_c_to_p;
+ uint8_t bn_p_to_c;
} __attribute__((packed));
-
struct ble_hci_le_set_cig_params_test_cp {
uint8_t cig_id;
- uint8_t sdu_interval_mtos[3];
- uint8_t sdu_interval_stom[3];
- uint8_t ft_mtos;
- uint8_t ft_stom;
+ uint8_t sdu_interval_c_to_p[3];
+ uint8_t sdu_interval_p_to_c[3];
+ uint8_t ft_c_to_p;
+ uint8_t ft_p_to_c;
uint16_t iso_interval;
- uint8_t sca;
+ uint8_t worst_sca;
uint8_t packing;
uint8_t framing;
- uint8_t cis_cnt;
- struct ble_hci_le_cis_params_test cis_params[0];
+ uint8_t cis_count;
+ struct ble_hci_le_cis_params_test cis[0];
+} __attribute__((packed));
+struct ble_hci_le_set_cig_params_test_rp {
+ uint8_t cig_id;
+ uint8_t cis_count;
+ uint16_t conn_handle[0];
} __attribute__((packed));
-#endif
-#define BLE_HCI_LE_CREATE_CIS_MAX_CIS_NUM (0x1F)
#define BLE_HCI_OCF_LE_CREATE_CIS (0x0064)
struct ble_hci_le_create_cis_params {
uint16_t cis_handle;
uint16_t conn_handle;
} __attribute__((packed));
-
struct ble_hci_le_create_cis_cp {
- uint8_t cis_cnt;
- struct ble_hci_le_create_cis_params params[0];
+ uint8_t cis_count;
+ struct ble_hci_le_create_cis_params cis[0];
} __attribute__((packed));
#define BLE_HCI_OCF_LE_REMOVE_CIG (0x0065)
struct ble_hci_le_remove_cig_cp {
uint8_t cig_id;
} __attribute__((packed));
-
struct ble_hci_le_remove_cig_rp {
uint8_t cig_id;
} __attribute__((packed));
#define BLE_HCI_OCF_LE_ACCEPT_CIS_REQ (0x0066)
struct ble_hci_le_accept_cis_request_cp {
- uint16_t cis_handle;
+ uint16_t conn_handle;
} __attribute__((packed));
#define BLE_HCI_OCF_LE_REJECT_CIS_REQ (0x0067)
struct ble_hci_le_reject_cis_request_cp {
- uint16_t cis_handle;
+ uint16_t conn_handle;
uint8_t reason;
} __attribute__((packed));
-
struct ble_hci_le_reject_cis_request_rp {
uint16_t conn_handle;
} __attribute__((packed));
@@ -949,11 +942,11 @@ struct ble_hci_le_reject_cis_request_rp {
struct ble_hci_le_create_big_cp {
uint8_t big_handle;
uint8_t adv_handle;
- uint8_t bis_cnt;
+ uint8_t num_bis;
uint8_t sdu_interval[3];
uint16_t max_sdu;
uint16_t max_transport_latency;
- uint8_t rnt;
+ uint8_t rtn;
uint8_t phy;
uint8_t packing;
uint8_t framing;
@@ -961,12 +954,11 @@ struct ble_hci_le_create_big_cp {
uint8_t broadcast_code[16];
} __attribute__((packed));
-#if MYNEWT_VAL(BLE_ISO_TEST)
#define BLE_HCI_OCF_LE_CREATE_BIG_TEST (0x0069)
struct ble_hci_le_create_big_test_cp {
uint8_t big_handle;
uint8_t adv_handle;
- uint8_t bis_cnt;
+ uint8_t num_bis;
uint8_t sdu_interval[3];
uint16_t iso_interval;
uint8_t nse;
@@ -981,7 +973,6 @@ struct ble_hci_le_create_big_test_cp {
uint8_t encryption;
uint8_t broadcast_code[16];
} __attribute__((packed));
-#endif
#define BLE_HCI_OCF_LE_TERMINATE_BIG (0x006a)
struct ble_hci_le_terminate_big_cp {
@@ -989,78 +980,113 @@ struct ble_hci_le_terminate_big_cp {
uint8_t reason;
} __attribute__((packed));
-#define BLE_HCI_LE_BIG_CREATE_SYNC_LEN_MIN (25)
#define BLE_HCI_OCF_LE_BIG_CREATE_SYNC (0x006b)
struct ble_hci_le_big_create_sync_cp {
uint8_t big_handle;
uint16_t sync_handle;
- uint8_t big_cnt;
uint8_t encryption;
uint8_t broadcast_code[16];
uint8_t mse;
- uint16_t timeout;
+ uint16_t sync_timeout;
+ uint8_t num_bis;
uint8_t bis[0];
} __attribute__((packed));
#define BLE_HCI_OCF_LE_BIG_TERMINATE_SYNC (0x006c)
-struct ble_hci_le_terminate_big_sync_cp {
+struct ble_hci_le_big_terminate_sync_cp {
+ uint8_t big_handle;
+} __attribute__((packed));
+struct ble_hci_le_big_terminate_sync_rp {
uint8_t big_handle;
} __attribute__((packed));
-#endif
#define BLE_HCI_OCF_LE_REQ_PEER_SCA (0x006d)
struct ble_hci_le_request_peer_sca_cp {
uint16_t conn_handle;
} __attribute__((packed));
-#if MYNEWT_VAL(BLE_ISO)
#define BLE_HCI_OCF_LE_SETUP_ISO_DATA_PATH (0x006e)
-struct ble_hci_le_iso_setup_data_path_cp {
- uint16_t iso_handle;
- uint8_t direction;
- uint8_t id;
+struct ble_hci_le_setup_iso_data_path_cp {
+ uint16_t conn_handle;
+ uint8_t data_path_dir;
+ uint8_t data_path_id;
uint8_t codec_id[5];
uint8_t controller_delay[3];
- uint8_t codec_conf_len;
- uint8_t codec_conf[0];
+ uint8_t codec_config_len;
+ uint8_t codec_config[0];
+} __attribute__((packed));
+struct ble_hci_le_setup_iso_data_path_rp {
+ uint16_t conn_handle;
} __attribute__((packed));
-#define BLE_HCI_LE_REMOVE_INPUT_DATA_PATH_BIT (0x01)
-#define BLE_HCI_LE_REMOVE_OUTPUT_DATA_PATH_BIT (0x02)
#define BLE_HCI_OCF_LE_REMOVE_ISO_DATA_PATH (0x006f)
-struct ble_hci_le_iso_remove_data_path_cp {
- uint16_t iso_handle;
- uint8_t direction;
+struct ble_hci_le_remove_iso_data_path_cp {
+ uint16_t conn_handle;
+ uint8_t data_path_dir;
+} __attribute__((packed));
+struct ble_hci_le_remove_iso_data_path_rp {
+ uint16_t conn_handle;
} __attribute__((packed));
-#if MYNEWT_VAL(BLE_ISO_TEST)
#define BLE_HCI_OCF_LE_ISO_TRANSMIT_TEST (0x0070)
struct ble_hci_le_iso_transmit_test_cp {
- uint16_t iso_handle;
+ uint16_t conn_handle;
uint8_t payload_type;
} __attribute__((packed));
+struct ble_hci_le_iso_transmit_test_rp {
+ uint16_t conn_handle;
+} __attribute__((packed));
#define BLE_HCI_OCF_LE_ISO_RECEIVE_TEST (0x0071)
struct ble_hci_le_iso_receive_test_cp {
- uint16_t iso_handle;
+ uint16_t conn_handle;
+ uint8_t payload_type;
+} __attribute__((packed));
+struct ble_hci_le_iso_receive_test_rp {
+ uint16_t conn_handle;
} __attribute__((packed));
#define BLE_HCI_OCF_LE_ISO_READ_TEST_COUNTERS (0x0072)
struct ble_hci_le_iso_read_test_counters_cp {
- uint16_t iso_handle;
+ uint16_t conn_handle;
+} __attribute__((packed));
+struct ble_hci_le_iso_read_test_counters_rp {
+ uint16_t conn_handle;
+ uint32_t received_sdu_count;
+ uint32_t missed_sdu_count;
+ uint32_t failed_sdu_count;
} __attribute__((packed));
#define BLE_HCI_OCF_LE_ISO_TEST_END (0x0073)
struct ble_hci_le_iso_test_end_cp {
- uint16_t iso_handle;
+ uint16_t conn_handle;
+} __attribute__((packed));
+struct ble_hci_le_iso_test_end_rp {
+ uint16_t conn_handle;
+ uint32_t received_sdu_count;
+ uint32_t missed_sdu_count;
+ uint32_t failed_sdu_count;
} __attribute__((packed));
-#endif
-#endif
-#define BLE_HCI_OCF_LE_SET_HOST_FEAT (0x0074)
-struct ble_hci_le_set_host_feat_cp {
+#define BLE_HCI_OCF_LE_SET_HOST_FEATURE (0x0074)
+struct ble_hci_le_set_host_feature_cp {
uint8_t bit_num;
- uint8_t val;
+ uint8_t bit_val;
+} __attribute__((packed));
+
+#define BLE_HCI_OCF_LE_READ_ISO_LINK_QUALITY (0x0075)
+struct ble_hci_le_read_iso_link_quality_cp {
+ uint16_t conn_handle;
+} __attribute__((packed));
+struct ble_hci_le_read_iso_link_quality_rp {
+ uint16_t conn_handle;
+ uint32_t tx_unacked_pkts;
+ uint32_t tx_flushed_pkts;
+ uint32_t tx_last_subevent_pkts;
+ uint32_t retransmitted_pkts;
+ uint32_t crc_error_pkts;
+ uint32_t rx_unreceived_pkts;
+ uint32_t duplicate_pkts;
} __attribute__((packed));
#define BLE_HCI_OCF_LE_ENH_READ_TRANSMIT_POWER_LEVEL (0x0076)
@@ -1816,43 +1842,43 @@ struct ble_hci_ev_le_subev_periodic_adv_sync_transfer {
uint8_t aca;
} __attribute__((packed));
-#define BLE_HCI_LE_SUBEV_CIS_ESTAB (0x19)
+#define BLE_HCI_LE_SUBEV_CIS_ESTABLISHED (0x19)
struct ble_hci_ev_le_subev_cis_established {
uint8_t subev_code;
uint8_t status;
- uint16_t cis_handle;
+ uint16_t conn_handle;
uint8_t cig_sync_delay[3];
uint8_t cis_sync_delay[3];
- uint8_t trans_latency_mtos[3];
- uint8_t trans_latency_stom[3];
- uint8_t phy_mtos;
- uint8_t phy_stom;
+ uint8_t transport_latency_c_to_p[3];
+ uint8_t transport_latency_p_to_c[3];
+ uint8_t phy_c_to_p;
+ uint8_t phy_p_to_c;
uint8_t nse;
- uint8_t bn_mtos;
- uint8_t bn_stom;
- uint8_t ft_mtos;
- uint8_t ft_stom;
- uint16_t max_pdu_mtos;
- uint16_t max_pdu_stom;
+ uint8_t bn_c_to_p;
+ uint8_t bn_p_to_c;
+ uint8_t ft_c_to_p;
+ uint8_t ft_p_to_c;
+ uint16_t max_pdu_c_to_p;
+ uint16_t max_pdu_p_to_c;
uint16_t iso_interval;
} __attribute__((packed));
#define BLE_HCI_LE_SUBEV_CIS_REQUEST (0x1A)
struct ble_hci_ev_le_subev_cis_request {
uint8_t subev_code;
- uint16_t conn_handle;
- uint16_t cis_handle;
+ uint16_t acl_conn_handle;
+ uint16_t cis_conn_handle;
uint8_t cig_id;
uint8_t cis_id;
} __attribute__((packed));
-#define BLE_HCI_LE_SUBEV_BIG_COMP (0x1B)
-struct ble_hci_ev_le_subev_big_complete {
+#define BLE_HCI_LE_SUBEV_CREATE_BIG_COMPLETE (0x1B)
+struct ble_hci_ev_le_subev_create_big_complete {
uint8_t subev_code;
uint8_t status;
uint8_t big_handle;
uint8_t big_sync_delay[3];
- uint8_t transport_latency[3];
+ uint8_t transport_latency_big[3];
uint8_t phy;
uint8_t nse;
uint8_t bn;
@@ -1860,31 +1886,31 @@ struct ble_hci_ev_le_subev_big_complete {
uint8_t irc;
uint16_t max_pdu;
uint16_t iso_interval;
- uint8_t bis_cnt;
- uint16_t bis[0];
+ uint8_t num_bis;
+ uint16_t conn_handle[0];
} __attribute__((packed));
-#define BLE_HCI_LE_SUBEV_BIG_TERMINATE_COMP (0x1C)
-struct ble_hci_ev_le_subev_big_terminate_complete {
+#define BLE_HCI_LE_SUBEV_TERMINATE_BIG_COMPLETE (0x1C)
+struct ble_hci_ev_le_subev_terminate_big_complete {
uint8_t subev_code;
uint8_t big_handle;
uint8_t reason;
} __attribute__((packed));
-#define BLE_HCI_LE_SUBEV_BIG_SYNC_ESTAB (0x1D)
+#define BLE_HCI_LE_SUBEV_BIG_SYNC_ESTABLISHED (0x1D)
struct ble_hci_ev_le_subev_big_sync_established {
uint8_t subev_code;
uint8_t status;
uint8_t big_handle;
- uint8_t transport_latency[3];
+ uint8_t transport_latency_big[3];
uint8_t nse;
uint8_t bn;
uint8_t pto;
uint8_t irc;
uint16_t max_pdu;
uint16_t iso_interval;
- uint8_t bis_cnt;
- uint16_t bis_handles[0];
+ uint8_t num_bis;
+ uint16_t conn_handle[0];
} __attribute__((packed));
#define BLE_HCI_LE_SUBEV_BIG_SYNC_LOST (0x1E)