diff --git a/doc/doxygen/src/mainpage.md b/doc/doxygen/src/mainpage.md index 90a833bda2..557af6e2db 100644 --- a/doc/doxygen/src/mainpage.md +++ b/doc/doxygen/src/mainpage.md @@ -187,7 +187,7 @@ See @ref net for more details on networking code. pkg --- RIOT comes with support for a number of external libraries (e.g. -[OpenWSN](http://www.openwsn.org/), +[ccn-lite](https://github.com/cn-uofbasel/ccn-lite), [microcoap](https://github.com/1248/microcoap)). The way they are included is that RIOT ships with a custom Makefile for each supported library that downloads the library and optionally applies a number of patches to make it diff --git a/pkg/openwsn/Makefile b/pkg/openwsn/Makefile deleted file mode 100644 index a2b9d03633..0000000000 --- a/pkg/openwsn/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PKG_NAME=openwsn -PKG_URL=https://github.com/openwsn-berkeley/openwsn-fw.git -PKG_VERSION=ff25e5d0ae5d344ed793a724d60532fb917bf1f8 -PKG_LICENSE=BSD-3-Clause - -.PHONY: all - -all: git-download - "$(MAKE)" -C $(PKG_BUILDDIR) - -include $(RIOTBASE)/pkg/pkg.mk diff --git a/pkg/openwsn/README.md b/pkg/openwsn/README.md deleted file mode 100644 index 60c230ecc5..0000000000 --- a/pkg/openwsn/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# OpenWSN on RIOT - -This port of OpenWSN to RIOT is based on current OpenWSN upstream providing a -BSP with RIOT's interfaces. Currently supported are iotlab-m3 and fox. More -boards will follow through improvements in netdev radio driver interface. - -# Usage - -A test can be found in tests/openwsn providing a shell command to initialise -as root or listening node. And providing a sample Makefile. - -Build using -```Bash -$> export BOARD=iotlab-m3 -$> export PORT=/dev/ttyTHEPORTOFYOURIOTLAB -$> make -B clean flash term -``` - -To use OpenWSN with RIOT it has to be added to the used packages variable -```Makefile -USEPKG += openwsn -``` - -On the first build the archive will be fetched, patched and built. -**WARNING** A call of `make clean` also cleans the OpenWSN tree right now so -changes to the source code will be lost in the next build. diff --git a/pkg/openwsn/patches/0001-Add-RIOT-Makefiles.patch b/pkg/openwsn/patches/0001-Add-RIOT-Makefiles.patch deleted file mode 100644 index 4452b6c015..0000000000 --- a/pkg/openwsn/patches/0001-Add-RIOT-Makefiles.patch +++ /dev/null @@ -1,265 +0,0 @@ -From 740dc78ea84dceea25670c94faf6a81ef845fc39 Mon Sep 17 00:00:00 2001 -From: Thomas Eichinger -Date: Tue, 25 Nov 2014 15:45:36 +0100 -Subject: [PATCH 1/5] Add RIOT Makefiles - ---- - Makefile | 16 ++++++++++++++++ - kernel/openos/Makefile | 6 ++++++ - openapps/Makefile | 22 ++++++++++++++++++++++ - openapps/c6t/Makefile | 3 +++ - openapps/cinfo/Makefile | 2 ++ - openapps/cleds/Makefile | 2 ++ - openapps/cstorm/Makefile | 2 ++ - openapps/cwellknown/Makefile | 2 ++ - openapps/techo/Makefile | 3 +++ - openapps/uecho/Makefile | 3 +++ - openstack/02a-MAClow/Makefile | 3 +++ - openstack/02b-MAChigh/Makefile | 3 +++ - openstack/03a-IPHC/Makefile | 3 +++ - openstack/03b-IPv6/Makefile | 3 +++ - openstack/04-TRAN/Makefile | 6 ++++++ - openstack/Makefile | 18 ++++++++++++++++++ - openstack/cross-layers/Makefile | 3 +++ - projects/common/03oos_openwsn/Makefile | 3 +++ - 18 files changed, 103 insertions(+) - create mode 100644 Makefile - create mode 100644 kernel/openos/Makefile - create mode 100644 openapps/Makefile - create mode 100644 openapps/c6t/Makefile - create mode 100644 openapps/cinfo/Makefile - create mode 100644 openapps/cleds/Makefile - create mode 100644 openapps/cstorm/Makefile - create mode 100644 openapps/cwellknown/Makefile - create mode 100644 openapps/techo/Makefile - create mode 100644 openapps/uecho/Makefile - create mode 100644 openstack/02a-MAClow/Makefile - create mode 100644 openstack/02b-MAChigh/Makefile - create mode 100644 openstack/03a-IPHC/Makefile - create mode 100644 openstack/03b-IPv6/Makefile - create mode 100644 openstack/04-TRAN/Makefile - create mode 100644 openstack/Makefile - create mode 100644 openstack/cross-layers/Makefile - create mode 100644 projects/common/03oos_openwsn/Makefile - -diff --git a/Makefile b/Makefile -new file mode 100644 -index 0000000..66d60f8 ---- /dev/null -+++ b/Makefile -@@ -0,0 +1,16 @@ -+MODULE:=$(shell basename $(CURDIR)) -+export OPENWSN_ROOT=$(CURDIR) -+ -+DIRS += $(OPENWSN_ROOT)/projects/common/03oos_openwsn \ -+ $(OPENWSN_ROOT)/openstack \ -+ $(OPENWSN_ROOT)/openapps \ -+ $(OPENWSN_ROOT)/kernel/openos -+ -+INCLUDES += -I$(OPENWSN_ROOT)/kernel \ -+ -I$(OPENWSN_ROOT)/inc \ -+ -I$(OPENWSN_ROOT)/bsp/boards/ \ -+ -I$(OPENWSN_ROOT)/bsp/boards/riot-adaption \ -+ -I$(OPENWSN_ROOT)/openstack \ -+ -I$(OPENWSN_ROOT)/openapps -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/kernel/openos/Makefile b/kernel/openos/Makefile -new file mode 100644 -index 0000000..66fcdd0 ---- /dev/null -+++ b/kernel/openos/Makefile -@@ -0,0 +1,6 @@ -+MODULE = openwsn -+ -+INCLUDES += -I$(CURDIR)/.. -+INCLUDES += -I$(OPENWSN_ROOT)/bsp/boards -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/openapps/Makefile b/openapps/Makefile -new file mode 100644 -index 0000000..56af055 ---- /dev/null -+++ b/openapps/Makefile -@@ -0,0 +1,22 @@ -+MODULE = openwsn -+ -+DIRS += $(CURDIR)/c6t \ -+ $(CURDIR)/uecho \ -+ $(CURDIR)/techo -+ -+INCLUDES += -I$(CURDIR)/c6t \ -+ -I$(CURDIR)/techo \ -+ -I$(CURDIR)/uecho \ -+ -I$(CURDIR)/cinfo \ -+ -I$(CURDIR)/cleds \ -+ -I$(CURDIR)/cstorm \ -+ -I$(CURDIR)/cwellknown \ -+ -I$(OPENWSN_ROOT)/openstack/04-TRAN \ -+ -I$(OPENWSN_ROOT)/drivers/common \ -+ -I$(OPENWSN_ROOT)/openstack/02a-MAClow \ -+ -I$(OPENWSN_ROOT)/openstack/02b-MAChigh \ -+ -I$(OPENWSN_ROOT)/openstack/03a-IPHC \ -+ -I$(OPENWSN_ROOT)/openstack/03b-IPv6 \ -+ -I$(OPENWSN_ROOT)/openstack/cross-layers -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/openapps/c6t/Makefile b/openapps/c6t/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openapps/c6t/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openapps/cinfo/Makefile b/openapps/cinfo/Makefile -new file mode 100644 -index 0000000..fbf6584 ---- /dev/null -+++ b/openapps/cinfo/Makefile -@@ -0,0 +1,2 @@ -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/openapps/cleds/Makefile b/openapps/cleds/Makefile -new file mode 100644 -index 0000000..fbf6584 ---- /dev/null -+++ b/openapps/cleds/Makefile -@@ -0,0 +1,2 @@ -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/openapps/cstorm/Makefile b/openapps/cstorm/Makefile -new file mode 100644 -index 0000000..fbf6584 ---- /dev/null -+++ b/openapps/cstorm/Makefile -@@ -0,0 +1,2 @@ -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/openapps/cwellknown/Makefile b/openapps/cwellknown/Makefile -new file mode 100644 -index 0000000..fbf6584 ---- /dev/null -+++ b/openapps/cwellknown/Makefile -@@ -0,0 +1,2 @@ -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/openapps/techo/Makefile b/openapps/techo/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openapps/techo/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openapps/uecho/Makefile b/openapps/uecho/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openapps/uecho/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/02a-MAClow/Makefile b/openstack/02a-MAClow/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openstack/02a-MAClow/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/02b-MAChigh/Makefile b/openstack/02b-MAChigh/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openstack/02b-MAChigh/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/03a-IPHC/Makefile b/openstack/03a-IPHC/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openstack/03a-IPHC/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/03b-IPv6/Makefile b/openstack/03b-IPv6/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openstack/03b-IPv6/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/04-TRAN/Makefile b/openstack/04-TRAN/Makefile -new file mode 100644 -index 0000000..013e4fb ---- /dev/null -+++ b/openstack/04-TRAN/Makefile -@@ -0,0 +1,6 @@ -+MODULE = openwsn -+ -+INCLUDES += -I$(OPENWSN_ROOT)/openapps/techo \ -+ -I$(OPENWSN_ROOT)/openapps/uecho -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/Makefile b/openstack/Makefile -new file mode 100644 -index 0000000..a3c3aab ---- /dev/null -+++ b/openstack/Makefile -@@ -0,0 +1,18 @@ -+MODULE = openwsn -+ -+DIRS +=02a-MAClow -+DIRS +=02b-MAChigh -+DIRS +=03a-IPHC -+DIRS +=03b-IPv6 -+DIRS +=04-TRAN -+DIRS +=cross-layers -+ -+INCLUDES += -I$(CURDIR)/../drivers/common \ -+ -I$(CURDIR)/02a-MAClow \ -+ -I$(CURDIR)/02b-MAChigh \ -+ -I$(CURDIR)/03a-IPHC \ -+ -I$(CURDIR)/03b-IPv6 \ -+ -I$(CURDIR)/04-TRAN \ -+ -I$(CURDIR)/cross-layers -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/openstack/cross-layers/Makefile b/openstack/cross-layers/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/openstack/cross-layers/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -diff --git a/projects/common/03oos_openwsn/Makefile b/projects/common/03oos_openwsn/Makefile -new file mode 100644 -index 0000000..694bb09 ---- /dev/null -+++ b/projects/common/03oos_openwsn/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base --- -2.2.0 - diff --git a/pkg/openwsn/patches/0002-Add-RIOT-adaption.patch b/pkg/openwsn/patches/0002-Add-RIOT-adaption.patch deleted file mode 100644 index 943e99e3ba..0000000000 --- a/pkg/openwsn/patches/0002-Add-RIOT-adaption.patch +++ /dev/null @@ -1,1526 +0,0 @@ -From b5ecce21b0f3467bf5ef35b84a921bb081417764 Mon Sep 17 00:00:00 2001 -From: Thomas Eichinger -Date: Tue, 25 Nov 2014 15:46:26 +0100 -Subject: [PATCH 2/5] Add RIOT adaption - ---- - bsp/boards/board_ow.h | 40 +++ - bsp/boards/riot-adaption/Makefile | 3 + - bsp/boards/riot-adaption/board_info.h | 90 ++++++ - bsp/boards/riot-adaption/board_ow.c | 28 ++ - bsp/boards/riot-adaption/debugpins.c | 27 ++ - bsp/boards/riot-adaption/eui64.c | 25 ++ - bsp/boards/riot-adaption/leds_ow.c | 137 ++++++++++ - bsp/boards/riot-adaption/radio.c | 496 ++++++++++++++++++++++++++++++++++ - bsp/boards/riot-adaption/radiotimer.c | 155 +++++++++++ - bsp/boards/riot-adaption/spi_ow.c | 321 ++++++++++++++++++++++ - bsp/boards/riot-adaption/uart_ow.c | 96 +++++++ - 11 files changed, 1418 insertions(+) - create mode 100644 bsp/boards/board_ow.h - create mode 100644 bsp/boards/riot-adaption/Makefile - create mode 100644 bsp/boards/riot-adaption/board_info.h - create mode 100644 bsp/boards/riot-adaption/board_ow.c - create mode 100644 bsp/boards/riot-adaption/debugpins.c - create mode 100644 bsp/boards/riot-adaption/eui64.c - create mode 100644 bsp/boards/riot-adaption/leds_ow.c - create mode 100644 bsp/boards/riot-adaption/radio.c - create mode 100644 bsp/boards/riot-adaption/radiotimer.c - create mode 100644 bsp/boards/riot-adaption/spi_ow.c - create mode 100644 bsp/boards/riot-adaption/uart_ow.c - -diff --git a/bsp/boards/board_ow.h b/bsp/boards/board_ow.h -new file mode 100644 -index 0000000..adc373c ---- /dev/null -+++ b/bsp/boards/board_ow.h -@@ -0,0 +1,40 @@ -+#ifndef __BOARD_H -+#define __BOARD_H -+ -+/** -+\addtogroup BSP -+\{ -+\addtogroup board -+\{ -+ -+\brief Cross-platform declaration "board" bsp module. -+ -+\author Thomas Watteyne , February 2012. -+*/ -+ -+#include "board_info.h" -+#include "toolchain_defs.h" -+ -+//=========================== define ========================================== -+ -+typedef enum { -+ DO_NOT_KICK_SCHEDULER, -+ KICK_SCHEDULER, -+} kick_scheduler_t; -+ -+//=========================== typedef ========================================= -+ -+//=========================== variables ======================================= -+ -+//=========================== prototypes ====================================== -+ -+void board_init(void); -+void board_sleep(void); -+void board_reset(void); -+ -+/** -+\} -+\} -+*/ -+ -+#endif -diff --git a/bsp/boards/riot-adaption/Makefile b/bsp/boards/riot-adaption/Makefile -new file mode 100644 -index 0000000..fad1c2e ---- /dev/null -+++ b/bsp/boards/riot-adaption/Makefile -@@ -0,0 +1,3 @@ -+MODULE = openwsn -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/board_info.h b/bsp/boards/riot-adaption/board_info.h -new file mode 100644 -index 0000000..85f2eb1 ---- /dev/null -+++ b/bsp/boards/riot-adaption/board_info.h -@@ -0,0 +1,90 @@ -+/** -+\brief agilefox board information bsp module (based on openmoteSTM32 code). -+ -+This module simply defines some strings describing the board, which CoAP uses -+to return the board's description. -+ -+\author Thomas Watteyne , February 2012. -+\author Tengfei Chang , July 2012. -+\author Alaeddine Weslati , August 2013. -+*/ -+ -+#ifndef __BOARD_INFO_H -+#define __BOARD_INFO_H -+ -+#include "stdint.h" -+#include "string.h" -+#include "cpu.h" -+ -+//=========================== defines ========================================= -+ -+#define INTERRUPT_DECLARATION(); //no declaration -+ -+#define DISABLE_INTERRUPTS() irq_disable(); -+#define ENABLE_INTERRUPTS() irq_enable(); -+ -+//===== timer -+ -+#define PORT_TIMER_WIDTH uint32_t -+#define PORT_RADIOTIMER_WIDTH uint32_t -+ -+#define PORT_SIGNED_INT_WIDTH int32_t -+#define PORT_TICS_PER_MS 32 -+#define SCHEDULER_WAKEUP() //EXTI->SWIER |= EXTI_Line1; -+#define SCHEDULER_ENABLE_INTERRUPT() //enable in board use EXTI_Line1 -+ -+//===== pinout -+ -+// [P4.7] radio SLP_TR_CNTL -+#define PORT_PIN_RADIO_SLP_TR_CNTL_HIGH() //GPIOA->ODR |= (1<<0); -+#define PORT_PIN_RADIO_SLP_TR_CNTL_LOW() //GPIOA->ODR &= ~(1<<0); -+// radio reset line -+// radio /RST -+#define PORT_PIN_RADIO_RESET_HIGH() //GPIOC->ODR |= 0X0040;// nothing -+#define PORT_PIN_RADIO_RESET_LOW() //GPIOC->ODR &= ~0X0040;// nothing -+ -+//===== IEEE802154E timing -+ -+//// time-slot related -+//#define PORT_TsSlotDuration 491 // counter counts one extra count, see datasheet -+//// execution speed related -+//#define PORT_maxTxDataPrepare 66 // 2014us (measured 746us) -+//#define PORT_maxRxAckPrepare 10 // 305us (measured 83us) -+//#define PORT_maxRxDataPrepare 33 // 1007us (measured 84us) -+//#define PORT_maxTxAckPrepare 10 // 305us (measured 219us) -+//// radio speed related -+//#define PORT_delayTx 9 // 214us (measured 219us) -+//#define PORT_delayRx 0 // 0us (can not measure) -+//// radio watchdog -+ -+// time-slot related -+#define PORT_TsSlotDuration 245 // counter counts one extra count, see datasheet -+// execution speed related (rcc configure need 235us) -+#define PORT_maxTxDataPrepare 33 // 2014us (measured 812us+235) stm32 -+#define PORT_maxRxAckPrepare 10 // 900us (measured 171us+235) stm32 -+#define PORT_maxRxDataPrepare 16 // 976us (measured 170us+235) stm32 -+#define PORT_maxTxAckPrepare 10 // 900us (measured 323us+235) stm32 -+// radio speed related -+#define PORT_delayTx 10 // 549us (measured 315us+235) ..... -+#define PORT_delayRx 0 // 0us (can not measure) -+ -+//===== adaptive_sync accuracy -+ -+#define SYNC_ACCURACY 2 // ticks -+ -+//=========================== typedef ======================================== -+ -+//=========================== variables ======================================= -+ -+static const uint8_t rreg_uriquery[] = "h=ucb"; -+static const uint8_t infoBoardname[] = "riot-os"; -+static const uint8_t infouCName[] = "various"; -+static const uint8_t infoRadioName[] = "various"; -+ -+//=========================== prototypes ====================================== -+ -+//=========================== public ========================================== -+ -+//=========================== private ========================================= -+ -+#endif -diff --git a/bsp/boards/riot-adaption/board_ow.c b/bsp/boards/riot-adaption/board_ow.c -new file mode 100644 -index 0000000..95f29b1 ---- /dev/null -+++ b/bsp/boards/riot-adaption/board_ow.c -@@ -0,0 +1,28 @@ -+#include "board_ow.h" -+#include "radiotimer.h" -+#include "radio.h" -+#include "debugpins.h" -+#include "spi_ow.h" -+ -+#define ENABLE_DEBUG (1) -+#include "debug.h" -+ -+void board_init_ow(void) -+{ -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ spi_init_ow(); -+ radio_init(); -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ radiotimer_init(); -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ debugpins_init(); -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+} -+ -+void board_sleep(void) -+{ -+} -+ -+void board_reset(void) -+{ -+} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/debugpins.c b/bsp/boards/riot-adaption/debugpins.c -new file mode 100644 -index 0000000..06c7c2e ---- /dev/null -+++ b/bsp/boards/riot-adaption/debugpins.c -@@ -0,0 +1,27 @@ -+#include "debugpins.h" -+ -+void debugpins_init(void) {} -+ -+void debugpins_frame_toggle(void) {} -+void debugpins_frame_clr(void) {} -+void debugpins_frame_set(void) {} -+ -+void debugpins_slot_toggle(void) {} -+void debugpins_slot_clr(void) {} -+void debugpins_slot_set(void) {} -+ -+void debugpins_fsm_toggle(void) {} -+void debugpins_fsm_clr(void) {} -+void debugpins_fsm_set(void) {} -+ -+void debugpins_task_toggle(void) {} -+void debugpins_task_clr(void) {} -+void debugpins_task_set(void) {} -+ -+void debugpins_isr_toggle(void) {} -+void debugpins_isr_clr(void) {} -+void debugpins_isr_set(void) {} -+ -+void debugpins_radio_toggle(void) {} -+void debugpins_radio_clr(void) {} -+void debugpins_radio_set(void) {} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/eui64.c b/bsp/boards/riot-adaption/eui64.c -new file mode 100644 -index 0000000..da9da6d ---- /dev/null -+++ b/bsp/boards/riot-adaption/eui64.c -@@ -0,0 +1,25 @@ -+#include "eui64.h" -+ -+//=========================== defines ========================================= -+// stm32f103rey, 96-bit unique ID address -+#define UNIQUE_ID_BASE_ADDRESS 0x1FFFF7E8 -+ -+//=========================== variables ======================================= -+ -+const uint8_t const *uid = (const uint8_t *const) UNIQUE_ID_BASE_ADDRESS; -+ -+//=========================== prototypes ====================================== -+ -+//=========================== public ========================================== -+ -+void eui64_get(uint8_t* addressToWrite) -+{ -+ addressToWrite[0] = uid[0]; -+ addressToWrite[1] = uid[1]; -+ addressToWrite[2] = uid[2]; -+ addressToWrite[3] = uid[3]; -+ addressToWrite[4] = uid[4]; -+ addressToWrite[5] = uid[5]; -+ addressToWrite[6] = uid[6]; -+ addressToWrite[7] = uid[7]; -+} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/leds_ow.c b/bsp/boards/riot-adaption/leds_ow.c -new file mode 100644 -index 0000000..cd892e1 ---- /dev/null -+++ b/bsp/boards/riot-adaption/leds_ow.c -@@ -0,0 +1,137 @@ -+#include "board.h" -+#include "leds.h" -+ -+void Delay(void); -+ -+ -+void leds_init_ow(void) -+{ -+} -+ -+/* red */ -+void leds_error_on(void) -+{ -+ LED_RED_ON; -+} -+ -+void leds_error_off(void) -+{ -+ LED_RED_OFF; -+} -+void leds_error_toggle(void) -+{ -+ LED_RED_TOGGLE; -+} -+uint8_t leds_error_isOn(void) -+{ -+ uint8_t bitstatus = 0x00; -+ if ((LED_RED_PORT->ODR & LED_RED_PIN) != (uint32_t)0) -+ { -+ bitstatus = 0x00; -+ } -+ else -+ { -+ bitstatus = 0x01; -+ } -+ return bitstatus; -+} -+void leds_error_blink(void) {} -+ -+/* green */ -+void leds_sync_on(void) -+{ -+ LED_GREEN_ON; -+} -+void leds_sync_off(void) -+{ -+ LED_GREEN_OFF; -+} -+void leds_sync_toggle(void) -+{ -+ LED_GREEN_TOGGLE; -+} -+uint8_t leds_sync_isOn(void) -+{ -+ uint8_t bitstatus = 0x00; -+ if ((LED_GREEN_PORT->ODR & LED_GREEN_PIN) != (uint32_t)0) -+ { -+ bitstatus = 0x00; -+ } -+ else -+ { -+ bitstatus = 0x01; -+ } -+ return bitstatus; -+} -+ -+/* orange */ -+void leds_radio_on(void) -+{ -+ LED_ORANGE_ON; -+} -+void leds_radio_off(void) -+{ -+ LED_ORANGE_OFF; -+} -+void leds_radio_toggle(void) -+{ -+ LED_ORANGE_TOGGLE; -+} -+uint8_t leds_radio_isOn(void) -+{ -+ uint8_t bitstatus = 0x00; -+ if ((LED_ORANGE_PORT->ODR & LED_ORANGE_PIN) != (uint32_t)0) -+ { -+ bitstatus = 0x00; -+ } -+ else -+ { -+ bitstatus = 0x01; -+ } -+ return bitstatus; -+} -+ -+/* yellow */ -+void leds_debug_on(void) {} -+void leds_debug_off(void) {} -+void leds_debug_toggle(void) {} -+uint8_t leds_debug_isOn(void) { return 0;} -+ -+void leds_all_on(void) -+{ -+ leds_error_on(); -+ leds_sync_on(); -+ leds_radio_on(); -+} -+void leds_all_off(void) -+{ -+ leds_error_off(); -+ leds_sync_off(); -+ leds_radio_off(); -+} -+void leds_all_toggle(void) -+{ -+ leds_error_toggle(); -+ leds_sync_toggle(); -+ leds_radio_toggle(); -+} -+ -+void leds_circular_shift(void) -+{ -+ leds_error_toggle(); -+ Delay(); -+ leds_sync_toggle(); -+ Delay(); -+ leds_radio_toggle(); -+ Delay(); -+} -+ -+void leds_increment(void) {} -+ -+//=========================== private ========================================= -+ -+void Delay(void) -+{ -+ uint32_t i; -+ for(i=0; i<0xfffff; i++); -+} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/radio.c b/bsp/boards/riot-adaption/radio.c -new file mode 100644 -index 0000000..203550c ---- /dev/null -+++ b/bsp/boards/riot-adaption/radio.c -@@ -0,0 +1,496 @@ -+#include "board_ow.h" -+#include "radio.h" -+#include "at86rf231_ow.h" -+#include "spi_ow.h" -+#include "radiotimer.h" -+#include "debugpins.h" -+#include "leds.h" -+#include "board.h" -+#include "spi.h" -+#include "periph_conf.h" -+ -+#define ENABLE_DEBUG (0) -+#include "debug.h" -+ -+ -+//=========================== defines ========================================= -+ -+//=========================== variables ======================================= -+ -+typedef struct { -+ radiotimer_capture_cbt startFrame_cb; -+ radiotimer_capture_cbt endFrame_cb; -+ radio_state_t state; -+} radio_vars_t; -+ -+radio_vars_t radio_vars; -+ -+//=========================== prototypes ====================================== -+ -+void radio_spiWriteReg(uint8_t reg_addr, uint8_t reg_setting); -+uint8_t radio_spiReadReg(uint8_t reg_addr); -+void radio_spiWriteTxFifo(uint8_t* bufToWrite, uint8_t lenToWrite); -+void radio_spiReadRxFifo(uint8_t* pBufRead, -+ uint8_t* pLenRead, -+ uint8_t maxBufLen, -+ uint8_t* pLqi); -+uint8_t radio_spiReadRadioInfo(void); -+ -+//=========================== public ========================================== -+ -+//===== admin -+ -+void radio_init(void) { -+ -+ // clear variables -+ memset(&radio_vars,0,sizeof(radio_vars_t)); -+ -+ // change state -+ radio_vars.state = RADIOSTATE_STOPPED; -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ // configure the radio -+ radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF); // turn radio off -+ -+ radio_spiWriteReg(RG_IRQ_MASK, -+ (AT_IRQ_RX_START| AT_IRQ_TRX_END)); // tell radio to fire interrupt on TRX_END and RX_START -+ radio_spiReadReg(RG_IRQ_STATUS); // deassert the interrupt pin in case is high -+ radio_spiWriteReg(RG_ANT_DIV, RADIO_CHIP_ANTENNA); // use chip antenna -+#define RG_TRX_CTRL_1 0x04 -+ radio_spiWriteReg(RG_TRX_CTRL_1, 0x20); // have the radio calculate CRC -+ //busy wait until radio status is TRX_OFF -+ uint16_t c = 0; -+ while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF) -+ if (c++ == 10000) { -+ DEBUG("radio_spiReadReg timeout\n"); -+ break; -+ } -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ // change state -+ radio_vars.state = RADIOSTATE_RFOFF; -+} -+ -+void radio_setOverflowCb(radiotimer_compare_cbt cb) { -+ radiotimer_setOverflowCb(cb); -+} -+ -+void radio_setCompareCb(radiotimer_compare_cbt cb) { -+ radiotimer_setCompareCb(cb); -+} -+ -+void radio_setStartFrameCb(radiotimer_capture_cbt cb) { -+ radio_vars.startFrame_cb = cb; -+} -+ -+void radio_setEndFrameCb(radiotimer_capture_cbt cb) { -+ radio_vars.endFrame_cb = cb; -+} -+ -+//===== reset -+ -+void radio_reset(void) { -+ PORT_PIN_RADIO_RESET_LOW(); -+} -+ -+//===== timer -+ -+void radio_startTimer(PORT_TIMER_WIDTH period) { -+ radiotimer_start(period); -+} -+ -+PORT_TIMER_WIDTH radio_getTimerValue(void) { -+ return radiotimer_getValue(); -+} -+ -+void radio_setTimerPeriod(PORT_TIMER_WIDTH period) { -+ radiotimer_setPeriod(period); -+} -+ -+PORT_TIMER_WIDTH radio_getTimerPeriod(void) { -+ return radiotimer_getPeriod(); -+} -+ -+//===== RF admin -+ -+void radio_setFrequency(uint8_t frequency) { -+ // change state -+ radio_vars.state = RADIOSTATE_SETTING_FREQUENCY; -+ -+ // configure the radio to the right frequecy -+ radio_spiWriteReg(RG_PHY_CC_CCA,0x20+frequency); -+ -+ // change state -+ radio_vars.state = RADIOSTATE_FREQUENCY_SET; -+} -+ -+void radio_rfOn(void) { -+ PORT_PIN_RADIO_RESET_LOW(); -+} -+ -+void radio_rfOff(void) { -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ // change state -+ radio_vars.state = RADIOSTATE_TURNING_OFF; -+ radio_spiReadReg(RG_TRX_STATUS); -+ DEBUG("step 1\n"); -+ // turn radio off -+ radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF); -+ DEBUG("step 2\n"); -+ radio_spiWriteReg(RG_TRX_STATE, CMD_TRX_OFF); -+ -+ // busy wait until done -+ uint16_t c = 0; -+ while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF) -+ ;// if (c++ == 100000) { -+// DEBUG("%s: radio_spiReadReg timeout\n", __PRETTY_FUNCTION__); -+// break; -+// } -+ -+ DEBUG("step 3\n"); -+ // wiggle debug pin -+ debugpins_radio_clr(); -+ leds_radio_off(); -+ DEBUG("step 4\n"); -+ // change state -+ radio_vars.state = RADIOSTATE_RFOFF; -+ DEBUG("step 5\n"); -+} -+ -+//===== TX -+ -+void radio_loadPacket(uint8_t* packet, uint8_t len) { -+ // change state -+ radio_vars.state = RADIOSTATE_LOADING_PACKET; -+ -+ // load packet in TXFIFO -+ radio_spiWriteTxFifo(packet,len); -+ -+ // change state -+ radio_vars.state = RADIOSTATE_PACKET_LOADED; -+} -+ -+void radio_txEnable(void) { -+ // change state -+ radio_vars.state = RADIOSTATE_ENABLING_TX; -+ -+ // wiggle debug pin -+ debugpins_radio_set(); -+ leds_radio_on(); -+ -+ // turn on radio's PLL -+ radio_spiWriteReg(RG_TRX_STATE, CMD_PLL_ON); -+ uint16_t c = 0; -+ while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != PLL_ON) // busy wait until done -+ ;// if (c++ == 100000) { -+// DEBUG("%s: radio_spiReadReg timeout\n", __PRETTY_FUNCTION__); -+// break; -+// } -+ -+ // change state -+ radio_vars.state = RADIOSTATE_TX_ENABLED; -+} -+ -+void radio_txNow(void) { -+ PORT_TIMER_WIDTH val; -+ // change state -+ radio_vars.state = RADIOSTATE_TRANSMITTING; -+ leds_radio_toggle(); -+ // send packet by pulsing the SLP_TR_CNTL pin -+ PORT_PIN_RADIO_SLP_TR_CNTL_HIGH(); -+ PORT_PIN_RADIO_SLP_TR_CNTL_LOW(); -+ leds_radio_toggle(); -+ // The AT86RF231 does not generate an interrupt when the radio transmits the -+ // SFD, which messes up the MAC state machine. The danger is that, if we leave -+ // this funtion like this, any radio watchdog timer will expire. -+ // Instead, we cheat an mimick a start of frame event by calling -+ // ieee154e_startOfFrame from here. This also means that software can never catch -+ // a radio glitch by which #radio_txEnable would not be followed by a packet being -+ // transmitted (I've never seen that). -+ if (radio_vars.startFrame_cb!=NULL) { -+ // call the callback -+ val=radiotimer_getCapturedTime(); -+ radio_vars.startFrame_cb(val); -+ } -+ DEBUG("SENT\n"); -+} -+ -+//===== RX -+ -+void radio_rxEnable(void) { -+ // change state -+ radio_vars.state = RADIOSTATE_ENABLING_RX; -+ -+ // put radio in reception mode -+ radio_spiWriteReg(RG_TRX_STATE, CMD_RX_ON); -+ -+ // wiggle debug pin -+ debugpins_radio_set(); -+ leds_radio_on(); -+ -+ // busy wait until radio really listening -+ uint16_t c = 0; -+ while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != RX_ON) -+ ;// if (c++ == 100000) { -+// DEBUG("%s: radio_spiReadReg timeout\n",__PRETTY_FUNCTION__); -+// break; -+// } -+ -+ // change state -+ radio_vars.state = RADIOSTATE_LISTENING; -+} -+ -+void radio_rxNow(void) { -+ // nothing to do -+ -+} -+ -+void radio_getReceivedFrame(uint8_t* pBufRead, -+ uint8_t* pLenRead, -+ uint8_t maxBufLen, -+ int8_t* pRssi, -+ uint8_t* pLqi, -+ uint8_t* pCrc) { -+ uint8_t temp_reg_value; -+ -+ //===== crc -+ temp_reg_value = radio_spiReadReg(RG_PHY_RSSI); -+ *pCrc = (temp_reg_value & 0x80)>>7; // msb is whether packet passed CRC -+ -+ //===== rssi -+ // as per section 8.4.3 of the AT86RF231, the RSSI is calculate as: -+ // -91 + ED [dBm] -+ temp_reg_value = radio_spiReadReg(RG_PHY_ED_LEVEL); -+ *pRssi = -91 + temp_reg_value; -+ -+ //===== packet -+ radio_spiReadRxFifo(pBufRead, -+ pLenRead, -+ maxBufLen, -+ pLqi); -+} -+ -+//=========================== private ========================================= -+ -+static inline void CSn_SET(void) -+{ -+ SPI_0_CS_PORT->BSRR = (1 << SPI_0_CS_PIN); -+} -+static inline void CSn_CLR(void) -+{ -+ SPI_0_CS_PORT->BRR = (1 << SPI_0_CS_PIN); -+} -+ -+uint8_t radio_spiReadRadioInfo(void){ -+ uint8_t spi_tx_buffer[3]; -+ uint8_t spi_rx_buffer[3]; -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ // prepare buffer to send over SPI -+ spi_tx_buffer[0] = (0x80 | 0x1E); // [b7] Read/Write: 1 (read) -+ // [b6] RAM/Register : 1 (register) -+ // [b5-0] address: 0x1E (Manufacturer ID, Lower 16 Bit) -+ spi_tx_buffer[1] = 0x00; // send a SNOP strobe just to get the reg value -+ spi_tx_buffer[2] = 0x00; // send a SNOP strobe just to get the reg value -+ -+ // retrieve radio manufacturer ID over SPI -+ // spi_txrx(spi_tx_buffer, -+ // sizeof(spi_tx_buffer), -+ // SPI_BUFFER, -+ // spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_FIRST, -+ // SPI_LAST); -+ CSn_CLR(); -+ spi_transfer_bytes(SPI_0, spi_tx_buffer, spi_rx_buffer, 3); -+ CSn_SET(); -+ return spi_rx_buffer[2]; -+} -+ -+void radio_spiWriteReg(uint8_t reg_addr, uint8_t reg_setting) { -+ uint8_t spi_tx_buffer[2]; -+ uint8_t spi_rx_buffer[2]; -+ spi_tx_buffer[0] = (0xC0 | reg_addr); // turn addess in a 'reg write' address -+ spi_tx_buffer[1] = reg_setting; -+ -+ // spi_txrx(spi_tx_buffer, -+ // sizeof(spi_tx_buffer), -+ // SPI_BUFFER, -+ // (uint8_t*)spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_FIRST, -+ // SPI_LAST); -+ CSn_CLR(); -+ spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+ spi_transfer_byte(SPI_0, spi_tx_buffer[1], NULL); -+ CSn_SET(); -+} -+ -+uint8_t radio_spiReadReg(uint8_t reg_addr) { -+ uint8_t spi_tx_buffer[2]; -+ uint8_t spi_rx_buffer[2]; -+ spi_tx_buffer[0] = (0x80 | reg_addr); // turn addess in a 'reg read' address -+ spi_tx_buffer[1] = 0x00; // send a no_operation command just to get the reg value -+ -+ // spi_txrx(spi_tx_buffer, -+ // sizeof(spi_tx_buffer), -+ // SPI_BUFFER, -+ // (uint8_t*)spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_FIRST, -+ // SPI_LAST); -+ CSn_CLR(); -+ spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+ spi_transfer_byte(SPI_0, 0, spi_rx_buffer); -+ CSn_SET(); -+ -+ return spi_rx_buffer[0]; -+} -+ -+/** for testing purposes, remove if not needed anymore**/ -+ -+void radio_spiWriteTxFifo(uint8_t* bufToWrite, uint8_t lenToWrite) { -+ uint8_t spi_tx_buffer[2]; -+ uint8_t spi_rx_buffer[1+1+127]; // 1B SPI address, 1B length, max. 127B data -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ spi_tx_buffer[0] = 0x60; // SPI destination address for TXFIFO -+ spi_tx_buffer[1] = lenToWrite; // length byte -+ -+ CSn_CLR(); -+ spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+ spi_transfer_byte(SPI_0, spi_tx_buffer[1], NULL); -+ spi_transfer_bytes(SPI_0, bufToWrite, NULL, lenToWrite); -+ CSn_SET(); -+ -+ // spi_txrx(spi_tx_buffer, -+ // sizeof(spi_tx_buffer), -+ // SPI_BUFFER, -+ // spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_FIRST, -+ // SPI_NOTLAST); -+ -+ // spi_txrx(bufToWrite, -+ // lenToWrite, -+ // SPI_BUFFER, -+ // spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_NOTFIRST, -+ // SPI_LAST); -+} -+ -+ -+ -+void radio_spiReadRxFifo(uint8_t* pBufRead, -+ uint8_t* pLenRead, -+ uint8_t maxBufLen, -+ uint8_t* pLqi) { -+ // when reading the packet over SPI from the RX buffer, you get the following: -+ // - *[1B] dummy byte because of SPI -+ // - *[1B] length byte -+ // - [0-125B] packet (excluding CRC) -+ // - *[2B] CRC -+ // - *[1B] LQI -+ uint8_t spi_tx_buffer[125]; -+ uint8_t spi_rx_buffer[3]; -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ spi_tx_buffer[0] = 0x20; -+ -+ CSn_CLR(); -+ spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+ spi_transfer_byte(SPI_0, 0, spi_rx_buffer); -+ // 2 first bytes -+ // spi_txrx(spi_tx_buffer, -+ // 2, -+ // SPI_BUFFER, -+ // spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_FIRST, -+ // SPI_NOTLAST); -+ -+ *pLenRead = spi_rx_buffer[0]; -+ -+ if (*pLenRead>2 && *pLenRead<=127) { -+ // valid length -+ spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+ spi_transfer_bytes(SPI_0, NULL, pBufRead, *pLenRead); -+ -+ // //read packet -+ // spi_txrx(spi_tx_buffer, -+ // *pLenRead, -+ // SPI_BUFFER, -+ // pBufRead, -+ // 125, -+ // SPI_NOTFIRST, -+ // SPI_NOTLAST); -+ spi_transfer_byte(SPI_0, 0, 0); -+ spi_transfer_byte(SPI_0, 0, 0); -+ spi_transfer_byte(SPI_0, 0, pLqi); -+ // CRC (2B) and LQI (1B) -+ // spi_txrx(spi_tx_buffer, -+ // 2+1, -+ // SPI_BUFFER, -+ // spi_rx_buffer, -+ // 3, -+ // SPI_NOTFIRST, -+ // SPI_LAST); -+ -+ // *pLqi = spi_rx_buffer[2]; -+ -+ } else { -+ // invalid length -+ spi_transfer_byte(SPI_0, 0, 0); -+ // read a just byte to close spi -+ // spi_txrx(spi_tx_buffer, -+ // 1, -+ // SPI_BUFFER, -+ // spi_rx_buffer, -+ // sizeof(spi_rx_buffer), -+ // SPI_NOTFIRST, -+ // SPI_LAST); -+ } -+ CSn_SET(); -+} -+ -+//=========================== callbacks ======================================= -+ -+//=========================== interrupt handlers ============================== -+ -+kick_scheduler_t radio_isr(void) { -+ PORT_TIMER_WIDTH capturedTime; -+ uint8_t irq_status; -+ -+ // capture the time -+ capturedTime = radiotimer_getCapturedTime(); -+ -+ // reading IRQ_STATUS causes radio's IRQ pin to go low -+ irq_status = radio_spiReadReg(RG_IRQ_STATUS); -+ -+ // start of frame event -+ if (irq_status & AT_IRQ_RX_START) { -+ DEBUG("Start of frame.\n"); -+ // change state -+ radio_vars.state = RADIOSTATE_RECEIVING; -+ if (radio_vars.startFrame_cb!=NULL) { -+ // call the callback -+ radio_vars.startFrame_cb(capturedTime); -+ // kick the OS -+ return KICK_SCHEDULER; -+ } else { -+ while(1); -+ } -+ } -+ // end of frame event -+ if (irq_status & AT_IRQ_TRX_END) { -+ DEBUG("End of Frame.\n"); -+ // change state -+ radio_vars.state = RADIOSTATE_TXRX_DONE; -+ if (radio_vars.endFrame_cb!=NULL) { -+ // call the callback -+ radio_vars.endFrame_cb(capturedTime); -+ // kick the OS -+ return KICK_SCHEDULER; -+ } else { -+ while(1); -+ } -+ } -+ -+ return DO_NOT_KICK_SCHEDULER; -+} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/radiotimer.c b/bsp/boards/riot-adaption/radiotimer.c -new file mode 100644 -index 0000000..e9c0b54 ---- /dev/null -+++ b/bsp/boards/riot-adaption/radiotimer.c -@@ -0,0 +1,155 @@ -+/** -+\brief openmoteSTM32 definition of the "radiotimer" bsp module. -+On openmoteSTM32, we use RTC for the radiotimer module. -+\author Thomas Watteyne , February 2012. -+\author Chang Tengfei , July 2012. -+*/ -+ -+#include "stdint.h" -+ -+#include "periph/timer.h" -+ -+#include "leds.h" -+#include "radiotimer.h" -+#include "board_info.h" -+ -+#define ENABLE_DEBUG (0) -+#include "debug.h" -+ -+ -+//=========================== variables ======================================= -+ -+enum radiotimer_irqstatus_enum{ -+ RADIOTIMER_NONE = 0x00, //alarm interrupt default status -+ RADIOTIMER_OVERFLOW = 0x01, //alarm interrupt caused by overflow -+ RADIOTIMER_COMPARE = 0x02, //alarm interrupt caused by compare -+}; -+ -+typedef struct { -+ radiotimer_compare_cbt overflow_cb; -+ radiotimer_compare_cbt compare_cb; -+ uint8_t overflowORcompare;//indicate RTC alarm interrupt status -+ uint16_t currentSlotPeriod; -+} radiotimer_vars_t; -+ -+volatile radiotimer_vars_t radiotimer_vars; -+uint16_t current_period; -+ -+//=========================== prototypes ====================================== -+ -+//=========================== public ========================================== -+ -+//===== admin -+ -+void radiotimer_init(void) { -+ // clear local variables -+ memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t)); -+ current_period = 0; -+} -+ -+void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) { -+ radiotimer_vars.overflow_cb = cb; -+} -+ -+void radiotimer_setCompareCb(radiotimer_compare_cbt cb) { -+ radiotimer_vars.compare_cb = cb; -+} -+ -+void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) { -+ while(1); -+} -+ -+void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) { -+ while(1); -+} -+ -+void radiotimer_start(uint16_t period) { -+ DEBUG("%s\n", __PRETTY_FUNCTION__); -+ timer_init(TIMER_1, 1, &radiotimer_isr); -+ timer_set(TIMER_1, 1, (0xffff)&((unsigned int)period)); -+ current_period = period; -+ radiotimer_vars.currentSlotPeriod = period; -+ radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW; -+} -+ -+//===== direct access -+ -+uint16_t radiotimer_getValue(void) { -+ return (uint16_t)((0xffff)&timer_read(TIMER_1)); -+} -+ -+void radiotimer_setPeriod(uint16_t period) { -+ timer_set(TIMER_1, 1, (0xffff)&((unsigned int)period)); -+ current_period = period; -+ radiotimer_vars.currentSlotPeriod = period; -+ -+ //set radiotimer irpstatus -+ radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW; -+} -+ -+uint16_t radiotimer_getPeriod(void) { -+ return current_period; -+} -+ -+//===== compare -+ -+void radiotimer_schedule(uint16_t offset) { -+ timer_irq_disable(TIMER_1); -+ timer_set(TIMER_1, 1, offset); -+ current_period = offset; -+ timer_irq_enable(TIMER_1); -+ //set radiotimer irpstatus -+ radiotimer_vars.overflowORcompare = RADIOTIMER_COMPARE; -+} -+ -+void radiotimer_cancel(void) { -+ timer_irq_disable(TIMER_1); -+ timer_clear(TIMER_1, 1); -+ current_period = 0; -+ timer_irq_enable(TIMER_1); -+ -+ //set radiotimer irpstatus -+ radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW; -+} -+ -+//===== capture -+ -+inline uint16_t radiotimer_getCapturedTime(void) { -+ return (uint16_t)((0xffff)&timer_read(TIMER_1)); -+} -+ -+//=========================== private ========================================= -+ -+//=========================== interrupt handlers ============================== -+ -+kick_scheduler_t radiotimer_isr(void) { -+ uint8_t taiv_temp = radiotimer_vars.overflowORcompare; -+ switch (taiv_temp) { -+ case RADIOTIMER_COMPARE: -+ DEBUG("%s cmp\n", __PRETTY_FUNCTION__); -+ if (radiotimer_vars.compare_cb!=NULL) { -+ radiotimer_vars.compare_cb(); -+ // kick the OS -+ return KICK_SCHEDULER; -+ } -+ break; -+ case RADIOTIMER_OVERFLOW: // timer overflows -+ DEBUG("%s of\n", __PRETTY_FUNCTION__); -+ if (radiotimer_vars.overflow_cb!=NULL) { -+ //Wait until last write operation on RTC registers has finished -+ timer_reset(TIMER_1); -+ // call the callback -+ radiotimer_vars.overflow_cb(); -+ DEBUG("returned...\n"); -+ // kick the OS -+ return KICK_SCHEDULER; -+ } -+ break; -+ case RADIOTIMER_NONE: // this should not happen -+ DEBUG("%s none\n", __PRETTY_FUNCTION__); -+ default: -+ DEBUG("%s default\n", __PRETTY_FUNCTION__); -+ // while(1); // this should not happen -+ } -+ return DO_NOT_KICK_SCHEDULER; -+} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/spi_ow.c b/bsp/boards/riot-adaption/spi_ow.c -new file mode 100644 -index 0000000..56193f6 ---- /dev/null -+++ b/bsp/boards/riot-adaption/spi_ow.c -@@ -0,0 +1,321 @@ -+#include "stdio.h" -+#include "stdint.h" -+#include "string.h" -+#include "spi_ow.h" -+#include "spi.h" -+#include "leds.h" -+#include "board.h" -+#include "radio.h" -+#include "periph/gpio.h" -+#include "periph_conf.h" -+#include "at86rf231.h" -+ -+#define ENABLE_DEBUG (0) -+#include "debug.h" -+ -+//=========================== defines ========================================= -+ -+//=========================== variables ======================================= -+ -+typedef struct { -+ // information about the current transaction -+ uint8_t* pNextTxByte; -+ uint8_t numTxedBytes; -+ uint8_t txBytesLeft; -+ spi_return_t returnType; -+ uint8_t* pNextRxByte; -+ uint8_t maxRxBytes; -+ spi_first_t isFirst; -+ spi_last_t isLast; -+ // state of the module -+ uint8_t busy; -+#ifdef SPI_IN_INTERRUPT_MODE -+ // callback when module done -+ spi_cbt callback; -+#endif -+} spi_vars_t; -+ -+volatile spi_vars_t spi_vars; -+ -+//=========================== prototypes ====================================== -+// inline static void RESET_CLR(void) { GPIOC->BRR = 1<<1; } -+// inline static void RESET_SET(void) { GPIOC->BSRR = 1<<1; } -+// inline static void CSn_SET(void) { GPIOA->BSRR = 1<<4; } -+// inline static void CSn_CLR(void) { GPIOA->BRR = 1<<4; } -+// inline static void SLEEP_CLR(void) { GPIOA->BRR = 1<<2; } -+static inline void RESET_CLR(void) -+{ -+ SPI_0_RESET_PORT->BRR = (1 << SPI_0_RESET_PIN); -+} -+static inline void RESET_SET(void) -+{ -+ SPI_0_RESET_PORT->BSRR = (1 << SPI_0_RESET_PIN); -+} -+static inline void CSn_SET(void) -+{ -+ SPI_0_CS_PORT->BSRR = (1 << SPI_0_CS_PIN); -+} -+static inline void CSn_CLR(void) -+{ -+ SPI_0_CS_PORT->BRR = (1 << SPI_0_CS_PIN); -+} -+static inline void SLEEP_CLR(void) -+{ -+ SPI_0_SLEEP_PORT->BRR = (1 << SPI_0_SLEEP_PIN); -+} -+ -+//=========================== public ========================================== -+ -+void spi_init_ow(void) { -+ // clear variables -+ memset(&spi_vars,0,sizeof(spi_vars_t)); -+ -+ /* set up GPIO pins */ -+ /* SCLK and MOSI*/ -+ GPIOA->CRL &= ~(0xf << (5 * 4)); -+ GPIOA->CRL |= (0xb << (5 * 4)); -+ GPIOA->CRL &= ~(0xf << (7 * 4)); -+ GPIOA->CRL |= (0xb << (7 * 4)); -+ /* MISO */ -+ gpio_init_in(SPI_0_MISO_GPIO, GPIO_NOPULL); -+ -+ /* SPI init */ -+ spi_init_master(SPI_0, SPI_CONF_FIRST_RISING, 4500000); -+ -+ spi_poweron(SPI_0); -+ -+ /* IRQ0 */ -+ gpio_init_in(SPI_0_IRQ0_GPIO, GPIO_NOPULL); -+ gpio_init_int(SPI_0_IRQ0_GPIO, GPIO_NOPULL, GPIO_RISING, radio_isr); -+ -+ /* Connect EXTI4 Line to PC4 pin */ -+ gpio_irq_enable(SPI_0_IRQ0_GPIO); -+ -+ /* CS */ -+ gpio_init_out(SPI_0_CS_GPIO, GPIO_NOPULL); -+ /* SLEEP */ -+ gpio_init_out(SPI_0_SLEEP_GPIO, GPIO_NOPULL); -+ /* RESET */ -+ gpio_init_out(SPI_0_RESET_GPIO, GPIO_NOPULL); -+ -+ // force reset -+ RESET_CLR(); -+ CSn_SET(); -+ SLEEP_CLR(); -+ -+ for (uint16_t j=0;j<0xFFFF;j++); //small wait -+ -+ RESET_SET(); -+ // /* set up GPIO pins */ -+ // /* SCLK and MOSI*/ -+ // GPIOA->CRL &= ~(0xf << (5 * 4)); -+ // GPIOA->CRL |= (0xb << (5 * 4)); -+ // GPIOA->CRL &= ~(0xf << (7 * 4)); -+ // GPIOA->CRL |= (0xb << (7 * 4)); -+ // /* MISO */ -+ // gpio_init_in(SPI_0_MISO_GPIO, GPIO_NOPULL); -+ -+ // /* SPI init */ -+ // spi_init_master(SPI_0, SPI_CONF_FIRST_RISING, 4500000); -+ -+ // spi_poweron(SPI_0); -+ -+ // /* IRQ0 */ -+ // gpio_init_in(SPI_0_IRQ0_GPIO, GPIO_NOPULL); -+ // gpio_init_int(SPI_0_IRQ0_GPIO, GPIO_NOPULL, GPIO_RISING, radio_isr); -+ -+ // /* Connect EXTI4 Line to PC4 pin */ -+ // gpio_irq_enable(SPI_0_IRQ0_GPIO); -+ -+ // /* CS */ -+ // gpio_init_out(SPI_0_CS_GPIO, GPIO_NOPULL); -+ // /* SLEEP */ -+ // gpio_init_out(SPI_0_SLEEP_GPIO, GPIO_NOPULL); -+ // /* RESET */ -+ // gpio_init_out(SPI_0_RESET_GPIO, GPIO_NOPULL); -+ -+ // /* force reset */ -+ // RESET_CLR(); -+ // CSn_SET(); -+ // SLEEP_CLR(); -+ -+ // vtimer_usleep(AT86RF231_TIMING__RESET); -+ -+ // RESET_SET(); -+ -+ // /* Wait until TRX_OFF is entered */ -+ // vtimer_usleep(AT86RF231_TIMING__RESET_TO_TRX_OFF); -+ -+ // /* Send a FORCE TRX OFF command */ -+ // at86rf231_reg_write(AT86RF231_REG__TRX_STATE, AT86RF231_TRX_STATE__FORCE_TRX_OFF); -+ -+ // /* Wait until TRX_OFF state is entered from P_ON */ -+ // vtimer_usleep(AT86RF231_TIMING__SLEEP_TO_TRX_OFF); -+ -+ // /* busy wait for TRX_OFF state */ -+ // uint8_t status; -+ // uint8_t max_wait = 100; // TODO : move elsewhere, this is in 10us -+ -+ // do { -+ // status = at86rf231_get_status(); -+ -+ // vtimer_usleep(10); -+ -+ // if (!--max_wait) { -+ // printf("at86rf231 : ERROR : could not enter TRX_OFF mode\n"); -+ // break; -+ // } -+ // } while ((status & AT86RF231_TRX_STATUS_MASK__TRX_STATUS) -+ // != AT86RF231_TRX_STATUS__TRX_OFF); -+ -+} -+ -+#ifdef SPI_IN_INTERRUPT_MODE -+void spi_setCallback(spi_cbt cb) { -+ spi_vars.callback = cb; -+} -+#endif -+ -+void spi_txrx(uint8_t* bufTx, -+ uint8_t lenbufTx, -+ spi_return_t returnType, -+ uint8_t* bufRx, -+ uint8_t maxLenBufRx, -+ spi_first_t isFirst, -+ spi_last_t isLast) { -+ -+#ifdef SPI_IN_INTERRUPT_MODE -+ // disable interrupts -+ NVIC_RESETPRIMASK(); -+#endif -+ -+ // register spi frame to send -+ spi_vars.pNextTxByte = bufTx; -+ spi_vars.numTxedBytes = 0; -+ spi_vars.txBytesLeft = lenbufTx; -+ spi_vars.returnType = returnType; -+ spi_vars.pNextRxByte = bufRx; -+ spi_vars.maxRxBytes = maxLenBufRx; -+ spi_vars.isFirst = isFirst; -+ spi_vars.isLast = isLast; -+ -+ // SPI is now busy -+ spi_vars.busy = 1; -+ -+ -+ // lower CS signal to have slave listening -+ if (spi_vars.isFirst==SPI_FIRST) { -+ CSn_CLR(); -+ } -+ -+#ifdef SPI_IN_INTERRUPT_MODE -+ // implementation 1. use a callback function when transaction finishes -+ -+ // write first byte to TX buffer -+ SPI_I2S_SendData(SPI1,*spi_vars.pNextTxByte); -+ -+ // re-enable interrupts -+ NVIC_SETPRIMASK(); -+#else -+ // implementation 2. busy wait for each byte to be sent -+ // send all bytes -+ while (spi_vars.txBytesLeft>0) { -+ // write next byte to TX buffer -+ // SPI_I2S_SendData(SPI1,*spi_vars.pNextTxByte); -+ spi_transfer_byte(SPI_0, *((char*)spi_vars.pNextTxByte), NULL); -+ -+ // busy wait on the interrupt flag -+// uint16_t c = 0; -+// while (SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_RXNE) == RESET) -+// ;// if (c++ == 10000) { -+// // //DEBUG("spi_txrx timeout\n"); -+// // break; -+// // } -+ -+// // clear the interrupt flag -+// SPI_I2S_ClearFlag(SPI1, SPI_I2S_FLAG_RXNE); -+ // save the byte just received in the RX buffer -+ switch (spi_vars.returnType) { -+ case SPI_FIRSTBYTE: -+ if (spi_vars.numTxedBytes==0) { -+ spi_transfer_byte(SPI_0, 0, (char*)spi_vars.pNextRxByte); -+ // *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -+ } -+ break; -+ case SPI_BUFFER: -+ spi_transfer_byte(SPI_0, 0, (char*)spi_vars.pNextRxByte); -+ // *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -+ spi_vars.pNextRxByte++; -+ break; -+ case SPI_LASTBYTE: -+ spi_transfer_byte(SPI_0, 0, (char*)spi_vars.pNextRxByte); -+ // *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -+ break; -+ } -+ // one byte less to go -+ spi_vars.pNextTxByte++; -+ spi_vars.numTxedBytes++; -+ spi_vars.txBytesLeft--; -+ } -+ -+ // put CS signal high to signal end of transmission to slave -+ if (spi_vars.isLast==SPI_LAST) { -+ CSn_SET(); -+ } -+ -+ // SPI is not busy anymore -+ spi_vars.busy = 0; -+#endif -+} -+ -+//=========================== private ========================================= -+ -+//=========================== interrupt handlers ============================== -+ -+kick_scheduler_t spi_isr(void) { -+#ifdef SPI_IN_INTERRUPT_MODE -+ // save the byte just received in the RX buffer -+ switch (spi_vars.returnType) { -+ case SPI_FIRSTBYTE: -+ if (spi_vars.numTxedBytes==0) { -+ *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -+ } -+ break; -+ case SPI_BUFFER: -+ *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -+ spi_vars.pNextRxByte++; -+ break; -+ case SPI_LASTBYTE: -+ *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -+ break; -+ } -+ -+ // one byte less to go -+ spi_vars.pNextTxByte++; -+ spi_vars.numTxedBytes++; -+ spi_vars.txBytesLeft--; -+ -+ if (spi_vars.txBytesLeft>0) { -+ // write next byte to TX buffer -+ SPI_SendData(SPI1,*spi_vars.pNextTxByte); -+ } else { -+ // put CS signal high to signal end of transmission to slave -+ if (spi_vars.isLast==SPI_LAST) { -+ GPIO_SetBits(GPIOA, GPIO_Pin_4); -+ } -+ // SPI is not busy anymore -+ spi_vars.busy = 0; -+ -+ // SPI is done! -+ if (spi_vars.callback!=NULL) { -+ // call the callback -+ spi_vars.callback(); -+ // kick the OS -+ return 1; -+ } -+ } -+#else -+ while(1);// this should never happen -+ return 1; -+#endif -+} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/uart_ow.c b/bsp/boards/riot-adaption/uart_ow.c -new file mode 100644 -index 0000000..c2bcb4f ---- /dev/null -+++ b/bsp/boards/riot-adaption/uart_ow.c -@@ -0,0 +1,96 @@ -+#include "uart_ow.h" -+#include "leds.h" -+#include "periph/uart.h" -+ -+//=========================== defines ========================================= -+ -+//=========================== variables ======================================= -+ -+typedef struct { -+ uart_tx_cbt txCb; -+ uart_rx_cbt rxCb; -+ uint8_t startOrend; -+ uint8_t flagByte; -+} uart_vars_t; -+ -+volatile uart_vars_t uart_vars; -+ -+//=========================== prototypes ====================================== -+ -+//=========================== public ========================================== -+ -+void uart_init_ow(void) -+{ -+ // reset local variables -+ memset(&uart_vars,0,sizeof(uart_vars_t)); -+ -+ //when this value is 0, we are send the first data -+ uart_vars.startOrend = 0; -+ //flag byte for start byte and end byte -+ uart_vars.flagByte = 0x7E; -+} -+ -+void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb) -+{ -+ uart_vars.txCb = txCb; -+ uart_vars.rxCb = rxCb; -+} -+ -+void uart_enableInterrupts(void) -+{ -+ // USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); -+} -+ -+void uart_disableInterrupts(void) -+{ -+ // USART_ITConfig(USART1, USART_IT_TXE, DISABLE); -+ // USART_ITConfig(USART1, USART_IT_RXNE, DISABLE); -+} -+ -+void uart_clearRxInterrupts(void) -+{ -+ // USART_ClearFlag(USART1, USART_FLAG_RXNE); -+} -+ -+void uart_clearTxInterrupts(void) -+{ -+ // USART_ClearFlag(USART1, USART_FLAG_TXE); -+} -+ -+void uart_writeByte(uint8_t byteToWrite) -+{ -+ // USART_SendData(USART1, byteToWrite); -+ // while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) == RESET); -+ -+ // //start or end byte? -+ // if(byteToWrite == uart_vars.flagByte) { -+ // uart_vars.startOrend = (uart_vars.startOrend == 0)?1:0; -+ // //start byte -+ // if(uart_vars.startOrend == 1) { -+ // USART_ITConfig(USART1, USART_IT_TXE, ENABLE); -+ // } else { -+ // USART_ITConfig(USART1, USART_IT_TXE, DISABLE); -+ // } -+ // } -+} -+ -+uint8_t uart_readByte(void) -+{ -+ // uint16_t temp; -+ // temp = USART_ReceiveData(USART1); -+ // return (uint8_t)temp; -+} -+ -+//=========================== interrupt handlers ============================== -+ -+kick_scheduler_t uart_tx_isr(void) -+{ -+ uart_vars.txCb(); -+ return DO_NOT_KICK_SCHEDULER; -+} -+ -+kick_scheduler_t uart_rx_isr(void) -+{ -+ uart_vars.rxCb(); -+ return DO_NOT_KICK_SCHEDULER; -+} -\ No newline at end of file --- -2.2.0 - diff --git a/pkg/openwsn/patches/0003-Fix-old-style-definitions.patch b/pkg/openwsn/patches/0003-Fix-old-style-definitions.patch deleted file mode 100644 index d5434b89f4..0000000000 --- a/pkg/openwsn/patches/0003-Fix-old-style-definitions.patch +++ /dev/null @@ -1,1635 +0,0 @@ -From 95db91c259883f8cedf9c90ac5b59a309f93a36d Mon Sep 17 00:00:00 2001 -From: Thomas Eichinger -Date: Tue, 25 Nov 2014 15:46:55 +0100 -Subject: [PATCH 3/5] Fix old style definitions - ---- - Makefile | 5 ++- - bsp/boards/board.h | 40 ----------------- - bsp/boards/board_ow.h | 2 +- - bsp/boards/bsp_timer.h | 2 +- - bsp/boards/radiotimer.h | 2 +- - bsp/boards/riot-adaption/Makefile | 2 +- - bsp/boards/spi.h | 2 +- - bsp/boards/uart.h | 2 +- - drivers/common/Makefile | 2 + - drivers/common/openserial.c | 24 +++++----- - drivers/common/opentimers.c | 4 +- - kernel/openos/Makefile | 2 +- - kernel/openos/scheduler.c | 6 +-- - openapps/Makefile | 2 +- - openapps/c6t/Makefile | 2 +- - openapps/c6t/c6t.c | 2 +- - openapps/cexample/cexample.c | 6 +-- - openapps/cinfo/cinfo.c | 2 +- - openapps/cleds/cleds.c | 2 +- - openapps/cstorm/cstorm.c | 4 +- - openapps/cwellknown/cwellknown.c | 2 +- - openapps/techo/Makefile | 2 +- - openapps/techo/techo.c | 6 +-- - openapps/tohlone/tohlone.c | 8 ++-- - openapps/uecho/Makefile | 2 +- - openapps/uecho/uecho.c | 4 +- - openstack/02a-MAClow/IEEE802154E.c | 64 +++++++++++++-------------- - openstack/02a-MAClow/Makefile | 2 +- - openstack/02a-MAClow/adaptive_sync.c | 6 +-- - openstack/02b-MAChigh/Makefile | 2 +- - openstack/02b-MAChigh/neighbors.c | 12 ++--- - openstack/02b-MAChigh/schedule.c | 20 ++++----- - openstack/02b-MAChigh/sixtop.c | 18 ++++---- - openstack/03a-IPHC/Makefile | 2 +- - openstack/03a-IPHC/iphc.c | 2 +- - openstack/03a-IPHC/openbridge.c | 4 +- - openstack/03b-IPv6/Makefile | 2 +- - openstack/03b-IPv6/forwarding.c | 2 +- - openstack/03b-IPv6/icmpv6.c | 2 +- - openstack/03b-IPv6/icmpv6echo.c | 4 +- - openstack/03b-IPv6/icmpv6rpl.c | 16 +++---- - openstack/04-TRAN/Makefile | 2 +- - openstack/04-TRAN/opencoap.c | 2 +- - openstack/04-TRAN/opentcp.c | 8 ++-- - openstack/04-TRAN/openudp.c | 4 +- - openstack/Makefile | 2 +- - openstack/cross-layers/Makefile | 2 +- - openstack/cross-layers/idmanager.c | 8 ++-- - openstack/cross-layers/openqueue.c | 10 ++--- - openstack/cross-layers/openrandom.c | 4 +- - projects/common/03oos_openwsn/03oos_openwsn.c | 35 ++++++++++++++- - projects/common/03oos_openwsn/03oos_openwsn.h | 6 +++ - projects/common/03oos_openwsn/Makefile | 2 +- - 53 files changed, 192 insertions(+), 190 deletions(-) - delete mode 100644 bsp/boards/board.h - create mode 100644 drivers/common/Makefile - -diff --git a/Makefile b/Makefile -index 66d60f8..f1917fa 100644 ---- a/Makefile -+++ b/Makefile -@@ -1,10 +1,11 @@ --MODULE:=$(shell basename $(CURDIR)) -+export MODULE:=$(shell basename $(CURDIR)) - export OPENWSN_ROOT=$(CURDIR) - - DIRS += $(OPENWSN_ROOT)/projects/common/03oos_openwsn \ - $(OPENWSN_ROOT)/openstack \ - $(OPENWSN_ROOT)/openapps \ -- $(OPENWSN_ROOT)/kernel/openos -+ $(OPENWSN_ROOT)/kernel/openos \ -+ $(OPENWSN_ROOT)/drivers/common - - INCLUDES += -I$(OPENWSN_ROOT)/kernel \ - -I$(OPENWSN_ROOT)/inc \ -diff --git a/bsp/boards/board.h b/bsp/boards/board.h -deleted file mode 100644 -index 63f90ac..0000000 ---- a/bsp/boards/board.h -+++ /dev/null -@@ -1,40 +0,0 @@ --#ifndef __BOARD_H --#define __BOARD_H -- --/** --\addtogroup BSP --\{ --\addtogroup board --\{ -- --\brief Cross-platform declaration "board" bsp module. -- --\author Thomas Watteyne , February 2012. --*/ -- --#include "board_info.h" --#include "toolchain_defs.h" -- --//=========================== define ========================================== -- --typedef enum { -- DO_NOT_KICK_SCHEDULER, -- KICK_SCHEDULER, --} kick_scheduler_t; -- --//=========================== typedef ========================================= -- --//=========================== variables ======================================= -- --//=========================== prototypes ====================================== -- --void board_init(void); --void board_sleep(void); --void board_reset(void); -- --/** --\} --\} --*/ -- --#endif -diff --git a/bsp/boards/board_ow.h b/bsp/boards/board_ow.h -index adc373c..bd78e7b 100644 ---- a/bsp/boards/board_ow.h -+++ b/bsp/boards/board_ow.h -@@ -28,7 +28,7 @@ typedef enum { - - //=========================== prototypes ====================================== - --void board_init(void); -+void board_init_ow(void); - void board_sleep(void); - void board_reset(void); - -diff --git a/bsp/boards/bsp_timer.h b/bsp/boards/bsp_timer.h -index 67f751e..b491b83 100644 ---- a/bsp/boards/bsp_timer.h -+++ b/bsp/boards/bsp_timer.h -@@ -13,7 +13,7 @@ - */ - - #include "stdint.h" --#include "board.h" -+#include "board_ow.h" - - //=========================== define ========================================== - -diff --git a/bsp/boards/radiotimer.h b/bsp/boards/radiotimer.h -index 5058ba5..6b6b27c 100644 ---- a/bsp/boards/radiotimer.h -+++ b/bsp/boards/radiotimer.h -@@ -13,7 +13,7 @@ - */ - - #include "stdint.h" --#include "board.h" -+#include "board_ow.h" - - //=========================== define ========================================== - -diff --git a/bsp/boards/riot-adaption/Makefile b/bsp/boards/riot-adaption/Makefile -index fad1c2e..a7c0bdc 100644 ---- a/bsp/boards/riot-adaption/Makefile -+++ b/bsp/boards/riot-adaption/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/bsp/boards/spi.h b/bsp/boards/spi.h -index fae2b79..943f94e 100644 ---- a/bsp/boards/spi.h -+++ b/bsp/boards/spi.h -@@ -8,7 +8,7 @@ - #define __SPI_H - - #include "stdint.h" --#include "board.h" -+#include "board_ow.h" - - //=========================== define ========================================== - -diff --git a/bsp/boards/uart.h b/bsp/boards/uart.h -index 4add6f7..4f02a23 100644 ---- a/bsp/boards/uart.h -+++ b/bsp/boards/uart.h -@@ -13,7 +13,7 @@ - */ - - #include "stdint.h" --#include "board.h" -+#include "board_ow.h" - - //=========================== define ========================================== - -diff --git a/drivers/common/Makefile b/drivers/common/Makefile -new file mode 100644 -index 0000000..fbf6584 ---- /dev/null -+++ b/drivers/common/Makefile -@@ -0,0 +1,2 @@ -+ -+include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c -index 5b02499..edd059e 100644 ---- a/drivers/common/openserial.c -+++ b/drivers/common/openserial.c -@@ -43,7 +43,7 @@ void inputHdlcClose(void); - - //=========================== public ========================================== - --void openserial_init() { -+void openserial_init(void) { - uint16_t crc; - - // reset variable -@@ -200,7 +200,7 @@ owerror_t openserial_printCritical(uint8_t calling_component, uint8_t error_code - ); - } - --uint8_t openserial_getNumDataBytes() { -+uint8_t openserial_getNumDataBytes(void) { - uint8_t inputBufFill; - INTERRUPT_DECLARATION(); - -@@ -233,7 +233,7 @@ uint8_t openserial_getInputBuffer(uint8_t* bufferToWrite, uint8_t maxNumBytes) { - return numBytesWritten; - } - --void openserial_startInput() { -+void openserial_startInput(void) { - INTERRUPT_DECLARATION(); - - if (openserial_vars.inputBufFill>0) { -@@ -265,7 +265,7 @@ void openserial_startInput() { - ENABLE_INTERRUPTS(); - } - --void openserial_startOutput() { -+void openserial_startOutput(void) { - //schedule a task to get new status in the output buffer - uint8_t debugPrintCounter; - -@@ -349,7 +349,7 @@ void openserial_startOutput() { - ENABLE_INTERRUPTS(); - } - --void openserial_stop() { -+void openserial_stop(void) { - uint8_t inputBufFill; - uint8_t cmdByte; - bool busyReceiving; -@@ -415,7 +415,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_outBufferIndexes() { -+bool debugPrint_outBufferIndexes(void) { - uint16_t temp_buffer[2]; - INTERRUPT_DECLARATION(); - DISABLE_INTERRUPTS(); -@@ -433,7 +433,7 @@ bool debugPrint_outBufferIndexes() { - /** - \brief Start an HDLC frame in the output buffer. - */ --port_INLINE void outputHdlcOpen() { -+port_INLINE void outputHdlcOpen(void) { - // initialize the value of the CRC - openserial_vars.outputCrc = HDLC_CRCINIT; - -@@ -459,7 +459,7 @@ port_INLINE void outputHdlcWrite(uint8_t b) { - /** - \brief Finalize the outgoing HDLC frame. - */ --port_INLINE void outputHdlcClose() { -+port_INLINE void outputHdlcClose(void) { - uint16_t finalCrc; - - // finalize the calculation of the CRC -@@ -478,7 +478,7 @@ port_INLINE void outputHdlcClose() { - /** - \brief Start an HDLC frame in the input buffer. - */ --port_INLINE void inputHdlcOpen() { -+port_INLINE void inputHdlcOpen(void) { - // reset the input buffer index - openserial_vars.inputBufFill = 0; - -@@ -508,7 +508,7 @@ port_INLINE void inputHdlcWrite(uint8_t b) { - /** - \brief Finalize the incoming HDLC frame. - */ --port_INLINE void inputHdlcClose() { -+port_INLINE void inputHdlcClose(void) { - - // verify the validity of the frame - if (openserial_vars.inputCrc==HDLC_CRCGOOD) { -@@ -527,7 +527,7 @@ port_INLINE void inputHdlcClose() { - //=========================== interrupt handlers ============================== - - //executed in ISR, called from scheduler.c --void isr_openserial_tx() { -+void isr_openserial_tx(void) { - switch (openserial_vars.mode) { - case MODE_INPUT: - openserial_vars.reqFrameIdx++; -@@ -550,7 +550,7 @@ void isr_openserial_tx() { - } - - // executed in ISR, called from scheduler.c --void isr_openserial_rx() { -+void isr_openserial_rx(void) { - uint8_t rxbyte; - uint8_t inputBufFill; - -diff --git a/drivers/common/opentimers.c b/drivers/common/opentimers.c -index f361faf..5c6ba4f 100644 ---- a/drivers/common/opentimers.c -+++ b/drivers/common/opentimers.c -@@ -30,7 +30,7 @@ void opentimers_timer_callback(void); - - Initializes data structures and hardware timer. - */ --void opentimers_init(){ -+void opentimers_init(void) { - uint8_t i; - - // initialize local variables -@@ -196,7 +196,7 @@ This function maps the expiration event to possibly multiple timers, calls the - corresponding callback(s), and restarts the hardware timer with the next timer - to expire. - */ --void opentimers_timer_callback() { -+void opentimers_timer_callback(void) { - - opentimer_id_t id; - PORT_TIMER_WIDTH min_timeout; -diff --git a/kernel/openos/Makefile b/kernel/openos/Makefile -index 66fcdd0..6cea0de 100644 ---- a/kernel/openos/Makefile -+++ b/kernel/openos/Makefile -@@ -1,4 +1,4 @@ --MODULE = openwsn -+#MODULE = openwsn - - INCLUDES += -I$(CURDIR)/.. - INCLUDES += -I$(OPENWSN_ROOT)/bsp/boards -diff --git a/kernel/openos/scheduler.c b/kernel/openos/scheduler.c -index 9d9d0d2..367513c 100644 ---- a/kernel/openos/scheduler.c -+++ b/kernel/openos/scheduler.c -@@ -6,7 +6,7 @@ - - #include "opendefs.h" - #include "scheduler.h" --#include "board.h" -+#include "board_ow.h" - #include "debugpins.h" - #include "leds.h" - -@@ -21,7 +21,7 @@ void consumeTask(uint8_t taskId); - - //=========================== public ========================================== - --void scheduler_init() { -+void scheduler_init(void) { - - // initialization module variables - memset(&scheduler_vars,0,sizeof(scheduler_vars_t)); -@@ -31,7 +31,7 @@ void scheduler_init() { - SCHEDULER_ENABLE_INTERRUPT(); - } - --void scheduler_start() { -+void scheduler_start(void) { - taskList_item_t* pThisTask; - while (1) { - while(scheduler_vars.task_list!=NULL) { -diff --git a/openapps/Makefile b/openapps/Makefile -index 56af055..ab615ba 100644 ---- a/openapps/Makefile -+++ b/openapps/Makefile -@@ -1,4 +1,4 @@ --MODULE = openwsn -+#MODULE = openwsn - - DIRS += $(CURDIR)/c6t \ - $(CURDIR)/uecho \ -diff --git a/openapps/c6t/Makefile b/openapps/c6t/Makefile -index 694bb09..47289c6 100644 ---- a/openapps/c6t/Makefile -+++ b/openapps/c6t/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openapps/c6t/c6t.c b/openapps/c6t/c6t.c -index 74206ae..cdb037c 100644 ---- a/openapps/c6t/c6t.c -+++ b/openapps/c6t/c6t.c -@@ -34,7 +34,7 @@ void c6t_sendDone( - - //=========================== public ========================================== - --void c6t_init() { -+void c6t_init(void) { - if(idmanager_getIsDAGroot()==TRUE) return; - - // prepare the resource descriptor for the /6t path -diff --git a/openapps/cexample/cexample.c b/openapps/cexample/cexample.c -index ee8bfb4..719e1f0 100644 ---- a/openapps/cexample/cexample.c -+++ b/openapps/cexample/cexample.c -@@ -39,7 +39,7 @@ void cexample_sendDone(OpenQueueEntry_t* msg, - - //=========================== public ========================================== - --void cexample_init() { -+void cexample_init(void) { - - // prepare the resource descriptor for the /ex path - cexample_vars.desc.path0len = sizeof(cexample_path0)-1; -@@ -67,11 +67,11 @@ owerror_t cexample_receive(OpenQueueEntry_t* msg, - - //timer fired, but we don't want to execute task in ISR mode - //instead, push task to scheduler with COAP priority, and let scheduler take care of it --void cexample_timer_cb(){ -+void cexample_timer_cb(void) { - scheduler_push_task(cexample_task_cb,TASKPRIO_COAP); - } - --void cexample_task_cb() { -+void cexample_task_cb(void) { - OpenQueueEntry_t* pkt; - owerror_t outcome; - uint8_t numOptions; -diff --git a/openapps/cinfo/cinfo.c b/openapps/cinfo/cinfo.c -index a143d92..4ea853a 100644 ---- a/openapps/cinfo/cinfo.c -+++ b/openapps/cinfo/cinfo.c -@@ -37,7 +37,7 @@ void cinfo_sendDone( - /** - \brief Initialize this module. - */ --void cinfo_init() { -+void cinfo_init(void) { - // do not run if DAGroot - if(idmanager_getIsDAGroot()==TRUE) return; - -diff --git a/openapps/cleds/cleds.c b/openapps/cleds/cleds.c -index 74bd91a..5aea308 100644 ---- a/openapps/cleds/cleds.c -+++ b/openapps/cleds/cleds.c -@@ -30,7 +30,7 @@ void cleds_sendDone( - - //=========================== public ========================================== - --void cleds__init() { -+void cleds__init(void) { - - // prepare the resource descriptor for the /l path - cleds_vars.desc.path0len = sizeof(cleds_path0)-1; -diff --git a/openapps/cstorm/cstorm.c b/openapps/cstorm/cstorm.c -index 6366d18..ffcf106 100644 ---- a/openapps/cstorm/cstorm.c -+++ b/openapps/cstorm/cstorm.c -@@ -140,11 +140,11 @@ owerror_t cstorm_receive( - \note timer fired, but we don't want to execute task in ISR mode instead, push - task to scheduler with CoAP priority, and let scheduler take care of it. - */ --void cstorm_timer_cb(){ -+void cstorm_timer_cb(void) { - scheduler_push_task(cstorm_task_cb,TASKPRIO_COAP); - } - --void cstorm_task_cb() { -+void cstorm_task_cb(void) { - OpenQueueEntry_t* pkt; - owerror_t outcome; - uint8_t numOptions; -diff --git a/openapps/cwellknown/cwellknown.c b/openapps/cwellknown/cwellknown.c -index b38445c..3b45da5 100644 ---- a/openapps/cwellknown/cwellknown.c -+++ b/openapps/cwellknown/cwellknown.c -@@ -28,7 +28,7 @@ void cwellknown_sendDone( - - //=========================== public ========================================== - --void cwellknown_init() { -+void cwellknown_init(void) { - if(idmanager_getIsDAGroot()==TRUE) return; - - // prepare the resource descriptor for the /.well-known/core path -diff --git a/openapps/techo/Makefile b/openapps/techo/Makefile -index 694bb09..47289c6 100644 ---- a/openapps/techo/Makefile -+++ b/openapps/techo/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openapps/techo/techo.c b/openapps/techo/techo.c -index a7e314e..df3bdb3 100644 ---- a/openapps/techo/techo.c -+++ b/openapps/techo/techo.c -@@ -10,10 +10,10 @@ - - //=========================== public ========================================== - --void techo_init() { -+void techo_init(void) { - } - --bool techo_shouldIlisten() { -+bool techo_shouldIlisten(void) { - return TRUE; - } - -@@ -46,7 +46,7 @@ void techo_sendDone(OpenQueueEntry_t* msg, owerror_t error) { - void techo_connectDone(owerror_t error) { - } - --bool techo_debugPrint() { -+bool techo_debugPrint(void) { - return FALSE; - } - -diff --git a/openapps/tohlone/tohlone.c b/openapps/tohlone/tohlone.c -index fdaf9ad..6136c03 100644 ---- a/openapps/tohlone/tohlone.c -+++ b/openapps/tohlone/tohlone.c -@@ -18,18 +18,18 @@ bool tohlone_check4chars(uint8_t c1[4], uint8_t c2[4]); - - //=========================== public ========================================== - --void tohlone_init() { -+void tohlone_init(void) { - tohlone_vars.httpChunk = 0; - tohlone_vars.getRequest[0] = '/'; - tohlone_vars.getRequest[1] = ' '; - tohlone_webpages_init(); - } - --bool tohlone_shouldIlisten() { -+bool tohlone_shouldIlisten(void) { - return TRUE; - } - --void tohlone_sendpkt() { -+void tohlone_sendpkt(void) { - uint8_t buffer[TCP_DEFAULT_WINDOW_SIZE]; - uint8_t buffer_len; - -@@ -106,7 +106,7 @@ void tohlone_sendDone(OpenQueueEntry_t* msg, owerror_t error) { - void tohlone_connectDone(owerror_t error) { - } - --bool tohlone_debugPrint() { -+bool tohlone_debugPrint(void) { - return FALSE; - } - -diff --git a/openapps/uecho/Makefile b/openapps/uecho/Makefile -index 694bb09..47289c6 100644 ---- a/openapps/uecho/Makefile -+++ b/openapps/uecho/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openapps/uecho/uecho.c b/openapps/uecho/uecho.c -index b7fb405..1141c51 100644 ---- a/openapps/uecho/uecho.c -+++ b/openapps/uecho/uecho.c -@@ -11,7 +11,7 @@ - - //=========================== public ========================================== - --void uecho_init() { -+void uecho_init(void) { - } - - void uecho_receive(OpenQueueEntry_t* request) { -@@ -55,7 +55,7 @@ void uecho_sendDone(OpenQueueEntry_t* msg, owerror_t error) { - openqueue_freePacketBuffer(msg); - } - --bool uecho_debugPrint() { -+bool uecho_debugPrint(void) { - return FALSE; - } - -diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c -index 6720529..461a8bd 100644 ---- a/openstack/02a-MAClow/IEEE802154E.c -+++ b/openstack/02a-MAClow/IEEE802154E.c -@@ -99,7 +99,7 @@ void isr_ieee154e_timer(void); - Call this function once before any other function in this module, possibly - during boot-up. - */ --void ieee154e_init() { -+void ieee154e_init(void) { - - // initialize variables - memset(&ieee154e_vars,0,sizeof(ieee154e_vars_t)); -@@ -166,7 +166,7 @@ PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN) { - - This function executes in ISR mode, when the new slot timer fires. - */ --void isr_ieee154e_newSlot() { -+void isr_ieee154e_newSlot(void) { - radio_setTimerPeriod(TsSlotDuration); - if (ieee154e_vars.isSync==FALSE) { - if (idmanager_getIsDAGroot()==TRUE) { -@@ -187,7 +187,7 @@ void isr_ieee154e_newSlot() { - - This function executes in ISR mode, when the FSM timer fires. - */ --void isr_ieee154e_timer() { -+void isr_ieee154e_timer(void) { - switch (ieee154e_vars.state) { - case S_TXDATAOFFSET: - activity_ti2(); -@@ -354,7 +354,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_asn() { -+bool debugPrint_asn(void) { - asn_t output; - output.byte4 = ieee154e_vars.asn.byte4; - output.bytes2and3 = ieee154e_vars.asn.bytes2and3; -@@ -371,7 +371,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_isSync() { -+bool debugPrint_isSync(void) { - uint8_t output=0; - output = ieee154e_vars.isSync; - openserial_printStatus(STATUS_ISSYNC,(uint8_t*)&output,sizeof(uint8_t)); -@@ -386,7 +386,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_macStats() { -+bool debugPrint_macStats(void) { - // send current stats over serial - openserial_printStatus(STATUS_MACSTATS,(uint8_t*)&ieee154e_stats,sizeof(ieee154e_stats_t)); - return TRUE; -@@ -396,7 +396,7 @@ bool debugPrint_macStats() { - - //======= SYNCHRONIZING - --port_INLINE void activity_synchronize_newSlot() { -+port_INLINE void activity_synchronize_newSlot(void) { - // I'm in the middle of receiving a packet - if (ieee154e_vars.state==S_SYNCRX) { - return; -@@ -747,7 +747,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) { - - //======= TX - --port_INLINE void activity_ti1ORri1() { -+port_INLINE void activity_ti1ORri1(void) { - cellType_t cellType; - open_addr_t neighbor; - uint8_t i; -@@ -915,7 +915,7 @@ port_INLINE void activity_ti1ORri1() { - } - } - --port_INLINE void activity_ti2() { -+port_INLINE void activity_ti2(void) { - // change state - changeState(S_TXDATAPREPARE); - -@@ -940,7 +940,7 @@ port_INLINE void activity_ti2() { - changeState(S_TXDATAREADY); - } - --port_INLINE void activity_tie1() { -+port_INLINE void activity_tie1(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_MAXTXDATAPREPARE_OVERFLOW, - (errorparameter_t)ieee154e_vars.state, -@@ -950,7 +950,7 @@ port_INLINE void activity_tie1() { - endSlot(); - } - --port_INLINE void activity_ti3() { -+port_INLINE void activity_ti3(void) { - // change state - changeState(S_TXDATADELAY); - -@@ -961,7 +961,7 @@ port_INLINE void activity_ti3() { - radio_txNow(); - } - --port_INLINE void activity_tie2() { -+port_INLINE void activity_tie2(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_WDRADIO_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -986,7 +986,7 @@ port_INLINE void activity_ti4(PORT_RADIOTIMER_WIDTH capturedTime) { - radiotimer_schedule(DURATION_tt4); - } - --port_INLINE void activity_tie3() { -+port_INLINE void activity_tie3(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_WDDATADURATION_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -1034,7 +1034,7 @@ port_INLINE void activity_ti5(PORT_RADIOTIMER_WIDTH capturedTime) { - } - } - --port_INLINE void activity_ti6() { -+port_INLINE void activity_ti6(void) { - // change state - changeState(S_RXACKPREPARE); - -@@ -1056,7 +1056,7 @@ port_INLINE void activity_ti6() { - changeState(S_RXACKREADY); - } - --port_INLINE void activity_tie4() { -+port_INLINE void activity_tie4(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_MAXRXACKPREPARE_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -1066,7 +1066,7 @@ port_INLINE void activity_tie4() { - endSlot(); - } - --port_INLINE void activity_ti7() { -+port_INLINE void activity_ti7(void) { - // change state - changeState(S_RXACKLISTEN); - -@@ -1077,7 +1077,7 @@ port_INLINE void activity_ti7() { - radiotimer_schedule(DURATION_tt7); - } - --port_INLINE void activity_tie5() { -+port_INLINE void activity_tie5(void) { - // indicate transmit failed to schedule to keep stats - schedule_indicateTx(&ieee154e_vars.asn,FALSE); - -@@ -1113,7 +1113,7 @@ port_INLINE void activity_ti8(PORT_RADIOTIMER_WIDTH capturedTime) { - radiotimer_schedule(DURATION_tt8); - } - --port_INLINE void activity_tie6() { -+port_INLINE void activity_tie6(void) { - // abort - endSlot(); - } -@@ -1248,7 +1248,7 @@ port_INLINE void activity_ti9(PORT_RADIOTIMER_WIDTH capturedTime) { - - //======= RX - --port_INLINE void activity_ri2() { -+port_INLINE void activity_ri2(void) { - // change state - changeState(S_RXDATAPREPARE); - -@@ -1270,7 +1270,7 @@ port_INLINE void activity_ri2() { - changeState(S_RXDATAREADY); - } - --port_INLINE void activity_rie1() { -+port_INLINE void activity_rie1(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_MAXRXDATAPREPARE_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -1280,7 +1280,7 @@ port_INLINE void activity_rie1() { - endSlot(); - } - --port_INLINE void activity_ri3() { -+port_INLINE void activity_ri3(void) { - // change state - changeState(S_RXDATALISTEN); - -@@ -1291,7 +1291,7 @@ port_INLINE void activity_ri3() { - radiotimer_schedule(DURATION_rt3); - } - --port_INLINE void activity_rie2() { -+port_INLINE void activity_rie2(void) { - // abort - endSlot(); - } -@@ -1313,7 +1313,7 @@ port_INLINE void activity_ri4(PORT_RADIOTIMER_WIDTH capturedTime) { - radiotimer_schedule(DURATION_rt4); - } - --port_INLINE void activity_rie3() { -+port_INLINE void activity_rie3(void) { - - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_WDDATADURATION_OVERFLOWS, -@@ -1465,7 +1465,7 @@ port_INLINE void activity_ri5(PORT_RADIOTIMER_WIDTH capturedTime) { - endSlot(); - } - --port_INLINE void activity_ri6() { -+port_INLINE void activity_ri6(void) { - PORT_SIGNED_INT_WIDTH timeCorrection; - header_IE_ht header_desc; - -@@ -1546,7 +1546,7 @@ port_INLINE void activity_ri6() { - changeState(S_TXACKREADY); - } - --port_INLINE void activity_rie4() { -+port_INLINE void activity_rie4(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_MAXTXACKPREPARE_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -1556,7 +1556,7 @@ port_INLINE void activity_rie4() { - endSlot(); - } - --port_INLINE void activity_ri7() { -+port_INLINE void activity_ri7(void) { - // change state - changeState(S_TXACKDELAY); - -@@ -1567,7 +1567,7 @@ port_INLINE void activity_ri7() { - radio_txNow(); - } - --port_INLINE void activity_rie5() { -+port_INLINE void activity_rie5(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_WDRADIOTX_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -1591,7 +1591,7 @@ port_INLINE void activity_ri8(PORT_RADIOTIMER_WIDTH capturedTime) { - radiotimer_schedule(DURATION_rt8); - } - --port_INLINE void activity_rie6() { -+port_INLINE void activity_rie6(void) { - // log the error - openserial_printError(COMPONENT_IEEE802154E,ERR_WDACKDURATION_OVERFLOWS, - (errorparameter_t)ieee154e_vars.state, -@@ -1695,7 +1695,7 @@ port_INLINE bool isValidAck(ieee802154_header_iht* ieee802514_header, OpenQueueE - - //======= ASN handling - --port_INLINE void incrementAsnOffset() { -+port_INLINE void incrementAsnOffset(void) { - // increment the asn - ieee154e_vars.asn.bytes0and1++; - if (ieee154e_vars.asn.bytes0and1==0) { -@@ -1890,7 +1890,7 @@ void notif_receive(OpenQueueEntry_t* packetReceived) { - - //======= stats - --port_INLINE void resetStats() { -+port_INLINE void resetStats(void) { - ieee154e_stats.numSyncPkt = 0; - ieee154e_stats.numSyncAck = 0; - ieee154e_stats.minCorrection = 127; -@@ -1997,7 +1997,7 @@ have been sent to the upper layer. Similarly, in a Tx slot, the sendDone - function should already have been done. If this is not the case, this function - will do that for you, but assume that something went wrong. - */ --void endSlot() { -+void endSlot(void) { - - // turn off the radio - radio_rfOff(); -@@ -2079,6 +2079,6 @@ void endSlot() { - changeState(S_SLEEP); - } - --bool ieee154e_isSynch(){ -+bool ieee154e_isSynch(void) { - return ieee154e_vars.isSync; - } -diff --git a/openstack/02a-MAClow/Makefile b/openstack/02a-MAClow/Makefile -index 694bb09..47289c6 100644 ---- a/openstack/02a-MAClow/Makefile -+++ b/openstack/02a-MAClow/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openstack/02a-MAClow/adaptive_sync.c b/openstack/02a-MAClow/adaptive_sync.c -index 76c4cc9..0386bcc 100644 ---- a/openstack/02a-MAClow/adaptive_sync.c -+++ b/openstack/02a-MAClow/adaptive_sync.c -@@ -32,7 +32,7 @@ adaptive_sync_vars_t adaptive_sync_vars; - /** - \brief initial this module - */ --void adaptive_sync_init() { -+void adaptive_sync_init(void) { - // reset local variables - memset(&adaptive_sync_vars,0x00,sizeof(adaptive_sync_vars_t)); - -@@ -170,7 +170,7 @@ void adaptive_sync_calculateCompensatedSlots(int16_t timeCorrection) { - - Once compensationTimeout == 0, extend or shorten current slot length for one tick. - */ --void adaptive_sync_countCompensationTimeout() { -+void adaptive_sync_countCompensationTimeout(void) { - uint16_t newSlotDuration; - - newSlotDuration = TsSlotDuration; -@@ -262,7 +262,7 @@ void adaptive_sync_countCompensationTimeout_compoundSlots(uint16_t compoundSlots - /** - \brief set driftChanged to true. - */ --void adaptive_sync_driftChanged() { -+void adaptive_sync_driftChanged(void) { - #ifndef NOADAPTIVESYNC - adaptive_sync_vars.driftChanged = TRUE; - #endif -diff --git a/openstack/02b-MAChigh/Makefile b/openstack/02b-MAChigh/Makefile -index 694bb09..47289c6 100644 ---- a/openstack/02b-MAChigh/Makefile -+++ b/openstack/02b-MAChigh/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openstack/02b-MAChigh/neighbors.c b/openstack/02b-MAChigh/neighbors.c -index 7e136e9..ba465ef 100644 ---- a/openstack/02b-MAChigh/neighbors.c -+++ b/openstack/02b-MAChigh/neighbors.c -@@ -31,7 +31,7 @@ bool isThisRowMatching( - /** - \brief Initializes this module. - */ --void neighbors_init() { -+void neighbors_init(void) { - - // clear module variables - memset(&neighbors_vars,0,sizeof(neighbors_vars_t)); -@@ -51,7 +51,7 @@ void neighbors_init() { - - \returns This mote's current DAG rank. - */ --dagrank_t neighbors_getMyDAGrank() { -+dagrank_t neighbors_getMyDAGrank(void) { - return neighbors_vars.myDAGrank; - } - -@@ -60,7 +60,7 @@ dagrank_t neighbors_getMyDAGrank() { - - \returns The number of neighbors this mote's currently knows of. - */ --uint8_t neighbors_getNumNeighbors() { -+uint8_t neighbors_getNumNeighbors(void) { - uint8_t i; - uint8_t returnVal; - -@@ -494,7 +494,7 @@ routing decisions to change. Examples are: - very low DAGrank, I may want to change by routing parent. - - I became a DAGroot, so my DAGrank should be 0. - */ --void neighbors_updateMyDAGrankAndNeighborPreference() { -+void neighbors_updateMyDAGrankAndNeighborPreference(void) { - uint8_t i; - uint16_t rankIncrease; - uint32_t tentativeDAGrank; // 32-bit since is used to sum -@@ -550,7 +550,7 @@ void neighbors_updateMyDAGrankAndNeighborPreference() { - - //===== maintenance - --void neighbors_removeOld() { -+void neighbors_removeOld(void) { - uint8_t i; - uint16_t timeSinceHeard; - -@@ -574,7 +574,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_neighbors() { -+bool debugPrint_neighbors(void) { - debugNeighborEntry_t temp; - neighbors_vars.debugRow=(neighbors_vars.debugRow+1)%MAXNUMNEIGHBORS; - temp.row=neighbors_vars.debugRow; -diff --git a/openstack/02b-MAChigh/schedule.c b/openstack/02b-MAChigh/schedule.c -index c2e2394..fafb6f6 100644 ---- a/openstack/02b-MAChigh/schedule.c -+++ b/openstack/02b-MAChigh/schedule.c -@@ -22,7 +22,7 @@ void schedule_resetEntry(scheduleEntry_t* pScheduleEntry); - - \post Call this function before calling any other function in this module. - */ --void schedule_init() { -+void schedule_init(void) { - uint8_t i; - slotOffset_t running_slotOffset; - open_addr_t temp_neighbor; -@@ -87,7 +87,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_schedule() { -+bool debugPrint_schedule(void) { - debugScheduleEntry_t temp; - - // increment the row just printed -@@ -138,7 +138,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_backoff() { -+bool debugPrint_backoff(void) { - uint8_t temp[2]; - - // gather status data -@@ -417,7 +417,7 @@ void schedule_syncSlotOffset(slotOffset_t targetSlotOffset) { - /** - \brief advance to next active slot - */ --void schedule_advanceSlot() { -+void schedule_advanceSlot(void) { - - INTERRUPT_DECLARATION(); - DISABLE_INTERRUPTS(); -@@ -430,7 +430,7 @@ void schedule_advanceSlot() { - /** - \brief return slotOffset of next active slot - */ --slotOffset_t schedule_getNextActiveSlotOffset() { -+slotOffset_t schedule_getNextActiveSlotOffset(void) { - slotOffset_t res; - - INTERRUPT_DECLARATION(); -@@ -448,7 +448,7 @@ slotOffset_t schedule_getNextActiveSlotOffset() { - - \returns The frame length. - */ --frameLength_t schedule_getFrameLength() { -+frameLength_t schedule_getFrameLength(void) { - frameLength_t returnVal; - - INTERRUPT_DECLARATION(); -@@ -466,7 +466,7 @@ frameLength_t schedule_getFrameLength() { - - \returns The type of the current schedule entry. - */ --cellType_t schedule_getType() { -+cellType_t schedule_getType(void) { - cellType_t returnVal; - - INTERRUPT_DECLARATION(); -@@ -499,7 +499,7 @@ void schedule_getNeighbor(open_addr_t* addrToWrite) { - - \returns The channel offset of the current schedule entry. - */ --channelOffset_t schedule_getChannelOffset() { -+channelOffset_t schedule_getChannelOffset(void) { - channelOffset_t returnVal; - - INTERRUPT_DECLARATION(); -@@ -524,7 +524,7 @@ Note that the backoff counter is global, not per slot. - - \returns TRUE if it is OK to send on this slot, FALSE otherwise. - */ --bool schedule_getOkToSend() { -+bool schedule_getOkToSend(void) { - bool returnVal; - - INTERRUPT_DECLARATION(); -@@ -558,7 +558,7 @@ bool schedule_getOkToSend() { - /** - \brief Reset the backoff and backoffExponent. - */ --void schedule_resetBackoff() { -+void schedule_resetBackoff(void) { - - INTERRUPT_DECLARATION(); - DISABLE_INTERRUPTS(); -diff --git a/openstack/02b-MAChigh/sixtop.c b/openstack/02b-MAChigh/sixtop.c -index 6913957..8abc76c 100644 ---- a/openstack/02b-MAChigh/sixtop.c -+++ b/openstack/02b-MAChigh/sixtop.c -@@ -115,7 +115,7 @@ bool sixtop_areAvailableCellsToBeScheduled( - - //=========================== public ========================================== - --void sixtop_init() { -+void sixtop_init(void) { - - sixtop_vars.periodMaintenance = 872 +(openrandom_get16b()&0xff); - sixtop_vars.busySendingKA = FALSE; -@@ -337,7 +337,7 @@ owerror_t sixtop_send(OpenQueueEntry_t *msg) { - - //======= from lower layer - --void task_sixtopNotifSendDone() { -+void task_sixtopNotifSendDone(void) { - OpenQueueEntry_t* msg; - - // get recently-sent packet from openqueue -@@ -410,7 +410,7 @@ void task_sixtopNotifSendDone() { - } - } - --void task_sixtopNotifReceive() { -+void task_sixtopNotifReceive(void) { - OpenQueueEntry_t* msg; - uint16_t lenIE; - -@@ -495,7 +495,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_myDAGrank() { -+bool debugPrint_myDAGrank(void) { - uint16_t output; - - output = 0; -@@ -513,7 +513,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_kaPeriod() { -+bool debugPrint_kaPeriod(void) { - uint16_t output; - - output = sixtop_vars.kaPeriod; -@@ -582,11 +582,11 @@ owerror_t sixtop_send_internal( - - // timer interrupt callbacks - --void sixtop_maintenance_timer_cb() { -+void sixtop_maintenance_timer_cb(void) { - scheduler_push_task(timer_sixtop_management_fired,TASKPRIO_SIXTOP); - } - --void sixtop_timeout_timer_cb() { -+void sixtop_timeout_timer_cb(void) { - scheduler_push_task(timer_sixtop_six2six_timeout_fired,TASKPRIO_SIXTOP_TIMEOUT); - } - -@@ -626,7 +626,7 @@ This is one of the MAC management tasks. This function inlines in the - timers_res_fired() function, but is declared as a separate function for better - readability of the code. - */ --port_INLINE void sixtop_sendEB() { -+port_INLINE void sixtop_sendEB(void) { - OpenQueueEntry_t* adv; - uint8_t len; - -@@ -695,7 +695,7 @@ This is one of the MAC management tasks. This function inlines in the - timers_res_fired() function, but is declared as a separate function for better - readability of the code. - */ --port_INLINE void sixtop_sendKA() { -+port_INLINE void sixtop_sendKA(void) { - OpenQueueEntry_t* kaPkt; - open_addr_t* kaNeighAddr; - -diff --git a/openstack/03a-IPHC/Makefile b/openstack/03a-IPHC/Makefile -index 694bb09..47289c6 100644 ---- a/openstack/03a-IPHC/Makefile -+++ b/openstack/03a-IPHC/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openstack/03a-IPHC/iphc.c b/openstack/03a-IPHC/iphc.c -index 3ff5bd1..2b25466 100644 ---- a/openstack/03a-IPHC/iphc.c -+++ b/openstack/03a-IPHC/iphc.c -@@ -48,7 +48,7 @@ void iphc_retrieveIPv6HopByHopHeader( - - //=========================== public ========================================== - --void iphc_init() { -+void iphc_init(void) { - } - - // send from upper layer: I need to add 6LoWPAN header -diff --git a/openstack/03a-IPHC/openbridge.c b/openstack/03a-IPHC/openbridge.c -index 6ee4ba3..eaf672f 100644 ---- a/openstack/03a-IPHC/openbridge.c -+++ b/openstack/03a-IPHC/openbridge.c -@@ -11,10 +11,10 @@ - //=========================== prototypes ====================================== - //=========================== public ========================================== - --void openbridge_init() { -+void openbridge_init(void) { - } - --void openbridge_triggerData() { -+void openbridge_triggerData(void) { - uint8_t input_buffer[136];//worst case: 8B of next hop + 128B of data - OpenQueueEntry_t* pkt; - uint8_t numDataBytes; -diff --git a/openstack/03b-IPv6/Makefile b/openstack/03b-IPv6/Makefile -index 694bb09..47289c6 100644 ---- a/openstack/03b-IPv6/Makefile -+++ b/openstack/03b-IPv6/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openstack/03b-IPv6/forwarding.c b/openstack/03b-IPv6/forwarding.c -index 532e14c..25a3094 100644 ---- a/openstack/03b-IPv6/forwarding.c -+++ b/openstack/03b-IPv6/forwarding.c -@@ -45,7 +45,7 @@ void forwarding_createFlowLabel(uint32_t* flow_label,uint8_t flags); - /** - \brief Initialize this module. - */ --void forwarding_init() { -+void forwarding_init(void) { - } - - /** -diff --git a/openstack/03b-IPv6/icmpv6.c b/openstack/03b-IPv6/icmpv6.c -index b895b98..ab5af97 100644 ---- a/openstack/03b-IPv6/icmpv6.c -+++ b/openstack/03b-IPv6/icmpv6.c -@@ -12,7 +12,7 @@ - - //=========================== public ========================================== - --void icmpv6_init() { -+void icmpv6_init(void) { - } - - owerror_t icmpv6_send(OpenQueueEntry_t* msg) { -diff --git a/openstack/03b-IPv6/icmpv6echo.c b/openstack/03b-IPv6/icmpv6echo.c -index 3967969..24f8eab 100644 ---- a/openstack/03b-IPv6/icmpv6echo.c -+++ b/openstack/03b-IPv6/icmpv6echo.c -@@ -14,12 +14,12 @@ icmpv6echo_vars_t icmpv6echo_vars; - - //=========================== public ========================================== - --void icmpv6echo_init() { -+void icmpv6echo_init(void) { - icmpv6echo_vars.busySending = FALSE; - icmpv6echo_vars.seq = 0; - } - --void icmpv6echo_trigger() { -+void icmpv6echo_trigger(void) { - uint8_t number_bytes_from_input_buffer; - uint8_t input_buffer[16]; - OpenQueueEntry_t* msg; -diff --git a/openstack/03b-IPv6/icmpv6rpl.c b/openstack/03b-IPv6/icmpv6rpl.c -index cd422be..32c3e7d 100644 ---- a/openstack/03b-IPv6/icmpv6rpl.c -+++ b/openstack/03b-IPv6/icmpv6rpl.c -@@ -31,7 +31,7 @@ void sendDAO(void); - /** - \brief Initialize this module. - */ --void icmpv6rpl_init() { -+void icmpv6rpl_init(void) { - uint8_t dodagid[16]; - - // retrieve my prefix and EUI64 -@@ -145,7 +145,7 @@ void icmpv6rpl_writeDODAGid(uint8_t* dodagid) { - icmpv6rpl_vars.fDodagidWritten = 1; - } - --uint8_t icmpv6rpl_getRPLIntanceID(){ -+uint8_t icmpv6rpl_getRPLIntanceID(void) { - return icmpv6rpl_vars.dao.rplinstanceId; - } - -@@ -248,7 +248,7 @@ void icmpv6rpl_receive(OpenQueueEntry_t* msg) { - \note This function is executed in interrupt context, and should only push a - task. - */ --void icmpv6rpl_timer_DIO_cb() { -+void icmpv6rpl_timer_DIO_cb(void) { - scheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL); - } - -@@ -257,7 +257,7 @@ void icmpv6rpl_timer_DIO_cb() { - - \note This function is executed in task context, called by the scheduler. - */ --void icmpv6rpl_timer_DIO_task() { -+void icmpv6rpl_timer_DIO_task(void) { - - // update the delayDIO - icmpv6rpl_vars.delayDIO = (icmpv6rpl_vars.delayDIO+1)%5; -@@ -283,7 +283,7 @@ void icmpv6rpl_timer_DIO_task() { - /** - \brief Prepare and a send a RPL DIO. - */ --void sendDIO() { -+void sendDIO(void) { - OpenQueueEntry_t* msg; - - // stop if I'm not sync'ed -@@ -369,7 +369,7 @@ void sendDIO() { - \note This function is executed in interrupt context, and should only push a - task. - */ --void icmpv6rpl_timer_DAO_cb() { -+void icmpv6rpl_timer_DAO_cb(void) { - scheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL); - } - -@@ -378,7 +378,7 @@ void icmpv6rpl_timer_DAO_cb() { - - \note This function is executed in task context, called by the scheduler. - */ --void icmpv6rpl_timer_DAO_task() { -+void icmpv6rpl_timer_DAO_task(void) { - - // update the delayDAO - icmpv6rpl_vars.delayDAO = (icmpv6rpl_vars.delayDAO+1)%5; -@@ -404,7 +404,7 @@ void icmpv6rpl_timer_DAO_task() { - /** - \brief Prepare and a send a RPL DAO. - */ --void sendDAO() { -+void sendDAO(void) { - OpenQueueEntry_t* msg; // pointer to DAO messages - uint8_t nbrIdx; // running neighbor index - uint8_t numTransitParents,numTargetParents; // the number of parents indicated in transit option -diff --git a/openstack/04-TRAN/Makefile b/openstack/04-TRAN/Makefile -index 013e4fb..e8c21c9 100644 ---- a/openstack/04-TRAN/Makefile -+++ b/openstack/04-TRAN/Makefile -@@ -1,4 +1,4 @@ --MODULE = openwsn -+#MODULE = openwsn - - INCLUDES += -I$(OPENWSN_ROOT)/openapps/techo \ - -I$(OPENWSN_ROOT)/openapps/uecho -diff --git a/openstack/04-TRAN/opencoap.c b/openstack/04-TRAN/opencoap.c -index 13d490f..050fb40 100644 ---- a/openstack/04-TRAN/opencoap.c -+++ b/openstack/04-TRAN/opencoap.c -@@ -26,7 +26,7 @@ opencoap_vars_t opencoap_vars; - /** - \brief Initialize this module. - */ --void opencoap_init() { -+void opencoap_init(void) { - // initialize the resource linked list - opencoap_vars.resources = NULL; - -diff --git a/openstack/04-TRAN/opentcp.c b/openstack/04-TRAN/opentcp.c -index 4285e53..3444e6d 100644 ---- a/openstack/04-TRAN/opentcp.c -+++ b/openstack/04-TRAN/opentcp.c -@@ -24,7 +24,7 @@ void opentcp_timer_cb(void); - - //=========================== public ========================================== - --void opentcp_init() { -+void opentcp_init(void) { - // reset local variables - memset(&tcp_vars,0,sizeof(tcp_vars_t)); - // reset state machine -@@ -567,7 +567,7 @@ void opentcp_receive(OpenQueueEntry_t* msg) { - } - } - --owerror_t opentcp_close() { //[command] teardown -+owerror_t opentcp_close(void) { //[command] teardown - OpenQueueEntry_t* tempPkt; - if ( tcp_vars.state==TCP_STATE_ALMOST_CLOSE_WAIT || - tcp_vars.state==TCP_STATE_CLOSE_WAIT || -@@ -666,7 +666,7 @@ bool containsControlBits(OpenQueueEntry_t* msg, uint8_t ack, uint8_t rst, uint8_ - return return_value; - } - --void opentcp_reset() { -+void opentcp_reset(void) { - tcp_change_state(TCP_STATE_CLOSED); - tcp_vars.mySeqNum = TCP_INITIAL_SEQNUM; - tcp_vars.hisNextSeqNum = 0; -@@ -694,6 +694,6 @@ void tcp_change_state(uint8_t new_tcp_state) { - } - } - --void opentcp_timer_cb() { -+void opentcp_timer_cb(void) { - scheduler_push_task(timers_tcp_fired,TASKPRIO_TCP_TIMEOUT); - } -diff --git a/openstack/04-TRAN/openudp.c b/openstack/04-TRAN/openudp.c -index 079c2b1..3100f70 100644 ---- a/openstack/04-TRAN/openudp.c -+++ b/openstack/04-TRAN/openudp.c -@@ -14,7 +14,7 @@ - - //=========================== public ========================================== - --void openudp_init() { -+void openudp_init(void) { - } - - owerror_t openudp_send(OpenQueueEntry_t* msg) { -@@ -106,7 +106,7 @@ void openudp_receive(OpenQueueEntry_t* msg) { - } - } - --bool openudp_debugPrint() { -+bool openudp_debugPrint(void) { - return FALSE; - } - -diff --git a/openstack/Makefile b/openstack/Makefile -index a3c3aab..33de77f 100644 ---- a/openstack/Makefile -+++ b/openstack/Makefile -@@ -1,4 +1,4 @@ --MODULE = openwsn -+#MODULE = openwsn - - DIRS +=02a-MAClow - DIRS +=02b-MAChigh -diff --git a/openstack/cross-layers/Makefile b/openstack/cross-layers/Makefile -index 694bb09..47289c6 100644 ---- a/openstack/cross-layers/Makefile -+++ b/openstack/cross-layers/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base -diff --git a/openstack/cross-layers/idmanager.c b/openstack/cross-layers/idmanager.c -index a0a276c..a6f5e2c 100644 ---- a/openstack/cross-layers/idmanager.c -+++ b/openstack/cross-layers/idmanager.c -@@ -13,7 +13,7 @@ idmanager_vars_t idmanager_vars; - - //=========================== public ========================================== - --void idmanager_init() { -+void idmanager_init(void) { - - // reset local variables - memset(&idmanager_vars, 0, sizeof(idmanager_vars_t)); -@@ -53,7 +53,7 @@ void idmanager_init() { - packetfunctions_mac64bToMac16b(&idmanager_vars.my64bID,&idmanager_vars.my16bID); - } - --bool idmanager_getIsDAGroot() { -+bool idmanager_getIsDAGroot(void) { - bool res; - INTERRUPT_DECLARATION(); - -@@ -171,7 +171,7 @@ bool idmanager_isMyAddress(open_addr_t* addr) { - } - } - --void idmanager_triggerAboutRoot() { -+void idmanager_triggerAboutRoot(void) { - uint8_t number_bytes_from_input_buffer; - uint8_t input_buffer[9]; - open_addr_t myPrefix; -@@ -230,7 +230,7 @@ status information about several modules in the OpenWSN stack. - - \returns TRUE if this function printed something, FALSE otherwise. - */ --bool debugPrint_id() { -+bool debugPrint_id(void) { - debugIDManagerEntry_t output; - - output.isDAGroot = idmanager_vars.isDAGroot; -diff --git a/openstack/cross-layers/openqueue.c b/openstack/cross-layers/openqueue.c -index 74de9db..28ad4a6 100644 ---- a/openstack/cross-layers/openqueue.c -+++ b/openstack/cross-layers/openqueue.c -@@ -19,7 +19,7 @@ void openqueue_reset_entry(OpenQueueEntry_t* entry); - /** - \brief Initialize this module. - */ --void openqueue_init() { -+void openqueue_init(void) { - uint8_t i; - for (i=0;iaddr_16b[0]*256; - random_vars.shift_reg += idmanager_getMyID(ADDR_16B)->addr_16b[1]; - } - --uint16_t openrandom_get16b() { -+uint16_t openrandom_get16b(void) { - uint8_t i; - uint16_t random_value; - random_value = 0; -diff --git a/projects/common/03oos_openwsn/03oos_openwsn.c b/projects/common/03oos_openwsn/03oos_openwsn.c -index 31021d4..3f4b36e 100644 ---- a/projects/common/03oos_openwsn/03oos_openwsn.c -+++ b/projects/common/03oos_openwsn/03oos_openwsn.c -@@ -4,11 +4,44 @@ - \author Thomas Watteyne , August 2010 - */ - --#include "board.h" -+#include "thread.h" -+ -+#include "board_ow.h" -+#include "leds.h" - #include "scheduler.h" - #include "openstack.h" - #include "opendefs.h" - -+#include "03oos_openwsn.h" -+ -+#define ENABLE_DEBUG (0) -+#include "debug.h" -+ -+static char openwsn_stack[THREAD_STACKSIZE_MAIN]; -+int openwsn_pid = -1; -+ -+void openwsn_init(void); -+void* openwsn_start(void *arg); -+ -+void openwsn_start_thread(void) { -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ openwsn_pid = thread_create(openwsn_stack, THREAD_STACKSIZE_MAIN, -+ PRIORITY_OPENWSN-2, CREATE_STACKTEST, -+ openwsn_start, NULL, "openwsn thread"); -+} -+ -+void* openwsn_start(void *arg) { -+ DEBUG("%s\n",__PRETTY_FUNCTION__); -+ (void)arg; -+ leds_all_off(); -+ board_init_ow(); -+ scheduler_init(); -+ openstack_init(); -+ puts("OpenWSN thread started."); -+ scheduler_start(); -+ return NULL; -+} -+ - int mote_main(void) { - - // initialize -diff --git a/projects/common/03oos_openwsn/03oos_openwsn.h b/projects/common/03oos_openwsn/03oos_openwsn.h -index 138cb12..5a9f1fa 100644 ---- a/projects/common/03oos_openwsn/03oos_openwsn.h -+++ b/projects/common/03oos_openwsn/03oos_openwsn.h -@@ -7,4 +7,10 @@ - #ifndef __openwsn_H - #define __openwsn_H - -+void openwsn_start_thread(void); -+ -+//=========================== define ========================================== -+ -+#define PRIORITY_OPENWSN THREAD_PRIORITY_MAIN-1 -+ - #endif -diff --git a/projects/common/03oos_openwsn/Makefile b/projects/common/03oos_openwsn/Makefile -index 694bb09..47289c6 100644 ---- a/projects/common/03oos_openwsn/Makefile -+++ b/projects/common/03oos_openwsn/Makefile -@@ -1,3 +1,3 @@ --MODULE = openwsn -+#MODULE = openwsn - - include $(RIOTBASE)/Makefile.base --- -2.2.0 - diff --git a/pkg/openwsn/patches/0004-provide-openserial-dummies.patch b/pkg/openwsn/patches/0004-provide-openserial-dummies.patch deleted file mode 100644 index f0ced87e7d..0000000000 --- a/pkg/openwsn/patches/0004-provide-openserial-dummies.patch +++ /dev/null @@ -1,990 +0,0 @@ -From 5bcbe4daaed320af19815f6ec949f3f9d105f4d1 Mon Sep 17 00:00:00 2001 -From: Thomas Eichinger -Date: Fri, 28 Nov 2014 14:02:49 +0100 -Subject: [PATCH 4/5] provide openserial dummies - ---- - drivers/common/openserial.c | 836 ++++++++++++++++++++++---------------------- - 1 file changed, 418 insertions(+), 418 deletions(-) - -diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c -index edd059e..c54cfff 100644 ---- a/drivers/common/openserial.c -+++ b/drivers/common/openserial.c -@@ -44,56 +44,56 @@ void inputHdlcClose(void); - //=========================== public ========================================== - - void openserial_init(void) { -- uint16_t crc; -- -- // reset variable -- memset(&openserial_vars,0,sizeof(openserial_vars_t)); -- -- // admin -- openserial_vars.mode = MODE_OFF; -- openserial_vars.debugPrintCounter = 0; -- -- // input -- openserial_vars.reqFrame[0] = HDLC_FLAG; -- openserial_vars.reqFrame[1] = SERFRAME_MOTE2PC_REQUEST; -- crc = HDLC_CRCINIT; -- crc = crcIteration(crc,openserial_vars.reqFrame[1]); -- crc = ~crc; -- openserial_vars.reqFrame[2] = (crc>>0)&0xff; -- openserial_vars.reqFrame[3] = (crc>>8)&0xff; -- openserial_vars.reqFrame[4] = HDLC_FLAG; -- openserial_vars.reqFrameIdx = 0; -- openserial_vars.lastRxByte = HDLC_FLAG; -- openserial_vars.busyReceiving = FALSE; -- openserial_vars.inputEscaping = FALSE; -- openserial_vars.inputBufFill = 0; -- -- // ouput -- openserial_vars.outputBufFilled = FALSE; -- openserial_vars.outputBufIdxR = 0; -- openserial_vars.outputBufIdxW = 0; -- -- // set callbacks -- uart_setCallbacks(isr_openserial_tx, -- isr_openserial_rx); -+ // uint16_t crc; -+ -+ // // reset variable -+ // memset(&openserial_vars,0,sizeof(openserial_vars_t)); -+ -+ // // admin -+ // openserial_vars.mode = MODE_OFF; -+ // openserial_vars.debugPrintCounter = 0; -+ -+ // // input -+ // openserial_vars.reqFrame[0] = HDLC_FLAG; -+ // openserial_vars.reqFrame[1] = SERFRAME_MOTE2PC_REQUEST; -+ // crc = HDLC_CRCINIT; -+ // crc = crcIteration(crc,openserial_vars.reqFrame[1]); -+ // crc = ~crc; -+ // openserial_vars.reqFrame[2] = (crc>>0)&0xff; -+ // openserial_vars.reqFrame[3] = (crc>>8)&0xff; -+ // openserial_vars.reqFrame[4] = HDLC_FLAG; -+ // openserial_vars.reqFrameIdx = 0; -+ // openserial_vars.lastRxByte = HDLC_FLAG; -+ // openserial_vars.busyReceiving = FALSE; -+ // openserial_vars.inputEscaping = FALSE; -+ // openserial_vars.inputBufFill = 0; -+ -+ // // ouput -+ // openserial_vars.outputBufFilled = FALSE; -+ // openserial_vars.outputBufIdxR = 0; -+ // openserial_vars.outputBufIdxW = 0; -+ -+ // // set callbacks -+ // uart_setCallbacks(isr_openserial_tx, -+ // isr_openserial_rx); - } - - owerror_t openserial_printStatus(uint8_t statusElement,uint8_t* buffer, uint8_t length) { -- uint8_t i; -- INTERRUPT_DECLARATION(); -- -- DISABLE_INTERRUPTS(); -- openserial_vars.outputBufFilled = TRUE; -- outputHdlcOpen(); -- outputHdlcWrite(SERFRAME_MOTE2PC_STATUS); -- outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); -- outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); -- outputHdlcWrite(statusElement); -- for (i=0;iaddr_16b[0]); -+ // outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); -+ // outputHdlcWrite(statusElement); -+ // for (i=0;iaddr_16b[0]); -- outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); -- outputHdlcWrite(calling_component); -- outputHdlcWrite(error_code); -- outputHdlcWrite((uint8_t)((arg1 & 0xff00)>>8)); -- outputHdlcWrite((uint8_t) (arg1 & 0x00ff)); -- outputHdlcWrite((uint8_t)((arg2 & 0xff00)>>8)); -- outputHdlcWrite((uint8_t) (arg2 & 0x00ff)); -- outputHdlcClose(); -- ENABLE_INTERRUPTS(); -+ // INTERRUPT_DECLARATION(); -+ -+ // DISABLE_INTERRUPTS(); -+ // openserial_vars.outputBufFilled = TRUE; -+ // outputHdlcOpen(); -+ // outputHdlcWrite(severity); -+ // outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); -+ // outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); -+ // outputHdlcWrite(calling_component); -+ // outputHdlcWrite(error_code); -+ // outputHdlcWrite((uint8_t)((arg1 & 0xff00)>>8)); -+ // outputHdlcWrite((uint8_t) (arg1 & 0x00ff)); -+ // outputHdlcWrite((uint8_t)((arg2 & 0xff00)>>8)); -+ // outputHdlcWrite((uint8_t) (arg2 & 0x00ff)); -+ // outputHdlcClose(); -+ // ENABLE_INTERRUPTS(); - - return E_SUCCESS; - } - - owerror_t openserial_printData(uint8_t* buffer, uint8_t length) { -- uint8_t i; -- uint8_t asn[5]; -- INTERRUPT_DECLARATION(); -- -- // retrieve ASN -- ieee154e_getAsn(asn);// byte01,byte23,byte4 -- -- DISABLE_INTERRUPTS(); -- openserial_vars.outputBufFilled = TRUE; -- outputHdlcOpen(); -- outputHdlcWrite(SERFRAME_MOTE2PC_DATA); -- outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[1]); -- outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); -- outputHdlcWrite(asn[0]); -- outputHdlcWrite(asn[1]); -- outputHdlcWrite(asn[2]); -- outputHdlcWrite(asn[3]); -- outputHdlcWrite(asn[4]); -- for (i=0;iaddr_16b[1]); -+ // outputHdlcWrite(idmanager_getMyID(ADDR_16B)->addr_16b[0]); -+ // outputHdlcWrite(asn[0]); -+ // outputHdlcWrite(asn[1]); -+ // outputHdlcWrite(asn[2]); -+ // outputHdlcWrite(asn[3]); -+ // outputHdlcWrite(asn[4]); -+ // for (i=0;i0) { -- openserial_printError(COMPONENT_OPENSERIAL,ERR_INPUTBUFFER_LENGTH, -- (errorparameter_t)openserial_vars.inputBufFill, -- (errorparameter_t)0); -- DISABLE_INTERRUPTS(); -- openserial_vars.inputBufFill=0; -- ENABLE_INTERRUPTS(); -- } -- -- uart_clearTxInterrupts(); -- uart_clearRxInterrupts(); // clear possible pending interrupts -- uart_enableInterrupts(); // Enable USCI_A1 TX & RX interrupt -- -- DISABLE_INTERRUPTS(); -- openserial_vars.busyReceiving = FALSE; -- openserial_vars.mode = MODE_INPUT; -- openserial_vars.reqFrameIdx = 0; --#ifdef FASTSIM -- uart_writeBufferByLen_FASTSIM( -- openserial_vars.reqFrame, -- sizeof(openserial_vars.reqFrame) -- ); -- openserial_vars.reqFrameIdx = sizeof(openserial_vars.reqFrame); --#else -- uart_writeByte(openserial_vars.reqFrame[openserial_vars.reqFrameIdx]); --#endif -- ENABLE_INTERRUPTS(); -+// INTERRUPT_DECLARATION(); -+ -+// if (openserial_vars.inputBufFill>0) { -+// openserial_printError(COMPONENT_OPENSERIAL,ERR_INPUTBUFFER_LENGTH, -+// (errorparameter_t)openserial_vars.inputBufFill, -+// (errorparameter_t)0); -+// DISABLE_INTERRUPTS(); -+// openserial_vars.inputBufFill=0; -+// ENABLE_INTERRUPTS(); -+// } -+ -+// uart_clearTxInterrupts(); -+// uart_clearRxInterrupts(); // clear possible pending interrupts -+// uart_enableInterrupts(); // Enable USCI_A1 TX & RX interrupt -+ -+// DISABLE_INTERRUPTS(); -+// openserial_vars.busyReceiving = FALSE; -+// openserial_vars.mode = MODE_INPUT; -+// openserial_vars.reqFrameIdx = 0; -+// #ifdef FASTSIM -+// uart_writeBufferByLen_FASTSIM( -+// openserial_vars.reqFrame, -+// sizeof(openserial_vars.reqFrame) -+// ); -+// openserial_vars.reqFrameIdx = sizeof(openserial_vars.reqFrame); -+// #else -+// uart_writeByte(openserial_vars.reqFrame[openserial_vars.reqFrameIdx]); -+// #endif -+// ENABLE_INTERRUPTS(); - } - - void openserial_startOutput(void) { -- //schedule a task to get new status in the output buffer -- uint8_t debugPrintCounter; -- -- INTERRUPT_DECLARATION(); -- DISABLE_INTERRUPTS(); -- openserial_vars.debugPrintCounter = (openserial_vars.debugPrintCounter+1)%STATUS_MAX; -- debugPrintCounter = openserial_vars.debugPrintCounter; -- ENABLE_INTERRUPTS(); -- -- // print debug information -- switch (debugPrintCounter) { -- case STATUS_ISSYNC: -- if (debugPrint_isSync()==TRUE) { -- break; -- } -- case STATUS_ID: -- if (debugPrint_id()==TRUE) { -- break; -- } -- case STATUS_DAGRANK: -- if (debugPrint_myDAGrank()==TRUE) { -- break; -- } -- case STATUS_OUTBUFFERINDEXES: -- if (debugPrint_outBufferIndexes()==TRUE) { -- break; -- } -- case STATUS_ASN: -- if (debugPrint_asn()==TRUE) { -- break; -- } -- case STATUS_MACSTATS: -- if (debugPrint_macStats()==TRUE) { -- break; -- } -- case STATUS_SCHEDULE: -- if(debugPrint_schedule()==TRUE) { -- break; -- } -- case STATUS_BACKOFF: -- if(debugPrint_backoff()==TRUE) { -- break; -- } -- case STATUS_QUEUE: -- if(debugPrint_queue()==TRUE) { -- break; -- } -- case STATUS_NEIGHBORS: -- if (debugPrint_neighbors()==TRUE) { -- break; -- } -- case STATUS_KAPERIOD: -- if (debugPrint_kaPeriod()==TRUE) { -- break; -- } -- default: -- DISABLE_INTERRUPTS(); -- openserial_vars.debugPrintCounter=0; -- ENABLE_INTERRUPTS(); -- } -- -- // flush buffer -- uart_clearTxInterrupts(); -- uart_clearRxInterrupts(); // clear possible pending interrupts -- uart_enableInterrupts(); // Enable USCI_A1 TX & RX interrupt -- DISABLE_INTERRUPTS(); -- openserial_vars.mode=MODE_OUTPUT; -- if (openserial_vars.outputBufFilled) { --#ifdef FASTSIM -- uart_writeCircularBuffer_FASTSIM( -- openserial_vars.outputBuf, -- &openserial_vars.outputBufIdxR, -- &openserial_vars.outputBufIdxW -- ); --#else -- uart_writeByte(openserial_vars.outputBuf[openserial_vars.outputBufIdxR++]); --#endif -- } else { -- openserial_stop(); -- } -- ENABLE_INTERRUPTS(); -+// //schedule a task to get new status in the output buffer -+// uint8_t debugPrintCounter; -+ -+// INTERRUPT_DECLARATION(); -+// DISABLE_INTERRUPTS(); -+// openserial_vars.debugPrintCounter = (openserial_vars.debugPrintCounter+1)%STATUS_MAX; -+// debugPrintCounter = openserial_vars.debugPrintCounter; -+// ENABLE_INTERRUPTS(); -+ -+// // print debug information -+// switch (debugPrintCounter) { -+// case STATUS_ISSYNC: -+// if (debugPrint_isSync()==TRUE) { -+// break; -+// } -+// case STATUS_ID: -+// if (debugPrint_id()==TRUE) { -+// break; -+// } -+// case STATUS_DAGRANK: -+// if (debugPrint_myDAGrank()==TRUE) { -+// break; -+// } -+// case STATUS_OUTBUFFERINDEXES: -+// if (debugPrint_outBufferIndexes()==TRUE) { -+// break; -+// } -+// case STATUS_ASN: -+// if (debugPrint_asn()==TRUE) { -+// break; -+// } -+// case STATUS_MACSTATS: -+// if (debugPrint_macStats()==TRUE) { -+// break; -+// } -+// case STATUS_SCHEDULE: -+// if(debugPrint_schedule()==TRUE) { -+// break; -+// } -+// case STATUS_BACKOFF: -+// if(debugPrint_backoff()==TRUE) { -+// break; -+// } -+// case STATUS_QUEUE: -+// if(debugPrint_queue()==TRUE) { -+// break; -+// } -+// case STATUS_NEIGHBORS: -+// if (debugPrint_neighbors()==TRUE) { -+// break; -+// } -+// case STATUS_KAPERIOD: -+// if (debugPrint_kaPeriod()==TRUE) { -+// break; -+// } -+// default: -+// DISABLE_INTERRUPTS(); -+// openserial_vars.debugPrintCounter=0; -+// ENABLE_INTERRUPTS(); -+// } -+ -+// // flush buffer -+// uart_clearTxInterrupts(); -+// uart_clearRxInterrupts(); // clear possible pending interrupts -+// uart_enableInterrupts(); // Enable USCI_A1 TX & RX interrupt -+// DISABLE_INTERRUPTS(); -+// openserial_vars.mode=MODE_OUTPUT; -+// if (openserial_vars.outputBufFilled) { -+// #ifdef FASTSIM -+// uart_writeCircularBuffer_FASTSIM( -+// openserial_vars.outputBuf, -+// &openserial_vars.outputBufIdxR, -+// &openserial_vars.outputBufIdxW -+// ); -+// #else -+// uart_writeByte(openserial_vars.outputBuf[openserial_vars.outputBufIdxR++]); -+// #endif -+// } else { -+// openserial_stop(); -+// } -+// ENABLE_INTERRUPTS(); - } - - void openserial_stop(void) { -- uint8_t inputBufFill; -- uint8_t cmdByte; -- bool busyReceiving; -- INTERRUPT_DECLARATION(); -- -- DISABLE_INTERRUPTS(); -- busyReceiving = openserial_vars.busyReceiving; -- inputBufFill = openserial_vars.inputBufFill; -- ENABLE_INTERRUPTS(); -- -- // disable USCI_A1 TX & RX interrupt -- uart_disableInterrupts(); -- -- DISABLE_INTERRUPTS(); -- openserial_vars.mode=MODE_OFF; -- ENABLE_INTERRUPTS(); -- //the inputBuffer has to be reset if it is not reset where the data is read. -- //or the function openserial_getInputBuffer is called (which resets the buffer) -- if (busyReceiving==TRUE){ -- openserial_printError(COMPONENT_OPENSERIAL,ERR_BUSY_RECEIVING, -- (errorparameter_t)0, -- (errorparameter_t)inputBufFill); -- } -- -- if (busyReceiving == FALSE && inputBufFill>0) { -- DISABLE_INTERRUPTS(); -- cmdByte = openserial_vars.inputBuf[0]; -- ENABLE_INTERRUPTS(); -- switch (cmdByte) { -- case SERFRAME_PC2MOTE_SETROOT: -- idmanager_triggerAboutRoot(); -- break; -- case SERFRAME_PC2MOTE_DATA: -- openbridge_triggerData(); -- break; -- case SERFRAME_PC2MOTE_TRIGGERSERIALECHO: -- //echo function must reset input buffer after reading the data. -- openserial_echo(&openserial_vars.inputBuf[1],inputBufFill-1); -- break; -- default: -- openserial_printError(COMPONENT_OPENSERIAL,ERR_UNSUPPORTED_COMMAND, -- (errorparameter_t)cmdByte, -- (errorparameter_t)0); -- //reset here as it is not being reset in any other callback -- DISABLE_INTERRUPTS(); -- openserial_vars.inputBufFill = 0; -- ENABLE_INTERRUPTS(); -- break; -- } -- } -- -- DISABLE_INTERRUPTS(); -- openserial_vars.inputBufFill = 0; -- openserial_vars.busyReceiving = FALSE; -- ENABLE_INTERRUPTS(); -+ // uint8_t inputBufFill; -+ // uint8_t cmdByte; -+ // bool busyReceiving; -+ // INTERRUPT_DECLARATION(); -+ -+ // DISABLE_INTERRUPTS(); -+ // busyReceiving = openserial_vars.busyReceiving; -+ // inputBufFill = openserial_vars.inputBufFill; -+ // ENABLE_INTERRUPTS(); -+ -+ // // disable USCI_A1 TX & RX interrupt -+ // uart_disableInterrupts(); -+ -+ // DISABLE_INTERRUPTS(); -+ // openserial_vars.mode=MODE_OFF; -+ // ENABLE_INTERRUPTS(); -+ // //the inputBuffer has to be reset if it is not reset where the data is read. -+ // //or the function openserial_getInputBuffer is called (which resets the buffer) -+ // if (busyReceiving==TRUE){ -+ // openserial_printError(COMPONENT_OPENSERIAL,ERR_BUSY_RECEIVING, -+ // (errorparameter_t)0, -+ // (errorparameter_t)inputBufFill); -+ // } -+ -+ // if (busyReceiving == FALSE && inputBufFill>0) { -+ // DISABLE_INTERRUPTS(); -+ // cmdByte = openserial_vars.inputBuf[0]; -+ // ENABLE_INTERRUPTS(); -+ // switch (cmdByte) { -+ // case SERFRAME_PC2MOTE_SETROOT: -+ // idmanager_triggerAboutRoot(); -+ // break; -+ // case SERFRAME_PC2MOTE_DATA: -+ // openbridge_triggerData(); -+ // break; -+ // case SERFRAME_PC2MOTE_TRIGGERSERIALECHO: -+ // //echo function must reset input buffer after reading the data. -+ // openserial_echo(&openserial_vars.inputBuf[1],inputBufFill-1); -+ // break; -+ // default: -+ // openserial_printError(COMPONENT_OPENSERIAL,ERR_UNSUPPORTED_COMMAND, -+ // (errorparameter_t)cmdByte, -+ // (errorparameter_t)0); -+ // //reset here as it is not being reset in any other callback -+ // DISABLE_INTERRUPTS(); -+ // openserial_vars.inputBufFill = 0; -+ // ENABLE_INTERRUPTS(); -+ // break; -+ // } -+ // } -+ -+ // DISABLE_INTERRUPTS(); -+ // openserial_vars.inputBufFill = 0; -+ // openserial_vars.busyReceiving = FALSE; -+ // ENABLE_INTERRUPTS(); - } - - /** -@@ -416,13 +416,13 @@ status information about several modules in the OpenWSN stack. - \returns TRUE if this function printed something, FALSE otherwise. - */ - bool debugPrint_outBufferIndexes(void) { -- uint16_t temp_buffer[2]; -- INTERRUPT_DECLARATION(); -- DISABLE_INTERRUPTS(); -- temp_buffer[0] = openserial_vars.outputBufIdxW; -- temp_buffer[1] = openserial_vars.outputBufIdxR; -- ENABLE_INTERRUPTS(); -- openserial_printStatus(STATUS_OUTBUFFERINDEXES,(uint8_t*)temp_buffer,sizeof(temp_buffer)); -+ // uint16_t temp_buffer[2]; -+ // INTERRUPT_DECLARATION(); -+ // DISABLE_INTERRUPTS(); -+ // temp_buffer[0] = openserial_vars.outputBufIdxW; -+ // temp_buffer[1] = openserial_vars.outputBufIdxR; -+ // ENABLE_INTERRUPTS(); -+ // openserial_printStatus(STATUS_OUTBUFFERINDEXES,(uint8_t*)temp_buffer,sizeof(temp_buffer)); - return TRUE; - } - -@@ -434,43 +434,43 @@ bool debugPrint_outBufferIndexes(void) { - \brief Start an HDLC frame in the output buffer. - */ - port_INLINE void outputHdlcOpen(void) { -- // initialize the value of the CRC -- openserial_vars.outputCrc = HDLC_CRCINIT; -+ // // initialize the value of the CRC -+ // openserial_vars.outputCrc = HDLC_CRCINIT; - -- // write the opening HDLC flag -- openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_FLAG; -+ // // write the opening HDLC flag -+ // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_FLAG; - } - /** - \brief Add a byte to the outgoing HDLC frame being built. - */ - port_INLINE void outputHdlcWrite(uint8_t b) { - -- // iterate through CRC calculator -- openserial_vars.outputCrc = crcIteration(openserial_vars.outputCrc,b); -+ // // iterate through CRC calculator -+ // openserial_vars.outputCrc = crcIteration(openserial_vars.outputCrc,b); - -- // add byte to buffer -- if (b==HDLC_FLAG || b==HDLC_ESCAPE) { -- openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_ESCAPE; -- b = b^HDLC_ESCAPE_MASK; -- } -- openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = b; -+ // // add byte to buffer -+ // if (b==HDLC_FLAG || b==HDLC_ESCAPE) { -+ // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_ESCAPE; -+ // b = b^HDLC_ESCAPE_MASK; -+ // } -+ // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = b; - - } - /** - \brief Finalize the outgoing HDLC frame. - */ - port_INLINE void outputHdlcClose(void) { -- uint16_t finalCrc; -+ // uint16_t finalCrc; - -- // finalize the calculation of the CRC -- finalCrc = ~openserial_vars.outputCrc; -+ // // finalize the calculation of the CRC -+ // finalCrc = ~openserial_vars.outputCrc; - -- // write the CRC value -- outputHdlcWrite((finalCrc>>0)&0xff); -- outputHdlcWrite((finalCrc>>8)&0xff); -+ // // write the CRC value -+ // outputHdlcWrite((finalCrc>>0)&0xff); -+ // outputHdlcWrite((finalCrc>>8)&0xff); - -- // write the closing HDLC flag -- openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_FLAG; -+ // // write the closing HDLC flag -+ // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_FLAG; - } - - //===== hdlc (input) -@@ -479,158 +479,158 @@ port_INLINE void outputHdlcClose(void) { - \brief Start an HDLC frame in the input buffer. - */ - port_INLINE void inputHdlcOpen(void) { -- // reset the input buffer index -- openserial_vars.inputBufFill = 0; -+ // // reset the input buffer index -+ // openserial_vars.inputBufFill = 0; - -- // initialize the value of the CRC -- openserial_vars.inputCrc = HDLC_CRCINIT; -+ // // initialize the value of the CRC -+ // openserial_vars.inputCrc = HDLC_CRCINIT; - } - /** - \brief Add a byte to the incoming HDLC frame. - */ - port_INLINE void inputHdlcWrite(uint8_t b) { -- if (b==HDLC_ESCAPE) { -- openserial_vars.inputEscaping = TRUE; -- } else { -- if (openserial_vars.inputEscaping==TRUE) { -- b = b^HDLC_ESCAPE_MASK; -- openserial_vars.inputEscaping = FALSE; -- } -+ // if (b==HDLC_ESCAPE) { -+ // openserial_vars.inputEscaping = TRUE; -+ // } else { -+ // if (openserial_vars.inputEscaping==TRUE) { -+ // b = b^HDLC_ESCAPE_MASK; -+ // openserial_vars.inputEscaping = FALSE; -+ // } - -- // add byte to input buffer -- openserial_vars.inputBuf[openserial_vars.inputBufFill] = b; -- openserial_vars.inputBufFill++; -+ // // add byte to input buffer -+ // openserial_vars.inputBuf[openserial_vars.inputBufFill] = b; -+ // openserial_vars.inputBufFill++; - -- // iterate through CRC calculator -- openserial_vars.inputCrc = crcIteration(openserial_vars.inputCrc,b); -- } -+ // // iterate through CRC calculator -+ // openserial_vars.inputCrc = crcIteration(openserial_vars.inputCrc,b); -+ // } - } - /** - \brief Finalize the incoming HDLC frame. - */ - port_INLINE void inputHdlcClose(void) { - -- // verify the validity of the frame -- if (openserial_vars.inputCrc==HDLC_CRCGOOD) { -- // the CRC is correct -+ // // verify the validity of the frame -+ // if (openserial_vars.inputCrc==HDLC_CRCGOOD) { -+ // // the CRC is correct - -- // remove the CRC from the input buffer -- openserial_vars.inputBufFill -= 2; -- } else { -- // the CRC is incorrect -+ // // remove the CRC from the input buffer -+ // openserial_vars.inputBufFill -= 2; -+ // } else { -+ // // the CRC is incorrect - -- // drop the incoming fram -- openserial_vars.inputBufFill = 0; -- } -+ // // drop the incoming fram -+ // openserial_vars.inputBufFill = 0; -+ // } - } - - //=========================== interrupt handlers ============================== - - //executed in ISR, called from scheduler.c - void isr_openserial_tx(void) { -- switch (openserial_vars.mode) { -- case MODE_INPUT: -- openserial_vars.reqFrameIdx++; -- if (openserial_vars.reqFrameIdxSERIAL_INPUT_BUFFER_SIZE){ -- // input buffer overflow -- openserial_printError(COMPONENT_OPENSERIAL,ERR_INPUT_BUFFER_OVERFLOW, -- (errorparameter_t)0, -- (errorparameter_t)0); -- openserial_vars.inputBufFill = 0; -- openserial_vars.busyReceiving = FALSE; -- openserial_stop(); -- } -- } else if ( -- openserial_vars.busyReceiving==TRUE && -- rxbyte==HDLC_FLAG -- ) { -- // end of frame -+ // // add the byte just received -+ // inputHdlcWrite(rxbyte); -+ // if (openserial_vars.inputBufFill+1>SERIAL_INPUT_BUFFER_SIZE){ -+ // // input buffer overflow -+ // openserial_printError(COMPONENT_OPENSERIAL,ERR_INPUT_BUFFER_OVERFLOW, -+ // (errorparameter_t)0, -+ // (errorparameter_t)0); -+ // openserial_vars.inputBufFill = 0; -+ // openserial_vars.busyReceiving = FALSE; -+ // openserial_stop(); -+ // } -+ // } else if ( -+ // openserial_vars.busyReceiving==TRUE && -+ // rxbyte==HDLC_FLAG -+ // ) { -+ // // end of frame - -- // finalize the HDLC frame -- inputHdlcClose(); -+ // // finalize the HDLC frame -+ // inputHdlcClose(); - -- if (openserial_vars.inputBufFill==0){ -- // invalid HDLC frame -- openserial_printError(COMPONENT_OPENSERIAL,ERR_WRONG_CRC_INPUT, -- (errorparameter_t)inputBufFill, -- (errorparameter_t)0); -+ // if (openserial_vars.inputBufFill==0){ -+ // // invalid HDLC frame -+ // openserial_printError(COMPONENT_OPENSERIAL,ERR_WRONG_CRC_INPUT, -+ // (errorparameter_t)inputBufFill, -+ // (errorparameter_t)0); - -- } -+ // } - -- openserial_vars.busyReceiving = FALSE; -- openserial_stop(); -- } -+ // openserial_vars.busyReceiving = FALSE; -+ // openserial_stop(); -+ // } - -- openserial_vars.lastRxByte = rxbyte; -+ // openserial_vars.lastRxByte = rxbyte; - } - - //======== SERIAL ECHO ============= - - void openserial_echo(uint8_t* buf, uint8_t bufLen){ -- INTERRUPT_DECLARATION(); -- // echo back what you received -- openserial_printData( -- buf, -- bufLen -- ); -- -- DISABLE_INTERRUPTS(); -- openserial_vars.inputBufFill = 0; -- ENABLE_INTERRUPTS(); -+ // INTERRUPT_DECLARATION(); -+ // // echo back what you received -+ // openserial_printData( -+ // buf, -+ // bufLen -+ // ); -+ -+ // DISABLE_INTERRUPTS(); -+ // openserial_vars.inputBufFill = 0; -+ // ENABLE_INTERRUPTS(); - } --- -2.2.0 - diff --git a/pkg/openwsn/patches/0005-fixes-to-RIOT-adaption.patch b/pkg/openwsn/patches/0005-fixes-to-RIOT-adaption.patch deleted file mode 100644 index 8254bb376f..0000000000 --- a/pkg/openwsn/patches/0005-fixes-to-RIOT-adaption.patch +++ /dev/null @@ -1,2828 +0,0 @@ -From 49fa857a8548b297381f823bf0979732fe18b7dd Mon Sep 17 00:00:00 2001 -From: Thomas Eichinger -Date: Tue, 2 Dec 2014 14:48:17 +0100 -Subject: [PATCH 5/5] fixes to RIOT adaption - ---- - Makefile | 3 +- - bsp/boards/radiotimer.h | 2 +- - bsp/boards/riot-adaption/board_info.h | 51 +-- - bsp/boards/riot-adaption/board_ow.c | 8 +- - bsp/boards/riot-adaption/leds_ow.c | 63 +-- - bsp/boards/riot-adaption/radio.c | 615 ++++++++++++++------------ - bsp/boards/riot-adaption/radiotimer.c | 58 +-- - bsp/boards/riot-adaption/riot.h | 36 ++ - bsp/boards/riot-adaption/spi_ow.c | 321 -------------- - bsp/boards/riot-adaption/uart_ow.c | 8 +- - bsp/boards/uart.h | 2 +- - drivers/common/Makefile | 6 + - drivers/common/openserial.c | 412 ++++++++--------- - drivers/common/opentimers.c | 32 +- - kernel/openos/scheduler.c | 22 +- - openapps/Makefile | 6 +- - openapps/cstorm/cstorm.c | 2 +- - openapps/uecho/uecho.c | 98 ++-- - openstack/02a-MAClow/IEEE802154E.c | 5 + - openstack/02a-MAClow/IEEE802154E.h | 14 +- - openstack/02b-MAChigh/schedule.c | 30 +- - openstack/Makefile | 2 + - openstack/cross-layers/idmanager.c | 37 +- - openstack/cross-layers/idmanager.h | 2 +- - openstack/openstack.c | 8 +- - openstack/openstack.h | 2 +- - projects/common/03oos_openwsn/03oos_openwsn.c | 72 +-- - projects/common/03oos_openwsn/03oos_openwsn.h | 8 +- - projects/common/03oos_openwsn/Makefile | 2 + - 29 files changed, 875 insertions(+), 1052 deletions(-) - create mode 100644 bsp/boards/riot-adaption/riot.h - delete mode 100644 bsp/boards/riot-adaption/spi_ow.c - -diff --git a/Makefile b/Makefile -index f1917fa..41ca883 100644 ---- a/Makefile -+++ b/Makefile -@@ -5,7 +5,8 @@ DIRS += $(OPENWSN_ROOT)/projects/common/03oos_openwsn \ - $(OPENWSN_ROOT)/openstack \ - $(OPENWSN_ROOT)/openapps \ - $(OPENWSN_ROOT)/kernel/openos \ -- $(OPENWSN_ROOT)/drivers/common -+ $(OPENWSN_ROOT)/drivers/common \ -+ $(OPENWSN_ROOT)/bsp/boards/riot-adaption - - INCLUDES += -I$(OPENWSN_ROOT)/kernel \ - -I$(OPENWSN_ROOT)/inc \ -diff --git a/bsp/boards/radiotimer.h b/bsp/boards/radiotimer.h -index 6b6b27c..fc2e639 100644 ---- a/bsp/boards/radiotimer.h -+++ b/bsp/boards/radiotimer.h -@@ -44,7 +44,7 @@ void radiotimer_cancel(void); - PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime(void); - - // interrupt handlers --kick_scheduler_t radiotimer_isr(void); -+void radiotimer_isr(void); - - /** - \} -diff --git a/bsp/boards/riot-adaption/board_info.h b/bsp/boards/riot-adaption/board_info.h -index 85f2eb1..fd46c20 100644 ---- a/bsp/boards/riot-adaption/board_info.h -+++ b/bsp/boards/riot-adaption/board_info.h -@@ -1,12 +1,10 @@ - /** --\brief agilefox board information bsp module (based on openmoteSTM32 code). -+\brief RIOT adaption information bsp module. - - This module simply defines some strings describing the board, which CoAP uses - to return the board's description. - --\author Thomas Watteyne , February 2012. --\author Tengfei Chang , July 2012. --\author Alaeddine Weslati , August 2013. -+\author Thomas Eichinger - */ - - #ifndef __BOARD_INFO_H -@@ -29,44 +27,21 @@ to return the board's description. - #define PORT_RADIOTIMER_WIDTH uint32_t - - #define PORT_SIGNED_INT_WIDTH int32_t --#define PORT_TICS_PER_MS 32 --#define SCHEDULER_WAKEUP() //EXTI->SWIER |= EXTI_Line1; --#define SCHEDULER_ENABLE_INTERRUPT() //enable in board use EXTI_Line1 -- --//===== pinout -- --// [P4.7] radio SLP_TR_CNTL --#define PORT_PIN_RADIO_SLP_TR_CNTL_HIGH() //GPIOA->ODR |= (1<<0); --#define PORT_PIN_RADIO_SLP_TR_CNTL_LOW() //GPIOA->ODR &= ~(1<<0); --// radio reset line --// radio /RST --#define PORT_PIN_RADIO_RESET_HIGH() //GPIOC->ODR |= 0X0040;// nothing --#define PORT_PIN_RADIO_RESET_LOW() //GPIOC->ODR &= ~0X0040;// nothing -+#define PORT_TICS_PER_MS 1000 -+#define SCHEDULER_WAKEUP() -+#define SCHEDULER_ENABLE_INTERRUPT() - - //===== IEEE802154E timing -- --//// time-slot related --//#define PORT_TsSlotDuration 491 // counter counts one extra count, see datasheet --//// execution speed related --//#define PORT_maxTxDataPrepare 66 // 2014us (measured 746us) --//#define PORT_maxRxAckPrepare 10 // 305us (measured 83us) --//#define PORT_maxRxDataPrepare 33 // 1007us (measured 84us) --//#define PORT_maxTxAckPrepare 10 // 305us (measured 219us) --//// radio speed related --//#define PORT_delayTx 9 // 214us (measured 219us) --//#define PORT_delayRx 0 // 0us (can not measure) --//// radio watchdog -- - // time-slot related --#define PORT_TsSlotDuration 245 // counter counts one extra count, see datasheet --// execution speed related (rcc configure need 235us) --#define PORT_maxTxDataPrepare 33 // 2014us (measured 812us+235) stm32 --#define PORT_maxRxAckPrepare 10 // 900us (measured 171us+235) stm32 --#define PORT_maxRxDataPrepare 16 // 976us (measured 170us+235) stm32 --#define PORT_maxTxAckPrepare 10 // 900us (measured 323us+235) stm32 -+#define PORT_TsSlotDuration 15000 -+ -+#define PORT_maxTxDataPrepare 2014 -+#define PORT_maxRxAckPrepare 900 -+#define PORT_maxRxDataPrepare 976 -+#define PORT_maxTxAckPrepare 900 - // radio speed related --#define PORT_delayTx 10 // 549us (measured 315us+235) ..... --#define PORT_delayRx 0 // 0us (can not measure) -+#define PORT_delayTx 549 -+#define PORT_delayRx 0 - - //===== adaptive_sync accuracy - -diff --git a/bsp/boards/riot-adaption/board_ow.c b/bsp/boards/riot-adaption/board_ow.c -index 95f29b1..6c79b33 100644 ---- a/bsp/boards/riot-adaption/board_ow.c -+++ b/bsp/boards/riot-adaption/board_ow.c -@@ -2,21 +2,15 @@ - #include "radiotimer.h" - #include "radio.h" - #include "debugpins.h" --#include "spi_ow.h" - --#define ENABLE_DEBUG (1) -+#define ENABLE_DEBUG (0) - #include "debug.h" - - void board_init_ow(void) - { -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- spi_init_ow(); - radio_init(); -- DEBUG("%s\n",__PRETTY_FUNCTION__); - radiotimer_init(); -- DEBUG("%s\n",__PRETTY_FUNCTION__); - debugpins_init(); -- DEBUG("%s\n",__PRETTY_FUNCTION__); - } - - void board_sleep(void) -diff --git a/bsp/boards/riot-adaption/leds_ow.c b/bsp/boards/riot-adaption/leds_ow.c -index cd892e1..0fd260e 100644 ---- a/bsp/boards/riot-adaption/leds_ow.c -+++ b/bsp/boards/riot-adaption/leds_ow.c -@@ -24,16 +24,17 @@ void leds_error_toggle(void) - } - uint8_t leds_error_isOn(void) - { -- uint8_t bitstatus = 0x00; -- if ((LED_RED_PORT->ODR & LED_RED_PIN) != (uint32_t)0) -- { -- bitstatus = 0x00; -- } -- else -- { -- bitstatus = 0x01; -- } -- return bitstatus; -+ // uint8_t bitstatus = 0x00; -+ // if ((LED_RED_PORT->ODR & LED_RED_PIN) != (uint32_t)0) -+ // { -+ // bitstatus = 0x00; -+ // } -+ // else -+ // { -+ // bitstatus = 0x01; -+ // } -+ // return bitstatus; -+ return true; - } - void leds_error_blink(void) {} - -@@ -52,16 +53,17 @@ void leds_sync_toggle(void) - } - uint8_t leds_sync_isOn(void) - { -- uint8_t bitstatus = 0x00; -- if ((LED_GREEN_PORT->ODR & LED_GREEN_PIN) != (uint32_t)0) -- { -- bitstatus = 0x00; -- } -- else -- { -- bitstatus = 0x01; -- } -- return bitstatus; -+ // uint8_t bitstatus = 0x00; -+ // if ((LED_GREEN_PORT->ODR & LED_GREEN_PIN) != (uint32_t)0) -+ // { -+ // bitstatus = 0x00; -+ // } -+ // else -+ // { -+ // bitstatus = 0x01; -+ // } -+ // return bitstatus; -+ return true; - } - - /* orange */ -@@ -79,16 +81,17 @@ void leds_radio_toggle(void) - } - uint8_t leds_radio_isOn(void) - { -- uint8_t bitstatus = 0x00; -- if ((LED_ORANGE_PORT->ODR & LED_ORANGE_PIN) != (uint32_t)0) -- { -- bitstatus = 0x00; -- } -- else -- { -- bitstatus = 0x01; -- } -- return bitstatus; -+ // uint8_t bitstatus = 0x00; -+ // if ((LED_ORANGE_PORT->ODR & LED_ORANGE_PIN) != (uint32_t)0) -+ // { -+ // bitstatus = 0x00; -+ // } -+ // else -+ // { -+ // bitstatus = 0x01; -+ // } -+ // return bitstatus; -+ return true; - } - - /* yellow */ -diff --git a/bsp/boards/riot-adaption/radio.c b/bsp/boards/riot-adaption/radio.c -index 203550c..76fd0ba 100644 ---- a/bsp/boards/riot-adaption/radio.c -+++ b/bsp/boards/riot-adaption/radio.c -@@ -1,12 +1,11 @@ - #include "board_ow.h" - #include "radio.h" --#include "at86rf231_ow.h" --#include "spi_ow.h" -+#include "board.h" -+#include "at86rf231.h" -+#include "at86rf231_spi.h" - #include "radiotimer.h" - #include "debugpins.h" - #include "leds.h" --#include "board.h" --#include "spi.h" - #include "periph_conf.h" - - #define ENABLE_DEBUG (0) -@@ -27,46 +26,49 @@ radio_vars_t radio_vars; - - //=========================== prototypes ====================================== - --void radio_spiWriteReg(uint8_t reg_addr, uint8_t reg_setting); --uint8_t radio_spiReadReg(uint8_t reg_addr); --void radio_spiWriteTxFifo(uint8_t* bufToWrite, uint8_t lenToWrite); --void radio_spiReadRxFifo(uint8_t* pBufRead, -- uint8_t* pLenRead, -- uint8_t maxBufLen, -- uint8_t* pLqi); --uint8_t radio_spiReadRadioInfo(void); -+// void radio_spiWriteReg(uint8_t reg_addr, uint8_t reg_setting); -+// uint8_t radio_spiReadReg(uint8_t reg_addr); -+// void radio_spiWriteTxFifo(uint8_t* bufToWrite, uint8_t lenToWrite); -+// void radio_spiReadRxFifo(uint8_t* pBufRead, -+// uint8_t* pLenRead, -+// uint8_t maxBufLen, -+// uint8_t* pLqi); -+// uint8_t radio_spiReadRadioInfo(void); - - //=========================== public ========================================== - - //===== admin - - void radio_init(void) { -- -- // clear variables -- memset(&radio_vars,0,sizeof(radio_vars_t)); -- -- // change state -- radio_vars.state = RADIOSTATE_STOPPED; -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- // configure the radio -- radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF); // turn radio off -- -- radio_spiWriteReg(RG_IRQ_MASK, -- (AT_IRQ_RX_START| AT_IRQ_TRX_END)); // tell radio to fire interrupt on TRX_END and RX_START -- radio_spiReadReg(RG_IRQ_STATUS); // deassert the interrupt pin in case is high -- radio_spiWriteReg(RG_ANT_DIV, RADIO_CHIP_ANTENNA); // use chip antenna --#define RG_TRX_CTRL_1 0x04 -- radio_spiWriteReg(RG_TRX_CTRL_1, 0x20); // have the radio calculate CRC -- //busy wait until radio status is TRX_OFF -- uint16_t c = 0; -- while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF) -- if (c++ == 10000) { -- DEBUG("radio_spiReadReg timeout\n"); -- break; -- } -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- // change state -- radio_vars.state = RADIOSTATE_RFOFF; -+ DEBUG("%s\n", __PRETTY_FUNCTION__); -+ at86rf231_initialize(&at86rf231_netdev); -+ at86rf231_set_monitor(1); -+ -+// // clear variables -+// memset(&radio_vars,0,sizeof(radio_vars_t)); -+ -+// // change state -+// radio_vars.state = RADIOSTATE_STOPPED; -+// DEBUG("%s\n",__PRETTY_FUNCTION__); -+// // configure the radio -+// radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF); // turn radio off -+ -+// radio_spiWriteReg(RG_IRQ_MASK, -+// (AT_IRQ_RX_START| AT_IRQ_TRX_END)); // tell radio to fire interrupt on TRX_END and RX_START -+// radio_spiReadReg(RG_IRQ_STATUS); // deassert the interrupt pin in case is high -+// radio_spiWriteReg(RG_ANT_DIV, RADIO_CHIP_ANTENNA); // use chip antenna -+// #define RG_TRX_CTRL_1 0x04 -+// radio_spiWriteReg(RG_TRX_CTRL_1, 0x20); // have the radio calculate CRC -+// //busy wait until radio status is TRX_OFF -+// uint16_t c = 0; -+// while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF) -+// if (c++ == 10000) { -+// DEBUG("radio_spiReadReg timeout\n"); -+// break; -+// } -+// DEBUG("%s\n",__PRETTY_FUNCTION__); -+// // change state -+// radio_vars.state = RADIOSTATE_RFOFF; - } - - void radio_setOverflowCb(radiotimer_compare_cbt cb) { -@@ -88,7 +90,8 @@ void radio_setEndFrameCb(radiotimer_capture_cbt cb) { - //===== reset - - void radio_reset(void) { -- PORT_PIN_RADIO_RESET_LOW(); -+ at86rf231_off(); -+ at86rf231_on(); - } - - //===== timer -@@ -116,53 +119,54 @@ void radio_setFrequency(uint8_t frequency) { - radio_vars.state = RADIOSTATE_SETTING_FREQUENCY; - - // configure the radio to the right frequecy -- radio_spiWriteReg(RG_PHY_CC_CCA,0x20+frequency); -+ at86rf231_set_channel(frequency); - - // change state - radio_vars.state = RADIOSTATE_FREQUENCY_SET; - } - - void radio_rfOn(void) { -- PORT_PIN_RADIO_RESET_LOW(); -+ at86rf231_on(); - } - - void radio_rfOff(void) { -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- // change state -- radio_vars.state = RADIOSTATE_TURNING_OFF; -- radio_spiReadReg(RG_TRX_STATUS); -- DEBUG("step 1\n"); -- // turn radio off -- radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF); -- DEBUG("step 2\n"); -- radio_spiWriteReg(RG_TRX_STATE, CMD_TRX_OFF); -- -- // busy wait until done -- uint16_t c = 0; -- while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF) -- ;// if (c++ == 100000) { --// DEBUG("%s: radio_spiReadReg timeout\n", __PRETTY_FUNCTION__); --// break; --// } -- -- DEBUG("step 3\n"); -- // wiggle debug pin -- debugpins_radio_clr(); -+ // DEBUG("%s\n",__PRETTY_FUNCTION__); -+// // change state -+// radio_vars.state = RADIOSTATE_TURNING_OFF; -+// radio_spiReadReg(RG_TRX_STATUS); -+// DEBUG("step 1\n"); -+// // turn radio off -+// radio_spiWriteReg(RG_TRX_STATE, CMD_FORCE_TRX_OFF); -+// DEBUG("step 2\n"); -+// radio_spiWriteReg(RG_TRX_STATE, CMD_TRX_OFF); -+ -+// // busy wait until done -+// uint16_t c = 0; -+// while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != TRX_OFF) -+// ;// if (c++ == 100000) { -+// // DEBUG("%s: radio_spiReadReg timeout\n", __PRETTY_FUNCTION__); -+// // break; -+// // } -+ -+// DEBUG("step 3\n"); -+// // wiggle debug pin -+// debugpins_radio_clr(); - leds_radio_off(); -- DEBUG("step 4\n"); -- // change state -- radio_vars.state = RADIOSTATE_RFOFF; -- DEBUG("step 5\n"); -+// DEBUG("step 4\n"); -+// // change state -+// radio_vars.state = RADIOSTATE_RFOFF; -+// DEBUG("step 5\n"); - } - - //===== TX - - void radio_loadPacket(uint8_t* packet, uint8_t len) { -+ DEBUG("rf load\n"); - // change state - radio_vars.state = RADIOSTATE_LOADING_PACKET; - - // load packet in TXFIFO -- radio_spiWriteTxFifo(packet,len); -+ at86rf231_write_fifo(packet, len); - - // change state - radio_vars.state = RADIOSTATE_PACKET_LOADED; -@@ -171,19 +175,43 @@ void radio_loadPacket(uint8_t* packet, uint8_t len) { - void radio_txEnable(void) { - // change state - radio_vars.state = RADIOSTATE_ENABLING_TX; -- -- // wiggle debug pin -- debugpins_radio_set(); -+ DEBUG("rf tx en\n"); -+// // wiggle debug pin -+// debugpins_radio_set(); - leds_radio_on(); - -- // turn on radio's PLL -- radio_spiWriteReg(RG_TRX_STATE, CMD_PLL_ON); -- uint16_t c = 0; -- while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != PLL_ON) // busy wait until done -- ;// if (c++ == 100000) { --// DEBUG("%s: radio_spiReadReg timeout\n", __PRETTY_FUNCTION__); --// break; --// } -+ /* Go to state PLL_ON */ -+ at86rf231_reg_write(AT86RF231_REG__TRX_STATE, AT86RF231_TRX_STATE__PLL_ON); -+ -+ /* wait until it is on PLL_ON state */ -+ do { -+ int max_wait = 100; -+ if (!--max_wait) { -+ DEBUG("at86rf231 : ERROR : could not enter PLL_ON mode\n"); -+ break; -+ } -+ } while ((at86rf231_get_status() & AT86RF231_TRX_STATUS_MASK__TRX_STATUS) -+ != AT86RF231_TRX_STATUS__PLL_ON); -+ -+ /* change into TX_ARET_ON state */ -+ at86rf231_reg_write(AT86RF231_REG__TRX_STATE, AT86RF231_TRX_STATE__TX_ARET_ON); -+ -+ do { -+ int max_wait = 100; -+ if (!--max_wait) { -+ DEBUG("at86rf231 : ERROR : could not enter TX_ARET_ON mode\n"); -+ break; -+ } -+ } while (at86rf231_get_status() != AT86RF231_TRX_STATUS__TX_ARET_ON); -+ -+// // turn on radio's PLL -+// radio_spiWriteReg(RG_TRX_STATE, CMD_PLL_ON); -+// uint16_t c = 0; -+// while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != PLL_ON) // busy wait until done -+// ;// if (c++ == 100000) { -+// // DEBUG("%s: radio_spiReadReg timeout\n", __PRETTY_FUNCTION__); -+// // break; -+// // } - - // change state - radio_vars.state = RADIOSTATE_TX_ENABLED; -@@ -195,8 +223,11 @@ void radio_txNow(void) { - radio_vars.state = RADIOSTATE_TRANSMITTING; - leds_radio_toggle(); - // send packet by pulsing the SLP_TR_CNTL pin -- PORT_PIN_RADIO_SLP_TR_CNTL_HIGH(); -- PORT_PIN_RADIO_SLP_TR_CNTL_LOW(); -+ // PORT_PIN_RADIO_SLP_TR_CNTL_HIGH(); -+ // PORT_PIN_RADIO_SLP_TR_CNTL_LOW(); -+ -+ at86rf231_transmit_tx_buf(&at86rf231_netdev); -+ - leds_radio_toggle(); - // The AT86RF231 does not generate an interrupt when the radio transmits the - // SFD, which messes up the MAC state machine. The danger is that, if we leave -@@ -220,19 +251,21 @@ void radio_rxEnable(void) { - radio_vars.state = RADIOSTATE_ENABLING_RX; - - // put radio in reception mode -- radio_spiWriteReg(RG_TRX_STATE, CMD_RX_ON); -+ // radio_spiWriteReg(RG_TRX_STATE, CMD_RX_ON); - -- // wiggle debug pin -- debugpins_radio_set(); -+ at86rf231_switch_to_rx(); -+ -+// // wiggle debug pin -+// debugpins_radio_set(); - leds_radio_on(); - -- // busy wait until radio really listening -- uint16_t c = 0; -- while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != RX_ON) -- ;// if (c++ == 100000) { --// DEBUG("%s: radio_spiReadReg timeout\n",__PRETTY_FUNCTION__); --// break; --// } -+// // busy wait until radio really listening -+// uint16_t c = 0; -+// while((radio_spiReadReg(RG_TRX_STATUS) & 0x1F) != RX_ON) -+// ;// if (c++ == 100000) { -+// // DEBUG("%s: radio_spiReadReg timeout\n",__PRETTY_FUNCTION__); -+// // break; -+// // } - - // change state - radio_vars.state = RADIOSTATE_LISTENING; -@@ -248,212 +281,216 @@ void radio_getReceivedFrame(uint8_t* pBufRead, - uint8_t maxBufLen, - int8_t* pRssi, - uint8_t* pLqi, -- uint8_t* pCrc) { -+ bool* pCrc) { - uint8_t temp_reg_value; - - //===== crc -- temp_reg_value = radio_spiReadReg(RG_PHY_RSSI); -+ temp_reg_value = at86rf231_reg_read(AT86RF231_REG__PHY_RSSI); - *pCrc = (temp_reg_value & 0x80)>>7; // msb is whether packet passed CRC -- -- //===== rssi -- // as per section 8.4.3 of the AT86RF231, the RSSI is calculate as: -- // -91 + ED [dBm] -- temp_reg_value = radio_spiReadReg(RG_PHY_ED_LEVEL); -- *pRssi = -91 + temp_reg_value; -- -- //===== packet -- radio_spiReadRxFifo(pBufRead, -- pLenRead, -- maxBufLen, -- pLqi); -+ *pRssi = (temp_reg_value & 0x0f); -+ -+ // //===== rssi -+ // // as per section 8.4.3 of the AT86RF231, the RSSI is calculate as: -+ // // -91 + ED [dBm] -+ // temp_reg_value = radio_spiReadReg(RG_PHY_ED_LEVEL); -+ // *pRssi = -91 + temp_reg_value; -+ -+ // //===== packet -+ // radio_spiReadRxFifo(pBufRead, -+ // pLenRead, -+ // maxBufLen, -+ // pLqi); -+ at86rf231_read_fifo(pLenRead, 1); -+ at86rf231_read_fifo(pBufRead, *pLenRead); -+ *pLqi = pBufRead[(*pLenRead)-1]; - } - - //=========================== private ========================================= - --static inline void CSn_SET(void) --{ -- SPI_0_CS_PORT->BSRR = (1 << SPI_0_CS_PIN); --} --static inline void CSn_CLR(void) --{ -- SPI_0_CS_PORT->BRR = (1 << SPI_0_CS_PIN); --} -- --uint8_t radio_spiReadRadioInfo(void){ -- uint8_t spi_tx_buffer[3]; -- uint8_t spi_rx_buffer[3]; -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- // prepare buffer to send over SPI -- spi_tx_buffer[0] = (0x80 | 0x1E); // [b7] Read/Write: 1 (read) -- // [b6] RAM/Register : 1 (register) -- // [b5-0] address: 0x1E (Manufacturer ID, Lower 16 Bit) -- spi_tx_buffer[1] = 0x00; // send a SNOP strobe just to get the reg value -- spi_tx_buffer[2] = 0x00; // send a SNOP strobe just to get the reg value -- -- // retrieve radio manufacturer ID over SPI -- // spi_txrx(spi_tx_buffer, -- // sizeof(spi_tx_buffer), -- // SPI_BUFFER, -- // spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_FIRST, -- // SPI_LAST); -- CSn_CLR(); -- spi_transfer_bytes(SPI_0, spi_tx_buffer, spi_rx_buffer, 3); -- CSn_SET(); -- return spi_rx_buffer[2]; --} -- --void radio_spiWriteReg(uint8_t reg_addr, uint8_t reg_setting) { -- uint8_t spi_tx_buffer[2]; -- uint8_t spi_rx_buffer[2]; -- spi_tx_buffer[0] = (0xC0 | reg_addr); // turn addess in a 'reg write' address -- spi_tx_buffer[1] = reg_setting; -- -- // spi_txrx(spi_tx_buffer, -- // sizeof(spi_tx_buffer), -- // SPI_BUFFER, -- // (uint8_t*)spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_FIRST, -- // SPI_LAST); -- CSn_CLR(); -- spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -- spi_transfer_byte(SPI_0, spi_tx_buffer[1], NULL); -- CSn_SET(); --} -- --uint8_t radio_spiReadReg(uint8_t reg_addr) { -- uint8_t spi_tx_buffer[2]; -- uint8_t spi_rx_buffer[2]; -- spi_tx_buffer[0] = (0x80 | reg_addr); // turn addess in a 'reg read' address -- spi_tx_buffer[1] = 0x00; // send a no_operation command just to get the reg value -- -- // spi_txrx(spi_tx_buffer, -- // sizeof(spi_tx_buffer), -- // SPI_BUFFER, -- // (uint8_t*)spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_FIRST, -- // SPI_LAST); -- CSn_CLR(); -- spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -- spi_transfer_byte(SPI_0, 0, spi_rx_buffer); -- CSn_SET(); -- -- return spi_rx_buffer[0]; --} -- --/** for testing purposes, remove if not needed anymore**/ -- --void radio_spiWriteTxFifo(uint8_t* bufToWrite, uint8_t lenToWrite) { -- uint8_t spi_tx_buffer[2]; -- uint8_t spi_rx_buffer[1+1+127]; // 1B SPI address, 1B length, max. 127B data -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- spi_tx_buffer[0] = 0x60; // SPI destination address for TXFIFO -- spi_tx_buffer[1] = lenToWrite; // length byte -- -- CSn_CLR(); -- spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -- spi_transfer_byte(SPI_0, spi_tx_buffer[1], NULL); -- spi_transfer_bytes(SPI_0, bufToWrite, NULL, lenToWrite); -- CSn_SET(); -- -- // spi_txrx(spi_tx_buffer, -- // sizeof(spi_tx_buffer), -- // SPI_BUFFER, -- // spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_FIRST, -- // SPI_NOTLAST); -- -- // spi_txrx(bufToWrite, -- // lenToWrite, -- // SPI_BUFFER, -- // spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_NOTFIRST, -- // SPI_LAST); --} -- -- -- --void radio_spiReadRxFifo(uint8_t* pBufRead, -- uint8_t* pLenRead, -- uint8_t maxBufLen, -- uint8_t* pLqi) { -- // when reading the packet over SPI from the RX buffer, you get the following: -- // - *[1B] dummy byte because of SPI -- // - *[1B] length byte -- // - [0-125B] packet (excluding CRC) -- // - *[2B] CRC -- // - *[1B] LQI -- uint8_t spi_tx_buffer[125]; -- uint8_t spi_rx_buffer[3]; -- DEBUG("%s\n",__PRETTY_FUNCTION__); -- spi_tx_buffer[0] = 0x20; -- -- CSn_CLR(); -- spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -- spi_transfer_byte(SPI_0, 0, spi_rx_buffer); -- // 2 first bytes -- // spi_txrx(spi_tx_buffer, -- // 2, -- // SPI_BUFFER, -- // spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_FIRST, -- // SPI_NOTLAST); -- -- *pLenRead = spi_rx_buffer[0]; -- -- if (*pLenRead>2 && *pLenRead<=127) { -- // valid length -- spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -- spi_transfer_bytes(SPI_0, NULL, pBufRead, *pLenRead); -- -- // //read packet -- // spi_txrx(spi_tx_buffer, -- // *pLenRead, -- // SPI_BUFFER, -- // pBufRead, -- // 125, -- // SPI_NOTFIRST, -- // SPI_NOTLAST); -- spi_transfer_byte(SPI_0, 0, 0); -- spi_transfer_byte(SPI_0, 0, 0); -- spi_transfer_byte(SPI_0, 0, pLqi); -- // CRC (2B) and LQI (1B) -- // spi_txrx(spi_tx_buffer, -- // 2+1, -- // SPI_BUFFER, -- // spi_rx_buffer, -- // 3, -- // SPI_NOTFIRST, -- // SPI_LAST); -- -- // *pLqi = spi_rx_buffer[2]; -- -- } else { -- // invalid length -- spi_transfer_byte(SPI_0, 0, 0); -- // read a just byte to close spi -- // spi_txrx(spi_tx_buffer, -- // 1, -- // SPI_BUFFER, -- // spi_rx_buffer, -- // sizeof(spi_rx_buffer), -- // SPI_NOTFIRST, -- // SPI_LAST); -- } -- CSn_SET(); --} -+// static inline void CSn_SET(void) -+// { -+// SPI_0_CS_PORT->BSRR = (1 << SPI_0_CS_PIN); -+// } -+// static inline void CSn_CLR(void) -+// { -+// SPI_0_CS_PORT->BRR = (1 << SPI_0_CS_PIN); -+// } -+ -+// uint8_t radio_spiReadRadioInfo(void){ -+// uint8_t spi_tx_buffer[3]; -+// uint8_t spi_rx_buffer[3]; -+// DEBUG("%s\n",__PRETTY_FUNCTION__); -+// // prepare buffer to send over SPI -+// spi_tx_buffer[0] = (0x80 | 0x1E); // [b7] Read/Write: 1 (read) -+// // [b6] RAM/Register : 1 (register) -+// // [b5-0] address: 0x1E (Manufacturer ID, Lower 16 Bit) -+// spi_tx_buffer[1] = 0x00; // send a SNOP strobe just to get the reg value -+// spi_tx_buffer[2] = 0x00; // send a SNOP strobe just to get the reg value -+ -+// // retrieve radio manufacturer ID over SPI -+// // spi_txrx(spi_tx_buffer, -+// // sizeof(spi_tx_buffer), -+// // SPI_BUFFER, -+// // spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_FIRST, -+// // SPI_LAST); -+// CSn_CLR(); -+// spi_transfer_bytes(SPI_0, spi_tx_buffer, spi_rx_buffer, 3); -+// CSn_SET(); -+// return spi_rx_buffer[2]; -+// } -+ -+// void radio_spiWriteReg(uint8_t reg_addr, uint8_t reg_setting) { -+// uint8_t spi_tx_buffer[2]; -+// uint8_t spi_rx_buffer[2]; -+// spi_tx_buffer[0] = (0xC0 | reg_addr); // turn addess in a 'reg write' address -+// spi_tx_buffer[1] = reg_setting; -+ -+// // spi_txrx(spi_tx_buffer, -+// // sizeof(spi_tx_buffer), -+// // SPI_BUFFER, -+// // (uint8_t*)spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_FIRST, -+// // SPI_LAST); -+// CSn_CLR(); -+// spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+// spi_transfer_byte(SPI_0, spi_tx_buffer[1], NULL); -+// CSn_SET(); -+// } -+ -+// uint8_t radio_spiReadReg(uint8_t reg_addr) { -+// uint8_t spi_tx_buffer[2]; -+// uint8_t spi_rx_buffer[2]; -+// spi_tx_buffer[0] = (0x80 | reg_addr); // turn addess in a 'reg read' address -+// spi_tx_buffer[1] = 0x00; // send a no_operation command just to get the reg value -+ -+// // spi_txrx(spi_tx_buffer, -+// // sizeof(spi_tx_buffer), -+// // SPI_BUFFER, -+// // (uint8_t*)spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_FIRST, -+// // SPI_LAST); -+// CSn_CLR(); -+// spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+// spi_transfer_byte(SPI_0, 0, spi_rx_buffer); -+// CSn_SET(); -+ -+// return spi_rx_buffer[0]; -+// } -+ -+// /** for testing purposes, remove if not needed anymore**/ -+ -+// void radio_spiWriteTxFifo(uint8_t* bufToWrite, uint8_t lenToWrite) { -+// uint8_t spi_tx_buffer[2]; -+// uint8_t spi_rx_buffer[1+1+127]; // 1B SPI address, 1B length, max. 127B data -+// DEBUG("%s\n",__PRETTY_FUNCTION__); -+// spi_tx_buffer[0] = 0x60; // SPI destination address for TXFIFO -+// spi_tx_buffer[1] = lenToWrite; // length byte -+ -+// CSn_CLR(); -+// spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+// spi_transfer_byte(SPI_0, spi_tx_buffer[1], NULL); -+// spi_transfer_bytes(SPI_0, bufToWrite, NULL, lenToWrite); -+// CSn_SET(); -+ -+// // spi_txrx(spi_tx_buffer, -+// // sizeof(spi_tx_buffer), -+// // SPI_BUFFER, -+// // spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_FIRST, -+// // SPI_NOTLAST); -+ -+// // spi_txrx(bufToWrite, -+// // lenToWrite, -+// // SPI_BUFFER, -+// // spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_NOTFIRST, -+// // SPI_LAST); -+// } -+ -+ -+ -+// void radio_spiReadRxFifo(uint8_t* pBufRead, -+// uint8_t* pLenRead, -+// uint8_t maxBufLen, -+// uint8_t* pLqi) { -+// // when reading the packet over SPI from the RX buffer, you get the following: -+// // - *[1B] dummy byte because of SPI -+// // - *[1B] length byte -+// // - [0-125B] packet (excluding CRC) -+// // - *[2B] CRC -+// // - *[1B] LQI -+// uint8_t spi_tx_buffer[125]; -+// uint8_t spi_rx_buffer[3]; -+// DEBUG("%s\n",__PRETTY_FUNCTION__); -+// spi_tx_buffer[0] = 0x20; -+ -+// CSn_CLR(); -+// spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+// spi_transfer_byte(SPI_0, 0, spi_rx_buffer); -+// // 2 first bytes -+// // spi_txrx(spi_tx_buffer, -+// // 2, -+// // SPI_BUFFER, -+// // spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_FIRST, -+// // SPI_NOTLAST); -+ -+// *pLenRead = spi_rx_buffer[0]; -+ -+// if (*pLenRead>2 && *pLenRead<=127) { -+// // valid length -+// spi_transfer_byte(SPI_0, spi_tx_buffer[0], NULL); -+// spi_transfer_bytes(SPI_0, NULL, pBufRead, *pLenRead); -+ -+// // //read packet -+// // spi_txrx(spi_tx_buffer, -+// // *pLenRead, -+// // SPI_BUFFER, -+// // pBufRead, -+// // 125, -+// // SPI_NOTFIRST, -+// // SPI_NOTLAST); -+// spi_transfer_byte(SPI_0, 0, 0); -+// spi_transfer_byte(SPI_0, 0, 0); -+// spi_transfer_byte(SPI_0, 0, pLqi); -+// // CRC (2B) and LQI (1B) -+// // spi_txrx(spi_tx_buffer, -+// // 2+1, -+// // SPI_BUFFER, -+// // spi_rx_buffer, -+// // 3, -+// // SPI_NOTFIRST, -+// // SPI_LAST); -+ -+// // *pLqi = spi_rx_buffer[2]; -+ -+// } else { -+// // invalid length -+// spi_transfer_byte(SPI_0, 0, 0); -+// // read a just byte to close spi -+// // spi_txrx(spi_tx_buffer, -+// // 1, -+// // SPI_BUFFER, -+// // spi_rx_buffer, -+// // sizeof(spi_rx_buffer), -+// // SPI_NOTFIRST, -+// // SPI_LAST); -+// } -+// CSn_SET(); -+// } - - //=========================== callbacks ======================================= - - //=========================== interrupt handlers ============================== - --kick_scheduler_t radio_isr(void) { -+void at86rf231_rx_irq(void) { - PORT_TIMER_WIDTH capturedTime; - uint8_t irq_status; - -@@ -461,10 +498,10 @@ kick_scheduler_t radio_isr(void) { - capturedTime = radiotimer_getCapturedTime(); - - // reading IRQ_STATUS causes radio's IRQ pin to go low -- irq_status = radio_spiReadReg(RG_IRQ_STATUS); -+ irq_status = at86rf231_reg_read(AT86RF231_REG__IRQ_STATUS); - - // start of frame event -- if (irq_status & AT_IRQ_RX_START) { -+ if (irq_status & AT86RF231_IRQ_STATUS_MASK__RX_START) { - DEBUG("Start of frame.\n"); - // change state - radio_vars.state = RADIOSTATE_RECEIVING; -@@ -472,13 +509,13 @@ kick_scheduler_t radio_isr(void) { - // call the callback - radio_vars.startFrame_cb(capturedTime); - // kick the OS -- return KICK_SCHEDULER; -+ return; - } else { - while(1); - } - } - // end of frame event -- if (irq_status & AT_IRQ_TRX_END) { -+ if (irq_status & AT86RF231_IRQ_STATUS_MASK__TRX_END) { - DEBUG("End of Frame.\n"); - // change state - radio_vars.state = RADIOSTATE_TXRX_DONE; -@@ -486,11 +523,9 @@ kick_scheduler_t radio_isr(void) { - // call the callback - radio_vars.endFrame_cb(capturedTime); - // kick the OS -- return KICK_SCHEDULER; -+ return; - } else { - while(1); - } - } -- -- return DO_NOT_KICK_SCHEDULER; - } -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/radiotimer.c b/bsp/boards/riot-adaption/radiotimer.c -index e9c0b54..47fa2d2 100644 ---- a/bsp/boards/riot-adaption/radiotimer.c -+++ b/bsp/boards/riot-adaption/radiotimer.c -@@ -8,11 +8,14 @@ On openmoteSTM32, we use RTC for the radiotimer module. - #include "stdint.h" - - #include "periph/timer.h" -+#include "hwtimer.h" - - #include "leds.h" - #include "radiotimer.h" - #include "board_info.h" - -+#include "riot.h" -+ - #define ENABLE_DEBUG (0) - #include "debug.h" - -@@ -36,14 +39,14 @@ volatile radiotimer_vars_t radiotimer_vars; - uint16_t current_period; - - //=========================== prototypes ====================================== -- -+extern int timer_set_relative(tim_t, int channel, unsigned int rel_value); - //=========================== public ========================================== - - //===== admin - - void radiotimer_init(void) { - // clear local variables -- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t)); -+ memset((void*)&radiotimer_vars,0,sizeof(radiotimer_vars_t)); - current_period = 0; - } - -@@ -63,10 +66,10 @@ void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) { - while(1); - } - --void radiotimer_start(uint16_t period) { -+void radiotimer_start(PORT_RADIOTIMER_WIDTH period) { - DEBUG("%s\n", __PRETTY_FUNCTION__); -- timer_init(TIMER_1, 1, &radiotimer_isr); -- timer_set(TIMER_1, 1, (0xffff)&((unsigned int)period)); -+ // timer_init(OWSN_TIMER, 1, &radiotimer_isr); -+ timer_set(OWSN_TIMER, 1, ((unsigned int)HWTIMER_TICKS(period)*10)); - current_period = period; - radiotimer_vars.currentSlotPeriod = period; - radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW; -@@ -74,12 +77,13 @@ void radiotimer_start(uint16_t period) { - - //===== direct access - --uint16_t radiotimer_getValue(void) { -- return (uint16_t)((0xffff)&timer_read(TIMER_1)); -+PORT_RADIOTIMER_WIDTH radiotimer_getValue(void) { -+ return (PORT_RADIOTIMER_WIDTH)(HWTIMER_TICKS_TO_US(timer_read(OWSN_TIMER))); - } - --void radiotimer_setPeriod(uint16_t period) { -- timer_set(TIMER_1, 1, (0xffff)&((unsigned int)period)); -+void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) { -+ DEBUG("%s\n", __PRETTY_FUNCTION__); -+ timer_set(OWSN_TIMER, 1, ((unsigned int)HWTIMER_TICKS(period)*10)); - current_period = period; - radiotimer_vars.currentSlotPeriod = period; - -@@ -87,26 +91,27 @@ void radiotimer_setPeriod(uint16_t period) { - radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW; - } - --uint16_t radiotimer_getPeriod(void) { -+PORT_RADIOTIMER_WIDTH radiotimer_getPeriod(void) { - return current_period; - } - - //===== compare - --void radiotimer_schedule(uint16_t offset) { -- timer_irq_disable(TIMER_1); -- timer_set(TIMER_1, 1, offset); -- current_period = offset; -- timer_irq_enable(TIMER_1); -+void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) { -+ DEBUG("%s\n", __PRETTY_FUNCTION__); -+ timer_irq_disable(OWSN_TIMER); -+ timer_set(OWSN_TIMER, 1, HWTIMER_TICKS(offset)*10); -+ timer_irq_enable(OWSN_TIMER); - //set radiotimer irpstatus - radiotimer_vars.overflowORcompare = RADIOTIMER_COMPARE; - } - - void radiotimer_cancel(void) { -- timer_irq_disable(TIMER_1); -- timer_clear(TIMER_1, 1); -- current_period = 0; -- timer_irq_enable(TIMER_1); -+ DEBUG("%s\n", __PRETTY_FUNCTION__); -+ timer_irq_disable(OWSN_TIMER); -+ // timer_clear(OWSN_TIMER, 1); -+ timer_set(OWSN_TIMER, 1, HWTIMER_TICKS(current_period)*10); -+ timer_irq_enable(OWSN_TIMER); - - //set radiotimer irpstatus - radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW; -@@ -114,15 +119,14 @@ void radiotimer_cancel(void) { - - //===== capture - --inline uint16_t radiotimer_getCapturedTime(void) { -- return (uint16_t)((0xffff)&timer_read(TIMER_1)); -+inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime(void) { -+ return (PORT_RADIOTIMER_WIDTH)(timer_read(OWSN_TIMER)); - } - - //=========================== private ========================================= - - //=========================== interrupt handlers ============================== -- --kick_scheduler_t radiotimer_isr(void) { -+void radiotimer_isr(void) { - uint8_t taiv_temp = radiotimer_vars.overflowORcompare; - switch (taiv_temp) { - case RADIOTIMER_COMPARE: -@@ -130,19 +134,19 @@ kick_scheduler_t radiotimer_isr(void) { - if (radiotimer_vars.compare_cb!=NULL) { - radiotimer_vars.compare_cb(); - // kick the OS -- return KICK_SCHEDULER; -+ // return KICK_SCHEDULER; - } - break; - case RADIOTIMER_OVERFLOW: // timer overflows - DEBUG("%s of\n", __PRETTY_FUNCTION__); - if (radiotimer_vars.overflow_cb!=NULL) { - //Wait until last write operation on RTC registers has finished -- timer_reset(TIMER_1); -+ timer_set(OWSN_TIMER, 1, HWTIMER_TICKS(current_period)*10); - // call the callback - radiotimer_vars.overflow_cb(); - DEBUG("returned...\n"); - // kick the OS -- return KICK_SCHEDULER; -+ // return KICK_SCHEDULER; - } - break; - case RADIOTIMER_NONE: // this should not happen -@@ -151,5 +155,5 @@ kick_scheduler_t radiotimer_isr(void) { - DEBUG("%s default\n", __PRETTY_FUNCTION__); - // while(1); // this should not happen - } -- return DO_NOT_KICK_SCHEDULER; -+ // return DO_NOT_KICK_SCHEDULER; - } -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/riot.h b/bsp/boards/riot-adaption/riot.h -new file mode 100644 -index 0000000..982241c ---- /dev/null -+++ b/bsp/boards/riot-adaption/riot.h -@@ -0,0 +1,36 @@ -+/* -+ * Copyright (C) 2014 Freie Universität Berlin -+ * -+ * This file is subject to the terms and conditions of the GNU Lesser -+ * General Public License v2.1. See the file LICENSE in the top level -+ * directory for more details. -+ */ -+ -+/** -+ * @{ -+ * -+ * @file -+ * @brief RIOT specific definitions for OpenWSN -+ * -+ * @author Thomas Eichinger -+ */ -+ -+#ifndef __RIOT_H -+#define __RIOT_H -+ -+#include "thread.h" -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+/** -+ * @brief The peripheral timer to use with OpenWSN -+ */ -+#define OWSN_TIMER TIMER_1 -+ -+#ifdef __cplusplus -+} -+#endif -+#endif /* __RIOT_H */ -+/** @} */ -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/spi_ow.c b/bsp/boards/riot-adaption/spi_ow.c -deleted file mode 100644 -index 56193f6..0000000 ---- a/bsp/boards/riot-adaption/spi_ow.c -+++ /dev/null -@@ -1,321 +0,0 @@ --#include "stdio.h" --#include "stdint.h" --#include "string.h" --#include "spi_ow.h" --#include "spi.h" --#include "leds.h" --#include "board.h" --#include "radio.h" --#include "periph/gpio.h" --#include "periph_conf.h" --#include "at86rf231.h" -- --#define ENABLE_DEBUG (0) --#include "debug.h" -- --//=========================== defines ========================================= -- --//=========================== variables ======================================= -- --typedef struct { -- // information about the current transaction -- uint8_t* pNextTxByte; -- uint8_t numTxedBytes; -- uint8_t txBytesLeft; -- spi_return_t returnType; -- uint8_t* pNextRxByte; -- uint8_t maxRxBytes; -- spi_first_t isFirst; -- spi_last_t isLast; -- // state of the module -- uint8_t busy; --#ifdef SPI_IN_INTERRUPT_MODE -- // callback when module done -- spi_cbt callback; --#endif --} spi_vars_t; -- --volatile spi_vars_t spi_vars; -- --//=========================== prototypes ====================================== --// inline static void RESET_CLR(void) { GPIOC->BRR = 1<<1; } --// inline static void RESET_SET(void) { GPIOC->BSRR = 1<<1; } --// inline static void CSn_SET(void) { GPIOA->BSRR = 1<<4; } --// inline static void CSn_CLR(void) { GPIOA->BRR = 1<<4; } --// inline static void SLEEP_CLR(void) { GPIOA->BRR = 1<<2; } --static inline void RESET_CLR(void) --{ -- SPI_0_RESET_PORT->BRR = (1 << SPI_0_RESET_PIN); --} --static inline void RESET_SET(void) --{ -- SPI_0_RESET_PORT->BSRR = (1 << SPI_0_RESET_PIN); --} --static inline void CSn_SET(void) --{ -- SPI_0_CS_PORT->BSRR = (1 << SPI_0_CS_PIN); --} --static inline void CSn_CLR(void) --{ -- SPI_0_CS_PORT->BRR = (1 << SPI_0_CS_PIN); --} --static inline void SLEEP_CLR(void) --{ -- SPI_0_SLEEP_PORT->BRR = (1 << SPI_0_SLEEP_PIN); --} -- --//=========================== public ========================================== -- --void spi_init_ow(void) { -- // clear variables -- memset(&spi_vars,0,sizeof(spi_vars_t)); -- -- /* set up GPIO pins */ -- /* SCLK and MOSI*/ -- GPIOA->CRL &= ~(0xf << (5 * 4)); -- GPIOA->CRL |= (0xb << (5 * 4)); -- GPIOA->CRL &= ~(0xf << (7 * 4)); -- GPIOA->CRL |= (0xb << (7 * 4)); -- /* MISO */ -- gpio_init_in(SPI_0_MISO_GPIO, GPIO_NOPULL); -- -- /* SPI init */ -- spi_init_master(SPI_0, SPI_CONF_FIRST_RISING, 4500000); -- -- spi_poweron(SPI_0); -- -- /* IRQ0 */ -- gpio_init_in(SPI_0_IRQ0_GPIO, GPIO_NOPULL); -- gpio_init_int(SPI_0_IRQ0_GPIO, GPIO_NOPULL, GPIO_RISING, radio_isr); -- -- /* Connect EXTI4 Line to PC4 pin */ -- gpio_irq_enable(SPI_0_IRQ0_GPIO); -- -- /* CS */ -- gpio_init_out(SPI_0_CS_GPIO, GPIO_NOPULL); -- /* SLEEP */ -- gpio_init_out(SPI_0_SLEEP_GPIO, GPIO_NOPULL); -- /* RESET */ -- gpio_init_out(SPI_0_RESET_GPIO, GPIO_NOPULL); -- -- // force reset -- RESET_CLR(); -- CSn_SET(); -- SLEEP_CLR(); -- -- for (uint16_t j=0;j<0xFFFF;j++); //small wait -- -- RESET_SET(); -- // /* set up GPIO pins */ -- // /* SCLK and MOSI*/ -- // GPIOA->CRL &= ~(0xf << (5 * 4)); -- // GPIOA->CRL |= (0xb << (5 * 4)); -- // GPIOA->CRL &= ~(0xf << (7 * 4)); -- // GPIOA->CRL |= (0xb << (7 * 4)); -- // /* MISO */ -- // gpio_init_in(SPI_0_MISO_GPIO, GPIO_NOPULL); -- -- // /* SPI init */ -- // spi_init_master(SPI_0, SPI_CONF_FIRST_RISING, 4500000); -- -- // spi_poweron(SPI_0); -- -- // /* IRQ0 */ -- // gpio_init_in(SPI_0_IRQ0_GPIO, GPIO_NOPULL); -- // gpio_init_int(SPI_0_IRQ0_GPIO, GPIO_NOPULL, GPIO_RISING, radio_isr); -- -- // /* Connect EXTI4 Line to PC4 pin */ -- // gpio_irq_enable(SPI_0_IRQ0_GPIO); -- -- // /* CS */ -- // gpio_init_out(SPI_0_CS_GPIO, GPIO_NOPULL); -- // /* SLEEP */ -- // gpio_init_out(SPI_0_SLEEP_GPIO, GPIO_NOPULL); -- // /* RESET */ -- // gpio_init_out(SPI_0_RESET_GPIO, GPIO_NOPULL); -- -- // /* force reset */ -- // RESET_CLR(); -- // CSn_SET(); -- // SLEEP_CLR(); -- -- // vtimer_usleep(AT86RF231_TIMING__RESET); -- -- // RESET_SET(); -- -- // /* Wait until TRX_OFF is entered */ -- // vtimer_usleep(AT86RF231_TIMING__RESET_TO_TRX_OFF); -- -- // /* Send a FORCE TRX OFF command */ -- // at86rf231_reg_write(AT86RF231_REG__TRX_STATE, AT86RF231_TRX_STATE__FORCE_TRX_OFF); -- -- // /* Wait until TRX_OFF state is entered from P_ON */ -- // vtimer_usleep(AT86RF231_TIMING__SLEEP_TO_TRX_OFF); -- -- // /* busy wait for TRX_OFF state */ -- // uint8_t status; -- // uint8_t max_wait = 100; // TODO : move elsewhere, this is in 10us -- -- // do { -- // status = at86rf231_get_status(); -- -- // vtimer_usleep(10); -- -- // if (!--max_wait) { -- // printf("at86rf231 : ERROR : could not enter TRX_OFF mode\n"); -- // break; -- // } -- // } while ((status & AT86RF231_TRX_STATUS_MASK__TRX_STATUS) -- // != AT86RF231_TRX_STATUS__TRX_OFF); -- --} -- --#ifdef SPI_IN_INTERRUPT_MODE --void spi_setCallback(spi_cbt cb) { -- spi_vars.callback = cb; --} --#endif -- --void spi_txrx(uint8_t* bufTx, -- uint8_t lenbufTx, -- spi_return_t returnType, -- uint8_t* bufRx, -- uint8_t maxLenBufRx, -- spi_first_t isFirst, -- spi_last_t isLast) { -- --#ifdef SPI_IN_INTERRUPT_MODE -- // disable interrupts -- NVIC_RESETPRIMASK(); --#endif -- -- // register spi frame to send -- spi_vars.pNextTxByte = bufTx; -- spi_vars.numTxedBytes = 0; -- spi_vars.txBytesLeft = lenbufTx; -- spi_vars.returnType = returnType; -- spi_vars.pNextRxByte = bufRx; -- spi_vars.maxRxBytes = maxLenBufRx; -- spi_vars.isFirst = isFirst; -- spi_vars.isLast = isLast; -- -- // SPI is now busy -- spi_vars.busy = 1; -- -- -- // lower CS signal to have slave listening -- if (spi_vars.isFirst==SPI_FIRST) { -- CSn_CLR(); -- } -- --#ifdef SPI_IN_INTERRUPT_MODE -- // implementation 1. use a callback function when transaction finishes -- -- // write first byte to TX buffer -- SPI_I2S_SendData(SPI1,*spi_vars.pNextTxByte); -- -- // re-enable interrupts -- NVIC_SETPRIMASK(); --#else -- // implementation 2. busy wait for each byte to be sent -- // send all bytes -- while (spi_vars.txBytesLeft>0) { -- // write next byte to TX buffer -- // SPI_I2S_SendData(SPI1,*spi_vars.pNextTxByte); -- spi_transfer_byte(SPI_0, *((char*)spi_vars.pNextTxByte), NULL); -- -- // busy wait on the interrupt flag --// uint16_t c = 0; --// while (SPI_I2S_GetFlagStatus(SPI1,SPI_I2S_FLAG_RXNE) == RESET) --// ;// if (c++ == 10000) { --// // //DEBUG("spi_txrx timeout\n"); --// // break; --// // } -- --// // clear the interrupt flag --// SPI_I2S_ClearFlag(SPI1, SPI_I2S_FLAG_RXNE); -- // save the byte just received in the RX buffer -- switch (spi_vars.returnType) { -- case SPI_FIRSTBYTE: -- if (spi_vars.numTxedBytes==0) { -- spi_transfer_byte(SPI_0, 0, (char*)spi_vars.pNextRxByte); -- // *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -- } -- break; -- case SPI_BUFFER: -- spi_transfer_byte(SPI_0, 0, (char*)spi_vars.pNextRxByte); -- // *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -- spi_vars.pNextRxByte++; -- break; -- case SPI_LASTBYTE: -- spi_transfer_byte(SPI_0, 0, (char*)spi_vars.pNextRxByte); -- // *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -- break; -- } -- // one byte less to go -- spi_vars.pNextTxByte++; -- spi_vars.numTxedBytes++; -- spi_vars.txBytesLeft--; -- } -- -- // put CS signal high to signal end of transmission to slave -- if (spi_vars.isLast==SPI_LAST) { -- CSn_SET(); -- } -- -- // SPI is not busy anymore -- spi_vars.busy = 0; --#endif --} -- --//=========================== private ========================================= -- --//=========================== interrupt handlers ============================== -- --kick_scheduler_t spi_isr(void) { --#ifdef SPI_IN_INTERRUPT_MODE -- // save the byte just received in the RX buffer -- switch (spi_vars.returnType) { -- case SPI_FIRSTBYTE: -- if (spi_vars.numTxedBytes==0) { -- *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -- } -- break; -- case SPI_BUFFER: -- *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -- spi_vars.pNextRxByte++; -- break; -- case SPI_LASTBYTE: -- *spi_vars.pNextRxByte = SPI_I2S_ReceiveData(SPI1); -- break; -- } -- -- // one byte less to go -- spi_vars.pNextTxByte++; -- spi_vars.numTxedBytes++; -- spi_vars.txBytesLeft--; -- -- if (spi_vars.txBytesLeft>0) { -- // write next byte to TX buffer -- SPI_SendData(SPI1,*spi_vars.pNextTxByte); -- } else { -- // put CS signal high to signal end of transmission to slave -- if (spi_vars.isLast==SPI_LAST) { -- GPIO_SetBits(GPIOA, GPIO_Pin_4); -- } -- // SPI is not busy anymore -- spi_vars.busy = 0; -- -- // SPI is done! -- if (spi_vars.callback!=NULL) { -- // call the callback -- spi_vars.callback(); -- // kick the OS -- return 1; -- } -- } --#else -- while(1);// this should never happen -- return 1; --#endif --} -\ No newline at end of file -diff --git a/bsp/boards/riot-adaption/uart_ow.c b/bsp/boards/riot-adaption/uart_ow.c -index c2bcb4f..bd62ee6 100644 ---- a/bsp/boards/riot-adaption/uart_ow.c -+++ b/bsp/boards/riot-adaption/uart_ow.c -@@ -1,4 +1,4 @@ --#include "uart_ow.h" -+#include "uart.h" - #include "leds.h" - #include "periph/uart.h" - -@@ -22,7 +22,7 @@ volatile uart_vars_t uart_vars; - void uart_init_ow(void) - { - // reset local variables -- memset(&uart_vars,0,sizeof(uart_vars_t)); -+ memset((void*)&uart_vars,0,sizeof(uart_vars_t)); - - //when this value is 0, we are send the first data - uart_vars.startOrend = 0; -@@ -76,9 +76,9 @@ void uart_writeByte(uint8_t byteToWrite) - - uint8_t uart_readByte(void) - { -- // uint16_t temp; -+ uint16_t temp = 0; - // temp = USART_ReceiveData(USART1); -- // return (uint8_t)temp; -+ return (uint8_t)temp; - } - - //=========================== interrupt handlers ============================== -diff --git a/bsp/boards/uart.h b/bsp/boards/uart.h -index 4f02a23..57f93cf 100644 ---- a/bsp/boards/uart.h -+++ b/bsp/boards/uart.h -@@ -31,7 +31,7 @@ typedef void (*uart_rx_cbt)(void); - - //=========================== prototypes ====================================== - --void uart_init(void); -+void uart_init_ow(void); - void uart_setCallbacks(uart_tx_cbt txCb, uart_rx_cbt rxCb); - void uart_enableInterrupts(void); - void uart_disableInterrupts(void); -diff --git a/drivers/common/Makefile b/drivers/common/Makefile -index fbf6584..c703506 100644 ---- a/drivers/common/Makefile -+++ b/drivers/common/Makefile -@@ -1,2 +1,8 @@ -+INCLUDES += -I$(OPENWSN_ROOT)/openstack/02a-MAClow \ -+ -I$(OPENWSN_ROOT)/openstack/02b-MAChigh \ -+ -I$(OPENWSN_ROOT)/openstack/03a-IPHC \ -+ -I$(OPENWSN_ROOT)/openstack/03b-IPv6 \ -+ -I$(OPENWSN_ROOT)/openstack/cross-layers \ -+ -I$(CURDIR) - - include $(RIOTBASE)/Makefile.base -\ No newline at end of file -diff --git a/drivers/common/openserial.c b/drivers/common/openserial.c -index c54cfff..ebb2743 100644 ---- a/drivers/common/openserial.c -+++ b/drivers/common/openserial.c -@@ -1,48 +1,48 @@ --/** --\brief Definition of the "openserial" driver. -- --\author Fabien Chraim , March 2012. --*/ -- --#include "opendefs.h" --#include "openserial.h" --#include "IEEE802154E.h" --#include "neighbors.h" --#include "sixtop.h" --#include "icmpv6echo.h" --#include "idmanager.h" --#include "openqueue.h" --#include "openbridge.h" --#include "leds.h" --#include "schedule.h" --#include "uart.h" --#include "opentimers.h" --#include "openhdlc.h" -- --//=========================== variables ======================================= -- --openserial_vars_t openserial_vars; -- --//=========================== prototypes ====================================== -- --owerror_t openserial_printInfoErrorCritical( -- char severity, -- uint8_t calling_component, -- uint8_t error_code, -- errorparameter_t arg1, -- errorparameter_t arg2 --); --// HDLC output --void outputHdlcOpen(void); --void outputHdlcWrite(uint8_t b); --void outputHdlcClose(void); --// HDLC input --void inputHdlcOpen(void); --void inputHdlcWrite(uint8_t b); --void inputHdlcClose(void); -- --//=========================== public ========================================== -- -+/** -+\brief Definition of the "openserial" driver. -+ -+\author Fabien Chraim , March 2012. -+*/ -+ -+#include "opendefs.h" -+#include "openserial.h" -+#include "IEEE802154E.h" -+#include "neighbors.h" -+#include "sixtop.h" -+#include "icmpv6echo.h" -+#include "idmanager.h" -+#include "openqueue.h" -+#include "openbridge.h" -+#include "leds.h" -+#include "schedule.h" -+#include "uart.h" -+#include "opentimers.h" -+#include "openhdlc.h" -+ -+//=========================== variables ======================================= -+ -+openserial_vars_t openserial_vars; -+ -+//=========================== prototypes ====================================== -+ -+owerror_t openserial_printInfoErrorCritical( -+ char severity, -+ uint8_t calling_component, -+ uint8_t error_code, -+ errorparameter_t arg1, -+ errorparameter_t arg2 -+); -+// HDLC output -+void outputHdlcOpen(void); -+void outputHdlcWrite(uint8_t b); -+void outputHdlcClose(void); -+// HDLC input -+void inputHdlcOpen(void); -+void inputHdlcWrite(uint8_t b); -+void inputHdlcClose(void); -+ -+//=========================== public ========================================== -+ - void openserial_init(void) { - // uint16_t crc; - -@@ -76,9 +76,9 @@ void openserial_init(void) { - // // set callbacks - // uart_setCallbacks(isr_openserial_tx, - // isr_openserial_rx); --} -- --owerror_t openserial_printStatus(uint8_t statusElement,uint8_t* buffer, uint8_t length) { -+} -+ -+owerror_t openserial_printStatus(uint8_t statusElement,uint8_t* buffer, uint8_t length) { - // uint8_t i; - // INTERRUPT_DECLARATION(); - -@@ -94,17 +94,17 @@ owerror_t openserial_printStatus(uint8_t statusElement,uint8_t* buffer, uint8_t - // } - // outputHdlcClose(); - // ENABLE_INTERRUPTS(); -- -- return E_SUCCESS; --} -- --owerror_t openserial_printInfoErrorCritical( -- char severity, -- uint8_t calling_component, -- uint8_t error_code, -- errorparameter_t arg1, -- errorparameter_t arg2 -- ) { -+ -+ return E_SUCCESS; -+} -+ -+owerror_t openserial_printInfoErrorCritical( -+ char severity, -+ uint8_t calling_component, -+ uint8_t error_code, -+ errorparameter_t arg1, -+ errorparameter_t arg2 -+ ) { - // INTERRUPT_DECLARATION(); - - // DISABLE_INTERRUPTS(); -@@ -121,11 +121,11 @@ owerror_t openserial_printInfoErrorCritical( - // outputHdlcWrite((uint8_t) (arg2 & 0x00ff)); - // outputHdlcClose(); - // ENABLE_INTERRUPTS(); -- -- return E_SUCCESS; --} -- --owerror_t openserial_printData(uint8_t* buffer, uint8_t length) { -+ -+ return E_SUCCESS; -+} -+ -+owerror_t openserial_printData(uint8_t* buffer, uint8_t length) { - // uint8_t i; - // uint8_t asn[5]; - // INTERRUPT_DECLARATION(); -@@ -149,70 +149,70 @@ owerror_t openserial_printData(uint8_t* buffer, uint8_t length) { - // } - // outputHdlcClose(); - // ENABLE_INTERRUPTS(); -- -- return E_SUCCESS; --} -- --owerror_t openserial_printInfo(uint8_t calling_component, uint8_t error_code, -- errorparameter_t arg1, -- errorparameter_t arg2) { -- return openserial_printInfoErrorCritical( -- SERFRAME_MOTE2PC_INFO, -- calling_component, -- error_code, -- arg1, -- arg2 -- ); --} -- --owerror_t openserial_printError(uint8_t calling_component, uint8_t error_code, -- errorparameter_t arg1, -- errorparameter_t arg2) { -- // blink error LED, this is serious -+ -+ return E_SUCCESS; -+} -+ -+owerror_t openserial_printInfo(uint8_t calling_component, uint8_t error_code, -+ errorparameter_t arg1, -+ errorparameter_t arg2) { -+ return openserial_printInfoErrorCritical( -+ SERFRAME_MOTE2PC_INFO, -+ calling_component, -+ error_code, -+ arg1, -+ arg2 -+ ); -+} -+ -+owerror_t openserial_printError(uint8_t calling_component, uint8_t error_code, -+ errorparameter_t arg1, -+ errorparameter_t arg2) { -+ // blink error LED, this is serious - // leds_error_toggle(); -- -- return openserial_printInfoErrorCritical( -- SERFRAME_MOTE2PC_ERROR, -- calling_component, -- error_code, -- arg1, -- arg2 -- ); --} -- --owerror_t openserial_printCritical(uint8_t calling_component, uint8_t error_code, -- errorparameter_t arg1, -- errorparameter_t arg2) { -- // blink error LED, this is serious -+ -+ return openserial_printInfoErrorCritical( -+ SERFRAME_MOTE2PC_ERROR, -+ calling_component, -+ error_code, -+ arg1, -+ arg2 -+ ); -+} -+ -+owerror_t openserial_printCritical(uint8_t calling_component, uint8_t error_code, -+ errorparameter_t arg1, -+ errorparameter_t arg2) { -+ // blink error LED, this is serious - // leds_error_blink(); -- -+ - // // schedule for the mote to reboot in 10s - // opentimers_start(10000, - // TIMER_ONESHOT,TIME_MS, - // board_reset); -- -- return openserial_printInfoErrorCritical( -- SERFRAME_MOTE2PC_CRITICAL, -- calling_component, -- error_code, -- arg1, -- arg2 -- ); --} -- -+ -+ return openserial_printInfoErrorCritical( -+ SERFRAME_MOTE2PC_CRITICAL, -+ calling_component, -+ error_code, -+ arg1, -+ arg2 -+ ); -+} -+ - uint8_t openserial_getNumDataBytes(void) { -- uint8_t inputBufFill; -+ uint8_t inputBufFill = 0; - // INTERRUPT_DECLARATION(); -- -+ - // DISABLE_INTERRUPTS(); - // inputBufFill = openserial_vars.inputBufFill; - // ENABLE_INTERRUPTS(); -- -- return inputBufFill-1; // removing the command byte --} -- --uint8_t openserial_getInputBuffer(uint8_t* bufferToWrite, uint8_t maxNumBytes) { -- uint8_t numBytesWritten; -+ -+ return inputBufFill-1; // removing the command byte -+} -+ -+uint8_t openserial_getInputBuffer(uint8_t* bufferToWrite, uint8_t maxNumBytes) { -+ uint8_t numBytesWritten = 0; - // uint8_t inputBufFill; - // INTERRUPT_DECLARATION(); - -@@ -229,10 +229,10 @@ uint8_t openserial_getInputBuffer(uint8_t* bufferToWrite, uint8_t maxNumBytes) { - // numBytesWritten = inputBufFill-1; - // memcpy(bufferToWrite,&(openserial_vars.inputBuf[1]),numBytesWritten); - // } -- -- return numBytesWritten; --} -- -+ -+ return numBytesWritten; -+} -+ - void openserial_startInput(void) { - // INTERRUPT_DECLARATION(); - -@@ -263,8 +263,8 @@ void openserial_startInput(void) { - // uart_writeByte(openserial_vars.reqFrame[openserial_vars.reqFrameIdx]); - // #endif - // ENABLE_INTERRUPTS(); --} -- -+} -+ - void openserial_startOutput(void) { - // //schedule a task to get new status in the output buffer - // uint8_t debugPrintCounter; -@@ -347,8 +347,8 @@ void openserial_startOutput(void) { - // openserial_stop(); - // } - // ENABLE_INTERRUPTS(); --} -- -+} -+ - void openserial_stop(void) { - // uint8_t inputBufFill; - // uint8_t cmdByte; -@@ -405,16 +405,16 @@ void openserial_stop(void) { - // openserial_vars.inputBufFill = 0; - // openserial_vars.busyReceiving = FALSE; - // ENABLE_INTERRUPTS(); --} -- --/** --\brief Trigger this module to print status information, over serial. -- --debugPrint_* functions are used by the openserial module to continuously print --status information about several modules in the OpenWSN stack. -- --\returns TRUE if this function printed something, FALSE otherwise. --*/ -+} -+ -+/** -+\brief Trigger this module to print status information, over serial. -+ -+debugPrint_* functions are used by the openserial module to continuously print -+status information about several modules in the OpenWSN stack. -+ -+\returns TRUE if this function printed something, FALSE otherwise. -+*/ - bool debugPrint_outBufferIndexes(void) { - // uint16_t temp_buffer[2]; - // INTERRUPT_DECLARATION(); -@@ -423,72 +423,72 @@ bool debugPrint_outBufferIndexes(void) { - // temp_buffer[1] = openserial_vars.outputBufIdxR; - // ENABLE_INTERRUPTS(); - // openserial_printStatus(STATUS_OUTBUFFERINDEXES,(uint8_t*)temp_buffer,sizeof(temp_buffer)); -- return TRUE; --} -- --//=========================== private ========================================= -- --//===== hdlc (output) -- --/** --\brief Start an HDLC frame in the output buffer. --*/ -+ return TRUE; -+} -+ -+//=========================== private ========================================= -+ -+//===== hdlc (output) -+ -+/** -+\brief Start an HDLC frame in the output buffer. -+*/ - port_INLINE void outputHdlcOpen(void) { - // // initialize the value of the CRC - // openserial_vars.outputCrc = HDLC_CRCINIT; -- -+ - // // write the opening HDLC flag - // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_FLAG; --} --/** --\brief Add a byte to the outgoing HDLC frame being built. --*/ --port_INLINE void outputHdlcWrite(uint8_t b) { -- -+} -+/** -+\brief Add a byte to the outgoing HDLC frame being built. -+*/ -+port_INLINE void outputHdlcWrite(uint8_t b) { -+ - // // iterate through CRC calculator - // openserial_vars.outputCrc = crcIteration(openserial_vars.outputCrc,b); -- -+ - // // add byte to buffer - // if (b==HDLC_FLAG || b==HDLC_ESCAPE) { - // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_ESCAPE; - // b = b^HDLC_ESCAPE_MASK; - // } - // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = b; -- --} --/** --\brief Finalize the outgoing HDLC frame. --*/ -+ -+} -+/** -+\brief Finalize the outgoing HDLC frame. -+*/ - port_INLINE void outputHdlcClose(void) { - // uint16_t finalCrc; -- -+ - // // finalize the calculation of the CRC - // finalCrc = ~openserial_vars.outputCrc; -- -+ - // // write the CRC value - // outputHdlcWrite((finalCrc>>0)&0xff); - // outputHdlcWrite((finalCrc>>8)&0xff); -- -+ - // // write the closing HDLC flag - // openserial_vars.outputBuf[openserial_vars.outputBufIdxW++] = HDLC_FLAG; --} -- --//===== hdlc (input) -- --/** --\brief Start an HDLC frame in the input buffer. --*/ -+} -+ -+//===== hdlc (input) -+ -+/** -+\brief Start an HDLC frame in the input buffer. -+*/ - port_INLINE void inputHdlcOpen(void) { - // // reset the input buffer index - // openserial_vars.inputBufFill = 0; -- -+ - // // initialize the value of the CRC - // openserial_vars.inputCrc = HDLC_CRCINIT; --} --/** --\brief Add a byte to the incoming HDLC frame. --*/ --port_INLINE void inputHdlcWrite(uint8_t b) { -+} -+/** -+\brief Add a byte to the incoming HDLC frame. -+*/ -+port_INLINE void inputHdlcWrite(uint8_t b) { - // if (b==HDLC_ESCAPE) { - // openserial_vars.inputEscaping = TRUE; - // } else { -@@ -496,37 +496,37 @@ port_INLINE void inputHdlcWrite(uint8_t b) { - // b = b^HDLC_ESCAPE_MASK; - // openserial_vars.inputEscaping = FALSE; - // } -- -+ - // // add byte to input buffer - // openserial_vars.inputBuf[openserial_vars.inputBufFill] = b; - // openserial_vars.inputBufFill++; -- -+ - // // iterate through CRC calculator - // openserial_vars.inputCrc = crcIteration(openserial_vars.inputCrc,b); - // } --} --/** --\brief Finalize the incoming HDLC frame. --*/ -+} -+/** -+\brief Finalize the incoming HDLC frame. -+*/ - port_INLINE void inputHdlcClose(void) { -- -+ - // // verify the validity of the frame - // if (openserial_vars.inputCrc==HDLC_CRCGOOD) { - // // the CRC is correct -- -+ - // // remove the CRC from the input buffer - // openserial_vars.inputBufFill -= 2; - // } else { - // // the CRC is incorrect -- -+ - // // drop the incoming fram - // openserial_vars.inputBufFill = 0; - // } --} -- --//=========================== interrupt handlers ============================== -- --//executed in ISR, called from scheduler.c -+} -+ -+//=========================== interrupt handlers ============================== -+ -+//executed in ISR, called from scheduler.c - void isr_openserial_tx(void) { - // switch (openserial_vars.mode) { - // case MODE_INPUT: -@@ -547,9 +547,9 @@ void isr_openserial_tx(void) { - // default: - // break; - // } --} -- --// executed in ISR, called from scheduler.c -+} -+ -+// executed in ISR, called from scheduler.c - void isr_openserial_rx(void) { - // uint8_t rxbyte; - // uint8_t inputBufFill; -@@ -570,13 +570,13 @@ void isr_openserial_rx(void) { - // rxbyte!=HDLC_FLAG - // ) { - // // start of frame -- -+ - // // I'm now receiving - // openserial_vars.busyReceiving = TRUE; -- -+ - // // create the HDLC frame - // inputHdlcOpen(); -- -+ - // // add the byte just received - // inputHdlcWrite(rxbyte); - // } else if ( -@@ -584,7 +584,7 @@ void isr_openserial_rx(void) { - // rxbyte!=HDLC_FLAG - // ) { - // // middle of frame -- -+ - // // add the byte just received - // inputHdlcWrite(rxbyte); - // if (openserial_vars.inputBufFill+1>SERIAL_INPUT_BUFFER_SIZE){ -@@ -601,28 +601,28 @@ void isr_openserial_rx(void) { - // rxbyte==HDLC_FLAG - // ) { - // // end of frame -- -+ - // // finalize the HDLC frame - // inputHdlcClose(); -- -+ - // if (openserial_vars.inputBufFill==0){ - // // invalid HDLC frame - // openserial_printError(COMPONENT_OPENSERIAL,ERR_WRONG_CRC_INPUT, - // (errorparameter_t)inputBufFill, - // (errorparameter_t)0); -- -+ - // } -- -+ - // openserial_vars.busyReceiving = FALSE; - // openserial_stop(); - // } -- -+ - // openserial_vars.lastRxByte = rxbyte; --} -- --//======== SERIAL ECHO ============= -- --void openserial_echo(uint8_t* buf, uint8_t bufLen){ -+} -+ -+//======== SERIAL ECHO ============= -+ -+void openserial_echo(uint8_t* buf, uint8_t bufLen){ - // INTERRUPT_DECLARATION(); - // // echo back what you received - // openserial_printData( -@@ -633,4 +633,4 @@ void openserial_echo(uint8_t* buf, uint8_t bufLen){ - // DISABLE_INTERRUPTS(); - // openserial_vars.inputBufFill = 0; - // ENABLE_INTERRUPTS(); --} -+} -diff --git a/drivers/common/opentimers.c b/drivers/common/opentimers.c -index 5c6ba4f..cd5c550 100644 ---- a/drivers/common/opentimers.c -+++ b/drivers/common/opentimers.c -@@ -9,9 +9,12 @@ at most MAX_NUM_TIMERS timers. - - #include "opendefs.h" - #include "opentimers.h" --#include "bsp_timer.h" -+#include "board_ow.h" - #include "leds.h" - -+#include "riot.h" -+#include "periph/timer.h" -+ - //=========================== define ========================================== - - //=========================== variables ======================================= -@@ -22,9 +25,19 @@ opentimers_vars_t opentimers_vars; - //=========================== prototypes ====================================== - - void opentimers_timer_callback(void); -+extern void radiotimer_isr(void); - - //=========================== public ========================================== - -+void timers_isr(int channel) { -+ if (channel) { -+ radiotimer_isr(); -+ } -+ else { -+ opentimers_timer_callback(); -+ } -+} -+ - /** - \brief Initialize this module. - -@@ -45,7 +58,8 @@ void opentimers_init(void) { - } - - // set callback for bsp_timers module -- bsp_timer_set_callback(opentimers_timer_callback); -+ // bsp_timer_set_callback(opentimers_timer_callback); -+ timer_init(OWSN_TIMER, 1, &timers_isr); - } - - /** -@@ -121,9 +135,13 @@ opentimer_id_t opentimers_start(uint32_t duration, timer_type_t type, time_type_ - ) { - opentimers_vars.currentTimeout = opentimers_vars.timersBuf[id].ticks_remaining; - if (opentimers_vars.running==FALSE) { -- bsp_timer_reset(); -+ // bsp_timer_reset(); -+ timer_reset(OWSN_TIMER); -+ timer_set_absolute(OWSN_TIMER, 0, 0); -+ timer_set_absolute(OWSN_TIMER, 1, 0); - } -- bsp_timer_scheduleIn(opentimers_vars.timersBuf[id].ticks_remaining); -+ // bsp_timer_scheduleIn(opentimers_vars.timersBuf[id].ticks_remaining); -+ timer_set(OWSN_TIMER, 0, opentimers_vars.timersBuf[id].ticks_remaining); - } - - opentimers_vars.running = TRUE; -@@ -274,7 +292,8 @@ void opentimers_timer_callback(void) { - if (found==TRUE) { - // at least one timer pending - opentimers_vars.currentTimeout = min_timeout; -- bsp_timer_scheduleIn(opentimers_vars.currentTimeout); -+ // bsp_timer_scheduleIn(opentimers_vars.currentTimeout); -+ timer_set(OWSN_TIMER, 0, opentimers_vars.currentTimeout); - } else { - // no more timers pending - opentimers_vars.running = FALSE; -@@ -355,7 +374,8 @@ void opentimers_sleepTimeCompesation(uint16_t sleepTime) - if (found==TRUE) { - // at least one timer pending - opentimers_vars.currentTimeout = min_timeout; -- bsp_timer_scheduleIn(opentimers_vars.currentTimeout); -+ // bsp_timer_scheduleIn(opentimers_vars.currentTimeout); -+ timer_set(OWSN_TIMER, 0, opentimers_vars.currentTimeout); - } else { - // no more timers pending - opentimers_vars.running = FALSE; -diff --git a/kernel/openos/scheduler.c b/kernel/openos/scheduler.c -index 367513c..a5589ff 100644 ---- a/kernel/openos/scheduler.c -+++ b/kernel/openos/scheduler.c -@@ -10,6 +10,11 @@ - #include "debugpins.h" - #include "leds.h" - -+#include "thread.h" -+ -+#define ENABLE_DEBUG (0) -+#include "debug.h" -+ - //=========================== variables ======================================= - - scheduler_vars_t scheduler_vars; -@@ -18,14 +23,13 @@ scheduler_dbg_t scheduler_dbg; - //=========================== prototypes ====================================== - - void consumeTask(uint8_t taskId); -- --//=========================== public ========================================== -- -+ -+//=========================== public ========================================== -+ - void scheduler_init(void) { -- -- // initialization module variables -- memset(&scheduler_vars,0,sizeof(scheduler_vars_t)); -- memset(&scheduler_dbg,0,sizeof(scheduler_dbg_t)); -+ // initialization module variables -+ memset(&scheduler_vars,0,sizeof(scheduler_vars_t)); -+ memset(&scheduler_dbg,0,sizeof(scheduler_dbg_t)); - - // enable the scheduler's interrupt so SW can wake up the scheduler - SCHEDULER_ENABLE_INTERRUPT(); -@@ -53,7 +57,8 @@ void scheduler_start(void) { - scheduler_dbg.numTasksCur--; - } - debugpins_task_clr(); -- board_sleep(); -+ // board_sleep(); -+ thread_yield(); - debugpins_task_set(); // IAR should halt here if nothing to do - } - } -@@ -63,6 +68,7 @@ void scheduler_start(void) { - taskList_item_t** taskListWalker; - INTERRUPT_DECLARATION(); - -+ DEBUG("owsn scheduler: push back task %p.\n", (void *)cb); - DISABLE_INTERRUPTS(); - - // find an empty task container -diff --git a/openapps/Makefile b/openapps/Makefile -index ab615ba..57aa5c8 100644 ---- a/openapps/Makefile -+++ b/openapps/Makefile -@@ -2,7 +2,11 @@ - - DIRS += $(CURDIR)/c6t \ - $(CURDIR)/uecho \ -- $(CURDIR)/techo -+ $(CURDIR)/techo \ -+ $(CURDIR)/cinfo \ -+ $(CURDIR)/cleds \ -+ $(CURDIR)/cstorm \ -+ $(CURDIR)/cwellknown - - INCLUDES += -I$(CURDIR)/c6t \ - -I$(CURDIR)/techo \ -diff --git a/openapps/cstorm/cstorm.c b/openapps/cstorm/cstorm.c -index ffcf106..c0cdcc3 100644 ---- a/openapps/cstorm/cstorm.c -+++ b/openapps/cstorm/cstorm.c -@@ -196,7 +196,7 @@ void cstorm_task_cb(void) { - - // content-type option - packetfunctions_reserveHeaderSize(pkt,2); -- pkt->payload[0] = (COAP_OPTION_NUM_CONTENTFORMAT-COAP_OPTION_NUM_URIPATH) << 4 | sizeof(cstorm_payload)-1; -+ pkt->payload[0] = (((COAP_OPTION_NUM_CONTENTFORMAT-COAP_OPTION_NUM_URIPATH) << 4) | (sizeof(cstorm_payload)-1)); - pkt->payload[1] = COAP_MEDTYPE_APPOCTETSTREAM; - numOptions++; - -diff --git a/openapps/uecho/uecho.c b/openapps/uecho/uecho.c -index 1141c51..d98f0fe 100644 ---- a/openapps/uecho/uecho.c -+++ b/openapps/uecho/uecho.c -@@ -5,8 +5,13 @@ - #include "openserial.h" - #include "packetfunctions.h" - --//=========================== variables ======================================= -+#include "riot.h" -+ -+#define ENABLE_DEBUG (0) -+#include "debug.h" - -+//=========================== variables ======================================= -+uint8_t expect_echo; - //=========================== prototypes ====================================== - - //=========================== public ========================================== -@@ -17,37 +22,43 @@ void uecho_init(void) { - void uecho_receive(OpenQueueEntry_t* request) { - uint16_t temp_l4_destination_port; - OpenQueueEntry_t* reply; -- -- reply = openqueue_getFreePacketBuffer(COMPONENT_UECHO); -- if (reply==NULL) { -- openserial_printError( -- COMPONENT_UECHO, -- ERR_NO_FREE_PACKET_BUFFER, -- (errorparameter_t)0, -- (errorparameter_t)0 -- ); -- return; -+ -+ if (!expect_echo) { -+ reply = openqueue_getFreePacketBuffer(COMPONENT_UECHO); -+ if (reply==NULL) { -+ openserial_printError( -+ COMPONENT_UECHO, -+ ERR_NO_FREE_PACKET_BUFFER, -+ (errorparameter_t)0, -+ (errorparameter_t)0 -+ ); -+ return; -+ } -+ -+ reply->owner = COMPONENT_UECHO; -+ -+ // reply with the same OpenQueueEntry_t -+ reply->creator = COMPONENT_UECHO; -+ reply->l4_protocol = IANA_UDP; -+ temp_l4_destination_port = request->l4_destination_port; -+ reply->l4_destination_port = request->l4_sourcePortORicmpv6Type; -+ reply->l4_sourcePortORicmpv6Type = temp_l4_destination_port; -+ reply->l3_destinationAdd.type = ADDR_128B; -+ -+ // copy source to destination to echo. -+ memcpy(&reply->l3_destinationAdd.addr_128b[0],&request->l3_sourceAdd.addr_128b[0],16); -+ -+ packetfunctions_reserveHeaderSize(reply,request->length); -+ memcpy(&reply->payload[0],&request->payload[0],request->length); -+ openqueue_freePacketBuffer(request); -+ -+ if ((openudp_send(reply))==E_FAIL) { -+ openqueue_freePacketBuffer(reply); -+ } - } -- -- reply->owner = COMPONENT_UECHO; -- -- // reply with the same OpenQueueEntry_t -- reply->creator = COMPONENT_UECHO; -- reply->l4_protocol = IANA_UDP; -- temp_l4_destination_port = request->l4_destination_port; -- reply->l4_destination_port = request->l4_sourcePortORicmpv6Type; -- reply->l4_sourcePortORicmpv6Type = temp_l4_destination_port; -- reply->l3_destinationAdd.type = ADDR_128B; -- -- // copy source to destination to echo. -- memcpy(&reply->l3_destinationAdd.addr_128b[0],&request->l3_sourceAdd.addr_128b[0],16); -- -- packetfunctions_reserveHeaderSize(reply,request->length); -- memcpy(&reply->payload[0],&request->payload[0],request->length); -- openqueue_freePacketBuffer(request); -- -- if ((openudp_send(reply))==E_FAIL) { -- openqueue_freePacketBuffer(reply); -+ else { -+ openqueue_freePacketBuffer(request); -+ expect_echo = FALSE; - } - } - -@@ -59,4 +70,29 @@ bool uecho_debugPrint(void) { - return FALSE; - } - -+void uecho_send(uint8_t *dest_addr) -+{ -+ OpenQueueEntry_t *request; -+ request = openqueue_getFreePacketBuffer(COMPONENT_UECHO); -+ -+ if (request==NULL) { -+ DEBUG("UECHO: ERROR, no free packet.\n"); -+ return; -+ } -+ -+ request->owner = COMPONENT_UECHO; -+ request->creator = COMPONENT_UECHO; -+ request->l4_protocol = IANA_UDP; -+ request->l4_destination_port = UDP_PORTS_16b_SRC_16b_DEST_INLINE; -+ request->l4_sourcePortORicmpv6Type = UDP_PORTS_16b_SRC_16b_DEST_INLINE; -+ request->l3_destinationAdd.type = ADDR_128B; -+ memcpy(&(request->l3_destinationAdd.addr_128b[0]), dest_addr, 16); -+ -+ packetfunctions_reserveHeaderSize(request, 13); -+ expect_echo = TRUE; -+ if ((openudp_send(request))==E_FAIL) { -+ openqueue_freePacketBuffer(request); -+ } -+} -+ - //=========================== private ========================================= -\ No newline at end of file -diff --git a/openstack/02a-MAClow/IEEE802154E.c b/openstack/02a-MAClow/IEEE802154E.c -index 461a8bd..c0038a7 100644 ---- a/openstack/02a-MAClow/IEEE802154E.c -+++ b/openstack/02a-MAClow/IEEE802154E.c -@@ -16,6 +16,9 @@ - #include "adaptive_sync.h" - #include "processIE.h" - -+#define ENABLE_DEBUG (0) -+#include "debug.h" -+ - //=========================== variables ======================================= - - ieee154e_vars_t ieee154e_vars; -@@ -1849,9 +1852,11 @@ void changeIsSync(bool newIsSync) { - ieee154e_vars.isSync = newIsSync; - - if (ieee154e_vars.isSync==TRUE) { -+ DEBUG("Synced.\n"); - leds_sync_on(); - resetStats(); - } else { -+ DEBUG("Unsynced.\n"); - leds_sync_off(); - schedule_resetBackoff(); - } -diff --git a/openstack/02a-MAClow/IEEE802154E.h b/openstack/02a-MAClow/IEEE802154E.h -index fd3fe17..ef34b71 100644 ---- a/openstack/02a-MAClow/IEEE802154E.h -+++ b/openstack/02a-MAClow/IEEE802154E.h -@@ -127,10 +127,10 @@ typedef enum { - // - duration_in_seconds = ticks / 32768 - enum ieee154e_atomicdurations_enum { - // time-slot related -- TsTxOffset = 131, // 4000us -- TsLongGT = 43, // 1300us -- TsTxAckDelay = 151, // 4606us -- TsShortGT = 16, // 500us -+ TsTxOffset = 4000, // 4000us -+ TsLongGT = 1300, // 1300us -+ TsTxAckDelay = 4606, // 4606us -+ TsShortGT = 500, // 500us - TsSlotDuration = PORT_TsSlotDuration, // 15000us - // execution speed related - maxTxDataPrepare = PORT_maxTxDataPrepare, -@@ -141,9 +141,9 @@ enum ieee154e_atomicdurations_enum { - delayTx = PORT_delayTx, // between GO signal and SFD - delayRx = PORT_delayRx, // between GO signal and start listening - // radio watchdog -- wdRadioTx = 33, // 1000us (needs to be >delayTx) -- wdDataDuration = 164, // 5000us (measured 4280us with max payload) -- wdAckDuration = 98, // 3000us (measured 1000us) -+ wdRadioTx = 1000, // 1000us (needs to be >delayTx) -+ wdDataDuration = 5000, // 5000us (measured 4280us with max payload) -+ wdAckDuration = 3000, // 3000us (measured 1000us) - }; - - //shift of bytes in the linkOption bitmap -diff --git a/openstack/02b-MAChigh/schedule.c b/openstack/02b-MAChigh/schedule.c -index fafb6f6..933534f 100644 ---- a/openstack/02b-MAChigh/schedule.c -+++ b/openstack/02b-MAChigh/schedule.c -@@ -52,21 +52,21 @@ void schedule_init(void) { - ); - running_slotOffset++; - } -- -- // shared TXRX anycast slot(s) -- memset(&temp_neighbor,0,sizeof(temp_neighbor)); -- temp_neighbor.type = ADDR_ANYCAST; -- for (i=0;i, August 2010 --*/ -- -+\brief This project runs the full OpenWSN stack. -+ -+\author Thomas Watteyne , August 2010 -+\author Thomas Eichinger , December 2014 -+*/ -+ - #include "thread.h" - - #include "board_ow.h" - #include "leds.h" --#include "scheduler.h" --#include "openstack.h" --#include "opendefs.h" -- -+#include "scheduler.h" -+#include "openstack.h" -+#include "opendefs.h" -+#include "idmanager.h" -+ - #include "03oos_openwsn.h" - -+#include "riot.h" -+ - #define ENABLE_DEBUG (0) - #include "debug.h" - --static char openwsn_stack[THREAD_STACKSIZE_MAIN]; --int openwsn_pid = -1; -+static char openwsn_stack[THREAD_STACKSIZE_MAIN*2]; -+kernel_pid_t openwsn_pid = -1; -+uint8_t owsn_mop; - - void openwsn_init(void); - void* openwsn_start(void *arg); - --void openwsn_start_thread(void) { -+void openwsn_start_thread(int argc, char **argv) { - DEBUG("%s\n",__PRETTY_FUNCTION__); -- openwsn_pid = thread_create(openwsn_stack, THREAD_STACKSIZE_MAIN, -- PRIORITY_OPENWSN-2, CREATE_STACKTEST, -- openwsn_start, NULL, "openwsn thread"); -+ if (argc < 2) { -+ printf("usage: %s (r|n)\n", argv[0]); -+ puts("\tr\tinitialise as DAGROOT."); -+ puts("\tn\tinitialise as node."); -+ return; -+ } -+ -+ char command = argv[1][0]; -+ if (command == 'r') { -+ printf("Starting OpenWSN as root ... "); -+ owsn_mop = 1; -+ openwsn_pid = thread_create(openwsn_stack, THREAD_STACKSIZE_MAIN, -+ PRIORITY_OPENWSN, CREATE_STACKTEST, -+ openwsn_start, (void*)&owsn_mop, "openwsn thread"); -+ } -+ else { -+ printf("Starting OpenWSN as node ... "); -+ owsn_mop = 0; -+ openwsn_pid = thread_create(openwsn_stack, THREAD_STACKSIZE_MAIN, -+ PRIORITY_OPENWSN, CREATE_STACKTEST, -+ openwsn_start, (void*)&owsn_mop, "openwsn thread"); -+ } - } - - void* openwsn_start(void *arg) { - DEBUG("%s\n",__PRETTY_FUNCTION__); -- (void)arg; - leds_all_off(); - board_init_ow(); - scheduler_init(); -- openstack_init(); -- puts("OpenWSN thread started."); -+ openstack_init(*((uint8_t*)arg)); -+ puts("DONE"); - scheduler_start(); - return NULL; - } - --int mote_main(void) { -- -- // initialize -- board_init(); -- scheduler_init(); -- openstack_init(); -- -- // indicate -- -- // start -- scheduler_start(); -- return 0; // this line should never be reached --} -diff --git a/projects/common/03oos_openwsn/03oos_openwsn.h b/projects/common/03oos_openwsn/03oos_openwsn.h -index 5a9f1fa..8125096 100644 ---- a/projects/common/03oos_openwsn/03oos_openwsn.h -+++ b/projects/common/03oos_openwsn/03oos_openwsn.h -@@ -4,10 +4,10 @@ - \author Thomas Watteyne , August 2010 - */ - --#ifndef __openwsn_H --#define __openwsn_H -- --void openwsn_start_thread(void); -+#ifndef __openwsn_H -+#define __openwsn_H -+ -+void openwsn_start_thread(int argc, char **argv); - - //=========================== define ========================================== - -diff --git a/projects/common/03oos_openwsn/Makefile b/projects/common/03oos_openwsn/Makefile -index 47289c6..5ebc02a 100644 ---- a/projects/common/03oos_openwsn/Makefile -+++ b/projects/common/03oos_openwsn/Makefile -@@ -1,3 +1,5 @@ - #MODULE = openwsn - -+INCLUDES += -I$(OPENWSN_ROOT)/openstack/cross-layers -+ - include $(RIOTBASE)/Makefile.base --- -2.2.0 -