nimble/ll/css: Add vs event to indicate slot change

If hci_vs support is enabled for CSS, an event will be sent every time
slot chanes for a connection.
This commit is contained in:
Andrzej Kaczmarek
2022-08-29 15:03:38 +02:00
parent 3f1e0252d0
commit 1a27fe6494
4 changed files with 48 additions and 5 deletions
@@ -350,6 +350,11 @@ void ble_ll_hci_ev_sca_update(struct ble_ll_conn_sm *connsm,
void ble_ll_hci_ev_subrate_change(struct ble_ll_conn_sm *connsm, uint8_t status);
#endif
#if MYNEWT_VAL(BLE_LL_HCI_VS_CONN_STRICT_SCHED)
void ble_ll_hci_ev_send_vs_css_slot_changed(uint16_t conn_handle,
uint16_t slot_idx);
#endif
#ifdef __cplusplus
}
#endif
+5
View File
@@ -2496,6 +2496,11 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
ble_ll_sched_css_set_conn_anchor(connsm);
anchor_calc_for_css = 0;
}
#if MYNEWT_VAL(BLE_LL_HCI_VS_CONN_STRICT_SCHED)
ble_ll_hci_ev_send_vs_css_slot_changed(connsm->conn_handle,
connsm->css_slot_idx);
#endif
}
#endif
+29 -3
View File
@@ -523,10 +523,36 @@ ble_ll_hci_ev_subrate_change(struct ble_ll_conn_sm *connsm, uint8_t status)
}
#endif
#if MYNEWT_VAL(BLE_LL_HCI_VS_CONN_STRICT_SCHED)
void
ble_ll_hci_ev_send_vs_css_slot_changed(uint16_t conn_handle, uint16_t slot_idx)
{
struct ble_hci_ev_vs_css_slot_changed *ev;
struct ble_hci_ev_vs *ev_vs;
struct ble_hci_ev *hci_ev;
hci_ev = ble_transport_alloc_evt(0);
if (!hci_ev) {
return;
}
hci_ev->opcode = BLE_HCI_EVCODE_VS;
hci_ev->length = sizeof(*ev_vs) + sizeof(*ev);
ev_vs = (void *)hci_ev->data;
ev_vs->id = BLE_HCI_VS_SUBEV_ID_CSS_SLOT_CHANGED;
ev = (void *)ev_vs->data;
ev->conn_handle = htole16(conn_handle);
ev->slot_idx = htole16(slot_idx);
ble_ll_hci_event_send(hci_ev);
}
#endif
void
ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line)
{
struct ble_hci_ev_vs_debug *ev;
struct ble_hci_ev_vs *ev;
struct ble_hci_ev *hci_ev;
unsigned int str_len;
bool skip = true;
@@ -541,12 +567,12 @@ ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line)
hci_ev = ble_transport_alloc_evt(0);
if (hci_ev) {
hci_ev->opcode = BLE_HCI_EVCODE_VS_DEBUG;
hci_ev->opcode = BLE_HCI_EVCODE_VS;
hci_ev->length = sizeof(*ev);
ev = (void *) hci_ev->data;
/* Debug id for future use */
ev->id = 0x00;
ev->id = BLE_HCI_VS_SUBEV_ID_ASSERT;
/* snprintf would be nicer but this is heavy on flash
* len = snprintf((char *) ev->data, max_len, "%s:%u", file, line);
+9 -2
View File
@@ -1554,12 +1554,19 @@ struct ble_hci_ev_auth_pyld_tmo {
#define BLE_HCI_EVCODE_SAM_STATUS_CHG (0x58)
#define BLE_HCI_EVCODE_VS_DEBUG (0xFF)
struct ble_hci_ev_vs_debug {
#define BLE_HCI_EVCODE_VS (0xff)
struct ble_hci_ev_vs {
uint8_t id;
uint8_t data[0];
} __attribute__((packed));
#define BLE_HCI_VS_SUBEV_ID_ASSERT (0x01)
#define BLE_HCI_VS_SUBEV_ID_CSS_SLOT_CHANGED (0x02)
struct ble_hci_ev_vs_css_slot_changed {
uint16_t conn_handle;
uint16_t slot_idx;
};
/* LE sub-event codes */
#define BLE_HCI_LE_SUBEV_CONN_COMPLETE (0x01)
struct ble_hci_ev_le_subev_conn_complete {