#if DEBUG #include <stdio.h> #define PRINTF(...) printf(__VA_ARGS__) #else #define PRINTF(...) #endif SENSORS(&temperature_sensor); uip_ipaddr_t hostaddr,netmask, draddr; #include "net/uip-fw-drv.h" #include "net/uip-over-mesh.h" static struct uip_fw_netif meshif = {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; #define UIP_OVER_MESH_CHANNEL 8 static uint8_t is_gateway; #undef putchar int __attribute__(( weak )) putchar(int c) { uart0_writeb(c); return c; } void __io_putchar(char c) { putchar(c);
#endif /* UIP_ROUTER_MODULE */ extern const struct uip_router UIP_ROUTER_MODULE; #endif /* UIP_CONF_ROUTER */ #ifndef WITH_UIP #define WITH_UIP 0 #endif #if WITH_UIP #include "net/uip.h" #include "net/uip-fw.h" #include "net/uip-fw-drv.h" #include "net/uip-over-mesh.h" static struct uip_fw_netif slipif = {UIP_FW_NETIF(192,168,1,2, 255,255,255,255, slip_send)}; static struct uip_fw_netif meshif = {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, uip_over_mesh_send)}; #endif /* WITH_UIP */ #define UIP_OVER_MESH_CHANNEL 8 #if WITH_UIP static uint8_t is_gateway; #endif /* WITH_UIP */ #ifdef EXPERIMENT_SETUP #include "experiment-setup.h" #endif void init_platform(void);
static u8_t sender(void) { return cooja_radio.send((char*)UIP_IP_BUF, uip_len); } /*---------------------------------------------------------------------------*/ static void receiver(const struct radio_driver *d) { uip_len = d->read((char*)UIP_IP_BUF, UIP_BUFSIZE - UIP_LLH_LEN); tcpip_input(); } /*---------------------------------------------------------------------------*/ /* Only using a single network interface */ static struct uip_fw_netif wsn_if = {UIP_FW_NETIF(172,16,0,0, 255,255,0,0, sender)}; static struct uip_fw_netif slip_if = {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, slip_send)}; /*---------------------------------------------------------------------------*/ void init_net(void) { int i; uip_ipaddr_t hostaddr, netmask; rimeaddr_t rimeaddr; /* Init Rime */ ctimer_init(); rimeaddr.u8[0] = node_id & 0xff; rimeaddr.u8[1] = node_id >> 8; rimeaddr_set_node_addr(&rimeaddr);
#if 0 int force_float_inclusion() { extern int __fixsfsi; extern int __floatsisf; extern int __mulsf3; extern int __subsf3; return __fixsfsi + __floatsisf + __mulsf3 + __subsf3; } #endif /* We have two IP interfaces. */ struct uip_fw_netif cc2420if = {UIP_FW_NETIF(172,16,0,1, 255,255,0,0, cc2420_send_uaodv)}; static struct uip_fw_netif slipif = {UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)}; /* Radio stuff in network byte order. */ static u16_t panId = UIP_HTONS(0x2024); #ifndef RF_CHANNEL #define RF_CHANNEL 15 #endif int main(int argc, char **argv) { /*
#include "dev/ds2411.h" #include "dev/leds.h" #include "dev/light.h" #include "dev/xmem.h" #include "dev/button.h" #include "codeprop/codeprop.h" /* This is how we force inclusion of the psock library. */ #include "net/psock.h" void *force_psock_inclusion = &psock_init; void *force_udp_inclusion = &uip_udp_packet_send; struct uip_fw_netif cc2420if = {UIP_FW_NETIF(0,0,0,0, 255,255,255,255, cc2420_send_uaodv)}; PROCESS(button_process, "Button process"); PROCESS(dhclient_process, "Dhclient process"); /* Radio stuff in network byte order. */ static u16_t panId = HTONS(0x2024); #ifndef RF_CHANNEL #define RF_CHANNEL 15 #endif int main(int argc, char **argv) { /*
{ if ((xmit_buffer[0].flags & USB_BUFFER_SUBMITTED)) return UIP_FW_DROPPED; uip_arp_out(); memcpy(xmit_data, uip_buf, uip_len); xmit_buffer[0].next = NULL; xmit_buffer[0].left = uip_len; xmit_buffer[0].flags = USB_BUFFER_NOTIFY | USB_BUFFER_SHORT_END; xmit_buffer[0].data = xmit_data; /* printf("usbeth_send: %d\n", uip_len); */ usb_submit_xmit_buffer(DATA_IN, &xmit_buffer[0]); return UIP_FW_OK; } static struct uip_fw_netif usbethif = {UIP_FW_NETIF(172,16,0,1, 255,255,255,255, usbeth_send)}; #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) PROCESS(usb_eth_process, "USB ethernet"); PROCESS_THREAD(usb_eth_process, ev , data) { PROCESS_BEGIN(); usb_register_request_handler(&cdc_eth_request_hook); usb_setup(); usb_set_ep_event_process(DATA_OUT, process_current); usb_set_global_event_process(process_current); uip_fw_default(&usbethif); uip_setethaddr(default_uip_ethaddr); uip_arp_init();
/* devices */ #include "uip.h" #include "dev/slip.h" #include "dev/rs232.h" /* network server programs */ #include "webserver-nogui.h" #include "cmdd.h" #include "telnetd.h" #include "ctk/libconio_arch-small.h" /*---------------------------------------------------------------------------*/ /* inteface */ static struct uip_fw_netif slipif = {UIP_FW_NETIF(0, 0, 0, 0, 0, 0, 0, 0, slip_send)}; /* ip address of contiki */ const uip_ipaddr_t hostaddr = { { 10, 0, 1, 10 } }; /*---------------------------------------------------------------------------*/ int main(void) { /* initialize process manager. */ process_init(); clrscr_arch(); uip_init(); uip_sethostaddr(&hostaddr); uip_fw_default(&slipif);
#include "about-dsc.h" #include "calc-dsc.h" #include "dhcp-dsc.h" #include "email-dsc.h" #include "ftp-dsc.h" #include "irc-dsc.h" #include "netconf-dsc.h" #include "process-list-dsc.h" #include "shell-dsc.h" #include "www-dsc.h" #include "cmdd.h" static struct uip_fw_netif tapif = {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, tapdev_output)}; PROCESS(init_process, "Init"); PROCESS_THREAD(init_process, ev, data) { uip_ipaddr_t addr; PROCESS_BEGIN(); uip_ipaddr(&addr, 192,168,2,2); uip_sethostaddr(&addr); uip_ipaddr(&addr, 192,168,2,1); uip_setdraddr(&addr);
#include "net/rime.h" #include "sys/autostart.h" /*#include "codeprop/codeprop.h"*/ SENSORS(&button_sensor, &light_sensor, &sht11_sensor); extern int lpm_en; #define WITH_UIP 0 #if WITH_UIP static struct uip_fw_netif slipif = {UIP_FW_NETIF(192,168,1,2, 255,255,255,255, slip_send)}; #endif /* WITH_UIP */ /*---------------------------------------------------------------------------*/ #if 0 int force_float_inclusion() { extern int __fixsfsi; extern int __floatsisf; extern int __mulsf3; extern int __subsf3; return __fixsfsi + __floatsisf + __mulsf3 + __subsf3; } #endif
#include "dev/ds2411.h" #include "dev/leds.h" #include "dev/light.h" #include "dev/xmem.h" #include "dev/button.h" #include "codeprop/codeprop.h" /* This is how we force inclusion of the psock library. */ #include "net/psock.h" void *force_psock_inclusion = &psock_init; void *force_udp_inclusion = &uip_udp_packet_send; struct uip_fw_netif cc2420if = {UIP_FW_NETIF(172,16,0,9, 255,255,0,0, cc2420_send_uaodv)}; PROCESS(button_process, "Button process"); /* Radio stuff in network byte order. */ static u16_t panId = HTONS(0x2024); #ifndef RF_CHANNEL #define RF_CHANNEL 15 #endif int main(int argc, char **argv) { /* * Initalize hardware.
#include <debug-uart.h> #include <net/uip-fw-drv.h> #include <net/uip-over-mesh.h> #include <dev/slip.h> #include "contiki-main.h" /* SLIP interface */ extern struct uip_fw_netif cc2420if; rimeaddr_t node_addr = {{0,129}}; static struct uip_fw_netif slipif = {UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)}; /* USB buffers */ static unsigned char input_buffer[128]; static unsigned char output_buffer[128]; static unsigned char interrupt_buffer[16]; #define DEV_TO_HOST 0x81 #define HOST_TO_DEV 0x02 #define GATEWAY_TRICKLE_CHANNEL 8 void slip_arch_init(unsigned long ubr) { }