diff --git a/subsys/bluetooth/controller/include/ll.h b/subsys/bluetooth/controller/include/ll.h index 392a08b84fb..3f9feb70d1f 100644 --- a/subsys/bluetooth/controller/include/ll.h +++ b/subsys/bluetooth/controller/include/ll.h @@ -19,7 +19,7 @@ u32_t ll_adv_params_set(u16_t interval, u8_t adv_type, void ll_adv_data_set(u8_t len, u8_t const *const p_data); void ll_scan_data_set(u8_t len, u8_t const *const p_data); u32_t ll_adv_enable(u8_t enable); -u32_t ll_scan_params_set(u8_t scan_type, u16_t interval, u16_t window, +u32_t ll_scan_params_set(u8_t type, u16_t interval, u16_t window, u8_t own_addr_type, u8_t filter_policy); u32_t ll_scan_enable(u8_t enable); void ll_filter_clear(void); diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.c b/subsys/bluetooth/controller/ll_sw/ctrl.c index 913b5c2828d..5ee6f34c754 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.c +++ b/subsys/bluetooth/controller/ll_sw/ctrl.c @@ -94,9 +94,9 @@ struct scanner { struct shdr hdr; u8_t is_enabled:1; - u8_t scan_type:1; - u8_t scan_state:1; - u8_t scan_chan:2; + u8_t state:1; + u8_t chan:2; + u8_t type:1; u8_t filter_policy:2; u8_t adv_addr_type:1; u8_t init_addr_type:1; @@ -1230,7 +1230,7 @@ static inline u32_t isr_rx_scan(u8_t irkmatch_id, u8_t rssi_ready) /* Active scanner */ else if (((pdu_adv_rx->type == PDU_ADV_TYPE_ADV_IND) || (pdu_adv_rx->type == PDU_ADV_TYPE_SCAN_IND)) && - (_radio.scanner.scan_type != 0) && + (_radio.scanner.type != 0) && (_radio.scanner.conn == 0)) { struct pdu_adv *pdu_adv_tx; u32_t err; @@ -1253,7 +1253,7 @@ static inline u32_t isr_rx_scan(u8_t irkmatch_id, u8_t rssi_ready) &pdu_adv_rx->payload.adv_ind.addr[0], BDADDR_SIZE); /* switch scanner state to active */ - _radio.scanner.scan_state = 1; + _radio.scanner.state = 1; _radio.state = STATE_TX; radio_pkt_tx_set(pdu_adv_tx); @@ -1280,7 +1280,7 @@ static inline u32_t isr_rx_scan(u8_t irkmatch_id, u8_t rssi_ready) (pdu_adv_rx->type == PDU_ADV_TYPE_NONCONN_IND) || (pdu_adv_rx->type == PDU_ADV_TYPE_SCAN_IND) || ((pdu_adv_rx->type == PDU_ADV_TYPE_SCAN_RSP) && - (_radio.scanner.scan_state != 0))) && + (_radio.scanner.state != 0))) && (pdu_adv_rx->len != 0) && (!_radio.scanner.conn)) { u32_t err; @@ -2745,7 +2745,7 @@ static inline void isr_radio_state_rx(u8_t trx_done, u8_t crc_ok, _radio.state = STATE_CLOSE; radio_disable(); /* switch scanner state to idle */ - _radio.scanner.scan_state = 0; + _radio.scanner.state = 0; } break; @@ -4966,13 +4966,13 @@ static void event_scan(u32_t ticks_at_expire, u32_t remainder, u16_t lazy, _radio.ticker_id_prepare = 0; _radio.ticker_id_event = RADIO_TICKER_ID_SCAN; _radio.ticks_anchor = ticks_at_expire; - _radio.scanner.scan_state = 0; + _radio.scanner.state = 0; adv_scan_configure(0, 0); /* TODO: Advertisement PHY */ - chan_set(37 + _radio.scanner.scan_chan++); - if (_radio.scanner.scan_chan == 3) { - _radio.scanner.scan_chan = 0; + chan_set(37 + _radio.scanner.chan++); + if (_radio.scanner.chan == 3) { + _radio.scanner.chan = 0; } radio_pkt_rx_set(_radio.packet_rx[_radio.packet_rx_last]->pdu_data); @@ -8301,7 +8301,7 @@ u32_t radio_adv_is_enabled(void) return _radio.advertiser.is_enabled; } -u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, u8_t *init_addr, +u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr, u16_t interval, u16_t window, u8_t filter_policy) { u32_t volatile ret_cb = TICKER_STATUS_BUSY; @@ -8315,7 +8315,7 @@ u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, u8_t *init_addr, return 1; } - _radio.scanner.scan_type = scan_type; + _radio.scanner.type = type; _radio.scanner.init_addr_type = init_addr_type; memcpy(&_radio.scanner.init_addr[0], init_addr, BDADDR_SIZE); _radio.scanner.ticks_window = diff --git a/subsys/bluetooth/controller/ll_sw/ctrl.h b/subsys/bluetooth/controller/ll_sw/ctrl.h index c1f5f6f212f..85ff8a2bf56 100644 --- a/subsys/bluetooth/controller/ll_sw/ctrl.h +++ b/subsys/bluetooth/controller/ll_sw/ctrl.h @@ -320,7 +320,7 @@ u32_t radio_adv_enable(u16_t interval, u8_t chl_map, u32_t radio_adv_disable(void); u32_t radio_adv_is_enabled(void); /* Downstream - Scanner */ -u32_t radio_scan_enable(u8_t scan_type, u8_t init_addr_type, +u32_t radio_scan_enable(u8_t type, u8_t init_addr_type, u8_t *init_addr, u16_t interval, u16_t window, u8_t filter_policy); u32_t radio_scan_disable(void); diff --git a/subsys/bluetooth/controller/ll_sw/ll_scan.c b/subsys/bluetooth/controller/ll_sw/ll_scan.c index f92c6e3cbf9..3402e98c7ab 100644 --- a/subsys/bluetooth/controller/ll_sw/ll_scan.c +++ b/subsys/bluetooth/controller/ll_sw/ll_scan.c @@ -16,19 +16,19 @@ static struct { u16_t interval; u16_t window; - u8_t scan_type:1; + u8_t type:1; u8_t tx_addr:1; u8_t filter_policy:1; } ll_scan; -u32_t ll_scan_params_set(u8_t scan_type, u16_t interval, u16_t window, +u32_t ll_scan_params_set(u8_t type, u16_t interval, u16_t window, u8_t own_addr_type, u8_t filter_policy) { if (radio_scan_is_enabled()) { return 0x0C; /* Command Disallowed */ } - ll_scan.scan_type = scan_type; + ll_scan.type = type; ll_scan.interval = interval; ll_scan.window = window; ll_scan.tx_addr = own_addr_type; @@ -47,7 +47,7 @@ u32_t ll_scan_enable(u8_t enable) return status; } - status = radio_scan_enable(ll_scan.scan_type, ll_scan.tx_addr, + status = radio_scan_enable(ll_scan.type, ll_scan.tx_addr, ll_addr_get(ll_scan.tx_addr, NULL), ll_scan.interval, ll_scan.window, ll_scan.filter_policy);