Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers board_LPC43xx.c Source File

board_LPC43xx.c

Go to the documentation of this file.
00001 /**
00002  * @file    board_LPC43xx.c
00003  * @brief
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #include "sdk.h"
00023 #include "lpc43xx_cgu.h"
00024 
00025 void sdk_init(void)
00026 {
00027     /* Set core clock to 96MHz */
00028     CGU_Init(96000000);
00029     /* Set up USB0 clock */
00030     /* Disable PLL first */
00031     CGU_EnableEntity(CGU_CLKSRC_PLL0, DISABLE);
00032 
00033     /* the usb core require output clock = 480MHz */
00034     if (CGU_SetPLL0() != CGU_ERROR_SUCCESS) {
00035         while (1);
00036     }
00037 
00038     CGU_EntityConnect(CGU_CLKSRC_XTAL_OSC, CGU_CLKSRC_PLL0);
00039     /* Enable PLL after all setting is done */
00040     CGU_EnableEntity(CGU_CLKSRC_PLL0, ENABLE);
00041     /* Turn on the USB0PHY */
00042     LPC_CREG->CREG0 &= ~(1 << 5);
00043 }