Bluetooth: controller: legacy: Fix cond. compile error

Fix conditional compilation error when enabling
BT_CTLR_FAST_ENC for central only application builds.

Also added additional compilation to code exclusive to
central or peripheral role.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-02-28 12:16:57 +05:30 committed by Johan Hedberg
commit 4bacb0e098

View file

@ -348,15 +348,16 @@ static void ctrl_tx_enqueue(struct connection *conn,
struct radio_pdu_node_tx *node_tx);
static void connection_release(struct connection *conn);
static void terminate_ind_rx_enqueue(struct connection *conn, u8_t reason);
static u8_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx);
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED) && \
defined(CONFIG_BT_CTLR_SCHED_ADVANCED)
static u32_t conn_update_req(struct connection *conn);
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED && CONFIG_BT_CTLR_SCHED_ADVANCED */
#if defined(CONFIG_BT_PERIPHERAL)
static u8_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx);
static u8_t chan_map_update(struct connection *conn,
struct pdu_data *pdu_data_rx);
#endif /* CONFIG_BT_PERIPHERAL */
#if defined(CONFIG_BT_CTLR_PHY)
static inline u8_t phy_upd_ind_recv(struct radio_pdu_node_rx *node_rx,
@ -1916,6 +1917,7 @@ static inline u32_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx,
break;
#if defined(CONFIG_BT_CTLR_LE_ENC)
#if defined(CONFIG_BT_CENTRAL)
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
/* things from master stored for session key calculation */
memcpy(&_radio.conn_curr->llcp.encryption.skd[0],
@ -1936,7 +1938,9 @@ static inline u32_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx,
/* Reset enc req queued state */
_radio.conn_curr->llcp_enc.ack = _radio.conn_curr->llcp_enc.req;
break;
#endif /* CONFIG_BT_CENTRAL */
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_ENC_RSP:
/* pause data packet tx */
_radio.conn_curr->pause_tx = 1U;
@ -1948,7 +1952,9 @@ static inline u32_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx,
* alongwith this tx ack at this point in time.
*/
break;
#endif /* CONFIG_BT_PERIPHERAL */
#if defined(CONFIG_BT_CENTRAL)
case PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ:
/* pause data packet tx */
_radio.conn_curr->pause_tx = 1U;
@ -1966,6 +1972,7 @@ static inline u32_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx,
/* Reset enc req queued state */
_radio.conn_curr->llcp_enc.ack = _radio.conn_curr->llcp_enc.req;
break;
#endif /* CONFIG_BT_CENTRAL */
case PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP:
if (_radio.role == ROLE_MASTER) {
@ -2064,16 +2071,20 @@ static inline u32_t isr_rx_conn_pkt_ack(struct pdu_data *pdu_data_tx,
_radio.conn_curr->llcp_phy.state = LLCP_PHY_STATE_RSP_WAIT;
/* fall through */
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_PHY_RSP:
if (_radio.role == ROLE_SLAVE) {
isr_rx_conn_phy_tx_time_set();
}
#endif /* CONFIG_BT_PERIPHERAL */
break;
#if defined(CONFIG_BT_CENTRAL)
case PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND:
_radio.conn_curr->phy_tx_time =
_radio.conn_curr->llcp.phy_upd_ind.tx;
break;
#endif /* CONFIG_BT_CENTRAL */
#endif /* CONFIG_BT_CTLR_PHY */
default:
@ -2324,7 +2335,7 @@ isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *node_rx, u8_t *rx_enqueue)
rej_ext_ind = (void *)&pdu_rx->llctrl.reject_ext_ind;
switch (rej_ext_ind->reject_opcode) {
#if defined(CONFIG_BT_CTLR_LE_ENC)
#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_CTLR_LE_ENC)
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
if (_radio.conn_curr->llcp_ack != _radio.conn_curr->llcp_req &&
_radio.conn_curr->llcp_type == LLCP_ENCRYPTION) {
@ -2336,7 +2347,7 @@ isr_rx_conn_pkt_ctrl_rej(struct radio_pdu_node_rx *node_rx, u8_t *rx_enqueue)
isr_rx_conn_pkt_ctrl_rej_enc(node_rx, rx_enqueue);
}
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */
#endif /* CONFIG_BT_CENTRAL && CONFIG_BT_CTLR_LE_ENC */
#if defined(CONFIG_BT_CTLR_PHY)
case PDU_DATA_LLCTRL_TYPE_PHY_REQ:
@ -2707,6 +2718,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
pdu_data_rx = (void *)node_rx->pdu_data;
switch (pdu_data_rx->llctrl.opcode) {
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_CONN_UPDATE_IND:
{
u8_t err;
@ -2743,6 +2755,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
}
}
break;
#endif /* CONFIG_BT_PERIPHERAL */
case PDU_DATA_LLCTRL_TYPE_TERMINATE_IND:
if (!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_TERMINATE_IND,
@ -2756,6 +2769,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
break;
#if defined(CONFIG_BT_CTLR_LE_ENC)
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_ENC_REQ:
if (!_radio.conn_curr->role ||
!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_ENC_REQ,
@ -2822,7 +2836,9 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
_radio.conn_curr->procedure_expire =
_radio.conn_curr->procedure_reload;
break;
#endif /* CONFIG_BT_PERIPHERAL */
#if defined(CONFIG_BT_CENTRAL)
case PDU_DATA_LLCTRL_TYPE_ENC_RSP:
if (_radio.conn_curr->role ||
!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_ENC_RSP,
@ -2853,6 +2869,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
/* start enc rsp to be scheduled in master prepare */
_radio.conn_curr->llcp.encryption.state = LLCP_ENC_STATE_INPROG;
break;
#endif /* CONFIG_BT_CENTRAL */
case PDU_DATA_LLCTRL_TYPE_START_ENC_RSP:
if (!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_START_ENC_RSP,
@ -2904,6 +2921,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
break;
#endif /* CONFIG_BT_CTLR_LE_ENC */
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_FEATURE_REQ:
if (!_radio.conn_curr->role ||
!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_FEATURE_REQ,
@ -2913,7 +2931,9 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
nack = feature_rsp_send(_radio.conn_curr, pdu_data_rx);
break;
#endif /* CONFIG_BT_PERIPHERAL */
#if defined(CONFIG_BT_CENTRAL)
case PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ:
if (_radio.conn_curr->role ||
!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_SLAVE_FEATURE_REQ,
@ -2923,6 +2943,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
nack = feature_rsp_send(_radio.conn_curr, pdu_data_rx);
break;
#endif /* CONFIG_BT_CENTRAL */
case PDU_DATA_LLCTRL_TYPE_FEATURE_RSP:
{
@ -2953,6 +2974,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
break;
#if defined(CONFIG_BT_CTLR_LE_ENC)
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ:
if (!_radio.conn_curr->role ||
!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ,
@ -2962,6 +2984,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
nack = pause_enc_rsp_send(_radio.conn_curr, 1);
break;
#endif /* CONFIG_BT_PERIPHERAL */
case PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP:
if (!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP,
@ -3519,6 +3542,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
}
break;
#if defined(CONFIG_BT_CENTRAL)
case PDU_DATA_LLCTRL_TYPE_PHY_RSP:
if (_radio.conn_curr->role ||
!pdu_len_cmp(PDU_DATA_LLCTRL_TYPE_PHY_RSP,
@ -3549,7 +3573,9 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
_radio.conn_curr->procedure_expire = 0U;
}
break;
#endif /* CONFIG_BT_CENTRAL */
#if defined(CONFIG_BT_PERIPHERAL)
case PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND:
{
u8_t err;
@ -3566,6 +3592,7 @@ isr_rx_conn_pkt_ctrl(struct radio_pdu_node_rx *node_rx,
}
}
break;
#endif /* CONFIG_BT_PERIPHERAL */
#endif /* CONFIG_BT_CTLR_PHY */
#if defined(CONFIG_BT_CTLR_MIN_USED_CHAN)
@ -10462,6 +10489,7 @@ static void terminate_ind_rx_enqueue(struct connection *conn, u8_t reason)
packet_rx_callback();
}
#if defined(CONFIG_BT_PERIPHERAL)
static u8_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx)
{
if (((pdu_data_rx->llctrl.conn_update_ind.instant -
@ -10504,6 +10532,7 @@ static u8_t conn_update(struct connection *conn, struct pdu_data *pdu_data_rx)
return 0;
}
#endif /* CONFIG_BT_PERIPHERAL */
#if defined (CONFIG_BT_CTLR_XTAL_ADVANCED) && \
defined(CONFIG_BT_CTLR_SCHED_ADVANCED)
@ -10558,6 +10587,7 @@ static u32_t conn_update_req(struct connection *conn)
}
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED && CONFIG_BT_CTLR_SCHED_ADVANCED */
#if defined(CONFIG_BT_PERIPHERAL)
static u8_t chan_map_update(struct connection *conn,
struct pdu_data *pdu_data_rx)
{
@ -10584,6 +10614,7 @@ static u8_t chan_map_update(struct connection *conn,
return 0;
}
#endif /* CONFIG_BT_PERIPHERAL */
#if defined(CONFIG_BT_CTLR_PHY)
static inline u8_t phy_upd_ind_recv(struct radio_pdu_node_rx *node_rx,