Add menu option to temporarily disable RS232 debug output for higher 6lowpan throughput.

Functional rpl with RNDIS/Ubuntu (tested on Raven single hops)
This commit is contained in:
dak664 2010-11-19 20:02:25 +00:00
parent c6c81acede
commit b3324c6d23
5 changed files with 86 additions and 42 deletions

View File

@ -171,8 +171,12 @@ PROCESS_THREAD(cdc_process, ev, data_proc)
while (uart_usb_test_hit()){
menu_process(uart_usb_getchar()); // See what they want
}
#if USB_CONF_RS232
stdout=rs232_stdout;
#if USB_CONF_RS232
if (usbstick_mode.debugOn) {
stdout=rs232_stdout;
} else {
stdout=NULL;
}
#endif
}//if (Is_device_enumerated())
@ -196,30 +200,33 @@ PROCESS_THREAD(cdc_process, ev, data_proc)
*/
void menu_print(void)
{
PRINTF_P(PSTR("\n\r********** Jackdaw Menu ******************\n\r"));
PRINTF_P(PSTR("* *\n\r"));
PRINTF_P(PSTR("* Main Menu: *\n\r"));
PRINTF_P(PSTR("* h,? Print this menu *\n\r"));
PRINTF_P(PSTR("* m Print current mode *\n\r"));
PRINTF_P(PSTR("* s Set to sniffer mode *\n\r"));
PRINTF_P(PSTR("* n Set to network mode *\n\r"));
PRINTF_P(PSTR("* c Set RF channel *\n\r"));
PRINTF_P(PSTR("* 6 Toggle 6lowpan *\n\r"));
PRINTF_P(PSTR("* r Toggle raw mode *\n\r"));
#if UIP_CONF_IPV6_RPL
PRINTF_P(PSTR("* N RPL Neighbors *\n\r"));
PRINTF_P(PSTR("\n\r********** Jackdaw Menu *********\n\r"));
PRINTF_P(PSTR("* *\n\r"));
PRINTF_P(PSTR("* Main Menu: *\n\r"));
PRINTF_P(PSTR("* h,? Print this menu *\n\r"));
PRINTF_P(PSTR("* m Print current mode *\n\r"));
PRINTF_P(PSTR("* s Set to sniffer mode *\n\r"));
PRINTF_P(PSTR("* n Set to network mode *\n\r"));
PRINTF_P(PSTR("* c Set RF channel *\n\r"));
PRINTF_P(PSTR("* 6 Toggle 6lowpan *\n\r"));
PRINTF_P(PSTR("* r Toggle raw mode *\n\r"));
#if USB_CONF_RS232
PRINTF_P(PSTR("* d Toggle RS232 output *\n\r"));
#endif
PRINTF_P(PSTR("* e Energy Scan *\n\r"));
#if UIP_CONF_IPV6_RPL
PRINTF_P(PSTR("* N RPL Neighbors *\n\r"));
#endif
PRINTF_P(PSTR("* e Energy Scan *\n\r"));
#if USB_CONF_STORAGE
PRINTF_P(PSTR("* u Switch to mass-storage*\n\r"));
PRINTF_P(PSTR("* u Switch to mass-storage*\n\r"));
#endif
if(bootloader_is_present())
PRINTF_P(PSTR("* D Switch to DFU mode *\n\r"));
PRINTF_P(PSTR("* R Reset (via WDT) *\n\r"));
PRINTF_P(PSTR("* *\n\r"));
PRINTF_P(PSTR("* Make selection at any time by pressing *\n\r"));
PRINTF_P(PSTR("* your choice on keyboard. *\n\r"));
PRINTF_P(PSTR("******************************************\n\r"));
PRINTF_P(PSTR("* D Switch to DFU mode *\n\r"));
PRINTF_P(PSTR("* R Reset (via WDT) *\n\r"));
PRINTF_P(PSTR("* *\n\r"));
PRINTF_P(PSTR("* Make selection at any time by *\n\r"));
PRINTF_P(PSTR("* pressing your choice on keyboard*\n\r"));
PRINTF_P(PSTR("***********************************\n\r"));
PRINTF_P(PSTR("[Built "__DATE__"]\n\r"));
}
@ -407,6 +414,18 @@ void menu_process(char c)
usbstick_mode.raw = 1;
}
break;
#if USB_CONF_RS232
case 'd':
if (usbstick_mode.debugOn) {
PRINTF_P(PSTR("Jackdaw does not output debug strings\n\r"));
usbstick_mode.debugOn = 0;
} else {
PRINTF_P(PSTR("Jackdaw now outputs debug strings\n\r"));
usbstick_mode.debugOn = 1;
}
break;
#endif
case 'c':
#if RF230BB
@ -461,7 +480,15 @@ extern uip_ds6_route_t uip_ds6_routing_table[];
if (usbstick_mode.sicslowpan == 0) { PRINTF_P(PSTR("not "));}
PRINTF_P(PSTR("decompress 6lowpan headers\n\r * Will "));
if (usbstick_mode.raw == 0) { PRINTF_P(PSTR("not "));}
#if USB_CONF_RS232
PRINTF_P(PSTR("Output raw 802.15.4 frames\n\r * Will "));
if (usbstick_mode.debugOn == 0) { PRINTF_P(PSTR("not "));}
PRINTF_P(PSTR("Output RS232 debug strings\n\r"));
#else
PRINTF_P(PSTR("Output raw 802.15.4 frames\n\r"));
#endif
PRINTF_P(PSTR(" * USB Ethernet MAC: %02x:%02x:%02x:%02x:%02x:%02x\n"),
((uint8_t *)&usb_ethernet_addr)[0],
((uint8_t *)&usb_ethernet_addr)[1],
@ -603,6 +630,9 @@ extern uip_ds6_route_t uip_ds6_routing_table[];
//No more serial port
stdout = NULL;
#if USB_CONF_RS232
usb_stdout = NULL;
#endif
//RNDIS is over
rndis_state = rndis_uninitialized;

View File

@ -287,28 +287,36 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
#if UIP_CONF_IPV6_RPL
/* Not completely working yet. Link local pings work but address prefixes do not get assigned */
/* Not completely working yet. Works on Ubuntu after $ifconfig usb0 -arp to drop the neighbor solitications */
/* Haven't figured out how to drop the NS on Windows */
/* RPL requires the uip stack. Change #CONTIKI_NO_NET=1 to UIP_CONF_IPV6=1 in the examples makefile,
or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenusb */
/* For the present the buffer_length calcs in rpl-icmp6.c will need adjustment by the length difference
between 6lowpan (0) and ethernet (14) link-layer headers:
// buffer_length = uip_len - uip_l2_l3_icmp_hdr_len;
buffer_length = uip_len - uip_l2_l3_icmp_hdr_len + UIP_LLH_LEN; //Add jackdaw ethernet header
*/
#define UIP_CONF_ROUTER 1
#define RPL_CONF_STATS 0
#define PROCESS_CONF_NO_PROCESS_NAMES 0
//#undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page
//#define UIP_CONF_TCP 1
//#undef UIP_FALLBACK_INTERFACE
//#define UIP_FALLBACK_INTERFACE rpl_interface
#undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page
#define UIP_CONF_TCP 0
#undef UIP_FALLBACK_INTERFACE
#define UIP_FALLBACK_INTERFACE rpl_interface
//#undef UIP_CONF_MAX_CONNECTIONS
//#define UIP_CONF_MAX_CONNECTIONS 1
//#undef UIP_CONF_MAX_LISTENPORTS
//#define UIP_CONF_MAX_LISTENPORTS 10
//#define UIP_CONF_BUFFER_SIZE 256
//#define UIP_CONF_TCP_MSS 512
//#define UIP_CONF_ND6_SEND_RA 0 error in uip-nd6.c
#undef UIP_CONF_TCP_SPLIT //daktest
#define UIP_CONF_TCP_SPLIT 0
#undef UIP_CONF_STATISTICS
#define UIP_CONF_STATISTICS 0
#define UIP_CONF_DS6_NBR_NBU 10
#define UIP_CONF_DS6_ROUTE_NBU 10
#define UIP_CONF_DS6_NBR_NBU 2
#define UIP_CONF_DS6_ROUTE_NBU 2
#define UIP_CONF_ND6_SEND_RA 0
#define UIP_CONF_ND6_REACHABLE_TIME 600000

View File

@ -163,11 +163,12 @@ PROCESS_THREAD(border_router_process, ev, data)
memcpy_P(buf,dag_id,sizeof(dag_id));
dag = rpl_set_root((uip_ip6addr_t *)buf);
}
#if 0 //horrible cludge to direct aaaa::11 to internal webserver
#if UIP_CONF_IPV6_RPL
/* Assign bbbb::11 to the uip stack, and bbbb::1 to the host network interface, e.g. $ip -6 address add bbbb::1/64 dev usb0 */
/* $ifconfig usb0 -arp on Ubuntu to skip the neighbor solicitations. Don't know how to skip NS on Windows yet. */
if(dag != NULL) {
uip_ip6addr_t ipaddr;
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0x11);
// uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0x1);
uip_ip6addr(&ipaddr, 0xbbbb, 0, 0, 0, 0, 0, 0, 0x11);
// uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF);
uip_ds6_addr_add(&ipaddr, 0, ADDR_MANUAL);
rpl_set_prefix(dag, &ipaddr, 64);

