From 17f45e24a37f078f26a29b176b2f993ea823cec1 Mon Sep 17 00:00:00 2001 From: Tracy Wadleigh Date: Mon, 4 May 2020 10:10:24 -0700 Subject: [PATCH] Fix up SD1 initialization for KL2x In the case of KINETIS_SERIAL0_IS_UARTLP: * the argument to `sd_lld_init_driver` needs to be explicitly coerced to a pointer of type `UART_TypeDef`; * the initialization of `c4_p` needs to be patched, as its position is different in the underlying `UARTLP_TypeDef`. --- os/hal/ports/KINETIS/LLD/UARTv1/hal_serial_lld.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/os/hal/ports/KINETIS/LLD/UARTv1/hal_serial_lld.c b/os/hal/ports/KINETIS/LLD/UARTv1/hal_serial_lld.c index 443ec5ff..1f1c9966 100644 --- a/os/hal/ports/KINETIS/LLD/UARTv1/hal_serial_lld.c +++ b/os/hal/ports/KINETIS/LLD/UARTv1/hal_serial_lld.c @@ -416,7 +416,7 @@ void sd_lld_init(void) { #if KINETIS_SERIAL_USE_UART0 /* Driver initialization.*/ #if ! KINETIS_SERIAL0_IS_LPUART - sd_lld_init_driver(&SD1, UART0); + sd_lld_init_driver(&SD1, (UART_TypeDef *)UART0); #else /* ! KINETIS_SERIAL0_IS_LPUART */ /* little endian! */ sdObjectInit(&SD1, NULL, notify); @@ -431,6 +431,7 @@ void sd_lld_init(void) { SD1.uart.d_p = ((uint8_t *)&(LPUART0->DATA)) + 0; /* D: DATA, byte 4 */ #endif /* ! KINETIS_SERIAL0_IS_LPUART */ #if KINETIS_SERIAL0_IS_UARTLP + SD1.uart.c4_p = UART0->c4_p; /* fix up misconfigured C4 register */ SD1.uart.uartlp_p = UART0; SD1.uart.uart_p = NULL; #elif KINETIS_SERIAL0_IS_LPUART