Provide boot sequence hooks (Zoul)
This commit is contained in:
parent
47f02608c3
commit
fd239a32c3
@ -31,7 +31,7 @@ PLATFORM_ROOT_DIR = $(CONTIKI)/arch/platform/$(TARGET)
|
||||
-include $(PLATFORM_ROOT_DIR)/$(BOARD)/Makefile.$(BOARD)
|
||||
|
||||
### Include
|
||||
CONTIKI_TARGET_SOURCEFILES += contiki-main.c
|
||||
CONTIKI_TARGET_SOURCEFILES += platform.c
|
||||
CONTIKI_TARGET_SOURCEFILES += leds.c cc1200-zoul-arch.c
|
||||
CONTIKI_TARGET_SOURCEFILES += adc-zoul.c button-sensor.c zoul-sensors.c
|
||||
CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES)
|
||||
|
@ -171,8 +171,8 @@ typedef uint32_t rtimer_clock_t;
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#ifndef STARTUP_CONF_VERBOSE
|
||||
#define STARTUP_CONF_VERBOSE 1 /**< Set to 0 to decrease startup verbosity */
|
||||
#ifndef PLATFORM_CONF_STARTUP_VERBOSE
|
||||
#define PLATFORM_CONF_STARTUP_VERBOSE 1 /**< Set to 0 to decrease startup verbosity */
|
||||
#endif
|
||||
/** @} */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -267,8 +267,8 @@ typedef uint32_t rtimer_clock_t;
|
||||
#undef UART_CONF_ENABLE
|
||||
#define UART_CONF_ENABLE 0
|
||||
|
||||
#undef STARTUP_CONF_VERBOSE
|
||||
#define STARTUP_CONF_VERBOSE 0
|
||||
#undef PLATFORM_CONF_STARTUP_VERBOSE
|
||||
#define PLATFORM_CONF_STARTUP_VERBOSE 0
|
||||
#endif /* CC2538_CONF_QUIET */
|
||||
|
||||
/**
|
||||
|
@ -46,11 +46,7 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/leds.h"
|
||||
#include "dev/sys-ctrl.h"
|
||||
#include "dev/nvic.h"
|
||||
#include "dev/uart.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "dev/ioc.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/slip.h"
|
||||
@ -61,29 +57,20 @@
|
||||
#include "usb/usb-serial.h"
|
||||
#include "lib/random.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/queuebuf.h"
|
||||
#include "net/ipv6/tcpip.h"
|
||||
#include "net/ipv6/uip.h"
|
||||
#include "net/mac/framer/frame802154.h"
|
||||
#include "net/linkaddr.h"
|
||||
#include "sys/platform.h"
|
||||
#include "soc.h"
|
||||
#include "cpu.h"
|
||||
#include "reg.h"
|
||||
#include "ieee-addr.h"
|
||||
#include "lpm.h"
|
||||
#include "sys/autostart.h"
|
||||
#if BUILD_WITH_ORCHESTRA
|
||||
#include "orchestra.h"
|
||||
#endif /* BUILD_WITH_ORCHESTRA */
|
||||
#if BUILD_WITH_SHELL
|
||||
#include "serial-shell.h"
|
||||
#endif /* BUILD_WITH_SHELL */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if STARTUP_CONF_VERBOSE
|
||||
#if PLATFORM_STARTUP_VERBOSE
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
@ -95,7 +82,9 @@
|
||||
#define PUTS(s)
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \brief Board specific iniatialisation */
|
||||
/**
|
||||
* \brief Board specific iniatialisation
|
||||
*/
|
||||
void board_init(void);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
@ -187,7 +176,7 @@ set_rf_params(void)
|
||||
/* Populate linkaddr_node_addr. Maintain endianness */
|
||||
memcpy(&linkaddr_node_addr, &ext_addr[8 - LINKADDR_SIZE], LINKADDR_SIZE);
|
||||
|
||||
#if STARTUP_CONF_VERBOSE
|
||||
#if PLATFORM_STARTUP_VERBOSE
|
||||
{
|
||||
int i;
|
||||
printf("Contiki configured with address ");
|
||||
@ -204,24 +193,18 @@ set_rf_params(void)
|
||||
NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* \brief Main routine for the Zoul-based platforms
|
||||
*/
|
||||
int
|
||||
main(void)
|
||||
void
|
||||
platform_init_stage_one(void)
|
||||
{
|
||||
nvic_init();
|
||||
ioc_init();
|
||||
sys_ctrl_init();
|
||||
clock_init();
|
||||
lpm_init();
|
||||
rtimer_init();
|
||||
gpio_init();
|
||||
soc_init();
|
||||
|
||||
leds_init();
|
||||
fade(LEDS_RED);
|
||||
process_init();
|
||||
watchdog_init();
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_init_stage_two()
|
||||
{
|
||||
/*
|
||||
* Character I/O Initialisation.
|
||||
* When the UART receives a character it will call serial_line_input_byte to
|
||||
@ -245,80 +228,52 @@ main(void)
|
||||
|
||||
serial_line_init();
|
||||
|
||||
INTERRUPTS_ENABLE();
|
||||
fade(LEDS_BLUE);
|
||||
|
||||
PUTS(CONTIKI_VERSION_STRING);
|
||||
PUTS(BOARD_STRING);
|
||||
#if STARTUP_CONF_VERBOSE
|
||||
soc_print_info();
|
||||
#endif
|
||||
|
||||
/* Initialise the H/W RNG engine. */
|
||||
random_init(0);
|
||||
|
||||
udma_init();
|
||||
|
||||
process_start(&etimer_process, NULL);
|
||||
ctimer_init();
|
||||
|
||||
board_init();
|
||||
|
||||
#if CRYPTO_CONF_INIT
|
||||
crypto_init();
|
||||
crypto_disable();
|
||||
#endif
|
||||
|
||||
INTERRUPTS_ENABLE();
|
||||
|
||||
fade(LEDS_BLUE);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_init_stage_three()
|
||||
{
|
||||
PUTS(BOARD_STRING);
|
||||
|
||||
board_init();
|
||||
|
||||
rtc_init();
|
||||
|
||||
netstack_init();
|
||||
set_rf_params();
|
||||
|
||||
PRINTF(" Net: ");
|
||||
PRINTF("%s\n", NETSTACK_NETWORK.name);
|
||||
PRINTF(" MAC: ");
|
||||
PRINTF("%s\n", NETSTACK_MAC.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr));
|
||||
queuebuf_init();
|
||||
process_start(&tcpip_process, NULL);
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
#if PLATFORM_STARTUP_VERBOSE
|
||||
soc_print_info();
|
||||
#endif
|
||||
|
||||
process_start(&sensors_process, NULL);
|
||||
|
||||
#if PLATFORM_HAS_BUTTON
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
#endif
|
||||
energest_init();
|
||||
ENERGEST_ON(ENERGEST_TYPE_CPU);
|
||||
|
||||
#if BUILD_WITH_ORCHESTRA
|
||||
orchestra_init();
|
||||
#endif /* BUILD_WITH_ORCHESTRA */
|
||||
#if BUILD_WITH_SHELL
|
||||
serial_shell_init();
|
||||
#endif /* BUILD_WITH_SHELL */
|
||||
|
||||
autostart_start(autostart_processes);
|
||||
|
||||
watchdog_start();
|
||||
fade(LEDS_GREEN);
|
||||
|
||||
while(1) {
|
||||
uint8_t r;
|
||||
do {
|
||||
/* Reset watchdog and handle polls and events */
|
||||
watchdog_periodic();
|
||||
|
||||
r = process_run();
|
||||
} while(r > 0);
|
||||
|
||||
/* We have serviced all pending events. Enter a Low-Power mode. */
|
||||
lpm_enter();
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
void
|
||||
platform_idle()
|
||||
{
|
||||
/* We have serviced all pending events. Enter a Low-Power mode. */
|
||||
lpm_enter();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
* @}
|
Loading…
Reference in New Issue
Block a user