Provide boot sequence hooks (Native)
This commit is contained in:
parent
5d95f8bd54
commit
3a1d362549
|
@ -9,7 +9,7 @@ endif
|
|||
CONTIKI_TARGET_DIRS = . dev
|
||||
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c leds.c leds-arch.c \
|
||||
CONTIKI_TARGET_SOURCEFILES = platform.c clock.c leds.c leds-arch.c \
|
||||
button-sensor.c pir-sensor.c vib-sensor.c xmem.c \
|
||||
sensors.c irq.c cfs-posix.c cfs-posix-dir.c
|
||||
|
||||
|
|
|
@ -68,3 +68,10 @@ clock_delay(unsigned int d)
|
|||
/* Does not do anything. */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
clock_init(void)
|
||||
{
|
||||
/* Provide this function, required by main() */
|
||||
return;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
|
@ -99,4 +99,7 @@ typedef unsigned long clock_time_t;
|
|||
/* Not part of C99 but actually present */
|
||||
int strcasecmp(const char*, const char*);
|
||||
|
||||
#define PLATFORM_CONF_PROVIDES_MAIN_LOOP 1
|
||||
#define PLATFORM_CONF_MAIN_ACCEPTS_ARGS 1
|
||||
|
||||
#endif /* CONTIKI_CONF_H_ */
|
||||
|
|
|
@ -164,7 +164,7 @@ set_lladdr(void)
|
|||
}
|
||||
#endif
|
||||
linkaddr_set_node_addr(&addr);
|
||||
printf("Contiki started with address ");
|
||||
printf("Contiki starting with address ");
|
||||
for(i = 0; i < sizeof(addr.u8) - 1; i++) {
|
||||
printf("%d.", addr.u8[i]);
|
||||
}
|
||||
|
@ -210,20 +210,10 @@ set_global_address(void)
|
|||
/*---------------------------------------------------------------------------*/
|
||||
int contiki_argc = 0;
|
||||
char **contiki_argv;
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_process_args(int argc, char**argv)
|
||||
{
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
#if UIP_CONF_IPV6_RPL
|
||||
printf(CONTIKI_VERSION_STRING " started with IPV6, RPL\n");
|
||||
#else
|
||||
printf(CONTIKI_VERSION_STRING " started with IPV6\n");
|
||||
#endif
|
||||
#else
|
||||
printf(CONTIKI_VERSION_STRING " started\n");
|
||||
#endif
|
||||
|
||||
/* crappy way of remembering and accessing argc/v */
|
||||
contiki_argc = argc;
|
||||
contiki_argv = argv;
|
||||
|
@ -239,23 +229,34 @@ main(int argc, char **argv)
|
|||
contiki_argv++;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
process_init();
|
||||
process_start(&etimer_process, NULL);
|
||||
ctimer_init();
|
||||
rtimer_init();
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_init_stage_one()
|
||||
{
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
#if UIP_CONF_IPV6_RPL
|
||||
printf(CONTIKI_VERSION_STRING " starting with IPV6, RPL\n");
|
||||
#else
|
||||
printf(CONTIKI_VERSION_STRING " starting with IPV6\n");
|
||||
#endif
|
||||
#else
|
||||
printf(CONTIKI_VERSION_STRING " starting\n");
|
||||
#endif
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_init_stage_two()
|
||||
{
|
||||
set_lladdr();
|
||||
|
||||
netstack_init();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_init_stage_three()
|
||||
{
|
||||
printf("MAC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_NETWORK.name);
|
||||
|
||||
#if NETSTACK_CONF_WITH_IPV6
|
||||
queuebuf_init();
|
||||
|
||||
memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr));
|
||||
|
||||
process_start(&tcpip_process, NULL);
|
||||
#ifdef __CYGWIN__
|
||||
process_start(&wpcap_process, NULL);
|
||||
#endif
|
||||
|
@ -279,20 +280,13 @@ main(int argc, char **argv)
|
|||
|
||||
#endif /* NETSTACK_CONF_WITH_IPV6 */
|
||||
|
||||
serial_line_init();
|
||||
|
||||
#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);
|
||||
|
||||
/* Make standard output unbuffered. */
|
||||
setvbuf(stdout, (char *)NULL, _IONBF, 0);
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
platform_main_loop()
|
||||
{
|
||||
select_set_callback(STDIN_FILENO, &stdin_fd);
|
||||
while(1) {
|
||||
fd_set fdr;
|
||||
|
@ -333,7 +327,7 @@ main(int argc, char **argv)
|
|||
etimer_request_poll();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
Loading…
Reference in New Issue