Bluetooth: controller: Add cpu_dsb hal interface

Add cpu_dsb() hal interface so that data synchronization
barrier be used in ARM Cortex M4 and M33 architecture
implementation.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2020-08-27 20:55:28 +05:30 committed by Carles Cufí
commit 530c090cba
4 changed files with 42 additions and 13 deletions

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "hal/cpu_vendor_hal.h"

View file

@ -1,13 +0,0 @@
/*
* Copyright (c) 2016 Nordic Semiconductor ASA
* Copyright (c) 2016 Vinayak Kariappa Chettimada
*
* SPDX-License-Identifier: Apache-2.0
*/
static inline void cpu_sleep(void)
{
__WFE();
__SEV();
__WFE();
}

View file

@ -0,0 +1,7 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "hal/nrf5/cpu.h"

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2016-2020 Nordic Semiconductor ASA
* Copyright (c) 2016 Vinayak Kariappa Chettimada
*
* SPDX-License-Identifier: Apache-2.0
*/
static inline void cpu_sleep(void)
{
#if defined(CONFIG_CPU_CORTEX_M0) || \
defined(CONFIG_CPU_CORTEX_M4) || \
defined(CONFIG_CPU_CORTEX_M33)
__WFE();
__SEV();
__WFE();
#endif
}
static inline void cpu_dsb(void)
{
#if defined(CONFIG_CPU_CORTEX_M0) || defined(CONFIG_ARCH_POSIX)
/* No need of data synchronization barrier */
#elif defined(CONFIG_CPU_CORTEX_M4) || defined(CONFIG_CPU_CORTEX_M33)
__DSB();
#else
#error "Unsupported CPU."
#endif
}