Skip to content

Commit

Permalink
nimble/ll: fix BLE_LL_ISO flags and function names
Browse files Browse the repository at this point in the history
This patch makes MYNEWT_VAL flags consistent: BLE_LL_CFG_FEAT_LL_ISO
defines same functionality as BLE_LL_ISO, and the latter shall be used.

Removed duplicated case in ble_ll_hci_le_cmd_proc for
BLE_HCI_OCF_LE_READ_ISO_TX_SYNC OP code.
  • Loading branch information
KKopyscinski committed Oct 16, 2023
1 parent 8618776 commit c68c18e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 58 deletions.
14 changes: 7 additions & 7 deletions nimble/controller/include/controller/ble_ll_iso.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ extern "C" {
#endif

int ble_ll_iso_read_tx_sync(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_set_cig_param(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen);
int ble_ll_isoal_hci_set_cig_param(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen);
int ble_ll_iso_set_cig_param_test(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen);
int ble_ll_iso_create_cis(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_isoal_hci_create_cis(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_disconnect_cmd(const struct ble_hci_lc_disconnect_cp *cmd);
int ble_ll_iso_remove_cig(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen);
int ble_ll_iso_accept_cis_req(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_reject_cis_req(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_isoal_hci_remove_cig(const uint8_t *cmdbuf, uint8_t len, uint8_t *rspbuf, uint8_t *rsplen);
int ble_ll_isoal_hci_accept_cis_req(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_isoal_hci_reject_cis_req(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_create_big(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_create_big_test(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_terminate_big(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_big_create_sync(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_big_terminate_sync(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_isoal_hci_big_create_sync(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_isoal_hci_big_terminate_sync(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_setup_iso_data_path(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_remove_iso_data_path(const uint8_t *cmdbuf, uint8_t len);
int ble_ll_iso_transmit_test(const uint8_t *cmdbuf, uint8_t len);
Expand Down
2 changes: 1 addition & 1 deletion nimble/controller/src/ble_ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ ble_ll_init(void)
features |= BLE_LL_FEAT_SCA_UPDATE;
#endif

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
features |= BLE_LL_FEAT_CIS_CENTRAL;
features |= BLE_LL_FEAT_CIS_PERIPH;
features |= BLE_LL_FEAT_CIS_HOST;
Expand Down
8 changes: 4 additions & 4 deletions nimble/controller/src/ble_ll_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,7 @@ ble_ll_ctrl_rx_subrate_ind(struct ble_ll_conn_sm *connsm, uint8_t *req,
}
#endif

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
static uint8_t
ble_ll_ctrl_rx_cis_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
uint8_t *rspdata)
Expand Down Expand Up @@ -1522,7 +1522,7 @@ ble_ll_ctrl_start_enc_send(struct ble_ll_conn_sm *connsm)
return rc;
}

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
static void
ble_ll_ctrl_cis_create(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
{
Expand Down Expand Up @@ -2544,7 +2544,7 @@ ble_ll_ctrl_proc_init(struct ble_ll_conn_sm *connsm, int ctrl_proc, void *data)
ble_ll_ctrl_sca_req_rsp_make(connsm, ctrdata);
break;
#endif
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
case BLE_LL_CTRL_PROC_CIS_CREATE:
opcode = BLE_LL_CTRL_CIS_REQ;
ble_ll_ctrl_cis_create(connsm, ctrdata);
Expand Down Expand Up @@ -3013,7 +3013,7 @@ ble_ll_ctrl_rx_pdu(struct ble_ll_conn_sm *connsm, struct os_mbuf *om)
break;
#endif

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
case BLE_LL_CTRL_CIS_REQ:
rsp_opcode = ble_ll_ctrl_rx_cis_req(connsm, dptr, rspdata);
break;
Expand Down
27 changes: 11 additions & 16 deletions nimble/controller/src/ble_ll_hci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1275,49 +1275,44 @@ ble_ll_hci_le_cmd_proc(const uint8_t *cmdbuf, uint8_t len, uint16_t ocf,
rc = ble_ll_iso_big_hci_terminate(cmdbuf, len);
break;
#endif /* BLE_LL_ISO_BROADCASTER */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
case BLE_HCI_OCF_LE_READ_ISO_TX_SYNC:
rc = ble_ll_iso_read_tx_sync(cmdbuf, len);
rc = ble_ll_isoal_hci_read_tx_sync(cmdbuf, len, rspbuf, rsplen);
break;
case BLE_HCI_OCF_LE_SET_CIG_PARAMS:
rc = ble_ll_iso_set_cig_param(cmdbuf, len, rspbuf, rsplen);
rc = ble_ll_isoal_hci_set_cig_param(cmdbuf, len, rspbuf, rsplen);
break;
case BLE_HCI_OCF_LE_CREATE_CIS:
rc = ble_ll_iso_create_cis(cmdbuf, len);
rc = ble_ll_isoal_hci_create_cis(cmdbuf, len);
break;
case BLE_HCI_OCF_LE_REMOVE_CIG:
rc = ble_ll_iso_remove_cig(cmdbuf, len, rspbuf, rsplen);
rc = ble_ll_isoal_hci_remove_cig(cmdbuf, len, rspbuf, rsplen);
break;
case BLE_HCI_OCF_LE_ACCEPT_CIS_REQ:
rc = ble_ll_iso_accept_cis_req(cmdbuf, len);
rc = ble_ll_isoal_hci_accept_cis_req(cmdbuf, len);
break;
case BLE_HCI_OCF_LE_REJECT_CIS_REQ:
rc = ble_ll_iso_reject_cis_req(cmdbuf, len);
rc = ble_ll_isoal_hci_reject_cis_req(cmdbuf, len);
break;
case BLE_HCI_OCF_LE_BIG_CREATE_SYNC:
rc = ble_ll_iso_big_create_sync(cmdbuf, len);
rc = ble_ll_isoal_hci_big_create_sync(cmdbuf, len);
break;
case BLE_HCI_OCF_LE_BIG_TERMINATE_SYNC:
rc = ble_ll_iso_big_terminate_sync(cmdbuf,len);
rc = ble_ll_isoal_hci_big_terminate_sync(cmdbuf, len);
break;
#endif
#if MYNEWT_VAL(BLE_LL_ISO)
case BLE_HCI_OCF_LE_SETUP_ISO_DATA_PATH:
rc = ble_ll_isoal_hci_setup_iso_data_path(cmdbuf, len, rspbuf, rsplen);
break;
case BLE_HCI_OCF_LE_REMOVE_ISO_DATA_PATH:
rc = ble_ll_isoal_hci_remove_iso_data_path(cmdbuf, len, rspbuf, rsplen);
break;
case BLE_HCI_OCF_LE_READ_ISO_TX_SYNC:
rc = ble_ll_isoal_hci_read_tx_sync(cmdbuf, len, rspbuf, rsplen);
break;
case BLE_HCI_OCF_LE_RD_BUF_SIZE_V2:
if (len == 0) {
rc = ble_ll_hci_le_read_bufsize_v2(rspbuf, rsplen);
}
break;
#endif /* BLE_LL_ISO */
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO_TEST)
#if MYNEWT_VAL(BLE_LL_ISO_TEST)
case BLE_HCI_OCF_LE_SET_CIG_PARAMS_TEST:
rc = ble_ll_iso_set_cig_param_test(cmdbuf, len, rspbuf, rsplen);
break;
Expand Down Expand Up @@ -1385,7 +1380,7 @@ ble_ll_hci_disconnect(const uint8_t *cmdbuf, uint8_t len)
return BLE_ERR_INV_HCI_CMD_PARMS;
}

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)
if (le16toh(cmd->conn_handle) >= BLE_LL_CONN_HANDLE_ISO_OFFSET) {
return ble_ll_iso_disconnect_cmd(cmd);
}
Expand Down
22 changes: 11 additions & 11 deletions nimble/controller/src/ble_ll_iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "nimble/hci_common.h"
#include "controller/ble_ll_iso.h"

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO)
#if MYNEWT_VAL(BLE_LL_ISO)

int
ble_ll_iso_read_tx_sync(const uint8_t *cmdbuf, uint8_t len)
Expand All @@ -32,14 +32,14 @@ ble_ll_iso_read_tx_sync(const uint8_t *cmdbuf, uint8_t len)
}

int
ble_ll_iso_set_cig_param(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen)
ble_ll_isoal_hci_set_cig_param(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen)
{
return BLE_ERR_UNSUPPORTED;
}

int
ble_ll_iso_create_cis(const uint8_t *cmdbuf, uint8_t len)
ble_ll_isoal_hci_create_cis(const uint8_t *cmdbuf, uint8_t len)
{
return BLE_ERR_UNSUPPORTED;
}
Expand All @@ -51,20 +51,20 @@ ble_ll_iso_disconnect_cmd(const struct ble_hci_lc_disconnect_cp *cmd)
}

int
ble_ll_iso_remove_cig(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen)
ble_ll_isoal_hci_remove_cig(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen)
{
return BLE_ERR_UNSUPPORTED;
}

int
ble_ll_iso_accept_cis_req(const uint8_t *cmdbuf, uint8_t len)
ble_ll_isoal_hci_accept_cis_req(const uint8_t *cmdbuf, uint8_t len)
{
return BLE_ERR_UNSUPPORTED;
}

int
ble_ll_iso_reject_cis_req(const uint8_t *cmdbuf, uint8_t len)
ble_ll_isoal_hci_reject_cis_req(const uint8_t *cmdbuf, uint8_t len)
{
return BLE_ERR_UNSUPPORTED;
}
Expand Down Expand Up @@ -94,18 +94,18 @@ ble_ll_iso_terminate_big(const uint8_t *cmdbuf, uint8_t len)
}

int
ble_ll_iso_big_create_sync(const uint8_t *cmdbuf, uint8_t len)
ble_ll_isoal_hci_big_create_sync(const uint8_t *cmdbuf, uint8_t len)
{
return BLE_ERR_UNSUPPORTED;
}

int
ble_ll_iso_big_terminate_sync(const uint8_t *cmdbuf, uint8_t len)
ble_ll_isoal_hci_big_terminate_sync(const uint8_t *cmdbuf, uint8_t len)
{
return BLE_ERR_UNSUPPORTED;
}

#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_ISO_TEST)
#if MYNEWT_VAL(BLE_LL_ISO)
int
ble_ll_iso_set_cig_param_test(const uint8_t *cmdbuf, uint8_t len,
uint8_t *rspbuf, uint8_t *rsplen)
Expand Down
24 changes: 9 additions & 15 deletions nimble/controller/syscfg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,21 +348,6 @@ syscfg.defs:
restrictions:
- '(BLE_VERSION >= 53) if 1'

BLE_LL_CFG_FEAT_LL_ISO:
description: >
This option is used to enable/disable support for LE Isochronous Channels
as per Bluetooth v5.2 channels
value: MYNEWT_VAL(BLE_ISO)
restrictions:
- '(BLE_VERSION >= 52) if 1'

BLE_LL_CFG_FEAT_LL_ISO_TEST:
description: >
This option is used to enable/disbale test commands for ISO support
value: MYNEWT_VAL(BLE_ISO_TEST)
restrictions:
- 'BLE_LL_CFG_FEAT_LL_ISO if 1'

BLE_LL_PERIODIC_ADV_SYNC_BIGINFO_REPORTS:
description: >
This option is used to enable/disable support for
Expand Down Expand Up @@ -481,6 +466,15 @@ syscfg.defs:
- (BLE_VERSION >= 52) if 1
value: 0
state: experimental

BLE_LL_ISO_TEST:
description: >
This option is used to enable/disbale test commands for ISO support
value: MYNEWT_VAL(BLE_ISO_TEST)
restrictions:
- 'BLE_LL_ISO if 1'
state: experimental

BLE_LL_ISO_BROADCASTER:
description: >
Enable support for Isochronous Broadcasting state.
Expand Down
8 changes: 4 additions & 4 deletions porting/npl/riot/include/syscfg/syscfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -996,13 +996,13 @@
#endif

/* Value copied from BLE_ISO */
#ifndef MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_ISO
#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_ISO (0)
#ifndef MYNEWT_VAL_BLE_LL_ISO
#define MYNEWT_VAL_BLE_LL_ISO (0)
#endif

/* Value copied from BLE_ISO_TEST */
#ifndef MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_ISO_TEST
#define MYNEWT_VAL_BLE_LL_CFG_FEAT_LL_ISO_TEST (0)
#ifndef MYNEWT_VAL_BLE_LL_ISO_TEST
#define MYNEWT_VAL_BLE_LL_ISO_TEST (0)
#endif

/* Value copied from BLE_PERIODIC_ADV */
Expand Down

0 comments on commit c68c18e

Please sign in to comment.