View File

@ -304,6 +304,7 @@ void mac_ethernetSetup(void)
usbstick_mode.sicslowpan = 1;
usbstick_mode.sendToRf = 1;
usbstick_mode.translate = 1;
usbstick_mode.debugOn= 1;
//usbstick_mode.raw = 1;
usbstick_mode.raw = 0; //default: don't report raw frames until they are entirely correct
@ -425,15 +426,21 @@ void mac_ethernetToLowpan(uint8_t * ethHeader)
mac_translateIPLinkLayer(ll_802154_type);
#endif
}
#if UIP_CONF_IPV6 //allow non-ipv6 builds (Hello World)
tcpip_output(destAddrPtr);
#if UIP_CONF_IPV6
/* Send the packet to the uip6 stack if it exists, else send to 6lowpan */
#if UIP_CONF_IPV6_RPL
tcpip_input();
#else
tcpip_output();
tcpip_output(destAddrPtr);
#endif
#else /* UIP_CONF_IPV6 */
tcpip_output(); //Allow non-ipv6 builds (Hello World)
#endif /* UIP_CONF_IPV6 */
#if !RF230BB
usb_eth_stat.txok++;
#endif
uip_len = 0;
}
@ -449,7 +456,6 @@ void mac_LowpanToEthernet(void)
parsed_frame = sicslowmac_get_frame();
#endif
//printf("in lowpantoethernet\n\r");
//Setup generic ethernet stuff
ETHBUF(uip_buf)->type = uip_htons(UIP_ETHTYPE_IPV6);
@ -567,7 +573,6 @@ int8_t mac_translateIcmpLinkLayer(lltype_t target)
uint8_t llbuf[16];
//Figure out offset to start of options
// printf("mac_translateicmplinklayer...");
switch(UIP_ICMP_BUF->type) {
case ICMP6_NS:
case ICMP6_NA:
@ -639,7 +644,6 @@ int8_t mac_translateIcmpLinkLayer(lltype_t target)
//Translate addresses
if (target == ll_802154_type) {
// printf("createsicslowpanlongaddr");
mac_createSicslowpanLongAddr(llbuf, (uip_lladdr_t *)UIP_ICMP_OPTS(icmp_opt_offset)->data);
} else {
#if !UIP_CONF_SIMPLE_JACKDAW_ADDR_TRANS

View File

@ -64,6 +64,7 @@ typedef struct {
uint8_t sendToRf :1;
uint8_t translate :1;
uint8_t raw :1;
uint8_t debugOn :1;
} usbstick_mode_t;