From 9fec648b3eb4b7bb6b1ec2021cf658d4ed488f54 Mon Sep 17 00:00:00 2001 From: David Kopf Date: Thu, 25 Aug 2011 14:43:18 -0400 Subject: [PATCH] Allow selection of slip port --- platform/avr-atmega128rfa1/contiki-conf.h | 21 +++++++++++++++------ platform/avr-atmega128rfa1/contiki-main.c | 10 ++++++---- platform/avr-atmega128rfa1/slip_uart0.c | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/platform/avr-atmega128rfa1/contiki-conf.h b/platform/avr-atmega128rfa1/contiki-conf.h index 3a0cbe1b7..245ff90bb 100644 --- a/platform/avr-atmega128rfa1/contiki-conf.h +++ b/platform/avr-atmega128rfa1/contiki-conf.h @@ -78,8 +78,16 @@ unsigned long clock_seconds(void); /* This has not been tested yet */ #define AVR_CONF_USE32KCRYSTAL 0 -/* COM port to be used for SLIP connection. Not tested on Raven */ +/* Michael Hartman's protobyte board has LED on PORTE1, can be used for pings and radio on indication */ +/* However it requires disabling UART0. */ +#define RF230BB_CONF_LEDONPORTE1 1 + +/* COM port to be used for SLIP connection. This is usually UART0, but see above */ +#if RF230BB_CONF_LEDONPORTE1 +#define SLIP_PORT RS232_PORT_1 +#else #define SLIP_PORT RS232_PORT_0 +#endif /* Pre-allocated memory for loadable modules heap space (in bytes)*/ /* Default is 4096. Currently used only when elfloader is present. Not tested on Raven */ @@ -94,12 +102,11 @@ unsigned long clock_seconds(void); /* More extensive stats */ #define ENERGEST_CONF_ON 1 -/* Debugflow macro, useful for tracing path through mac and radio interrupts */ -#define DEBUGFLOWSIZE 128 +/* Possible watchdog timeouts depend on mcu. Default is WDTO_2S. -1 Disables the watchdog. */ +//#define WATCHDOG_CONF_TIMEOUT -1 -/* Michael Hartman's protobyte board has LED on PORTE1, can be used for pings and radio on indication */ -/* However it requires disabling UART0. */ -#define RF230BB_CONF_LEDONPORTE1 1 +/* Debugflow macro, useful for tracing path through mac and radio interrupts */ +//#define DEBUGFLOWSIZE 128 /* Network setup. The new NETSTACK interface requires RF230BB (as does ip4) */ #if RF230BB @@ -272,6 +279,8 @@ unsigned long clock_seconds(void); #undef UIP_CONF_UDP_CONNS #define UIP_CONF_UDP_CONNS 12 +/* For slow slip connections, to prevent buffer overruns */ +//#define UIP_CONF_RECEIVE_WINDOW 300 #undef UIP_CONF_FWCACHE_SIZE #define UIP_CONF_FWCACHE_SIZE 30 #define UIP_CONF_BROADCAST 1 diff --git a/platform/avr-atmega128rfa1/contiki-main.c b/platform/avr-atmega128rfa1/contiki-main.c index 7dfefc4fc..b59befdf0 100644 --- a/platform/avr-atmega128rfa1/contiki-main.c +++ b/platform/avr-atmega128rfa1/contiki-main.c @@ -103,7 +103,7 @@ uint8_t debugflowsize,debugflow[DEBUGFLOWSIZE]; #define ROUTES 128 #define STAMPS 30 #define STACKMONITOR 1024 -uint16_t clocktime; +uint32_t clocktime; #define TESTRTIMER 0 #if TESTRTIMER uint8_t rtimerflag=1; @@ -199,8 +199,10 @@ void initialize(void) #endif #endif - /* Second rs232 port for debugging */ + /* Second rs232 port for debugging or slip alternative */ rs232_init(RS232_PORT_1, USART_BAUD_57600,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); +// rs232_init(RS232_PORT_1, USART_BAUD_115200,USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); + /* Redirect stdout to second port */ rs232_redirect_stdout(RS232_PORT_1); clock_init(); @@ -514,9 +516,9 @@ if ((clocktime%STAMPS)==0) { print_stats(); #elif RADIOSTATS extern volatile unsigned long radioontime; - PRINTA("%u(%u)s ",clocktime,radioontime); + PRINTA("%u(%u)s\n",clocktime,radioontime); #else - PRINTA("%us ",clocktime); + PRINTA("%us\n",clocktime); #endif } diff --git a/platform/avr-atmega128rfa1/slip_uart0.c b/platform/avr-atmega128rfa1/slip_uart0.c index bf36616ad..edff55385 100644 --- a/platform/avr-atmega128rfa1/slip_uart0.c +++ b/platform/avr-atmega128rfa1/slip_uart0.c @@ -76,7 +76,7 @@ static FILE slip_stdout = FDEV_SETUP_STREAM(slip_putchar, NULL, void slip_arch_init(unsigned long ubr) { - rs232_set_input(RS232_PORT_0, slip_input_byte); + rs232_set_input(SLIP_PORT, slip_input_byte); stdout = &slip_stdout; } /*---------------------------------------------------------------------------*/