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