Skip to content

Commit

Permalink
Bluetooth: controller: Fix cond. compilation for broadcaster
Browse files Browse the repository at this point in the history
Fix compilation error when building only broadcaster support
in an application.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak authored and carlescufi committed Oct 7, 2020
1 parent 0de3943 commit abebdb2
Showing 1 changed file with 50 additions and 49 deletions.
99 changes: 50 additions & 49 deletions subsys/bluetooth/controller/ll_sw/ull.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,18 @@ static inline void *mark_get(void *m);
static inline void done_alloc(void);
static inline void rx_alloc(uint8_t max);
static void rx_demux(void *param);
#if defined(CONFIG_BT_CONN)
static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last);
static inline void rx_demux_conn_tx_ack(uint8_t ack_last, uint16_t handle,
memq_link_t *link,
struct node_tx *node_tx);
#endif /* CONFIG_BT_CONN */
static inline int rx_demux_rx(memq_link_t *link, struct node_rx_hdr *rx);
static inline void rx_demux_event_done(memq_link_t *link,
struct node_rx_hdr *rx);
static inline void ll_rx_link_inc_quota(int8_t delta);
static void disabled_cb(void *param);

#if defined(CONFIG_BT_CONN)
static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last);
#endif /* CONFIG_BT_CONN */

int ll_init(struct k_sem *sem_rx)
{
int err;
Expand Down Expand Up @@ -1327,6 +1326,7 @@ void *ull_event_done(void *param)
return evdone;
}

#if defined(CONFIG_BT_PERIPHERAL) || defined(CONFIG_BT_CTLR_SCAN_PERIODIC)
/**
* @brief Extract timing from completed event
*
Expand Down Expand Up @@ -1370,6 +1370,7 @@ void ull_drift_ticks_get(struct node_rx_event_done *done,
preamble_to_addr_us);
}
}
#endif /* CONFIG_BT_PERIPHERAL || CONFIG_BT_CTLR_SCAN_PERIODIC */

static inline int init_reset(void)
{
Expand Down Expand Up @@ -1575,51 +1576,6 @@ static inline void rx_alloc(uint8_t max)
}
}

#if defined(CONFIG_BT_CONN)
static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last)
{
struct lll_tx *tx;
uint8_t cmplt;

tx = mfifo_dequeue_iter_get(mfifo_tx_ack.m, mfifo_tx_ack.s,
mfifo_tx_ack.n, mfifo_tx_ack.f, last,
first);
if (!tx) {
return 0;
}

*handle = tx->handle;
cmplt = 0U;
do {
struct node_tx *node_tx;
struct pdu_data *p;

node_tx = tx->node;
p = (void *)node_tx->pdu;
if (!node_tx || (node_tx == (void *)1) ||
(((uint32_t)node_tx & ~3) &&
(p->ll_id == PDU_DATA_LLID_DATA_START ||
p->ll_id == PDU_DATA_LLID_DATA_CONTINUE))) {
/* data packet, hence count num cmplt */
tx->node = (void *)1;
cmplt++;
} else {
/* ctrl packet or flushed, hence dont count num cmplt */
tx->node = (void *)2;
}

if (((uint32_t)node_tx & ~3)) {
ll_tx_mem_release(node_tx);
}

tx = mfifo_dequeue_iter_get(mfifo_tx_ack.m, mfifo_tx_ack.s,
mfifo_tx_ack.n, mfifo_tx_ack.f,
last, first);
} while (tx && tx->handle == *handle);

return cmplt;
}

static void rx_demux(void *param)
{
memq_link_t *link;
Expand Down Expand Up @@ -1687,6 +1643,51 @@ static void rx_demux(void *param)
#endif /* CONFIG_BT_CTLR_LOW_LAT_ULL */
}

#if defined(CONFIG_BT_CONN)
static uint8_t tx_cmplt_get(uint16_t *handle, uint8_t *first, uint8_t last)
{
struct lll_tx *tx;
uint8_t cmplt;

tx = mfifo_dequeue_iter_get(mfifo_tx_ack.m, mfifo_tx_ack.s,
mfifo_tx_ack.n, mfifo_tx_ack.f, last,
first);
if (!tx) {
return 0;
}

*handle = tx->handle;
cmplt = 0U;
do {
struct node_tx *node_tx;
struct pdu_data *p;

node_tx = tx->node;
p = (void *)node_tx->pdu;
if (!node_tx || (node_tx == (void *)1) ||
(((uint32_t)node_tx & ~3) &&
(p->ll_id == PDU_DATA_LLID_DATA_START ||
p->ll_id == PDU_DATA_LLID_DATA_CONTINUE))) {
/* data packet, hence count num cmplt */
tx->node = (void *)1;
cmplt++;
} else {
/* ctrl packet or flushed, hence dont count num cmplt */
tx->node = (void *)2;
}

if (((uint32_t)node_tx & ~3)) {
ll_tx_mem_release(node_tx);
}

tx = mfifo_dequeue_iter_get(mfifo_tx_ack.m, mfifo_tx_ack.s,
mfifo_tx_ack.n, mfifo_tx_ack.f,
last, first);
} while (tx && tx->handle == *handle);

return cmplt;
}

static inline void rx_demux_conn_tx_ack(uint8_t ack_last, uint16_t handle,
memq_link_t *link,
struct node_tx *node_tx)
Expand Down

0 comments on commit abebdb2

Please sign in to comment.