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`.
This commit is contained in:
Tracy Wadleigh 2020-05-04 10:10:24 -07:00 committed by GitHub
parent 53d26371a8
commit 17f45e24a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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