1 /*
2  * Copyright (c) 2012 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #include <lk/err.h>
9 #include <lk/debug.h>
10 #include <target.h>
11 #include <lk/compiler.h>
12 #include <dev/gpio.h>
13 #include <kernel/timer.h>
14 #include <platform/gpio.h>
15 #include <platform/nrf51.h>
16 #include <target/gpioconfig.h>
17 
target_early_init(void)18 void target_early_init(void) {
19     NRF_CLOCK->XTALFREQ = CLOCK_XTALFREQ_XTALFREQ_16MHz;
20 
21     /* configure the usart1 pins */
22     gpio_config(GPIO_LED1, GPIO_OUTPUT);
23     gpio_config(GPIO_LED2, GPIO_OUTPUT);
24     gpio_config(GPIO_LED3, GPIO_OUTPUT);
25 
26     gpio_set(GPIO_LED1,1);
27     gpio_set(GPIO_LED2,1);
28     gpio_set(GPIO_LED3,1);
29 
30     gpio_config(UART0_RTS_PIN, GPIO_OUTPUT);
31     gpio_set(UART0_RTS_PIN,0);              //placate flow control requirements of pca10000
32 
33     nrf51_debug_early_init();
34 }
35 
target_init(void)36 void target_init(void) {
37     nrf51_debug_init();
38     dprintf(SPEW,"Target: PCA10000 DK...\n");
39 }
40