diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index 0bdeeb061..8e4541623 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: rf230bb.c,v 1.15 2010/12/03 20:42:01 dak664 Exp $ + * @(#)$Id: rf230bb.c,v 1.16 2010/12/04 21:32:35 dak664 Exp $ */ /* * This code is almost device independent and should be easy to port. @@ -123,7 +123,6 @@ struct timestamp { #define RADIOSTATS 1 #endif #if RADIOSTATS -uint8_t RF230_rsigsi; uint16_t RF230_sendpackets,RF230_receivepackets,RF230_sendfail,RF230_receivefail; #endif @@ -809,6 +808,9 @@ rf230_send(const void *payload, unsigned short payload_len) ret = rf230_transmit(payload_len); bail: +#if RADIOSTATS + if (ret) RF230_sendfail++; +#endif return ret; } /*---------------------------------------------------------------------------*/ @@ -968,7 +970,7 @@ if (RF230_receive_on) { * It calls the core MAC layer which calls rf230_read to get the packet * rf230processflag can be printed in the main idle loop for debugging */ -#if 1 +#if 0 uint8_t rf230processflag; #define RF230PROCESSFLAG(arg) rf230processflag=arg #else @@ -1003,6 +1005,10 @@ PROCESS_THREAD(rf230_process, ev, data) &rf230_timetable); timetable_clear(&rf230_timetable); #endif /* RF230_TIMETABLE_PROFILING */ + } else { +#if RADIOSTATS + RF230_receivefail++; +#endif } } diff --git a/examples/ravenusbstick/fakeuip.c b/examples/ravenusbstick/fakeuip.c index bd9e609a9..22468e65b 100644 --- a/examples/ravenusbstick/fakeuip.c +++ b/examples/ravenusbstick/fakeuip.c @@ -3,8 +3,6 @@ * compile. Allows you to save needing to compile all of uIP in just * to get a few things. This file is included in the build by the contiki * Makefile.include only when CONTIKI_NO_NET is defined */ - -//#if CONTIKI_NO_NET #include "uip.h" #include @@ -132,4 +130,3 @@ uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } -//#endif /* CONTIKI_NO_NET */ diff --git a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c index 4a8d6c6e2..95c55471e 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-cgi.c +++ b/platform/avr-raven/apps/raven-webserver/httpd-cgi.c @@ -28,7 +28,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: httpd-cgi.c,v 1.9 2010/12/02 15:37:13 dak664 Exp $ + * $Id: httpd-cgi.c,v 1.10 2010/12/04 21:32:35 dak664 Exp $ * */ @@ -112,7 +112,7 @@ static const char *states[] = { extern unsigned long seconds; #if RADIOSTATS extern unsigned long radioontime; - extern uint8_t RF230_radio_on, RF230_rsigsi; + extern uint8_t RF230_radio_on, rf230_last_rssi; extern uint16_t RF230_sendpackets,RF230_receivepackets,RF230_sendfail,RF230_receivefail; #endif @@ -434,7 +434,7 @@ generate_radio_stats(void *arg) uint16_t h,m,s; uint8_t p1,p2; static const char httpd_cgi_sensor4[] HTTPD_STRING_ATTR = "Radio on: %02d:%02d:%02d (%d.%02d%%)
"; - static const char httpd_cgi_sensor5[] HTTPD_STRING_ATTR = "Packets: Tx=%5d Rx=%5d TxL=%5d RxL=%5d RSSI=%2d\n"; + static const char httpd_cgi_sensor5[] HTTPD_STRING_ATTR = "Packets: Tx=%5d Rx=%5d TxL=%5d RxL=%5d RSSI=%2ddBm\n"; s=(10000UL*radioontime)/seconds; p1=s/100; @@ -445,9 +445,18 @@ generate_radio_stats(void *arg) s=s-m*60; numprinted =httpd_snprintf((char *)uip_appdata , uip_mss() , httpd_cgi_sensor4,\ - h,m,s,p1,p2); + h,m,s,p1,p2); + + #if RF230BB numprinted+=httpd_snprintf((char *)uip_appdata + numprinted, uip_mss() - numprinted, httpd_cgi_sensor5,\ - RF230_sendpackets,RF230_receivepackets,RF230_sendfail,RF230_receivefail,RF230_rsigsi); + RF230_sendpackets,RF230_receivepackets,RF230_sendfail,RF230_receivefail,-92+rf230_last_rssi); +#else + p1=0; + radio_get_rssi_value(&p1); + p1 = -91*3(p1-1); + numprinted+=httpd_snprintf((char *)uip_appdata + numprinted, uip_mss() - numprinted, httpd_cgi_sensor5,\ + RF230_sendpackets,RF230_receivepackets,RF230_sendfail,RF230_receivefail,p1); +#endif return numprinted; } diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fs/header.html b/platform/avr-raven/apps/raven-webserver/httpd-fs/header.html index 304a5065b..83a57ef6a 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fs/header.html +++ b/platform/avr-raven/apps/raven-webserver/httpd-fs/header.html @@ -2,5 +2,5 @@ Welcome to the Contiki-demo server! - +

Welcome to the Contiki web server!

diff --git a/platform/avr-raven/apps/raven-webserver/httpd-fs/status.shtml b/platform/avr-raven/apps/raven-webserver/httpd-fs/status.shtml index 78b395e75..59b7fa9fb 100644 --- a/platform/avr-raven/apps/raven-webserver/httpd-fs/status.shtml +++ b/platform/avr-raven/apps/raven-webserver/httpd-fs/status.shtml @@ -5,6 +5,7 @@ %! neighbors

Routes

%! routes +

Sensors

+%! sensors - %! file-stats . diff --git a/platform/avr-ravenusb/httpd-simple-avr.c b/platform/avr-ravenusb/httpd-simple-avr.c index fb68b940e..9c40d4e79 100644 --- a/platform/avr-ravenusb/httpd-simple-avr.c +++ b/platform/avr-ravenusb/httpd-simple-avr.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: httpd-simple-avr.c,v 1.7 2010/12/03 20:42:02 dak664 Exp $ + * $Id: httpd-simple-avr.c,v 1.8 2010/12/04 21:32:35 dak664 Exp $ */ /** @@ -176,7 +176,6 @@ PT_THREAD(handle_input(struct httpd_state *s)) } #if URLCONV -bomb s->inputbuf[PSOCK_DATALEN(&s->sin) - 1] = 0; urlconv_tofilename(s->filename, s->inputbuf, sizeof(s->filename)); #else /* URLCONV */ @@ -300,6 +299,10 @@ PT_THREAD(generate_routes(struct httpd_state *s)) PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); blen = 0; } +#else /* UIP_CONF_IPV6 */ + blen = 0;i++; + ADD("

