1 /* 2 * Copyright 2023 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include <stdint.h> 8 #include "fsl_common.h" 9 #include "clock_config.h" 10 #include "board.h" 11 #include "fsl_debug_console.h" 12 13 /******************************************************************************* 14 * Variables 15 ******************************************************************************/ 16 17 /* Clock rate on the CLKIN pin */ 18 const uint32_t ExtClockIn = BOARD_EXTCLKINRATE; 19 20 /******************************************************************************* 21 * Code 22 ******************************************************************************/ 23 /* Initialize debug console. */ BOARD_InitDebugConsole(void)24status_t BOARD_InitDebugConsole(void) 25 { 26 #if ((SDK_DEBUGCONSOLE == DEBUGCONSOLE_REDIRECT_TO_SDK) || defined(SDK_DEBUGCONSOLE_UART)) 27 status_t result; 28 /* Select the main clock as source clock of USART0 (debug console) */ 29 CLOCK_Select(BOARD_DEBUG_USART_CLK_ATTACH); 30 RESET_PeripheralReset(BOARD_DEBUG_USART_RST); 31 result = DbgConsole_Init(BOARD_DEBUG_USART_INSTANCE, BOARD_DEBUG_USART_BAUDRATE, BOARD_DEBUG_USART_TYPE, 32 BOARD_DEBUG_USART_CLK_FREQ); 33 assert(kStatus_Success == result); 34 return result; 35 #else 36 return kStatus_Success; 37 #endif 38 } 39