Bluetooth: controller: Fix XTAL advanced feature
Fix XTAL advanced feature by adding the missing implementation to calculate and, retain or release the XTAL clock source after a Bluetooth state or role is stopped. Fixes #15817. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
4b9dee8a74
commit
211a81f9f4
1 changed files with 81 additions and 0 deletions
|
@ -6603,6 +6603,13 @@ static void mayfly_adv_stop(void *param)
|
||||||
|
|
||||||
static inline void ticker_stop_adv_stop_active(void)
|
static inline void ticker_stop_adv_stop_active(void)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
static memq_link_t link_calc;
|
||||||
|
static struct mayfly s_mfy_xtal_calc = {0, 0, &link_calc,
|
||||||
|
(void *)RADIO_TICKER_ID_ADV,
|
||||||
|
mayfly_xtal_stop_calc};
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
|
|
||||||
static memq_link_t link_inact;
|
static memq_link_t link_inact;
|
||||||
static struct mayfly s_mfy_radio_inactive = {0, 0, &link_inact, NULL,
|
static struct mayfly s_mfy_radio_inactive = {0, 0, &link_inact, NULL,
|
||||||
mayfly_radio_inactive};
|
mayfly_radio_inactive};
|
||||||
|
@ -6681,6 +6688,17 @@ static inline void ticker_stop_adv_stop_active(void)
|
||||||
RADIO_TICKER_USER_ID_WORKER, 0,
|
RADIO_TICKER_USER_ID_WORKER, 0,
|
||||||
&s_mfy_xtal_stop);
|
&s_mfy_xtal_stop);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
/* calc whether xtal needs to be retained after
|
||||||
|
* this event
|
||||||
|
*/
|
||||||
|
ret = mayfly_enqueue(
|
||||||
|
RADIO_TICKER_USER_ID_JOB,
|
||||||
|
RADIO_TICKER_USER_ID_JOB, 0,
|
||||||
|
&s_mfy_xtal_calc);
|
||||||
|
LL_ASSERT(!ret);
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
}
|
}
|
||||||
} else if (ret_cb_m0 == TICKER_STATUS_FAILURE) {
|
} else if (ret_cb_m0 == TICKER_STATUS_FAILURE) {
|
||||||
/* Step 2.1.2: Deassert Radio Active and XTAL start */
|
/* Step 2.1.2: Deassert Radio Active and XTAL start */
|
||||||
|
@ -6696,6 +6714,16 @@ static inline void ticker_stop_adv_stop_active(void)
|
||||||
RADIO_TICKER_USER_ID_WORKER, 0,
|
RADIO_TICKER_USER_ID_WORKER, 0,
|
||||||
&s_mfy_xtal_stop);
|
&s_mfy_xtal_stop);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
/* calc whether xtal needs to be retained after this
|
||||||
|
* event
|
||||||
|
*/
|
||||||
|
ret = mayfly_enqueue(RADIO_TICKER_USER_ID_JOB,
|
||||||
|
RADIO_TICKER_USER_ID_JOB, 0,
|
||||||
|
&s_mfy_xtal_calc);
|
||||||
|
LL_ASSERT(!ret);
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
} else {
|
} else {
|
||||||
LL_ASSERT(0);
|
LL_ASSERT(0);
|
||||||
}
|
}
|
||||||
|
@ -6717,6 +6745,16 @@ static inline void ticker_stop_adv_stop_active(void)
|
||||||
&s_mfy_radio_stop);
|
&s_mfy_radio_stop);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
/* calc whether xtal needs to be retained after this
|
||||||
|
* event
|
||||||
|
*/
|
||||||
|
ret = mayfly_enqueue(RADIO_TICKER_USER_ID_JOB,
|
||||||
|
RADIO_TICKER_USER_ID_JOB, 0,
|
||||||
|
&s_mfy_xtal_calc);
|
||||||
|
LL_ASSERT(!ret);
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
|
|
||||||
/* NOTE: Cannot wait here for the event to finish
|
/* NOTE: Cannot wait here for the event to finish
|
||||||
* as we need to let radio ISR to execute if we are in
|
* as we need to let radio ISR to execute if we are in
|
||||||
* the same priority.
|
* the same priority.
|
||||||
|
@ -10326,6 +10364,12 @@ static inline void role_active_disable(u8_t ticker_id_stop,
|
||||||
u32_t ticks_xtal_to_start,
|
u32_t ticks_xtal_to_start,
|
||||||
u32_t ticks_active_to_start)
|
u32_t ticks_active_to_start)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
static memq_link_t link_calc;
|
||||||
|
static struct mayfly s_mfy_xtal_calc = {0, 0, &link_calc, NULL,
|
||||||
|
mayfly_xtal_stop_calc};
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
|
|
||||||
static memq_link_t link_inact;
|
static memq_link_t link_inact;
|
||||||
static struct mayfly s_mfy_radio_inactive = {0, 0, &link_inact, NULL,
|
static struct mayfly s_mfy_radio_inactive = {0, 0, &link_inact, NULL,
|
||||||
mayfly_radio_inactive};
|
mayfly_radio_inactive};
|
||||||
|
@ -10394,6 +10438,19 @@ static inline void role_active_disable(u8_t ticker_id_stop,
|
||||||
RADIO_TICKER_USER_ID_WORKER, 0,
|
RADIO_TICKER_USER_ID_WORKER, 0,
|
||||||
&s_mfy_xtal_stop);
|
&s_mfy_xtal_stop);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
/* calc whether xtal needs to be retained after
|
||||||
|
* this event
|
||||||
|
*/
|
||||||
|
s_mfy_xtal_calc.param =
|
||||||
|
(void *)(u32_t)_radio.ticker_id_stop;
|
||||||
|
ret = mayfly_enqueue(
|
||||||
|
RADIO_TICKER_USER_ID_APP,
|
||||||
|
RADIO_TICKER_USER_ID_JOB, 0,
|
||||||
|
&s_mfy_xtal_calc);
|
||||||
|
LL_ASSERT(!ret);
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
}
|
}
|
||||||
} else if (ret_cb_m0 == TICKER_STATUS_FAILURE) {
|
} else if (ret_cb_m0 == TICKER_STATUS_FAILURE) {
|
||||||
/* Step 2.1.2: Deassert Radio Active and XTAL start */
|
/* Step 2.1.2: Deassert Radio Active and XTAL start */
|
||||||
|
@ -10409,6 +10466,18 @@ static inline void role_active_disable(u8_t ticker_id_stop,
|
||||||
RADIO_TICKER_USER_ID_WORKER, 0,
|
RADIO_TICKER_USER_ID_WORKER, 0,
|
||||||
&s_mfy_xtal_stop);
|
&s_mfy_xtal_stop);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
/* calc whether xtal needs to be retained after this
|
||||||
|
* event
|
||||||
|
*/
|
||||||
|
s_mfy_xtal_calc.param =
|
||||||
|
(void *)(u32_t)_radio.ticker_id_stop;
|
||||||
|
ret = mayfly_enqueue(RADIO_TICKER_USER_ID_APP,
|
||||||
|
RADIO_TICKER_USER_ID_JOB, 0,
|
||||||
|
&s_mfy_xtal_calc);
|
||||||
|
LL_ASSERT(!ret);
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
} else {
|
} else {
|
||||||
LL_ASSERT(0);
|
LL_ASSERT(0);
|
||||||
}
|
}
|
||||||
|
@ -10457,6 +10526,18 @@ static inline void role_active_disable(u8_t ticker_id_stop,
|
||||||
&s_mfy_radio_stop);
|
&s_mfy_radio_stop);
|
||||||
LL_ASSERT(!ret);
|
LL_ASSERT(!ret);
|
||||||
|
|
||||||
|
#if defined(CONFIG_BT_CTLR_XTAL_ADVANCED)
|
||||||
|
/* calc whether xtal needs to be retained after this
|
||||||
|
* event
|
||||||
|
*/
|
||||||
|
s_mfy_xtal_calc.param =
|
||||||
|
(void *)(u32_t)_radio.ticker_id_stop;
|
||||||
|
ret = mayfly_enqueue(RADIO_TICKER_USER_ID_APP,
|
||||||
|
RADIO_TICKER_USER_ID_JOB, 0,
|
||||||
|
&s_mfy_xtal_calc);
|
||||||
|
LL_ASSERT(!ret);
|
||||||
|
#endif /* CONFIG_BT_CTLR_XTAL_ADVANCED */
|
||||||
|
|
||||||
/* wait for radio ISR to exit */
|
/* wait for radio ISR to exit */
|
||||||
while (_radio.role != ROLE_NONE) {
|
while (_radio.role != ROLE_NONE) {
|
||||||
cpu_sleep();
|
cpu_sleep();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue