pkg/openwsn: update to current openwsn version
parent
82be58e35a
commit
a9379881cf
@ -0,0 +1 @@
|
||||
openwsn
|
@ -0,0 +1,265 @@
|
||||
From 740dc78ea84dceea25670c94faf6a81ef845fc39 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Eichinger <thomas.eichinger1@gmail.com>
|
||||
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
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,990 @@
|
||||
From 5bcbe4daaed320af19815f6ec949f3f9d105f4d1 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Eichinger <thomas.eichinger1@gmail.com>
|
||||
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;i<length;i++){
|
||||
- outputHdlcWrite(buffer[i]);
|
||||
- }
|
||||
- outputHdlcClose();
|
||||
- ENABLE_INTERRUPTS();
|
||||
+ // 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;i<length;i++){
|
||||
+ // outputHdlcWrite(buffer[i]);
|
||||
+ // }
|
||||
+ // outputHdlcClose();
|
||||
+ // ENABLE_INTERRUPTS();
|
||||
|
||||
return E_SUCCESS;
|
||||
}
|
||||
@@ -105,50 +105,50 @@ owerror_t openserial_printInfoErrorCritical(
|
||||
errorparameter_t arg1,
|
||||
errorparameter_t arg2
|
||||
) {
|
||||
- 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();
|
||||
+ // 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;i<length;i++){
|
||||
- outputHdlcWrite(buffer[i]);
|
||||
- }
|
||||
- outputHdlcClose();
|
||||
- ENABLE_INTERRUPTS();
|
||||
+ // 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;i<length;i++){
|
||||
+ // outputHdlcWrite(buffer[i]);
|
||||
+ // }
|
||||
+ // outputHdlcClose();
|
||||
+ // ENABLE_INTERRUPTS();
|
||||
|
||||
return E_SUCCESS;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ 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();
|
||||
+ // leds_error_toggle();
|
||||
|
||||
return openserial_printInfoErrorCritical(
|
||||
SERFRAME_MOTE2PC_ERROR,
|
||||
@@ -184,12 +184,12 @@ 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();
|
||||
+ // leds_error_blink();
|
||||
|
||||
- // schedule for the mote to reboot in 10s
|
||||
- opentimers_start(10000,
|
||||
- TIMER_ONESHOT,TIME_MS,
|
||||
- board_reset);
|
||||
+ // // schedule for the mote to reboot in 10s
|
||||
+ // opentimers_start(10000,
|
||||
+ // TIMER_ONESHOT,TIME_MS,
|
||||
+ // board_reset);
|
||||
|
||||
return openserial_printInfoErrorCritical(
|
||||
SERFRAME_MOTE2PC_CRITICAL,
|
||||
@@ -202,209 +202,209 @@ owerror_t openserial_printCritical(uint8_t calling_component, uint8_t error_code
|
||||
|
||||
uint8_t openserial_getNumDataBytes(void) {
|
||||
uint8_t inputBufFill;
|
||||
- INTERRUPT_DECLARATION();
|
||||
+ // INTERRUPT_DECLARATION();
|
||||
|
||||
- DISABLE_INTERRUPTS();
|
||||
- inputBufFill = openserial_vars.inputBufFill;
|
||||
- ENABLE_INTERRUPTS();
|
||||
+ // 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;
|
||||
- uint8_t inputBufFill;
|
||||
- INTERRUPT_DECLARATION();
|
||||
-
|
||||
- DISABLE_INTERRUPTS();
|
||||
- inputBufFill = openserial_vars.inputBufFill;
|
||||
- ENABLE_INTERRUPTS();
|
||||
-
|
||||
- if (maxNumBytes<inputBufFill-1) {
|
||||
- openserial_printError(COMPONENT_OPENSERIAL,ERR_GETDATA_ASKS_TOO_FEW_BYTES,
|
||||
- (errorparameter_t)maxNumBytes,
|
||||
- (errorparameter_t)inputBufFill-1);
|
||||
- numBytesWritten = 0;
|
||||
- } else {
|
||||
- numBytesWritten = inputBufFill-1;
|
||||
- memcpy(bufferToWrite,&(openserial_vars.inputBuf[1]),numBytesWritten);
|
||||
- }
|
||||
+ // uint8_t inputBufFill;
|
||||
+ // INTERRUPT_DECLARATION();
|
||||
+
|
||||
+ // DISABLE_INTERRUPTS();
|
||||
+ // inputBufFill = openserial_vars.inputBufFill;
|
||||
+ // ENABLE_INTERRUPTS();
|
||||
+
|
||||
+ // if (maxNumBytes<inputBufFill-1) {
|
||||
+ // openserial_printError(COMPONENT_OPENSERIAL,ERR_GETDATA_ASKS_TOO_FEW_BYTES,
|
||||
+ // (errorparameter_t)maxNumBytes,
|
||||
+ // (errorparameter_t)inputBufFill-1);
|
||||
+ // numBytesWritten = 0;
|
||||
+ // } else {
|
||||
+ // numBytesWritten = inputBufFill-1;
|
||||
+ // memcpy(bufferToWrite,&(openserial_vars.inputBuf[1]),numBytesWritten);
|
||||
+ // }
|
||||
|
||||
return numBytesWritten;
|
||||
}
|
||||
|
||||
void openserial_startInput(void) {
|
||||
- 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();
|
||||
+// 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.reqFrameIdx<sizeof(openserial_vars.reqFrame)) {
|
||||
- uart_writeByte(openserial_vars.reqFrame[openserial_vars.reqFrameIdx]);
|
||||
- }
|
||||
- break;
|
||||
- case MODE_OUTPUT:
|
||||
- if (openserial_vars.outputBufIdxW==openserial_vars.outputBufIdxR) {
|
||||
- openserial_vars.outputBufFilled = FALSE;
|
||||
- }
|
||||
- if (openserial_vars.outputBufFilled) {
|
||||
- uart_writeByte(openserial_vars.outputBuf[openserial_vars.outputBufIdxR++]);
|
||||
- }
|
||||
- break;
|
||||
- case MODE_OFF:
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
+ // switch (openserial_vars.mode) {
|
||||
+ // case MODE_INPUT:
|
||||
+ // openserial_vars.reqFrameIdx++;
|
||||
+ // if (openserial_vars.reqFrameIdx<sizeof(openserial_vars.reqFrame)) {
|
||||
+ // uart_writeByte(openserial_vars.reqFrame[openserial_vars.reqFrameIdx]);
|
||||
+ // }
|
||||
+ // break;
|
||||
+ // case MODE_OUTPUT:
|
||||
+ // if (openserial_vars.outputBufIdxW==openserial_vars.outputBufIdxR) {
|
||||
+ // openserial_vars.outputBufFilled = FALSE;
|
||||
+ // }
|
||||
+ // if (openserial_vars.outputBufFilled) {
|
||||
+ // uart_writeByte(openserial_vars.outputBuf[openserial_vars.outputBufIdxR++]);
|
||||
+ // }
|
||||
+ // break;
|
||||
+ // case MODE_OFF:
|
||||
+ // default:
|
||||
+ // break;
|
||||
+ // }
|
||||
}
|
||||
|
||||
// executed in ISR, called from scheduler.c
|
||||
void isr_openserial_rx(void) {
|
||||
- uint8_t rxbyte;
|
||||
- uint8_t inputBufFill;
|
||||
-
|
||||
- // stop if I'm not in input mode
|
||||
- if (openserial_vars.mode!=MODE_INPUT) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- // read byte just received
|
||||
- rxbyte = uart_readByte();
|
||||
- //keep lenght
|
||||
- inputBufFill=openserial_vars.inputBufFill;
|
||||
-
|
||||
- if (
|
||||
- openserial_vars.busyReceiving==FALSE &&
|
||||
- openserial_vars.lastRxByte==HDLC_FLAG &&
|
||||
- rxbyte!=HDLC_FLAG
|
||||
- ) {
|
||||
- // start of frame
|
||||
+ // uint8_t rxbyte;
|
||||
+ // uint8_t inputBufFill;
|
||||
+
|
||||
+ // // stop if I'm not in input mode
|
||||
+ // if (openserial_vars.mode!=MODE_INPUT) {
|
||||
+ // return;
|
||||
+ // }
|
||||
+
|
||||
+ // // read byte just received
|
||||
+ // rxbyte = uart_readByte();
|
||||
+ // //keep lenght
|
||||
+ // inputBufFill=openserial_vars.inputBufFill;
|
||||
+
|
||||
+ // if (
|
||||
+ // openserial_vars.busyReceiving==FALSE &&
|
||||
+ // openserial_vars.lastRxByte==HDLC_FLAG &&
|
||||
+ // rxbyte!=HDLC_FLAG
|
||||
+ // ) {
|
||||
+ // // start of frame
|
||||
|
||||
- // I'm now receiving
|
||||
- openserial_vars.busyReceiving = TRUE;
|
||||
+ // // I'm now receiving
|
||||
+ // openserial_vars.busyReceiving = TRUE;
|
||||
|
||||
- // create the HDLC frame
|
||||
- inputHdlcOpen();
|
||||
+ // // create the HDLC frame
|
||||
+ // inputHdlcOpen();
|
||||
|
||||
- // add the byte just received
|
||||
- inputHdlcWrite(rxbyte);
|
||||
- } else if (
|
||||
- openserial_vars.busyReceiving==TRUE &&
|
||||
- rxbyte!=HDLC_FLAG
|
||||
- ) {
|
||||
- // middle of frame
|
||||
+ // // add the byte just received
|
||||
+ // inputHdlcWrite(rxbyte);
|
||||
+ // } else if (
|
||||
+ // openserial_vars.busyReceiving==TRUE &&
|
||||
+ // rxbyte!=HDLC_FLAG
|
||||
+ // ) {
|
||||
+ // // middle 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
|
||||
+ // // 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
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue