mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-08-31 06:10:03 +00:00
nimble: Move adv instances count definition to common header
This will be used by both controller and host now. X-Original-Commit: 5a4b7ca494a5e7ed0e8d8022fd623a4ff06809e8
This commit is contained in:
@@ -26,9 +26,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The number of advertising instances */
|
||||
#define BLE_LL_ADV_INSTANCES (MYNEWT_VAL_BLE_MULTI_ADV_INSTANCES + 1)
|
||||
|
||||
/*
|
||||
* ADV event timing
|
||||
* T_advEvent = advInterval + advDelay
|
||||
|
||||
@@ -156,7 +156,7 @@ ble_ll_adv_active_chanset_set_sec(struct ble_ll_adv_sm *advsm)
|
||||
}
|
||||
|
||||
/* The advertising state machine global object */
|
||||
struct ble_ll_adv_sm g_ble_ll_adv_sm[BLE_LL_ADV_INSTANCES];
|
||||
struct ble_ll_adv_sm g_ble_ll_adv_sm[BLE_ADV_INSTANCES];
|
||||
struct ble_ll_adv_sm *g_ble_ll_cur_adv_sm;
|
||||
|
||||
static void ble_ll_adv_make_done(struct ble_ll_adv_sm *advsm, struct ble_mbuf_hdr *hdr);
|
||||
@@ -1580,7 +1580,7 @@ ble_ll_adv_set_enable(uint8_t instance, uint8_t enable, int duration,
|
||||
int rc;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
if (instance >= BLE_LL_ADV_INSTANCES) {
|
||||
if (instance >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -1631,7 +1631,7 @@ ble_ll_adv_set_scan_rsp_data(uint8_t *cmd, uint8_t instance, uint8_t operation)
|
||||
uint8_t off = 0;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
if (instance >= BLE_LL_ADV_INSTANCES) {
|
||||
if (instance >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -1724,7 +1724,7 @@ ble_ll_adv_set_adv_data(uint8_t *cmd, uint8_t instance, uint8_t operation)
|
||||
uint8_t off = 0;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
if (instance >= BLE_LL_ADV_INSTANCES) {
|
||||
if (instance >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -1838,7 +1838,7 @@ ble_ll_adv_ext_set_param(uint8_t *cmdbuf, uint8_t *rspbuf, uint8_t *rsplen)
|
||||
uint8_t scan_req_notif;
|
||||
int8_t tx_power;
|
||||
|
||||
if (cmdbuf[0] >= BLE_LL_ADV_INSTANCES) {
|
||||
if (cmdbuf[0] >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -2066,7 +2066,7 @@ ble_ll_adv_ext_set_enable(uint8_t *cmd, uint8_t len)
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
if (sets > BLE_LL_ADV_INSTANCES) {
|
||||
if (sets > BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -2076,7 +2076,7 @@ ble_ll_adv_ext_set_enable(uint8_t *cmd, uint8_t len)
|
||||
}
|
||||
|
||||
/* disable all instances */
|
||||
for (i = 0; i < BLE_LL_ADV_INSTANCES; i++) {
|
||||
for (i = 0; i < BLE_ADV_INSTANCES; i++) {
|
||||
ble_ll_adv_set_enable(i, 0, 0, 0);
|
||||
}
|
||||
|
||||
@@ -2086,7 +2086,7 @@ ble_ll_adv_ext_set_enable(uint8_t *cmd, uint8_t len)
|
||||
set = (void *) cmd;
|
||||
/* validate instances */
|
||||
for (i = 0; i < sets; i++) {
|
||||
if (set->handle >= BLE_LL_ADV_INSTANCES) {
|
||||
if (set->handle >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -2129,7 +2129,7 @@ ble_ll_adv_set_random_addr(uint8_t *addr, uint8_t instance)
|
||||
{
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
if (instance >= BLE_LL_ADV_INSTANCES) {
|
||||
if (instance >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -2164,7 +2164,7 @@ ble_ll_adv_remove(uint8_t instance)
|
||||
* Should we allow any value for instance ID?
|
||||
*/
|
||||
|
||||
if (instance >= BLE_LL_ADV_INSTANCES) {
|
||||
if (instance >= BLE_ADV_INSTANCES) {
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -2189,7 +2189,7 @@ ble_ll_adv_clear_all(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BLE_LL_ADV_INSTANCES; i++) {
|
||||
for (i = 0; i < BLE_ADV_INSTANCES; i++) {
|
||||
if (g_ble_ll_adv_sm[i].adv_enabled) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
}
|
||||
@@ -2988,7 +2988,7 @@ ble_ll_adv_can_chg_whitelist(void)
|
||||
int i;
|
||||
|
||||
rc = 1;
|
||||
for (i = 0; i < BLE_LL_ADV_INSTANCES; ++i) {
|
||||
for (i = 0; i < BLE_ADV_INSTANCES; ++i) {
|
||||
advsm = &g_ble_ll_adv_sm[i];
|
||||
if (advsm->adv_enabled &&
|
||||
(advsm->adv_filter_policy != BLE_HCI_ADV_FILT_NONE)) {
|
||||
@@ -3089,7 +3089,7 @@ ble_ll_adv_reset(void)
|
||||
int i;
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
|
||||
for (i = 0; i < BLE_LL_ADV_INSTANCES; ++i) {
|
||||
for (i = 0; i < BLE_ADV_INSTANCES; ++i) {
|
||||
/* Stop advertising state machine */
|
||||
advsm = &g_ble_ll_adv_sm[i];
|
||||
ble_ll_adv_sm_stop(advsm);
|
||||
@@ -3144,7 +3144,7 @@ ble_ll_adv_init(void)
|
||||
int i;
|
||||
|
||||
/* Set default advertising parameters */
|
||||
for (i = 0; i < BLE_LL_ADV_INSTANCES; ++i) {
|
||||
for (i = 0; i < BLE_ADV_INSTANCES; ++i) {
|
||||
g_ble_ll_adv_sm[i].adv_instance = i;
|
||||
ble_ll_adv_sm_init(&g_ble_ll_adv_sm[i]);
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ ble_ll_adv_rd_max_adv_data_len(uint8_t *rspbuf, uint8_t *rsplen)
|
||||
static int
|
||||
ble_ll_adv_rd_sup_adv_sets(uint8_t *rspbuf, uint8_t *rsplen)
|
||||
{
|
||||
rspbuf[0] = BLE_LL_ADV_INSTANCES;
|
||||
rspbuf[0] = BLE_ADV_INSTANCES;
|
||||
*rsplen = BLE_HCI_RD_NR_SUP_ADV_SETS;
|
||||
return BLE_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,9 @@ extern "C" {
|
||||
#include "os/os.h"
|
||||
#include "syscfg/syscfg.h"
|
||||
|
||||
/* The number of advertising instances */
|
||||
#define BLE_ADV_INSTANCES (MYNEWT_VAL(BLE_MULTI_ADV_INSTANCES) + 1)
|
||||
|
||||
/* BLE encryption block definitions */
|
||||
#define BLE_ENC_BLOCK_SIZE (16)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user