mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-07 09:40:07 +00:00
nimble/ll: Extend controller busy helper with flags
This allows to optionally exclude specific checks (currently connections only).
This commit is contained in:
@@ -2063,7 +2063,7 @@ ble_ll_tx_power_set(int tx_power)
|
||||
}
|
||||
|
||||
int
|
||||
ble_ll_is_busy(void)
|
||||
ble_ll_is_busy(unsigned int flags)
|
||||
{
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
struct ble_ll_conn_sm *cur;
|
||||
@@ -2095,13 +2095,15 @@ ble_ll_is_busy(void)
|
||||
#endif
|
||||
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL) || MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
STAILQ_FOREACH(cur, &g_ble_ll_conn_free_list, free_stqe) {
|
||||
i++;
|
||||
}
|
||||
if (!(flags & BLE_LL_BUSY_EXCLUDE_CONNECTIONS)) {
|
||||
STAILQ_FOREACH(cur, &g_ble_ll_conn_free_list, free_stqe) {
|
||||
i++;
|
||||
}
|
||||
|
||||
/* check if all connection objects are free */
|
||||
if (i < MYNEWT_VAL(BLE_MAX_CONNECTIONS)) {
|
||||
return 1;
|
||||
/* check if all connection objects are free */
|
||||
if (i < MYNEWT_VAL(BLE_MAX_CONNECTIONS)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -483,7 +483,7 @@ ble_ll_dtm_tx_test(uint8_t tx_chan, uint8_t len, uint8_t packet_payload,
|
||||
{
|
||||
uint8_t phy_mode;
|
||||
|
||||
if (g_ble_ll_dtm_ctx.active || ble_ll_is_busy()) {
|
||||
if (g_ble_ll_dtm_ctx.active || ble_ll_is_busy(0)) {
|
||||
return BLE_ERR_CTLR_BUSY;
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ ble_ll_dtm_rx_test(uint8_t rx_chan, uint8_t hci_phy)
|
||||
{
|
||||
uint8_t phy_mode;
|
||||
|
||||
if (g_ble_ll_dtm_ctx.active || ble_ll_is_busy()) {
|
||||
if (g_ble_ll_dtm_ctx.active || ble_ll_is_busy(0)) {
|
||||
return BLE_ERR_CTLR_BUSY;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ ble_ll_hci_vs_set_tx_power(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (ble_ll_is_busy()) {
|
||||
if (ble_ll_is_busy(0)) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ ble_ll_hci_vs_set_antenna(uint16_t ocf, const uint8_t *cmdbuf, uint8_t cmdlen,
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (ble_ll_is_busy()) {
|
||||
if (ble_ll_is_busy(0)) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,9 @@ ble_ll_rx_gain(void)
|
||||
/* if there is any radio related activity enabled
|
||||
* (scanning, advertising, connection etc)
|
||||
*/
|
||||
int ble_ll_is_busy(void);
|
||||
#define BLE_LL_BUSY_EXCLUDE_CONNECTIONS 0x01
|
||||
|
||||
int ble_ll_is_busy(unsigned int flags);
|
||||
|
||||
#ifdef MYNEWT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user