From 9e5aed5df6554be3afda2e8fae9cb10bfe33d6b1 Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Sat, 21 Jan 2017 16:37:37 +0100 Subject: [PATCH 1/9] Support for changing PANID and channel from project-conf.h modified: cpu/avr/radio/rf230bb/rf230bb.c modified: platform/avr-rss2/contiki-conf.h modified: platform/avr-rss2/contiki-main.c --- cpu/avr/radio/rf230bb/rf230bb.c | 15 +++++++++++++++ platform/avr-rss2/contiki-conf.h | 4 ---- platform/avr-rss2/contiki-main.c | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/cpu/avr/radio/rf230bb/rf230bb.c b/cpu/avr/radio/rf230bb/rf230bb.c index cbe8160ef..565c118d5 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.c +++ b/cpu/avr/radio/rf230bb/rf230bb.c @@ -1291,6 +1291,21 @@ rf230_listen_channel(uint8_t c) radio_set_trx_state(RX_ON); } /*---------------------------------------------------------------------------*/ + +unsigned +rf230_get_panid(void) +{ + unsigned pan; + uint8_t byte; + + byte = hal_register_read(RG_PAN_ID_1); + pan = byte; + byte = hal_register_read(RG_PAN_ID_0); + pan = (pan << 8) + byte; + + return pan; +} + void rf230_set_pan_addr(unsigned pan, unsigned addr, diff --git a/platform/avr-rss2/contiki-conf.h b/platform/avr-rss2/contiki-conf.h index 3e1f5dfc2..e69a0a637 100644 --- a/platform/avr-rss2/contiki-conf.h +++ b/platform/avr-rss2/contiki-conf.h @@ -78,10 +78,6 @@ #define NETSTACK_CONF_RADIO rf230_driver #endif -#ifndef CHANNEL_802_15_4 -#define CHANNEL_802_15_4 26 -#endif - /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */ #ifndef RF230_CONF_AUTOACK #define RF230_CONF_AUTOACK 1 diff --git a/platform/avr-rss2/contiki-main.c b/platform/avr-rss2/contiki-main.c index f220a168a..a872d0cd5 100644 --- a/platform/avr-rss2/contiki-main.c +++ b/platform/avr-rss2/contiki-main.c @@ -314,8 +314,18 @@ initialize(void) memcpy(&uip_lladdr.addr, &addr.u8, sizeof(linkaddr_t)); #endif +#ifdef IEEE802154_CONF_PANID + rf230_set_pan_addr(IEEE802154_CONF_PANID, params_get_panaddr(), (uint8_t *)&addr.u8); +#else rf230_set_pan_addr(params_get_panid(), params_get_panaddr(), (uint8_t *)&addr.u8); +#endif + +#ifdef CHANNEL_CONF_802_15_4 + rf230_set_channel(CHANNEL_CONF_802_15_4); +#else rf230_set_channel(params_get_channel()); +#endif + rf230_set_txpower(params_get_txpower()); #if NETSTACK_CONF_WITH_IPV6 @@ -339,8 +349,8 @@ initialize(void) NETSTACK_NETWORK.init(); #if ANNOUNCE_BOOT - PRINTA("MAC=%s, RDC=%s, NETWORK=%s, channel=%-u, check-rate-Hz=%-u, tx-power=%-u\n", NETSTACK_MAC.name, - NETSTACK_RDC.name, NETSTACK_NETWORK.name, rf230_get_channel(), + PRINTA("PAN=0x%X, XMAC=%s, RDC=%s, NETWORK=%s, channel=%-u, check-rate-Hz=%-u, tx-power=%-u\n", rf230_get_panid(), + NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name, rf230_get_channel(), CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 : NETSTACK_RDC.channel_check_interval()), rf230_get_txpower()); #if UIP_CONF_IPV6_RPL @@ -349,7 +359,6 @@ initialize(void) #if UIP_CONF_ROUTER PRINTA("Routing Enabled\n"); #endif - #endif /* ANNOUNCE_BOOT */ #if NETSTACK_CONF_WITH_IPV6 || NETSTACK_CONF_WITH_IPV4 From fa6c52633fcbca7467fe6b38e61a23bad3a60fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Sj=C3=B6din?= Date: Fri, 28 Oct 2016 01:04:05 +0200 Subject: [PATCH 2/9] Use RS232_BAUDRATE to define baudrate from projekt config file. Removed serial initialization from contiki-main.c. It seems to be too soon. --- platform/avr-rss2/contiki-conf.h | 5 +++++ platform/avr-rss2/contiki-main.c | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platform/avr-rss2/contiki-conf.h b/platform/avr-rss2/contiki-conf.h index e69a0a637..2d3ee1031 100644 --- a/platform/avr-rss2/contiki-conf.h +++ b/platform/avr-rss2/contiki-conf.h @@ -106,6 +106,11 @@ void clock_adjust_ticks(clock_time_t howmany); #define AVR_CONF_USE32KCRYSTAL 1 #define SLIP_PORT RS232_PORT_0 +/* Default baud rare on RS232 port */ +#ifndef RS232_BAUDRATE +#define RS232_BAUDRATE USART_BAUD_38400 +#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 */ /* #define MMEM_CONF_SIZE 256 */ diff --git a/platform/avr-rss2/contiki-main.c b/platform/avr-rss2/contiki-main.c index a872d0cd5..907576d43 100644 --- a/platform/avr-rss2/contiki-main.c +++ b/platform/avr-rss2/contiki-main.c @@ -71,7 +71,6 @@ #include "contiki-lib.h" #include "dev/rs232.h" -#include "dev/serial-line.h" #include "dev/slip.h" #if AVR_WEBSERVER @@ -186,9 +185,8 @@ initialize(void) watchdog_init(); watchdog_start(); leds_init(); - serial_line_init(); - rs232_init(RS232_PORT_0, USART_BAUD_38400, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); + rs232_init(RS232_PORT_0, RS232_BAUDRATE, USART_PARITY_NONE | USART_STOP_BITS_1 | USART_DATA_BITS_8); rs232_redirect_stdout(RS232_PORT_0); #if 0 @@ -198,8 +196,6 @@ initialize(void) //UBRR0L = 3; UBRR0H = 0; UCSR0A = (1 << U2X0); // 500k 0% #endif - rs232_set_input(RS232_PORT_0, serial_line_input_byte); - clock_init(); if(MCUSR & (1 << PORF)) { From 29914b5a1fdfb487c6a6facb104599520c567bea Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Mon, 23 Jan 2017 22:18:54 +0100 Subject: [PATCH 3/9] =?UTF-8?q?Fixing=20input=20serial=20line=20initializa?= =?UTF-8?q?tion=20pointed=20by=20Peter=20Sj=C3=B6din/KTH=20For=20avr-rss2?= =?UTF-8?q?=20platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/avr-rss2/README.md | 8 -------- platform/avr-rss2/contiki-main.c | 5 +++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/platform/avr-rss2/README.md b/platform/avr-rss2/README.md index 05d448fc6..2f92a64c4 100644 --- a/platform/avr-rss2/README.md +++ b/platform/avr-rss2/README.md @@ -110,14 +110,6 @@ Tested applications and examples * `examples/powertrace` * `example-shell` -Note that the shell example needs file `symbols.c` to be added to project also seems like -in `core/dev/serial-line.c` the function `process_poll` must be replaced with `process_post`: - - /* Wake up consumer process */ - - process_poll(&serial_line_process); - + process_post(&serial_line_process, 0, 0); - - Platform tutorial applications ----------------------------- Example to read out various sensors, leds, serial numbers, and so on: diff --git a/platform/avr-rss2/contiki-main.c b/platform/avr-rss2/contiki-main.c index 907576d43..ad7af6d11 100644 --- a/platform/avr-rss2/contiki-main.c +++ b/platform/avr-rss2/contiki-main.c @@ -71,6 +71,7 @@ #include "contiki-lib.h" #include "dev/rs232.h" +#include "dev/serial-line.h" #include "dev/slip.h" #if AVR_WEBSERVER @@ -267,6 +268,10 @@ initialize(void) process_start(&etimer_process, NULL); ctimer_init(); + /* After process start */ + serial_line_init(); + rs232_set_input(RS232_PORT_0, serial_line_input_byte); + /* Start radio and radio receive process */ NETSTACK_RADIO.init(); From e09bdc0c07eeae0e765b1e5c16717e51dd8ea6f3 Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Sat, 18 Mar 2017 14:13:47 +0100 Subject: [PATCH 4/9] Increasing route table from 4 to 20 modified: platform/avr-rss2/examples/ipv6/mqtt-demo/project-conf.h --- platform/avr-rss2/contiki-conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/avr-rss2/contiki-conf.h b/platform/avr-rss2/contiki-conf.h index 2d3ee1031..8b365671a 100644 --- a/platform/avr-rss2/contiki-conf.h +++ b/platform/avr-rss2/contiki-conf.h @@ -274,7 +274,7 @@ typedef unsigned short uip_stats_t; #define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 -#define UIP_CONF_MAX_ROUTES 4 +#define UIP_CONF_MAX_ROUTES 20 #define UIP_CONF_DS6_ADDR_NBU 3 #define UIP_CONF_DS6_MADDR_NBU 0 #define UIP_CONF_DS6_AADDR_NBU 0 From c0239b41c92c7efdf216069880d66cd3e664abbc Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Sun, 19 Mar 2017 21:14:31 +0100 Subject: [PATCH 5/9] Cleand-up _CONF for ROUTES, NEIGHBOR and BUFFER_SIZE modified: platform/avr-rss2/contiki-conf.h --- platform/avr-rss2/contiki-conf.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/platform/avr-rss2/contiki-conf.h b/platform/avr-rss2/contiki-conf.h index 8b365671a..b379319b6 100644 --- a/platform/avr-rss2/contiki-conf.h +++ b/platform/avr-rss2/contiki-conf.h @@ -165,6 +165,16 @@ typedef unsigned short uip_stats_t; #define RDC_CONF_MCU_SLEEP 1 #if NETSTACK_CONF_WITH_IPV6 + +#ifndef NBR_TABLE_CONF_MAX_NEIGHBORS +#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 +#endif +#ifndef UIP_CONF_MAX_ROUTES +#define UIP_CONF_MAX_ROUTES 20 +#endif +#ifndef UIP_CONF_BUFFER_SIZE +#define UIP_CONF_BUFFER_SIZE 1280 +#endif #define LINKADDR_CONF_SIZE 8 #define UIP_CONF_ICMP6 1 #define UIP_CONF_UDP 1 @@ -230,16 +240,15 @@ typedef unsigned short uip_stats_t; /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */ /* ACKs to other ports become interleaved with computation-intensive GETs, so ACKs are particularly missed. */ /* Increasing the number of packet receive buffers in RAM helps to keep ACKs from being lost */ + #define UIP_CONF_MAX_CONNECTIONS 4 /* 2 bytes per TCP listening port */ #define UIP_CONF_MAX_LISTENPORTS 4 /* 25 bytes per UDP connection */ #define UIP_CONF_UDP_CONNS 10 /* See uip-ds6.h */ -#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 -#define UIP_CONF_MAX_ROUTES 20 #define UIP_CONF_DS6_ADDR_NBU 3 #define UIP_CONF_DS6_MADDR_NBU 0 #define UIP_CONF_DS6_AADDR_NBU 0 @@ -271,10 +280,8 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define NBR_TABLE_CONF_MAX_NEIGHBORS 20 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 -#define UIP_CONF_MAX_ROUTES 20 #define UIP_CONF_DS6_ADDR_NBU 3 #define UIP_CONF_DS6_MADDR_NBU 0 #define UIP_CONF_DS6_AADDR_NBU 0 @@ -300,10 +307,8 @@ typedef unsigned short uip_stats_t; #define UIP_CONF_MAX_CONNECTIONS 2 #define UIP_CONF_MAX_LISTENPORTS 4 #define UIP_CONF_UDP_CONNS 5 -#define NBR_TABLE_CONF_MAX_NEIGHBORS 4 #define UIP_CONF_DS6_DEFRT_NBU 2 #define UIP_CONF_DS6_PREFIX_NBU 3 -#define UIP_CONF_MAX_ROUTES 4 #define UIP_CONF_DS6_ADDR_NBU 3 #define UIP_CONF_DS6_MADDR_NBU 0 #define UIP_CONF_DS6_AADDR_NBU 0 @@ -333,7 +338,6 @@ typedef unsigned short uip_stats_t; /* For slow slip connections, to prevent buffer overruns */ /* #define UIP_CONF_RECEIVE_WINDOW 300 */ #undef UIP_CONF_FWCACHE_SIZE -#define UIP_CONF_BUFFER_SIZE 600 /* DHCPv4 packets by ip64 module */ #define UIP_CONF_FWCACHE_SIZE 30 #define UIP_CONF_BROADCAST 1 #define UIP_ARCH_IPCHKSUM 1 From bf8e77ea4e316e5d7988dcaf3a587169f40b3c51 Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Fri, 24 Mar 2017 17:07:35 +0100 Subject: [PATCH 6/9] Added missing prototype modified: cpu/avr/radio/rf230bb/rf230bb.h --- cpu/avr/radio/rf230bb/rf230bb.h | 1 + 1 file changed, 1 insertion(+) diff --git a/cpu/avr/radio/rf230bb/rf230bb.h b/cpu/avr/radio/rf230bb/rf230bb.h index c441e09ab..15f5b6438 100644 --- a/cpu/avr/radio/rf230bb/rf230bb.h +++ b/cpu/avr/radio/rf230bb/rf230bb.h @@ -215,6 +215,7 @@ void rf230_set_channel(uint8_t channel); void rf230_listen_channel(uint8_t channel); uint8_t rf230_get_channel(void); void rf230_set_pan_addr(unsigned pan,unsigned addr,const uint8_t ieee_addr[8]); +unsigned rf230_get_panid(void); void rf230_set_txpower(uint8_t power); uint8_t rf230_get_txpower(void); void rf230_set_rpc(uint8_t rpc); From e77dba152d3aa4664d6d3e50f24b212d607dc9cc Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Fri, 24 Mar 2017 17:29:50 +0100 Subject: [PATCH 7/9] Removing avr-rss2 private sniffer app. Better use examples/sensniff. --- platform/avr-rss2/apps/sniffer/Makefile | 11 -- platform/avr-rss2/apps/sniffer/README.md | 29 ----- platform/avr-rss2/apps/sniffer/project-conf.h | 51 --------- .../apps/sniffer/sniffer-example-coap.pcapng | 0 platform/avr-rss2/apps/sniffer/sniffer.c | 67 ------------ platform/avr-rss2/apps/sniffer/stub-rdc.c | 100 ------------------ 6 files changed, 258 deletions(-) delete mode 100644 platform/avr-rss2/apps/sniffer/Makefile delete mode 100644 platform/avr-rss2/apps/sniffer/README.md delete mode 100644 platform/avr-rss2/apps/sniffer/project-conf.h delete mode 100644 platform/avr-rss2/apps/sniffer/sniffer-example-coap.pcapng delete mode 100644 platform/avr-rss2/apps/sniffer/sniffer.c delete mode 100644 platform/avr-rss2/apps/sniffer/stub-rdc.c diff --git a/platform/avr-rss2/apps/sniffer/Makefile b/platform/avr-rss2/apps/sniffer/Makefile deleted file mode 100644 index 63412a817..000000000 --- a/platform/avr-rss2/apps/sniffer/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -DEFINES+=PROJECT_CONF_H=\"project-conf.h\" -PROJECT_SOURCEFILES += stub-rdc.c - -CONTIKI_PROJECT = sniffer - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../../.. - -CONTIKI_WITH_RIME = 1 -include $(CONTIKI)/Makefile.include diff --git a/platform/avr-rss2/apps/sniffer/README.md b/platform/avr-rss2/apps/sniffer/README.md deleted file mode 100644 index b9332893b..000000000 --- a/platform/avr-rss2/apps/sniffer/README.md +++ /dev/null @@ -1,29 +0,0 @@ -Sniffer application mote side -============================= -This put the radio in sniff mode and should capure all traffic used -on the set channel. - -Default channel ---------------- -26 - -Bulld ------ -make TARGET=avr-rss2 - -Default serial port speed -------------------------- -38400 bps - -More info & uasage ------------------- -Look in the host directory - -Contiki support ---------------- -The code promisc for support is needed. This also adds the sensniff -format. - -References ----------- -https://github.com/g-oikonomou/sensniff diff --git a/platform/avr-rss2/apps/sniffer/project-conf.h b/platform/avr-rss2/apps/sniffer/project-conf.h deleted file mode 100644 index d56b19e7d..000000000 --- a/platform/avr-rss2/apps/sniffer/project-conf.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Project specific configuration defines for the sniffer example. - * - * \author - * George Oikonomou - - * Robert Olsson - - */ - -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - - -#define NETSTACK_CONF_MAC nullmac_driver -/* Can see other channels. Interesting. */ -/* #define NETSTACK_CONF_MAC csma_driver */ -#define NETSTACK_CONF_RDC stub_rdc_driver - - -#endif /* PROJECT_CONF_H_ */ diff --git a/platform/avr-rss2/apps/sniffer/sniffer-example-coap.pcapng b/platform/avr-rss2/apps/sniffer/sniffer-example-coap.pcapng deleted file mode 100644 index e69de29bb..000000000 diff --git a/platform/avr-rss2/apps/sniffer/sniffer.c b/platform/avr-rss2/apps/sniffer/sniffer.c deleted file mode 100644 index be572bce1..000000000 --- a/platform/avr-rss2/apps/sniffer/sniffer.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - */ - -/* - Author: Robert Olsson -*/ - -#include "contiki.h" -#include "net/rime/rime.h" -#include "random.h" -#include "dev/button-sensor.h" -#include "dev/leds.h" -#include -/*---------------------------------------------------------------------------*/ - -PROCESS(sniffer_process, "Sniffer process"); -AUTOSTART_PROCESSES(&sniffer_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sniffer_process, ev, data) -{ - PROCESS_BEGIN(); - - /* - To get rf230bb radio in sniff mode we need to have radio in RX_ON. - The promisc commands fixes this for us. No need to set PAN and - address or MAC to zero is this case. Se Atmel datasheet. There is - a chance other radios works the same way. - */ - - rf230_set_promiscuous_mode(1); - - printf("Sniffer started\n"); - - while(1) { - PROCESS_YIELD(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/avr-rss2/apps/sniffer/stub-rdc.c b/platform/avr-rss2/apps/sniffer/stub-rdc.c deleted file mode 100644 index a4db0710d..000000000 --- a/platform/avr-rss2/apps/sniffer/stub-rdc.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2010, Loughborough University - Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - */ - -/** - * \file - * Definition of a fake RDC driver to be used with passive - * examples. The sniffer will never send packets and it will never - * push incoming packets up the stack. We do this by defining this - * driver as our RDC. We then drop everything - * - * \author - * George Oikonomou - - */ - -#include "net/mac/mac.h" -#include "net/mac/rdc.h" -/*---------------------------------------------------------------------------*/ -static void -send(mac_callback_t sent, void *ptr) -{ - if(sent) { - sent(ptr, MAC_TX_OK, 1); - } -} -/*---------------------------------------------------------------------------*/ -static void -send_list(mac_callback_t sent, void *ptr, struct rdc_buf_list *list) -{ - if(sent) { - sent(ptr, MAC_TX_OK, 1); - } -} -/*---------------------------------------------------------------------------*/ -static void -input(void) -{ -} -/*---------------------------------------------------------------------------*/ -static int -on(void) -{ - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -off(int keep_radio_on) -{ - return keep_radio_on; -} -/*---------------------------------------------------------------------------*/ -static unsigned short -cca(void) -{ - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -init(void) -{ -} -/*---------------------------------------------------------------------------*/ -const struct rdc_driver stub_rdc_driver = { - "stub-rdc", - init, - send, - send_list, - input, - on, - off, - cca, -}; -/*---------------------------------------------------------------------------*/ From 3829dd2f209a619a71521c37dc271f1a02087d8d Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Fri, 24 Mar 2017 17:37:37 +0100 Subject: [PATCH 8/9] Leds toggle added modified: platform/avr-rss2/dev/leds.c --- platform/avr-rss2/dev/leds.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/avr-rss2/dev/leds.c b/platform/avr-rss2/dev/leds.c index c59f9d09f..ec228f804 100644 --- a/platform/avr-rss2/dev/leds.c +++ b/platform/avr-rss2/dev/leds.c @@ -33,6 +33,12 @@ leds_off(unsigned char ledv) void leds_toggle(unsigned char ledv) { + if(ledv & LEDS_YELLOW) { + PORTE ^= (1 << LED_YELLOW); + } + if(ledv & LEDS_RED) { + PORTE ^= (1 << LED_RED); + } } void leds_invert(unsigned char ledv) From 399150b1428d49a36afbb74ca07f9d01c12e9e9b Mon Sep 17 00:00:00 2001 From: Robert Olsson Date: Thu, 30 Mar 2017 15:24:19 +0200 Subject: [PATCH 9/9] Minor spell fix in ANNOUNCE_BOOT modified: platform/avr-rss2/contiki-main.c --- platform/avr-rss2/contiki-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/avr-rss2/contiki-main.c b/platform/avr-rss2/contiki-main.c index ad7af6d11..2b5cf3b07 100644 --- a/platform/avr-rss2/contiki-main.c +++ b/platform/avr-rss2/contiki-main.c @@ -350,7 +350,7 @@ initialize(void) NETSTACK_NETWORK.init(); #if ANNOUNCE_BOOT - PRINTA("PAN=0x%X, XMAC=%s, RDC=%s, NETWORK=%s, channel=%-u, check-rate-Hz=%-u, tx-power=%-u\n", rf230_get_panid(), + PRINTA("PAN=0x%X, MAC=%s, RDC=%s, NETWORK=%s, channel=%-u, check-rate-Hz=%-u, tx-power=%-u\n", rf230_get_panid(), NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name, rf230_get_channel(), CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1 : NETSTACK_RDC.channel_check_interval()), rf230_get_txpower());