Skip to content

Commit

Permalink
bootloader: bl_boot: Fix disabling of UARTs
Browse files Browse the repository at this point in the history
This is a follow-up to commit 56d117d
("bootloader: bl_boot: update UART Kconfigs").

- add missing `CONFIG_` prefixes to `HAS_HW_NRF_*` symbols
- remove invalid entries that refer to non-existing peripherals
  (UART1 and UART2)
- move `#ifdef CONFIG_UART_NRFX` to the function, where it is actually
  needed (`CONFIG_UART_NRFX_UART` and `CONFIG_UART_NRFX_UARTE` imply
  `CONFIG_UART_NRFX`, as they cannot be defined otherwise, so there is
  no need for that additional `#ifdef` in inclusions).

Signed-off-by: Andrzej Głąbek <[email protected]>
  • Loading branch information
anangl committed Oct 23, 2023
1 parent db85d67 commit ce3ca1e
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions subsys/bootloader/bl_boot/bl_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,29 @@
#include <fw_info.h>
#include <fprotect.h>
#include <hal/nrf_clock.h>
#ifdef CONFIG_UART_NRFX
#ifdef CONFIG_UART_NRFX_UART
#include <hal/nrf_uart.h>
#endif
#if CONFIG_UART_NRFX_UARTE
#ifdef CONFIG_UART_NRFX_UARTE
#include <hal/nrf_uarte.h>
#endif
#endif

static void uninit_used_peripherals(void)
{
#if defined(HAS_HW_NRF_UART0)
#ifdef CONFIG_UART_NRFX
#if defined(CONFIG_HAS_HW_NRF_UART0)
nrf_uart_disable(NRF_UART0);
#elif defined(HAS_HW_NRF_UARTE0)
#elif defined(CONFIG_HAS_HW_NRF_UARTE0)
nrf_uarte_disable(NRF_UARTE0);
#endif
#if defined(HAS_HW_NRF_UART1)
nrf_uart_disable(NRF_UART1);
#elif defined(HAS_HW_NRF_UARTE1)
#if defined(CONFIG_HAS_HW_NRF_UARTE1)
nrf_uarte_disable(NRF_UARTE1);
#endif
#if defined(HAS_HW_NRF_UART2)
nrf_uart_disable(NRF_UART2);
#elif defined(HAS_HW_NRF_UARTE2)
#if defined(CONFIG_HAS_HW_NRF_UARTE2)
nrf_uarte_disable(NRF_UARTE2);
#endif
#endif /* CONFIG_UART_NRFX */

nrf_clock_int_disable(NRF_CLOCK, 0xFFFFFFFF);
}

Expand Down

0 comments on commit ce3ca1e

Please sign in to comment.