Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
BoardInit.c
00001 /******************************************************************************* 00002 * Copyright 2016, 2017 ARM Ltd. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 *******************************************************************************/ 00016 #include "board.h" 00017 #include "fsl_device_registers.h" 00018 #include "pin_mux.h" 00019 #include "clock_config.h" 00020 #include "FreeRTOS.h" 00021 #include "task.h" 00022 #include "fsl_rtc.h" 00023 00024 // TRNG Function for K64F device 00025 #include "fsl_common.h" 00026 #include "fsl_clock.h" 00027 00028 #include "pal_configuration.h" 00029 00030 00031 #define APP_DEBUG_UART_BAUDRATE 115200 /* Debug console baud rate. */ 00032 #define APP_DEBUG_UART_CLKSRC_NAME kCLOCK_CoreSysClk /* System clock. */ 00033 00034 //This stack overflow hook can catch stack overflow errors in FreeRTOS. 00035 //You must enable define of configCHECK_FOR_STACK_OVERFLOW in FreeRTOSConfig.h 00036 void vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ) 00037 { 00038 return; 00039 } 00040 00041 //This MallocFailedHook can catch memory allocation errors in FreeRTOS. 00042 //You must enable define of configUSE_MALLOC_FAILED_HOOK in FreeRTOSConfig.h 00043 void vApplicationMallocFailedHook( void ) 00044 { 00045 return; 00046 } 00047 00048 00049 static void APP_InitPlatformTRNG() 00050 { 00051 CLOCK_EnableClock(kCLOCK_Rnga0); 00052 CLOCK_DisableClock(kCLOCK_Rnga0); 00053 CLOCK_EnableClock(kCLOCK_Rnga0); 00054 } 00055 00056 #if 0 00057 static void APP_StopPlatformTRNG() 00058 { 00059 CLOCK_DisableClock(kCLOCK_Rnga0); 00060 } 00061 00062 void StopFreeRtosBoard() 00063 { 00064 APP_StopPlatformTRNG(); 00065 } 00066 #endif //0 00067 00068 void boardInit() 00069 { 00070 MPU_Type *base = MPU; 00071 BOARD_InitPins(); 00072 BOARD_BootClockRUN(); 00073 BOARD_InitDebugConsole(); 00074 00075 #if (PAL_USE_HW_RTC) 00076 rtc_config_t rtcConfig = {0, 0, 0, 0, 0}; 00077 RTC_GetDefaultConfig(&rtcConfig); 00078 rtcConfig.supervisorAccess = true; 00079 RTC_Init(RTC, &rtcConfig); 00080 /* Enable the RTC 32KHz oscillator */ 00081 RTC->CR |= RTC_CR_OSCE_MASK; 00082 RTC_StartTimer(RTC); 00083 #endif 00084 00085 APP_InitPlatformTRNG(); 00086 /* Disable MPU. */ 00087 base->CESR &= ~MPU_CESR_VLD_MASK; 00088 } 00089
Generated on Tue Jul 12 2022 16:24:07 by
1.7.2