nimble/ll: Add support for adv/scanrsp data fragmentation

This patch adds support for fragmentation of advertising and scan
response data on secondary advertising channels.

The controller can support up to 1650 bytes of data (spec limit).

The scheduling code for secondary channels is refactored to be more
generic and allow to easily schedule chains of aux packets for both
advertising and scan response data. We now have two scheduler instances
for auxiliary packets so we can have two consecutive packets scheduled.
This way AuxPtr can be calculated immediately, without need to schedule
new auxiliary packet in interrupt context. Subsequent auxiliary packets
are automatically scheduled as long as there are some data left unsent.

X-Original-Commit: 8eaa177d1a55e0dda724cda8b5bda03ec0f3c8ce
This commit is contained in:
Andrzej Kaczmarek
2018-02-06 11:00:09 +01:00
parent 54b5f31cb0
commit 5e82e31b74
4 changed files with 517 additions and 302 deletions
@@ -240,8 +240,9 @@ struct ble_dev_addr
#define BLE_LL_ACC_ADDR_LEN (4)
#define BLE_LL_CRC_LEN (3)
#define BLE_LL_PDU_HDR_LEN (2)
#define BLE_LL_MAX_PAYLOAD_LEN (255)
#define BLE_LL_MIN_PDU_LEN (BLE_LL_PDU_HDR_LEN)
#define BLE_LL_MAX_PDU_LEN (257)
#define BLE_LL_MAX_PDU_LEN ((BLE_LL_PDU_HDR_LEN) + (BLE_LL_MAX_PAYLOAD_LEN))
#define BLE_LL_CRCINIT_ADV (0x555555)
/* Access address for advertising channels */
@@ -152,10 +152,12 @@ int ble_ll_sched_master_new(struct ble_ll_conn_sm *connsm,
int ble_ll_sched_slave_new(struct ble_ll_conn_sm *connsm);
struct ble_ll_adv_sm;
typedef void ble_ll_sched_adv_new_cb(struct ble_ll_adv_sm *advsm, uint32_t sch_start);
typedef void ble_ll_sched_adv_new_cb(struct ble_ll_adv_sm *advsm,
uint32_t sch_start, void *arg);
/* Schedule a new advertising event */
int ble_ll_sched_adv_new(struct ble_ll_sched_item *sch, ble_ll_sched_adv_new_cb cb);
int ble_ll_sched_adv_new(struct ble_ll_sched_item *sch,
ble_ll_sched_adv_new_cb cb, void *arg);
/* Reschedule an advertising event */
int ble_ll_sched_adv_reschedule(struct ble_ll_sched_item *sch, uint32_t *start,
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -825,7 +825,8 @@ ble_ll_sched_slave_new(struct ble_ll_conn_sm *connsm)
}
int
ble_ll_sched_adv_new(struct ble_ll_sched_item *sch, ble_ll_sched_adv_new_cb cb)
ble_ll_sched_adv_new(struct ble_ll_sched_item *sch, ble_ll_sched_adv_new_cb cb,
void *arg)
{
int rc;
os_sr_t sr;
@@ -877,7 +878,7 @@ ble_ll_sched_adv_new(struct ble_ll_sched_item *sch, ble_ll_sched_adv_new_cb cb)
}
if (cb) {
cb((struct ble_ll_adv_sm *)orig->cb_arg, adv_start);
cb((struct ble_ll_adv_sm *)orig->cb_arg, adv_start, arg);
}
#ifdef BLE_XCVR_RFCLK