2016-01-12 11:20:35 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2012 Travis Geiselbrecht
|
|
|
|
|
*
|
2019-07-05 17:22:23 -07:00
|
|
|
* Use of this source code is governed by a MIT-style
|
|
|
|
|
* license that can be found in the LICENSE file or at
|
|
|
|
|
* https://opensource.org/licenses/MIT
|
2016-01-12 11:20:35 -08:00
|
|
|
*/
|
2019-06-17 18:28:51 -07:00
|
|
|
#include <lk/err.h>
|
|
|
|
|
#include <lk/debug.h>
|
2016-01-12 11:20:35 -08:00
|
|
|
#include <target.h>
|
2019-06-17 18:28:51 -07:00
|
|
|
#include <lk/compiler.h>
|
2016-01-12 11:20:35 -08:00
|
|
|
#include <dev/gpio.h>
|
|
|
|
|
#include <kernel/timer.h>
|
|
|
|
|
#include <platform/gpio.h>
|
|
|
|
|
#include <platform/nrf51.h>
|
|
|
|
|
#include <target/gpioconfig.h>
|
|
|
|
|
|
2019-06-19 20:54:28 -07:00
|
|
|
void target_early_init(void) {
|
2016-01-12 11:20:35 -08:00
|
|
|
NRF_CLOCK->XTALFREQ = CLOCK_XTALFREQ_XTALFREQ_16MHz;
|
|
|
|
|
|
2016-02-14 12:24:01 -08:00
|
|
|
/* configure the usart1 pins */
|
|
|
|
|
gpio_config(GPIO_LED1, GPIO_OUTPUT);
|
2016-01-12 11:20:35 -08:00
|
|
|
gpio_config(GPIO_LED2, GPIO_OUTPUT);
|
|
|
|
|
gpio_config(GPIO_LED3, GPIO_OUTPUT);
|
|
|
|
|
|
2016-02-14 12:24:01 -08:00
|
|
|
gpio_set(GPIO_LED1,1);
|
|
|
|
|
gpio_set(GPIO_LED2,1);
|
|
|
|
|
gpio_set(GPIO_LED3,1);
|
2016-01-12 11:20:35 -08:00
|
|
|
|
|
|
|
|
gpio_config(UART0_RTS_PIN, GPIO_OUTPUT);
|
|
|
|
|
gpio_set(UART0_RTS_PIN,0); //placate flow control requirements of pca10000
|
|
|
|
|
|
2016-02-14 12:24:01 -08:00
|
|
|
nrf51_debug_early_init();
|
2016-01-12 11:20:35 -08:00
|
|
|
}
|
|
|
|
|
|
2019-06-19 20:54:28 -07:00
|
|
|
void target_init(void) {
|
2016-02-14 12:24:01 -08:00
|
|
|
nrf51_debug_init();
|
2016-01-12 11:20:35 -08:00
|
|
|
dprintf(SPEW,"Target: PCA10000 DK...\n");
|
|
|
|
|
}
|