Skip to content

Commit 9799478

Browse files
cvinayakrlubos
authored andcommitted
[nrf fromtree] Bluetooth: Controller: Reuse cpu_sleep interface
Reuse cpu_sleep() interface consistently in Controller. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]> (cherry picked from commit b46b833) Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 775ebfa commit 9799478

File tree

2 files changed

+11
-13
lines changed
  • subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5

2 files changed

+11
-13
lines changed

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/ecb.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include <hal/nrf_ecb.h>
1313

1414
#include "util/mem.h"
15+
16+
#include "hal/cpu.h"
1517
#include "hal/ecb.h"
1618

1719
#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)
@@ -39,7 +41,10 @@ static void do_ecb(struct ecb_param *ecb)
3941
#if defined(CONFIG_SOC_SERIES_BSIM_NRFXX)
4042
k_busy_wait(10);
4143
#else
42-
/*__WFE();*/
44+
/* FIXME: use cpu_sleep(), but that will need interrupt
45+
* wake up source and hence necessary appropriate
46+
* code.
47+
*/
4348
#endif
4449
}
4550
nrf_ecb_task_trigger(NRF_ECB, NRF_ECB_TASK_STOPECB);
@@ -188,9 +193,7 @@ uint32_t ecb_ut(void)
188193
ecb.context = &context;
189194
status = ecb_encrypt_nonblocking(&ecb);
190195
do {
191-
__WFE();
192-
__SEV();
193-
__WFE();
196+
cpu_sleep();
194197
} while (!context.done);
195198

196199
if (context.status != 0U) {

subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/radio/radio.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "util/mem.h"
1919

20+
#include "hal/cpu.h"
2021
#include "hal/ccm.h"
2122
#include "hal/radio.h"
2223
#include "hal/ticker.h"
@@ -1608,9 +1609,7 @@ uint32_t radio_ccm_is_done(void)
16081609
{
16091610
nrf_ccm_int_enable(NRF_CCM, CCM_INTENSET_ENDCRYPT_Msk);
16101611
while (NRF_CCM->EVENTS_ENDCRYPT == 0) {
1611-
__WFE();
1612-
__SEV();
1613-
__WFE();
1612+
cpu_sleep();
16141613
}
16151614
nrf_ccm_int_disable(NRF_CCM, CCM_INTENCLR_ENDCRYPT_Msk);
16161615
NVIC_ClearPendingIRQ(nrfx_get_irq_number(NRF_CCM));
@@ -1701,9 +1700,7 @@ uint32_t radio_ar_has_match(void)
17011700
nrf_aar_int_enable(NRF_AAR, AAR_INTENSET_END_Msk);
17021701

17031702
while (NRF_AAR->EVENTS_END == 0U) {
1704-
__WFE();
1705-
__SEV();
1706-
__WFE();
1703+
cpu_sleep();
17071704
}
17081705

17091706
nrf_aar_int_disable(NRF_AAR, AAR_INTENCLR_END_Msk);
@@ -1737,9 +1734,7 @@ uint8_t radio_ar_resolve(const uint8_t *addr)
17371734
nrf_aar_task_trigger(NRF_AAR, NRF_AAR_TASK_START);
17381735

17391736
while (NRF_AAR->EVENTS_END == 0) {
1740-
__WFE();
1741-
__SEV();
1742-
__WFE();
1737+
cpu_sleep();
17431738
}
17441739

17451740
nrf_aar_int_disable(NRF_AAR, AAR_INTENCLR_END_Msk);

0 commit comments

Comments
 (0)