Hey, you got ip4 working!

"); + PSOCK_GENERATOR_SEND(&s->sout, generate_string, buf); #endif /* UIP_CONF_IPV6 */ PSOCK_GENERATOR_SEND(&s->sout, generate_string_P, BOTTOM); diff --git a/platform/avr-ravenusb/sicslow_ethernet.c b/platform/avr-ravenusb/sicslow_ethernet.c index 79ec053f1..8ac181b6b 100644 --- a/platform/avr-ravenusb/sicslow_ethernet.c +++ b/platform/avr-ravenusb/sicslow_ethernet.c @@ -381,6 +381,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) /* Simple Address Translation */ if(memcmp((uint8_t *)&simple_trans_ethernet_addr, &(((struct uip_eth_hdr *) ethHeader)->dest.addr[0]), 6) == 0) { +#if UIP_CONF_IPV6 //Addressed to us: make 802.15.4 address from IPv6 Address destAddr.addr[0] = UIP_IP_BUF->destipaddr.u8[8] ^ 0x02; destAddr.addr[1] = UIP_IP_BUF->destipaddr.u8[9]; @@ -390,6 +391,18 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) destAddr.addr[5] = UIP_IP_BUF->destipaddr.u8[13]; destAddr.addr[6] = UIP_IP_BUF->destipaddr.u8[14]; destAddr.addr[7] = UIP_IP_BUF->destipaddr.u8[15]; +#else + //Not intended to be functional, but allows ip4 build without errors. + destAddr.addr[0] = UIP_IP_BUF->destipaddr.u8[0] ^ 0x02; + destAddr.addr[1] = UIP_IP_BUF->destipaddr.u8[1]; + destAddr.addr[2] = UIP_IP_BUF->destipaddr.u8[2]; + destAddr.addr[3] = UIP_IP_BUF->destipaddr.u8[3]; + destAddr.addr[4] = UIP_IP_BUF->destipaddr.u8[0]; + destAddr.addr[5] = UIP_IP_BUF->destipaddr.u8[1]; + destAddr.addr[6] = UIP_IP_BUF->destipaddr.u8[2]; + destAddr.addr[7] = UIP_IP_BUF->destipaddr.u8[3]; + +#endif destAddrPtr = &destAddr; } @@ -414,7 +427,7 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) } PRINTF(" translated OK\n\r"); destAddrPtr = &destAddr; -#endif +#endif /* UIP_CONF_SIMPLE_JACKDAW_ADDR_TRANS */ } @@ -439,6 +452,8 @@ void mac_ethernetToLowpan(uint8_t * ethHeader) uip_ipaddr_copy(&last_sender, &UIP_IP_BUF->srcipaddr); tcpip_input(); #else +// PRINTF("Input from %x %x %x %x %x %x %x %x\n",UIP_IP_BUF->srcipaddr.u8[0],UIP_IP_BUF->srcipaddr.u8[1],UIP_IP_BUF->srcipaddr.u8[2],UIP_IP_BUF->srcipaddr.u8[3],UIP_IP_BUF->srcipaddr.u8[4],UIP_IP_BUF->srcipaddr.u8[5],UIP_IP_BUF->srcipaddr.u8[6],UIP_IP_BUF->srcipaddr.u8[7]); +// PRINTF("Output to %x %x %x %x %x %x %x %x\n",destAddr.addr[0],destAddr.addr[1],destAddr.addr[2],destAddr.addr[3],destAddr.addr[4],destAddr.addr[5],destAddr.addr[6],destAddr.addr[7]); tcpip_output(destAddrPtr); #endif #else /* UIP_CONF_IPV6 */ @@ -477,10 +492,19 @@ void mac_LowpanToEthernet(void) #endif ETHBUF(uip_buf)->dest.addr[0] = 0x33; ETHBUF(uip_buf)->dest.addr[1] = 0x33; + +#if UIP_CONF_IPV6 ETHBUF(uip_buf)->dest.addr[2] = UIP_IP_BUF->destipaddr.u8[12]; ETHBUF(uip_buf)->dest.addr[3] = UIP_IP_BUF->destipaddr.u8[13]; ETHBUF(uip_buf)->dest.addr[4] = UIP_IP_BUF->destipaddr.u8[14]; ETHBUF(uip_buf)->dest.addr[5] = UIP_IP_BUF->destipaddr.u8[15]; +#else + //Not intended to be functional, but allows ip4 build without errors. + ETHBUF(uip_buf)->dest.addr[2] = UIP_IP_BUF->destipaddr.u8[0]; + ETHBUF(uip_buf)->dest.addr[3] = UIP_IP_BUF->destipaddr.u8[1]; + ETHBUF(uip_buf)->dest.addr[4] = UIP_IP_BUF->destipaddr.u8[2]; + ETHBUF(uip_buf)->dest.addr[5] = UIP_IP_BUF->destipaddr.u8[3]; +#endif } else { //Otherwise we have a real address mac_createEthernetAddr((uint8_t *) &(ETHBUF(uip_buf)->dest.addr[0]),