pkg/openwsn: remove old openwsn pkg
parent
3a2867fa50
commit
82be58e35a
@ -1,2 +0,0 @@
|
||||
RB-1.4.zip
|
||||
RB-1.4
|
@ -1,26 +1,36 @@
|
||||
PKG_NAME=RB
|
||||
PKG_URL=https://codeload.github.com/openwsn-berkeley/openwsn-fw
|
||||
PKG_VERSION=1.4
|
||||
PKG_EXT=zip
|
||||
PKG_NAME=openwsn-work
|
||||
PKG_URL=https://github.com/openwsn-berkeley/openwsn-fw.git
|
||||
PKG_VERSION=ff25e5d0ae5d344ed793a724d60532fb917bf1f8
|
||||
PKG_DIR=$(CURDIR)/$(PKG_NAME)
|
||||
|
||||
.PHONY: all clean
|
||||
ifneq ($(RIOTBOARD),)
|
||||
include $(RIOTBOARD)/$(BOARD)/Makefile.include
|
||||
endif
|
||||
|
||||
all: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/
|
||||
$(info *INFO* Building OpenWSN pkg)
|
||||
make -C $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
.PHONY: all clean patch reset
|
||||
|
||||
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)/: $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
|
||||
$(AD)rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
$(AD)$(UNZIP_HERE) $< -d $(PKG_NAME)-$(PKG_VERSION)
|
||||
$(AD)cd $@ && sh $(CURDIR)/structure_changes.sh
|
||||
$(AD)cd $@ && sh $(CURDIR)/apply_patches.sh
|
||||
all: patch
|
||||
"$(MAKE)" -C $(PKG_DIR)
|
||||
|
||||
$(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT):
|
||||
# Get PKG_VERSION of package from PKG_URL
|
||||
$(AD)$(DOWNLOAD_TO_FILE) $@ $(PKG_URL)/$(PKG_EXT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
patch: $(PKG_DIR)/Makefile
|
||||
|
||||
clean::
|
||||
rm -rf $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
$(PKG_DIR)/Makefile: $(PKG_DIR)/.git/config
|
||||
cd "$(PKG_DIR)" #&& git am --ignore-whitespace "$(CURDIR)/patches/*.patch"
|
||||
|
||||
distclean::
|
||||
rm -f $(CURDIR)/$(PKG_NAME)-$(PKG_VERSION).$(PKG_EXT)
|
||||
$(PKG_DIR)/.git/config:
|
||||
test -d "$(PKG_DIR)" || git clone "$(PKG_URL)" "$(PKG_DIR)"; \
|
||||
cd "$(PKG_DIR)" && git checkout -f "$(PKG_VERSION)"
|
||||
|
||||
# clean::
|
||||
# @echo "Cleaning up OpenWSN package..."
|
||||
# @cd "$(PKG_DIR)" 2> /dev/null > /dev/null && \
|
||||
# git clean -x -f && \
|
||||
# git am --abort && \
|
||||
# git reset --hard "$(PKG_VERSION)" && \
|
||||
# $(MAKE) patch || true
|
||||
|
||||
# distclean::
|
||||
# rm -rf "$(PKG_DIR)"
|
||||
|
||||
Makefile.include:
|
||||
@true
|
@ -1,9 +0,0 @@
|
||||
DIRS =
|
||||
DIRS += openwsn
|
||||
|
||||
all::
|
||||
@for i in $(DIRS) ; do "$(MAKE)" -C $$i || exit 1; done ;
|
||||
|
||||
# remove compilation products
|
||||
clean::
|
||||
@for i in $(DIRS) ; do "$(MAKE)" -C $$i clean || exit 1; done ;
|
@ -1 +0,0 @@
|
||||
export INCLUDES += -I${RIOTBASE}/drivers/include/
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
set -o nounset # Treat unset variables as an error
|
||||
|
||||
if [[ $QUIET == "1" ]]; then
|
||||
for i in `ls ../patches`; do
|
||||
patch -p1 -N -i ../patches/$i > /dev/null
|
||||
done
|
||||
else
|
||||
for i in `ls ../patches`; do
|
||||
patch -p1 -N -i ../patches/$i
|
||||
done
|
||||
fi
|
||||
exit 0
|
@ -1,235 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/IEEE802154.c Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/IEEE802154.c Thu Mar 27 11:10:40 2014
|
||||
***************
|
||||
*** 16,35 ****
|
||||
|
||||
Note that we are writing the field from the end of the header to the beginning.
|
||||
|
||||
! \param msg [in,out] The message to append the header to.
|
||||
! \param frameType [in] Type of IEEE802.15.4 frame.
|
||||
! \param securityEnabled [in] Is security enabled on this frame?
|
||||
! \param nextHop [in] Address of the next hop
|
||||
*/
|
||||
void ieee802154_prependHeader(OpenQueueEntry_t* msg,
|
||||
uint8_t frameType,
|
||||
bool securityEnabled,
|
||||
uint8_t sequenceNumber,
|
||||
open_addr_t* nextHop) {
|
||||
uint8_t temp_8b;
|
||||
|
||||
// previousHop address (always 64-bit)
|
||||
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_64B),LITTLE_ENDIAN);
|
||||
// nextHop address
|
||||
if (packetfunctions_isBroadcastMulticast(nextHop)) {
|
||||
//broadcast address is always 16-bit
|
||||
--- 16,42 ----
|
||||
|
||||
Note that we are writing the field from the end of the header to the beginning.
|
||||
|
||||
! \param[in,out] msg The message to append the header to.
|
||||
! \param[in] frameType Type of IEEE802.15.4 frame.
|
||||
! \param[in] ielistpresent Is the IE list present¿
|
||||
! \param[in] frameVersion IEEE802.15.4 frame version.
|
||||
! \param[in] securityEnabled Is security enabled on this frame?
|
||||
! \param[in] sequenceNumber Sequence number of this frame.
|
||||
! \param[in] nextHop Address of the next hop
|
||||
*/
|
||||
void ieee802154_prependHeader(OpenQueueEntry_t* msg,
|
||||
uint8_t frameType,
|
||||
+ uint8_t ielistpresent,
|
||||
+ uint8_t frameversion,
|
||||
bool securityEnabled,
|
||||
uint8_t sequenceNumber,
|
||||
open_addr_t* nextHop) {
|
||||
uint8_t temp_8b;
|
||||
|
||||
+ //General IEs here (those that are carried in all packets) -- None by now.
|
||||
+
|
||||
// previousHop address (always 64-bit)
|
||||
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_64B),OW_LITTLE_ENDIAN);
|
||||
// nextHop address
|
||||
if (packetfunctions_isBroadcastMulticast(nextHop)) {
|
||||
//broadcast address is always 16-bit
|
||||
***************
|
||||
*** 41,47 ****
|
||||
switch (nextHop->type) {
|
||||
case ADDR_16B:
|
||||
case ADDR_64B:
|
||||
! packetfunctions_writeAddress(msg,nextHop,LITTLE_ENDIAN);
|
||||
break;
|
||||
default:
|
||||
openserial_printCritical(COMPONENT_IEEE802154,ERR_WRONG_ADDR_TYPE,
|
||||
--- 48,54 ----
|
||||
switch (nextHop->type) {
|
||||
case ADDR_16B:
|
||||
case ADDR_64B:
|
||||
! packetfunctions_writeAddress(msg,nextHop,OW_LITTLE_ENDIAN);
|
||||
break;
|
||||
default:
|
||||
openserial_printCritical(COMPONENT_IEEE802154,ERR_WRONG_ADDR_TYPE,
|
||||
***************
|
||||
*** 51,57 ****
|
||||
|
||||
}
|
||||
// destpan
|
||||
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_PANID),LITTLE_ENDIAN);
|
||||
//dsn
|
||||
packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
|
||||
*((uint8_t*)(msg->payload)) = sequenceNumber;
|
||||
--- 58,64 ----
|
||||
|
||||
}
|
||||
// destpan
|
||||
! packetfunctions_writeAddress(msg,idmanager_getMyID(ADDR_PANID),OW_LITTLE_ENDIAN);
|
||||
//dsn
|
||||
packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
|
||||
*((uint8_t*)(msg->payload)) = sequenceNumber;
|
||||
***************
|
||||
*** 72,77 ****
|
||||
--- 79,88 ----
|
||||
}
|
||||
}
|
||||
temp_8b |= IEEE154_ADDR_EXT << IEEE154_FCF_SRC_ADDR_MODE;
|
||||
+ //poipoi xv IE list present
|
||||
+ temp_8b |= ielistpresent << IEEE154_FCF_IELIST_PRESENT;
|
||||
+ temp_8b |= frameversion << IEEE154_FCF_FRAME_VERSION;
|
||||
+
|
||||
*((uint8_t*)(msg->payload)) = temp_8b;
|
||||
//fcf (1st byte)
|
||||
packetfunctions_reserveHeaderSize(msg,sizeof(uint8_t));
|
||||
***************
|
||||
*** 93,100 ****
|
||||
|
||||
Note We are writing the fields from the begnning of the header to the end.
|
||||
|
||||
! \param msg [in,out] The message just received.
|
||||
! \param ieee802514_header [out] The internal header to write the data to.
|
||||
*/
|
||||
void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,
|
||||
ieee802154_header_iht* ieee802514_header) {
|
||||
--- 104,111 ----
|
||||
|
||||
Note We are writing the fields from the begnning of the header to the end.
|
||||
|
||||
! \param[in,out] msg The message just received.
|
||||
! \param[out] ieee802514_header The internal header to write the data to.
|
||||
*/
|
||||
void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,
|
||||
ieee802154_header_iht* ieee802514_header) {
|
||||
***************
|
||||
*** 117,122 ****
|
||||
--- 128,141 ----
|
||||
// fcf, byte 2
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
temp_8b = *((uint8_t*)(msg->payload)+ieee802514_header->headerLength);
|
||||
+ //poipoi xv IE list present
|
||||
+ ieee802514_header->ieListPresent = (temp_8b >> IEEE154_FCF_IELIST_PRESENT ) & 0x01;//1b
|
||||
+ ieee802514_header->frameVersion = (temp_8b >> IEEE154_FCF_FRAME_VERSION ) & 0x03;//2b
|
||||
+
|
||||
+ if (ieee802514_header->ieListPresent==TRUE && ieee802514_header->frameVersion!=IEEE154_FRAMEVERSION){
|
||||
+ return; //invalid packet accordint to p.64 IEEE15.4e
|
||||
+ }
|
||||
+
|
||||
switch ( (temp_8b >> IEEE154_FCF_DEST_ADDR_MODE ) & 0x03 ) {
|
||||
case IEEE154_ADDR_NONE:
|
||||
ieee802514_header->dest.type = ADDR_NONE;
|
||||
***************
|
||||
*** 159,165 ****
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_PANID,
|
||||
&ieee802514_header->panid,
|
||||
! LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 2;
|
||||
// dest
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
--- 178,184 ----
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_PANID,
|
||||
&ieee802514_header->panid,
|
||||
! OW_LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 2;
|
||||
// dest
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
***************
|
||||
*** 171,177 ****
|
||||
((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_16B,
|
||||
&ieee802514_header->dest,
|
||||
! LITTLE_ENDIAN
|
||||
);
|
||||
ieee802514_header->headerLength += 2;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
--- 190,196 ----
|
||||
((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_16B,
|
||||
&ieee802514_header->dest,
|
||||
! OW_LITTLE_ENDIAN
|
||||
);
|
||||
ieee802514_header->headerLength += 2;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
***************
|
||||
*** 180,186 ****
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_64B,
|
||||
&ieee802514_header->dest,
|
||||
! LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 8;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
break;
|
||||
--- 199,205 ----
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_64B,
|
||||
&ieee802514_header->dest,
|
||||
! OW_LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 8;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
break;
|
||||
***************
|
||||
*** 194,200 ****
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_16B,
|
||||
&ieee802514_header->src,
|
||||
! LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 2;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
break;
|
||||
--- 213,219 ----
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_16B,
|
||||
&ieee802514_header->src,
|
||||
! OW_LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 2;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
break;
|
||||
***************
|
||||
*** 202,213 ****
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_64B,
|
||||
&ieee802514_header->src,
|
||||
! LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 8;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
break;
|
||||
// no need for a default, since case would have been caught above
|
||||
}
|
||||
// apply topology filter
|
||||
if (topology_isAcceptablePacket(ieee802514_header)==FALSE) {
|
||||
// the topology filter does accept this packet, return
|
||||
--- 221,237 ----
|
||||
packetfunctions_readAddress(((uint8_t*)(msg->payload)+ieee802514_header->headerLength),
|
||||
ADDR_64B,
|
||||
&ieee802514_header->src,
|
||||
! OW_LITTLE_ENDIAN);
|
||||
ieee802514_header->headerLength += 8;
|
||||
if (ieee802514_header->headerLength>msg->length) { return; } // no more to read!
|
||||
break;
|
||||
// no need for a default, since case would have been caught above
|
||||
}
|
||||
+
|
||||
+ if (ieee802514_header->ieListPresent==TRUE && ieee802514_header->frameVersion!=IEEE154_FRAMEVERSION){
|
||||
+ return; //invalid packet accordint to p.64 IEEE15.4e
|
||||
+ }
|
||||
+
|
||||
// apply topology filter
|
||||
if (topology_isAcceptablePacket(ieee802514_header)==FALSE) {
|
||||
// the topology filter does accept this packet, return
|
@ -1,93 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/IEEE802154.h Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/IEEE802154.h Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 2,8 ****
|
||||
#define __IEEE802154_H
|
||||
|
||||
/**
|
||||
! \addtogroup helpers
|
||||
\{
|
||||
\addtogroup IEEE802154
|
||||
\{
|
||||
--- 2,8 ----
|
||||
#define __IEEE802154_H
|
||||
|
||||
/**
|
||||
! \addtogroup MAClow
|
||||
\{
|
||||
\addtogroup IEEE802154
|
||||
\{
|
||||
***************
|
||||
*** 18,27 ****
|
||||
--- 18,36 ----
|
||||
IEEE154_FCF_FRAME_PENDING = 4,
|
||||
IEEE154_FCF_ACK_REQ = 5,
|
||||
IEEE154_FCF_INTRAPAN = 6,
|
||||
+ IEEE154_FCF_IELIST_PRESENT = 1,
|
||||
IEEE154_FCF_DEST_ADDR_MODE = 2,
|
||||
+ IEEE154_FCF_FRAME_VERSION = 4,
|
||||
IEEE154_FCF_SRC_ADDR_MODE = 6,
|
||||
};
|
||||
|
||||
+
|
||||
+ enum IEEE802154_fcf_frameversion_enums {
|
||||
+ IEEE154_FRAMEVERSION_2003 = 0, //ieee154-2003
|
||||
+ IEEE154_FRAMEVERSION_2006 = 1, //ieee154-2006
|
||||
+ IEEE154_FRAMEVERSION = 2, //ieee154
|
||||
+ };
|
||||
+
|
||||
enum IEEE802154_fcf_type_enums {
|
||||
IEEE154_TYPE_BEACON = 0,
|
||||
IEEE154_TYPE_DATA = 1,
|
||||
***************
|
||||
*** 35,40 ****
|
||||
--- 44,54 ----
|
||||
IEEE154_SEC_YES_SECURITY = 1,
|
||||
};
|
||||
|
||||
+ enum IEEE802154_fcf_ielist_enums {
|
||||
+ IEEE154_IELIST_NO = 0,
|
||||
+ IEEE154_IELIST_YES = 1,
|
||||
+ };
|
||||
+
|
||||
enum IEEE802154_fcf_pending_enums {
|
||||
IEEE154_PENDING_NO_FRAMEPENDING = 0,
|
||||
IEEE154_PENDING_YES_FRAMEPENDING = 1,
|
||||
***************
|
||||
*** 66,71 ****
|
||||
--- 80,87 ----
|
||||
bool framePending;
|
||||
bool ackRequested;
|
||||
bool panIDCompression;
|
||||
+ bool ieListPresent;
|
||||
+ uint8_t frameVersion;
|
||||
uint8_t dsn;
|
||||
open_addr_t panid;
|
||||
open_addr_t dest;
|
||||
***************
|
||||
*** 78,88 ****
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
! void ieee802154_prependHeader (OpenQueueEntry_t* msg,
|
||||
! uint8_t frameType,
|
||||
! bool securityEnabled,
|
||||
! uint8_t sequenceNumber,
|
||||
! open_addr_t* nextHop);
|
||||
void ieee802154_retrieveHeader (OpenQueueEntry_t* msg,
|
||||
ieee802154_header_iht* ieee802514_header);
|
||||
|
||||
--- 94,107 ----
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
! void ieee802154_prependHeader(OpenQueueEntry_t* msg,
|
||||
! uint8_t frameType,
|
||||
! uint8_t ielistpresent,
|
||||
! uint8_t frameversion,
|
||||
! bool securityEnabled,
|
||||
! uint8_t sequenceNumber,
|
||||
! open_addr_t* nextHop);
|
||||
!
|
||||
void ieee802154_retrieveHeader (OpenQueueEntry_t* msg,
|
||||
ieee802154_header_iht* ieee802514_header);
|
File diff suppressed because it is too large
Load Diff
@ -1,265 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/IEEE802154E.h Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/IEEE802154E.h Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 10,21 ****
|
||||
|
||||
#include "openwsn.h"
|
||||
#include "board_info.h"
|
||||
|
||||
//=========================== debug define ====================================
|
||||
|
||||
//=========================== define ==========================================
|
||||
|
||||
! #define SYNCHRONIZING_CHANNEL 20 // channel the mote listens on to synchronize
|
||||
#define TXRETRIES 3 // number of MAC retries before declaring failed
|
||||
#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)
|
||||
#define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to succesfully synchronize
|
||||
--- 10,22 ----
|
||||
|
||||
#include "openwsn.h"
|
||||
#include "board_info.h"
|
||||
+ #include "schedule.h"
|
||||
|
||||
//=========================== debug define ====================================
|
||||
|
||||
//=========================== define ==========================================
|
||||
|
||||
! #define SYNCHRONIZING_CHANNEL 0x1a // channel the mote listens on to synchronize
|
||||
#define TXRETRIES 3 // number of MAC retries before declaring failed
|
||||
#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)
|
||||
#define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to succesfully synchronize
|
||||
***************
|
||||
*** 25,30 ****
|
||||
--- 26,79 ----
|
||||
#define LIMITLARGETIMECORRECTION 5 // threshold number of ticks to declare a timeCorrection "large"
|
||||
#define LENGTH_IEEE154_MAX 128 // max length of a valid radio packet
|
||||
|
||||
+ //15.4e information elements related
|
||||
+ #define IEEE802154E_PAYLOAD_DESC_LEN_SHIFT 0x04
|
||||
+ #define IEEE802154E_PAYLOAD_DESC_GROUP_ID_MLME (0x01 << 1) //includes shift 1
|
||||
+ #define IEEE802154E_DESC_TYPE_LONG 0x01
|
||||
+ #define IEEE802154E_DESC_TYPE_SHORT 0x00
|
||||
+
|
||||
+ #define IEEE802154E_DESC_TYPE_HEADER_IE 0x00
|
||||
+ #define IEEE802154E_DESC_TYPE_PAYLOAD_IE 0x01
|
||||
+ //len field on PAYLOAD/HEADER DESC
|
||||
+ #define IEEE802154E_DESC_LEN_HEADER_IE_MASK 0xFE00
|
||||
+ #define IEEE802154E_DESC_LEN_PAYLOAD_IE_MASK 0xFFE0
|
||||
+
|
||||
+ #define IEEE802154E_DESC_LEN_HEADER_IE_SHIFT 9
|
||||
+ #define IEEE802154E_DESC_LEN_PAYLOAD_IE_SHIFT 5
|
||||
+
|
||||
+ //groupID/elementID field on PAYLOAD/HEADER DESC
|
||||
+ #define IEEE802154E_DESC_ELEMENTID_HEADER_IE_MASK 0x01FE
|
||||
+ #define IEEE802154E_DESC_GROUPID_PAYLOAD_IE_MASK 0x001E
|
||||
+
|
||||
+ #define IEEE802154E_DESC_ELEMENTID_HEADER_IE_SHIFT 1
|
||||
+ #define IEEE802154E_DESC_GROUPID_PAYLOAD_IE_SHIFT 1
|
||||
+
|
||||
+ //MLME Sub IE LONG page 83
|
||||
+ #define IEEE802154E_DESC_LEN_LONG_MLME_IE_MASK 0xFFE0
|
||||
+ #define IEEE802154E_DESC_SUBID_LONG_MLME_IE_MASK 0x001E
|
||||
+
|
||||
+ #define IEEE802154E_DESC_LEN_LONG_MLME_IE_SHIFT 5
|
||||
+ #define IEEE802154E_DESC_SUBID_LONG_MLME_IE_SHIFT 1
|
||||
+
|
||||
+ //MLME Sub IE SHORT page 82
|
||||
+ #define IEEE802154E_DESC_LEN_SHORT_MLME_IE_MASK 0xFF00
|
||||
+ #define IEEE802154E_DESC_SUBID_SHORT_MLME_IE_MASK 0x00FE
|
||||
+
|
||||
+ #define IEEE802154E_DESC_LEN_SHORT_MLME_IE_SHIFT 8
|
||||
+ #define IEEE802154E_DESC_SUBID_SHORT_MLME_IE_SHIFT 1
|
||||
+
|
||||
+
|
||||
+ #define IEEE802154E_MLME_SYNC_IE_SUBID 0x1A
|
||||
+ #define IEEE802154E_MLME_SYNC_IE_SUBID_SHIFT 1
|
||||
+ #define IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID 0x1B
|
||||
+ #define IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID_SHIFT 1
|
||||
+ #define IEEE802154E_MLME_TIMESLOT_IE_SUBID 0x1c
|
||||
+ #define IEEE802154E_MLME_TIMESLOT_IE_SUBID_SHIFT 1
|
||||
+
|
||||
+ #define IEEE802154E_MLME_IE_GROUPID 0x01
|
||||
+ #define IEEE802154E_ACK_NACK_TIMECORRECTION_ELEMENTID 0x1E
|
||||
+
|
||||
+ #define IEEE802154E_
|
||||
/**
|
||||
When a packet is received, it is written inside the OpenQueueEntry_t->packet
|
||||
buffer, starting at the byte defined below. When a packet is relayed, it
|
||||
***************
|
||||
*** 81,86 ****
|
||||
--- 130,136 ----
|
||||
TsLongGT = 43, // 1300us
|
||||
TsTxAckDelay = 151, // 4606us
|
||||
TsShortGT = 16, // 500us
|
||||
+ // TsShortGT = 30, // 900us, stm32 can work well with this value
|
||||
TsSlotDuration = PORT_TsSlotDuration, // 15000us
|
||||
// execution speed related
|
||||
maxTxDataPrepare = PORT_maxTxDataPrepare,
|
||||
***************
|
||||
*** 97,102 ****
|
||||
--- 147,159 ----
|
||||
};
|
||||
|
||||
|
||||
+ //shift of bytes in the linkOption bitmap
|
||||
+ enum ieee154e_linkOption_enum {
|
||||
+ FLAG_TX_S = 7,
|
||||
+ FLAG_RX_S = 6,
|
||||
+ FLAG_SHARED_S = 5,
|
||||
+ FLAG_TIMEKEEPING_S = 4,
|
||||
+ };
|
||||
|
||||
// FSM timer durations (combinations of atomic durations)
|
||||
// TX
|
||||
***************
|
||||
*** 125,150 ****
|
||||
PORT_SIGNED_INT_WIDTH timeCorrection;
|
||||
} IEEE802154E_ACK_ht;
|
||||
|
||||
! #define ADV_PAYLOAD_LENGTH 5
|
||||
|
||||
! //=========================== variables =======================================
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
// admin
|
||||
! void ieee154e_init();
|
||||
// public
|
||||
! PORT_TIMER_WIDTH ieee154e_asnDiff(asn_t* someASN);
|
||||
! bool ieee154e_isSynch();
|
||||
! void asnWriteToPkt(OpenQueueEntry_t* frame);
|
||||
! void asnWriteToSerial(uint8_t* array);
|
||||
// events
|
||||
! void ieee154e_startOfFrame(PORT_TIMER_WIDTH capturedTime);
|
||||
! void ieee154e_endOfFrame(PORT_TIMER_WIDTH capturedTime);
|
||||
// misc
|
||||
! bool debugPrint_asn();
|
||||
! bool debugPrint_isSync();
|
||||
! bool debugPrint_macStats();
|
||||
|
||||
/**
|
||||
\}
|
||||
--- 182,304 ----
|
||||
PORT_SIGNED_INT_WIDTH timeCorrection;
|
||||
} IEEE802154E_ACK_ht;
|
||||
|
||||
! //includes payload header IE short + MLME short Header + Sync IE
|
||||
! #define ADV_PAYLOAD_LENGTH sizeof(payload_IE_descriptor_t) + \
|
||||
! sizeof(MLME_IE_subHeader_t) + \
|
||||
! sizeof(synch_IE_t)
|
||||
!
|
||||
!
|
||||
!
|
||||
!
|
||||
! //=========================== module variables ================================
|
||||
!
|
||||
! typedef struct {
|
||||
! // misc
|
||||
! asn_t asn; // current absolute slot number
|
||||
! slotOffset_t slotOffset; // current slot offset
|
||||
! slotOffset_t nextActiveSlotOffset; // next active slot offset
|
||||
! PORT_RADIOTIMER_WIDTH deSyncTimeout; // how many slots left before looses sync
|
||||
! bool isSync; // TRUE iff mote is synchronized to network
|
||||
! // as shown on the chronogram
|
||||
! ieee154e_state_t state; // state of the FSM
|
||||
! OpenQueueEntry_t* dataToSend; // pointer to the data to send
|
||||
! OpenQueueEntry_t* dataReceived; // pointer to the data received
|
||||
! OpenQueueEntry_t* ackToSend; // pointer to the ack to send
|
||||
! OpenQueueEntry_t* ackReceived; // pointer to the ack received
|
||||
! PORT_RADIOTIMER_WIDTH lastCapturedTime; // last captured time
|
||||
! PORT_RADIOTIMER_WIDTH syncCapturedTime; // captured time used to sync
|
||||
! //channel hopping
|
||||
! uint8_t freq; // frequency of the current slot
|
||||
! uint8_t asnOffset; // offset inside the frame
|
||||
!
|
||||
! PORT_RADIOTIMER_WIDTH radioOnInit; //when within the slot the radio turns on
|
||||
! PORT_RADIOTIMER_WIDTH radioOnTics;//how many tics within the slot the radio is on
|
||||
! bool radioOnThisSlot; //to control if the radio has been turned on in a slot.
|
||||
! } ieee154e_vars_t;
|
||||
!
|
||||
! PRAGMA(pack(1));
|
||||
! typedef struct {
|
||||
! uint8_t numSyncPkt; // how many times synchronized on a non-ACK packet
|
||||
! uint8_t numSyncAck; // how many times synchronized on an ACK
|
||||
! PORT_SIGNED_INT_WIDTH minCorrection; // minimum time correction
|
||||
! PORT_SIGNED_INT_WIDTH maxCorrection; // maximum time correction
|
||||
! uint8_t numDeSync; // number of times a desync happened
|
||||
! float dutyCycle; // mac dutyCycle at each superframe
|
||||
! } ieee154e_stats_t;
|
||||
! PRAGMA(pack());
|
||||
|
||||
! typedef struct {
|
||||
! PORT_RADIOTIMER_WIDTH num_newSlot;
|
||||
! PORT_RADIOTIMER_WIDTH num_timer;
|
||||
! PORT_RADIOTIMER_WIDTH num_startOfFrame;
|
||||
! PORT_RADIOTIMER_WIDTH num_endOfFrame;
|
||||
! } ieee154e_dbg_t;
|
||||
!
|
||||
!
|
||||
! //=========================== IEs =============================================
|
||||
! //the header for all header IEs
|
||||
! typedef struct{
|
||||
! uint16_t length_elementid_type;
|
||||
! }header_IE_descriptor_t;
|
||||
! //header descriptor. elementid will be 0 as described in 15.4e pag. 81
|
||||
! //type is 0 as described on p. 80
|
||||
!
|
||||
!
|
||||
! //the content for ack ie -- it is a header IE with values - element id =0x1e len=2 type=0
|
||||
! PRAGMA(pack(1));
|
||||
! typedef struct {
|
||||
! int16_t timesync_info;
|
||||
! }ack_timecorrection_IE_t;
|
||||
! PRAGMA(pack());
|
||||
! //the header for all payload IEs
|
||||
!
|
||||
!
|
||||
! typedef struct{//11b len 4b gid 1b type
|
||||
! uint16_t length_groupid_type; //bytes on the IE content- that is the embedded MLME or Header IE.
|
||||
! //groupid == 0x01 MLME | type long = 1
|
||||
! }payload_IE_descriptor_t; // payload descriptor. groupid will be 1 as described in 15.4e pag. 81
|
||||
!
|
||||
! //MLME sub id header appended to payload descriptor. we use group id=1 type=1
|
||||
! typedef struct{
|
||||
! uint16_t length_subID_type;
|
||||
! }MLME_IE_subHeader_t;
|
||||
!
|
||||
! //the Synchronization IE. it is a payload IE with values - subid=0x1a type=0 (short) len=6
|
||||
! PRAGMA(pack(1));
|
||||
! typedef struct {
|
||||
! uint8_t asn[5];
|
||||
! uint8_t join_priority;
|
||||
! }synch_IE_t;
|
||||
! PRAGMA(pack());
|
||||
!
|
||||
! //the Slotframe and Link IE
|
||||
! typedef struct {
|
||||
! uint8_t slotframehandle;
|
||||
! uint16_t slotframesize;
|
||||
! uint8_t numlinks;
|
||||
! }slotframelink_IE_t;
|
||||
!
|
||||
! typedef struct {
|
||||
! uint16_t tsNum;
|
||||
! uint16_t choffset;
|
||||
! uint8_t linkoptions;
|
||||
! }linkInfo_subIE_t;
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
// admin
|
||||
! void ieee154e_init(void);
|
||||
// public
|
||||
! PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN);
|
||||
! bool ieee154e_isSynch(void);
|
||||
! void ieee154e_getAsn(uint8_t* array);
|
||||
// events
|
||||
! void ieee154e_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);
|
||||
! void ieee154e_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);
|
||||
// misc
|
||||
! bool debugPrint_asn(void);
|
||||
! bool debugPrint_isSync(void);
|
||||
! bool debugPrint_macStats(void);
|
||||
|
||||
/**
|
||||
\}
|
@ -1,37 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/Makefile Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/Makefile Mon May 12 13:09:51 2014
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1,32 ----
|
||||
+ SUBMOD:=$(shell basename $(CURDIR)).a
|
||||
+ #BINDIR = $(RIOTBASE)/bin/
|
||||
+ SRC = $(wildcard *.c)
|
||||
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
+
|
||||
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_legacy/include -I$(RIOTBASE)/cpu/arm7_common/include -I$(RIOTBASE)/sys/net/include/
|
||||
+ INCLUDES += -I$(CURDIR)/02a-MAClow
|
||||
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
|
||||
+ INCLUDES += -I$(CURDIR)/03a-IPHC
|
||||
+ INCLUDES += -I$(CURDIR)/03b-IPv6
|
||||
+ INCLUDES += -I$(CURDIR)/04-TRAN
|
||||
+ INCLUDES += -I$(CURDIR)/cross-layers
|
||||
+
|
||||
+ .PHONY: $(BINDIR)$(SUBMOD)
|
||||
+
|
||||
+ $(BINDIR)$(SUBMOD): $(OBJ)
|
||||
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
|
||||
+
|
||||
+ # pull in dependency info for *existing* .o files
|
||||
+ -include $(OBJ:.o=.d)
|
||||
+
|
||||
+ # compile and generate dependency info
|
||||
+ $(BINDIR)%.o: %.c
|
||||
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
|
||||
+
|
||||
+ # remove compilation products
|
||||
+
|
||||
+ clean:
|
||||
+ rm -f $(OBJ) $(DEP)
|
@ -1,10 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/Makefile Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/Makefile Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1,4 ----
|
||||
+ MODULE:=$(shell basename $(CURDIR))
|
||||
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_legacy/include -I$(RIOTBASE)/cpu/arm7_common/include -I$(RIOTBASE)/sys/net/include/
|
||||
+
|
||||
+ include $(RIOTBASE)/Makefile.base
|
||||
\ No newline at end of file
|
@ -1,132 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/stupidmac.c Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/stupidmac.c Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 31,44 ****
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
#include "IEEE802154_common.c"
|
||||
! void packetReceived();
|
||||
! void armRandomBackoffTimer();
|
||||
void change_state(uint8_t newstate);
|
||||
|
||||
//======= from upper layer
|
||||
|
||||
//in stupidMAC, the radio is always on, listening
|
||||
! void stupidmac_init() {
|
||||
radio_rxOn(openwsn_frequency_channel);
|
||||
change_state(S_IDLE_LISTENING);
|
||||
stupidmac_dataFrameToSend = NULL;
|
||||
--- 31,44 ----
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
#include "IEEE802154_common.c"
|
||||
! void packetReceived(void);
|
||||
! void armRandomBackoffTimer(void);
|
||||
void change_state(uint8_t newstate);
|
||||
|
||||
//======= from upper layer
|
||||
|
||||
//in stupidMAC, the radio is always on, listening
|
||||
! void stupidmac_init(void) {
|
||||
radio_rxOn(openwsn_frequency_channel);
|
||||
change_state(S_IDLE_LISTENING);
|
||||
stupidmac_dataFrameToSend = NULL;
|
||||
***************
|
||||
*** 238,244 ****
|
||||
|
||||
//=========================== private =========================================
|
||||
|
||||
! void packetReceived() {
|
||||
if (stupidmac_dataFrameReceived->length>0) {
|
||||
//packet contains payload destined to an upper layer
|
||||
nores_receive(stupidmac_dataFrameReceived);
|
||||
--- 238,244 ----
|
||||
|
||||
//=========================== private =========================================
|
||||
|
||||
! void packetReceived(void) {
|
||||
if (stupidmac_dataFrameReceived->length>0) {
|
||||
//packet contains payload destined to an upper layer
|
||||
nores_receive(stupidmac_dataFrameReceived);
|
||||
***************
|
||||
*** 249,255 ****
|
||||
stupidmac_dataFrameReceived = NULL;
|
||||
}
|
||||
|
||||
! void armRandomBackoffTimer() {
|
||||
timer_startOneShot(TIMER_MAC_BACKOFF,MINBACKOFF); //TODO randomize
|
||||
}
|
||||
|
||||
--- 249,255 ----
|
||||
stupidmac_dataFrameReceived = NULL;
|
||||
}
|
||||
|
||||
! void armRandomBackoffTimer(void) {
|
||||
timer_startOneShot(TIMER_MAC_BACKOFF,MINBACKOFF); //TODO randomize
|
||||
}
|
||||
|
||||
***************
|
||||
*** 271,284 ****
|
||||
}
|
||||
}
|
||||
|
||||
! bool stupidmac_debugPrint() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//======= timers firing
|
||||
|
||||
//periodic timer used to transmit, and to trigger serial input/output
|
||||
! void timer_mac_periodic_fired() {
|
||||
#ifndef SERIALINSCHEDULER
|
||||
openserial_stop();
|
||||
#endif
|
||||
--- 271,284 ----
|
||||
}
|
||||
}
|
||||
|
||||
! bool stupidmac_debugPrint(void) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//======= timers firing
|
||||
|
||||
//periodic timer used to transmit, and to trigger serial input/output
|
||||
! void timer_mac_periodic_fired(void) {
|
||||
#ifndef SERIALINSCHEDULER
|
||||
openserial_stop();
|
||||
#endif
|
||||
***************
|
||||
*** 297,303 ****
|
||||
|
||||
//this function is the one which really initiates the transmission of a packet.
|
||||
//It only does so if the MAC layer is in S_IDLE_LISTENING stupidmac_state, otherwise it defers
|
||||
! void timer_mac_backoff_fired() {
|
||||
if (stupidmac_state==S_IDLE_LISTENING) {
|
||||
if (stupidmac_dataFrameToSend!=NULL) {
|
||||
openserial_printError(COMPONENT_MAC,ERR_DATAFRAMETOSEND_ERROR,
|
||||
--- 297,303 ----
|
||||
|
||||
//this function is the one which really initiates the transmission of a packet.
|
||||
//It only does so if the MAC layer is in S_IDLE_LISTENING stupidmac_state, otherwise it defers
|
||||
! void timer_mac_backoff_fired(void) {
|
||||
if (stupidmac_state==S_IDLE_LISTENING) {
|
||||
if (stupidmac_dataFrameToSend!=NULL) {
|
||||
openserial_printError(COMPONENT_MAC,ERR_DATAFRAMETOSEND_ERROR,
|
||||
***************
|
||||
*** 326,332 ****
|
||||
}
|
||||
}
|
||||
|
||||
! void timer_mac_watchdog_fired() {
|
||||
switch (stupidmac_state) {
|
||||
case S_TX_RXACK:
|
||||
//I'm a transmitter, didn't receive ACK (end of TX sequence).
|
||||
--- 326,332 ----
|
||||
}
|
||||
}
|
||||
|
||||
! void timer_mac_watchdog_fired(void) {
|
||||
switch (stupidmac_state) {
|
||||
case S_TX_RXACK:
|
||||
//I'm a transmitter, didn't receive ACK (end of TX sequence).
|
@ -1,33 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/stupidmac/stupidmac.h Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/stupidmac/stupidmac.h Thu Apr 24 16:53:29 2014
|
||||
***************
|
||||
*** 47,60 ****
|
||||
ACK_WAIT_TIME = 327, // 10ms
|
||||
};
|
||||
|
||||
! void stupidmac_init();
|
||||
! error_t stupidmac_send(OpenQueueEntry_t* msg);
|
||||
! void stupidmac_sendDone(OpenQueueEntry_t* msg, error_t error);
|
||||
void stupidmac_packet_received(OpenQueueEntry_t* pkt);
|
||||
! void stupidmac_sendDone(OpenQueueEntry_t* packetReceived, error_t error);
|
||||
! void timer_mac_backoff_fired();
|
||||
! void timer_mac_watchdog_fired();
|
||||
! void timer_mac_periodic_fired();
|
||||
! bool stupidmac_debugPrint();
|
||||
|
||||
#endif
|
||||
--- 47,60 ----
|
||||
ACK_WAIT_TIME = 327, // 10ms
|
||||
};
|
||||
|
||||
! void stupidmac_init(void);
|
||||
! owerror_t stupidmac_send(OpenQueueEntry_t* msg);
|
||||
! void stupidmac_sendDone(OpenQueueEntry_t* msg, owerror_t error);
|
||||
void stupidmac_packet_received(OpenQueueEntry_t* pkt);
|
||||
! void stupidmac_sendDone(OpenQueueEntry_t* packetReceived, owerror_t error);
|
||||
! void timer_mac_backoff_fired(void);
|
||||
! void timer_mac_watchdog_fired(void);
|
||||
! void timer_mac_periodic_fired(void);
|
||||
! bool stupidmac_debugPrint(void);
|
||||
|
||||
#endif
|
@ -1,52 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02a-MAClow/topology.c Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02a-MAClow/topology.c Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 4,13 ****
|
||||
|
||||
//=========================== defines =========================================
|
||||
|
||||
! #define TOPOLOGY_MOTE1 0x6f
|
||||
! #define TOPOLOGY_MOTE2 0xb9
|
||||
! #define TOPOLOGY_MOTE3 0x3b
|
||||
!
|
||||
//=========================== variables =======================================
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
--- 4,13 ----
|
||||
|
||||
//=========================== defines =========================================
|
||||
|
||||
! #define TOPOLOGY_MOTE1 0x01
|
||||
! #define TOPOLOGY_MOTE2 0x02
|
||||
! #define TOPOLOGY_MOTE3 0x03
|
||||
! #define TOPOLOGY_MOTE4 0x04
|
||||
//=========================== variables =======================================
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
***************
|
||||
*** 32,39 ****
|
||||
returnVal=FALSE;
|
||||
}
|
||||
break;
|
||||
! case TOPOLOGY_MOTE3:
|
||||
! if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE2) {
|
||||
returnVal=TRUE;
|
||||
} else {
|
||||
returnVal=FALSE;
|
||||
--- 32,47 ----
|
||||
returnVal=FALSE;
|
||||
}
|
||||
break;
|
||||
! case TOPOLOGY_MOTE3:
|
||||
! if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE2 ||
|
||||
! ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE4) {
|
||||
! returnVal=TRUE;
|
||||
! } else {
|
||||
! returnVal=FALSE;
|
||||
! }
|
||||
! break;
|
||||
! case TOPOLOGY_MOTE4:
|
||||
! if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE3) {
|
||||
returnVal=TRUE;
|
||||
} else {
|
||||
returnVal=FALSE;
|
@ -1,37 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02b-MAChigh/Makefile Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02b-MAChigh/Makefile Mon May 12 13:09:50 2014
|
||||
***************
|
||||
*** 0 ****
|
||||
--- 1,32 ----
|
||||
+ SUBMOD:=$(shell basename $(CURDIR)).a
|
||||
+ #BINDIR = $(RIOTBASE)/bin/
|
||||
+ SRC = $(wildcard *.c)
|
||||
+ OBJ = $(SRC:%.c=$(BINDIR)%.o)
|
||||
+ DEP = $(SRC:%.c=$(BINDIR)%.d)
|
||||
+
|
||||
+ INCLUDES += -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/drivers/cc110x_legacy/include -I$(RIOTBASE)/cpu/arm7_common/include -I$(RIOTBASE)/sys/net/include/
|
||||
+ INCLUDES += -I$(CURDIR)/02a-MAClow
|
||||
+ INCLUDES += -I$(CURDIR)/02b-MAChigh
|
||||
+ INCLUDES += -I$(CURDIR)/03a-IPHC
|
||||
+ INCLUDES += -I$(CURDIR)/03b-IPv6
|
||||
+ INCLUDES += -I$(CURDIR)/04-TRAN
|
||||
+ INCLUDES += -I$(CURDIR)/cross-layers
|
||||
+
|
||||
+ .PHONY: $(BINDIR)$(SUBMOD)
|
||||
+
|
||||
+ $(BINDIR)$(SUBMOD): $(OBJ)
|
||||
+ $(AD)$(AR) rcs $(BINDIR)$(MODULE) $(OBJ)
|
||||
+
|
||||
+ # pull in dependency info for *existing* .o files
|
||||
+ -include $(OBJ:.o=.d)
|
||||
+
|
||||
+ # compile and generate dependency info
|
||||
+ $(BINDIR)%.o: %.c
|
||||
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
+ $(AD)$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
+ @printf "$(BINDIR)" | cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
|
||||
+
|
||||
+ # remove compilation products
|
||||
+
|
||||
+ clean:
|
||||
+ rm -f $(OBJ) $(DEP)
|
@ -1,430 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02b-MAChigh/neighbors.c Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02b-MAChigh/neighbors.c Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 8,20 ****
|
||||
|
||||
//=========================== variables =======================================
|
||||
|
||||
- typedef struct {
|
||||
- neighborRow_t neighbors[MAXNUMNEIGHBORS];
|
||||
- dagrank_t myDAGrank;
|
||||
- uint8_t debugRow;
|
||||
- icmpv6rpl_dio_ht* dio; //keep it global to be able to debug correctly.
|
||||
- } neighbors_vars_t;
|
||||
-
|
||||
neighbors_vars_t neighbors_vars;
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
--- 8,13 ----
|
||||
***************
|
||||
*** 22,28 ****
|
||||
void registerNewNeighbor(
|
||||
open_addr_t* neighborID,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTimestamp
|
||||
);
|
||||
bool isNeighbor(open_addr_t* neighbor);
|
||||
void removeNeighbor(uint8_t neighborIndex);
|
||||
--- 15,23 ----
|
||||
void registerNewNeighbor(
|
||||
open_addr_t* neighborID,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTimestamp,
|
||||
! bool joinPrioPresent,
|
||||
! uint8_t joinPrio
|
||||
);
|
||||
bool isNeighbor(open_addr_t* neighbor);
|
||||
void removeNeighbor(uint8_t neighborIndex);
|
||||
***************
|
||||
*** 36,42 ****
|
||||
/**
|
||||
\brief Initializes this module.
|
||||
*/
|
||||
! void neighbors_init() {
|
||||
|
||||
// clear module variables
|
||||
memset(&neighbors_vars,0,sizeof(neighbors_vars_t));
|
||||
--- 31,37 ----
|
||||
/**
|
||||
\brief Initializes this module.
|
||||
*/
|
||||
! void neighbors_init(void) {
|
||||
|
||||
// clear module variables
|
||||
memset(&neighbors_vars,0,sizeof(neighbors_vars_t));
|
||||
***************
|
||||
*** 56,62 ****
|
||||
|
||||
\returns This mote's current DAG rank.
|
||||
*/
|
||||
! dagrank_t neighbors_getMyDAGrank() {
|
||||
return neighbors_vars.myDAGrank;
|
||||
}
|
||||
|
||||
--- 51,57 ----
|
||||
|
||||
\returns This mote's current DAG rank.
|
||||
*/
|
||||
! dagrank_t neighbors_getMyDAGrank(void) {
|
||||
return neighbors_vars.myDAGrank;
|
||||
}
|
||||
|
||||
***************
|
||||
*** 65,71 ****
|
||||
|
||||
\returns The number of neighbors this mote's currently knows of.
|
||||
*/
|
||||
! uint8_t neighbors_getNumNeighbors() {
|
||||
uint8_t i;
|
||||
uint8_t returnVal;
|
||||
|
||||
--- 60,66 ----
|
||||
|
||||
\returns The number of neighbors this mote's currently knows of.
|
||||
*/
|
||||
! uint8_t neighbors_getNumNeighbors(void) {
|
||||
uint8_t i;
|
||||
uint8_t returnVal;
|
||||
|
||||
***************
|
||||
*** 81,87 ****
|
||||
/**
|
||||
\brief Retrieve my preferred parent's EUI64 address.
|
||||
|
||||
! \param [out] addressToWrite Where to write the preferred parent's address to.
|
||||
*/
|
||||
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite) {
|
||||
uint8_t i;
|
||||
--- 76,82 ----
|
||||
/**
|
||||
\brief Retrieve my preferred parent's EUI64 address.
|
||||
|
||||
! \param[out] addressToWrite Where to write the preferred parent's address to.
|
||||
*/
|
||||
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite) {
|
||||
uint8_t i;
|
||||
***************
|
||||
*** 140,146 ****
|
||||
|
||||
\returns A pointer to the neighbor's address, or NULL if no KA is needed.
|
||||
*/
|
||||
! open_addr_t* neighbors_getKANeighbor() {
|
||||
uint8_t i;
|
||||
uint16_t timeSinceHeard;
|
||||
open_addr_t* addrPreferred;
|
||||
--- 135,141 ----
|
||||
|
||||
\returns A pointer to the neighbor's address, or NULL if no KA is needed.
|
||||
*/
|
||||
! open_addr_t* neighbors_getKANeighbor(void) {
|
||||
uint8_t i;
|
||||
uint16_t timeSinceHeard;
|
||||
open_addr_t* addrPreferred;
|
||||
***************
|
||||
*** 185,191 ****
|
||||
/**
|
||||
\brief Indicate whether some neighbor is a stable neighbor
|
||||
|
||||
! \param address [in] The address of the neighbor, a full 128-bit IPv6 addres.
|
||||
|
||||
\returns TRUE if that neighbor is stable, FALSE otherwise.
|
||||
*/
|
||||
--- 180,186 ----
|
||||
/**
|
||||
\brief Indicate whether some neighbor is a stable neighbor
|
||||
|
||||
! \param[in] address The address of the neighbor, a full 128-bit IPv6 addres.
|
||||
|
||||
\returns TRUE if that neighbor is stable, FALSE otherwise.
|
||||
*/
|
||||
***************
|
||||
*** 224,230 ****
|
||||
/**
|
||||
\brief Indicate whether some neighbor is a preferred neighbor.
|
||||
|
||||
! \param address [in] The EUI64 address of the neighbor.
|
||||
|
||||
\returns TRUE if that neighbor is preferred, FALSE otherwise.
|
||||
*/
|
||||
--- 219,225 ----
|
||||
/**
|
||||
\brief Indicate whether some neighbor is a preferred neighbor.
|
||||
|
||||
! \param[in] address The EUI64 address of the neighbor.
|
||||
|
||||
\returns TRUE if that neighbor is preferred, FALSE otherwise.
|
||||
*/
|
||||
***************
|
||||
*** 253,259 ****
|
||||
/**
|
||||
\brief Indicate whether some neighbor has a lower DAG rank that me.
|
||||
|
||||
! \param index [in] The index of that neighbor in the neighbor table.
|
||||
|
||||
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
|
||||
*/
|
||||
--- 248,254 ----
|
||||
/**
|
||||
\brief Indicate whether some neighbor has a lower DAG rank that me.
|
||||
|
||||
! \param[in] index The index of that neighbor in the neighbor table.
|
||||
|
||||
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
|
||||
*/
|
||||
***************
|
||||
*** 274,280 ****
|
||||
/**
|
||||
\brief Indicate whether some neighbor has a lower DAG rank that me.
|
||||
|
||||
! \param index [in] The index of that neighbor in the neighbor table.
|
||||
|
||||
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
|
||||
*/
|
||||
--- 269,275 ----
|
||||
/**
|
||||
\brief Indicate whether some neighbor has a lower DAG rank that me.
|
||||
|
||||
! \param[in] index The index of that neighbor in the neighbor table.
|
||||
|
||||
\returns TRUE if that neighbor has a lower DAG rank than me, FALSE otherwise.
|
||||
*/
|
||||
***************
|
||||
*** 306,319 ****
|
||||
- stableNeighbor
|
||||
- switchStabilityCounter
|
||||
|
||||
! \param l2_src [in] MAC source address of the packet, i.e. the neighbor who sent
|
||||
! the packet just received.
|
||||
! \param rssi [in] RSSI with which this packet was received.
|
||||
! \param asnTs [in] ASN at which this packet was received.
|
||||
*/
|
||||
void neighbors_indicateRx(open_addr_t* l2_src,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTs) {
|
||||
uint8_t i;
|
||||
bool newNeighbor;
|
||||
|
||||
--- 301,316 ----
|
||||
- stableNeighbor
|
||||
- switchStabilityCounter
|
||||
|
||||
! \param[in] l2_src MAC source address of the packet, i.e. the neighbor who sent
|
||||
! the packet just received.
|
||||
! \param[in] rssi RSSI with which this packet was received.
|
||||
! \param[in] asnTs ASN at which this packet was received.
|
||||
*/
|
||||
void neighbors_indicateRx(open_addr_t* l2_src,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTs,
|
||||
! bool joinPrioPresent,
|
||||
! uint8_t joinPrio) {
|
||||
uint8_t i;
|
||||
bool newNeighbor;
|
||||
|
||||
***************
|
||||
*** 329,334 ****
|
||||
--- 326,335 ----
|
||||
neighbors_vars.neighbors[i].numRx++;
|
||||
neighbors_vars.neighbors[i].rssi=rssi;
|
||||
memcpy(&neighbors_vars.neighbors[i].asn,asnTs,sizeof(asn_t));
|
||||
+ //update jp
|
||||
+ if (joinPrioPresent==TRUE){
|
||||
+ neighbors_vars.neighbors[i].joinPrio=joinPrio;
|
||||
+ }
|
||||
|
||||
// update stableNeighbor, switchStabilityCounter
|
||||
if (neighbors_vars.neighbors[i].stableNeighbor==FALSE) {
|
||||
***************
|
||||
*** 360,366 ****
|
||||
|
||||
// register new neighbor
|
||||
if (newNeighbor==TRUE) {
|
||||
! registerNewNeighbor(l2_src, rssi, asnTs);
|
||||
}
|
||||
}
|
||||
|
||||
--- 361,367 ----
|
||||
|
||||
// register new neighbor
|
||||
if (newNeighbor==TRUE) {
|
||||
! registerNewNeighbor(l2_src, rssi, asnTs, joinPrioPresent,joinPrio);
|
||||
}
|
||||
}
|
||||
|
||||
***************
|
||||
*** 375,386 ****
|
||||
- numTxACK
|
||||
- asn
|
||||
|
||||
! \param l2_dest [in] MAC destination address of the packet, i.e. the neighbor
|
||||
! who I just sent the packet to.
|
||||
! \param numTxAttempts [in] Number of transmission attempts to this neighbor.
|
||||
! \param was_finally_acked [in] TRUE iff the packet was ACK'ed by the neighbor
|
||||
! on final transmission attempt.
|
||||
! \param asnTs [in] ASN of the last transmission attempt.
|
||||
*/
|
||||
void neighbors_indicateTx(open_addr_t* l2_dest,
|
||||
uint8_t numTxAttempts,
|
||||
--- 376,387 ----
|
||||
- numTxACK
|
||||
- asn
|
||||
|
||||
! \param[in] l2_dest MAC destination address of the packet, i.e. the neighbor
|
||||
! who I just sent the packet to.
|
||||
! \param[in] numTxAttempts Number of transmission attempts to this neighbor.
|
||||
! \param[in] was_finally_acked TRUE iff the packet was ACK'ed by the neighbor
|
||||
! on final transmission attempt.
|
||||
! \param[in] asnTs ASN of the last transmission attempt.
|
||||
*/
|
||||
void neighbors_indicateTx(open_addr_t* l2_dest,
|
||||
uint8_t numTxAttempts,
|
||||
***************
|
||||
*** 423,430 ****
|
||||
The fields which are updated are:
|
||||
- DAGrank
|
||||
|
||||
! \param msg [in] The received message with msg->payload pointing to the DIO
|
||||
! header.
|
||||
*/
|
||||
void neighbors_indicateRxDIO(OpenQueueEntry_t* msg) {
|
||||
uint8_t i;
|
||||
--- 424,431 ----
|
||||
The fields which are updated are:
|
||||
- DAGrank
|
||||
|
||||
! \param[in] msg The received message with msg->payload pointing to the DIO
|
||||
! header.
|
||||
*/
|
||||
void neighbors_indicateRxDIO(OpenQueueEntry_t* msg) {
|
||||
uint8_t i;
|
||||
***************
|
||||
*** 438,448 ****
|
||||
for (i=0;i<MAXNUMNEIGHBORS;i++) {
|
||||
if (isThisRowMatching(&(msg->l2_nextORpreviousHop),i)) {
|
||||
if (
|
||||
! neighbors_vars.dio->rank>neighbors_vars.neighbors[i].DAGrank &&
|
||||
! neighbors_vars.dio->rank - neighbors_vars.neighbors[i].DAGrank>DEFAULTLINKCOST
|
||||
) {
|
||||
// the new DAGrank looks suspiciously high, only increment a bit
|
||||
! neighbors_vars.neighbors[i].DAGrank += DEFAULTLINKCOST;
|
||||
openserial_printError(COMPONENT_NEIGHBORS,ERR_LARGE_DAGRANK,
|
||||
(errorparameter_t)neighbors_vars.dio->rank,
|
||||
(errorparameter_t)neighbors_vars.neighbors[i].DAGrank);
|
||||
--- 439,449 ----
|
||||
for (i=0;i<MAXNUMNEIGHBORS;i++) {
|
||||
if (isThisRowMatching(&(msg->l2_nextORpreviousHop),i)) {
|
||||
if (
|
||||
! neighbors_vars.dio->rank > neighbors_vars.neighbors[i].DAGrank &&
|
||||
! neighbors_vars.dio->rank - neighbors_vars.neighbors[i].DAGrank >(DEFAULTLINKCOST*2*MINHOPRANKINCREASE)
|
||||
) {
|
||||
// the new DAGrank looks suspiciously high, only increment a bit
|
||||
! neighbors_vars.neighbors[i].DAGrank += (DEFAULTLINKCOST*2*MINHOPRANKINCREASE);
|
||||
openserial_printError(COMPONENT_NEIGHBORS,ERR_LARGE_DAGRANK,
|
||||
(errorparameter_t)neighbors_vars.dio->rank,
|
||||
(errorparameter_t)neighbors_vars.neighbors[i].DAGrank);
|
||||
***************
|
||||
*** 490,498 ****
|
||||
very low DAGrank, I may want to change by routing parent.
|
||||
- I became a DAGroot, so my DAGrank should be 0.
|
||||
*/
|
||||
! void neighbors_updateMyDAGrankAndNeighborPreference() {
|
||||
uint8_t i;
|
||||
! uint8_t linkCost;
|
||||
uint32_t tentativeDAGrank; // 32-bit since is used to sum
|
||||
uint8_t prefParentIdx;
|
||||
bool prefParentFound;
|
||||
--- 491,499 ----
|
||||
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) {
|
||||
uint8_t i;
|
||||
! uint16_t rankIncrease;
|
||||
uint32_t tentativeDAGrank; // 32-bit since is used to sum
|
||||
uint8_t prefParentIdx;
|
||||
bool prefParentFound;
|
||||
***************
|
||||
*** 517,527 ****
|
||||
neighbors_vars.neighbors[i].parentPreference=0;
|
||||
// calculate link cost to this neighbor
|
||||
if (neighbors_vars.neighbors[i].numTxACK==0) {
|
||||
! linkCost = DEFAULTLINKCOST;
|
||||
} else {
|
||||
! linkCost = (uint8_t)((((float)neighbors_vars.neighbors[i].numTx)/((float)neighbors_vars.neighbors[i].numTxACK))*10.0);
|
||||
}
|
||||
! tentativeDAGrank = neighbors_vars.neighbors[i].DAGrank+linkCost;
|
||||
if ( tentativeDAGrank<neighbors_vars.myDAGrank &&
|
||||
tentativeDAGrank<MAXDAGRANK) {
|
||||
// found better parent, lower my DAGrank
|
||||
--- 518,529 ----
|
||||
neighbors_vars.neighbors[i].parentPreference=0;
|
||||
// calculate link cost to this neighbor
|
||||
if (neighbors_vars.neighbors[i].numTxACK==0) {
|
||||
! rankIncrease = DEFAULTLINKCOST*2*MINHOPRANKINCREASE;
|
||||
} else {
|
||||
! //6TiSCH minimal draft using OF0 for rank computation
|
||||
! rankIncrease = (uint16_t)((((float)neighbors_vars.neighbors[i].numTx)/((float)neighbors_vars.neighbors[i].numTxACK))*2*MINHOPRANKINCREASE);
|
||||
}
|
||||
! tentativeDAGrank = neighbors_vars.neighbors[i].DAGrank+rankIncrease;
|
||||
if ( tentativeDAGrank<neighbors_vars.myDAGrank &&
|
||||
tentativeDAGrank<MAXDAGRANK) {
|
||||
// found better parent, lower my DAGrank
|
||||
***************
|
||||
*** 550,556 ****
|
||||
|
||||
\returns TRUE if this function printed something, FALSE otherwise.
|
||||
*/
|
||||
! bool debugPrint_neighbors() {
|
||||
debugNeighborEntry_t temp;
|
||||
neighbors_vars.debugRow=(neighbors_vars.debugRow+1)%MAXNUMNEIGHBORS;
|
||||
temp.row=neighbors_vars.debugRow;
|
||||
--- 552,558 ----
|
||||
|
||||
\returns TRUE if this function printed something, FALSE otherwise.
|
||||
*/
|
||||
! bool debugPrint_neighbors(void) {
|
||||
debugNeighborEntry_t temp;
|
||||
neighbors_vars.debugRow=(neighbors_vars.debugRow+1)%MAXNUMNEIGHBORS;
|
||||
temp.row=neighbors_vars.debugRow;
|
||||
***************
|
||||
*** 584,590 ****
|
||||
|
||||
void registerNewNeighbor(open_addr_t* address,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTimestamp) {
|
||||
uint8_t i,j;
|
||||
bool iHaveAPreferedParent;
|
||||
// filter errors
|
||||
--- 586,594 ----
|
||||
|
||||
void registerNewNeighbor(open_addr_t* address,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTimestamp,
|
||||
! bool joinPrioPresent,
|
||||
! uint8_t joinPrio) {
|
||||
uint8_t i,j;
|
||||
bool iHaveAPreferedParent;
|
||||
// filter errors
|
||||
***************
|
||||
*** 613,619 ****
|
||||
neighbors_vars.neighbors[i].numTx = 0;
|
||||
neighbors_vars.neighbors[i].numTxACK = 0;
|
||||
memcpy(&neighbors_vars.neighbors[i].asn,asnTimestamp,sizeof(asn_t));
|
||||
! // do I already have a preferred parent ?
|
||||
iHaveAPreferedParent = FALSE;
|
||||
for (j=0;j<MAXNUMNEIGHBORS;j++) {
|
||||
if (neighbors_vars.neighbors[j].parentPreference==MAXPREFERENCE) {
|
||||
--- 617,629 ----
|
||||
neighbors_vars.neighbors[i].numTx = 0;
|
||||
neighbors_vars.neighbors[i].numTxACK = 0;
|
||||
memcpy(&neighbors_vars.neighbors[i].asn,asnTimestamp,sizeof(asn_t));
|
||||
! //update jp
|
||||
! if (joinPrioPresent==TRUE){
|
||||
! neighbors_vars.neighbors[i].joinPrio=joinPrio;
|
||||
! }
|
||||
!
|
||||
!
|
||||
! // do I already have a preferred parent ? -- TODO change to use JP
|
||||
iHaveAPreferedParent = FALSE;
|
||||
for (j=0;j<MAXNUMNEIGHBORS;j++) {
|
||||
if (neighbors_vars.neighbors[j].parentPreference==MAXPREFERENCE) {
|
@ -1,108 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02b-MAChigh/neighbors.h Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02b-MAChigh/neighbors.h Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 21,26 ****
|
||||
--- 21,27 ----
|
||||
|
||||
#define MAXDAGRANK 0xffff
|
||||
#define DEFAULTDAGRANK MAXDAGRANK
|
||||
+ #define MINHOPRANKINCREASE 256 //default value in RPL and Minimal 6TiSCH draft
|
||||
|
||||
//=========================== typedef =========================================
|
||||
|
||||
***************
|
||||
*** 38,43 ****
|
||||
--- 39,45 ----
|
||||
uint8_t numTxACK;
|
||||
uint8_t numWraps;//number of times the tx counter wraps. can be removed if memory is a restriction. also check openvisualizer then.
|
||||
asn_t asn;
|
||||
+ uint8_t joinPrio;
|
||||
} neighborRow_t;
|
||||
PRAGMA(pack());
|
||||
|
||||
***************
|
||||
*** 58,73 ****
|
||||
} netDebugNeigborEntry_t;
|
||||
PRAGMA(pack());
|
||||
|
||||
! //=========================== variables =======================================
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
! void neighbors_init();
|
||||
// getters
|
||||
! dagrank_t neighbors_getMyDAGrank();
|
||||
! uint8_t neighbors_getNumNeighbors();
|
||||
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite);
|
||||
! open_addr_t* neighbors_getKANeighbor();
|
||||
// interrogators
|
||||
bool neighbors_isStableNeighbor(open_addr_t* address);
|
||||
bool neighbors_isPreferredParent(open_addr_t* address);
|
||||
--- 60,83 ----
|
||||
} netDebugNeigborEntry_t;
|
||||
PRAGMA(pack());
|
||||
|
||||
! //=========================== module variables ================================
|
||||
!
|
||||
! typedef struct {
|
||||
! neighborRow_t neighbors[MAXNUMNEIGHBORS];
|
||||
! dagrank_t myDAGrank;
|
||||
! uint8_t debugRow;
|
||||
! icmpv6rpl_dio_ht* dio; //keep it global to be able to debug correctly.
|
||||
! } neighbors_vars_t;
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
! void neighbors_init(void);
|
||||
// getters
|
||||
! dagrank_t neighbors_getMyDAGrank(void);
|
||||
! uint8_t neighbors_getNumNeighbors(void);
|
||||
bool neighbors_getPreferredParentEui64(open_addr_t* addressToWrite);
|
||||
! open_addr_t* neighbors_getKANeighbor(void);
|
||||
!
|
||||
// interrogators
|
||||
bool neighbors_isStableNeighbor(open_addr_t* address);
|
||||
bool neighbors_isPreferredParent(open_addr_t* address);
|
||||
***************
|
||||
*** 78,85 ****
|
||||
void neighbors_indicateRx(
|
||||
open_addr_t* l2_src,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTimestamp
|
||||
);
|
||||
void neighbors_indicateTx(
|
||||
open_addr_t* dest,
|
||||
uint8_t numTxAttempts,
|
||||
--- 88,98 ----
|
||||
void neighbors_indicateRx(
|
||||
open_addr_t* l2_src,
|
||||
int8_t rssi,
|
||||
! asn_t* asnTimestamp,
|
||||
! bool joinPrioPresent,
|
||||
! uint8_t joinPrio
|
||||
);
|
||||
+
|
||||
void neighbors_indicateTx(
|
||||
open_addr_t* dest,
|
||||
uint8_t numTxAttempts,
|
||||
***************
|
||||
*** 90,98 ****
|
||||
// get addresses
|
||||
void neighbors_getNeighbor(open_addr_t* address,uint8_t addr_type,uint8_t index);
|
||||
// managing routing info
|
||||
! void neighbors_updateMyDAGrankAndNeighborPreference();
|
||||
// debug
|
||||
! bool debugPrint_neighbors();
|
||||
void debugNetPrint_neighbors(netDebugNeigborEntry_t* schlist);
|
||||
|
||||
/**
|
||||
--- 103,111 ----
|
||||
// get addresses
|
||||
void neighbors_getNeighbor(open_addr_t* address,uint8_t addr_type,uint8_t index);
|
||||
// managing routing info
|
||||
! void neighbors_updateMyDAGrankAndNeighborPreference(void);
|
||||
// debug
|
||||
! bool debugPrint_neighbors(void);
|
||||
void debugNetPrint_neighbors(netDebugNeigborEntry_t* schlist);
|
||||
|
||||
/**
|
@ -1,437 +0,0 @@
|
||||
*** stock_iot-lab_M3/openwsn/02b-MAChigh/res.c Thu Apr 24 11:01:36 2014
|
||||
--- riot-openwsn-wip/openwsn/02b-MAChigh/res.c Thu Apr 24 16:55:54 2014
|
||||
***************
|
||||
*** 9,38 ****
|
||||
#include "openrandom.h"
|
||||
#include "scheduler.h"
|
||||
#include "opentimers.h"
|
||||
! #include "debugpins.h"
|
||||
! //=========================== variables =======================================
|
||||
|
||||
! typedef struct {
|
||||
! uint16_t periodMaintenance;
|
||||
! bool busySendingKa; // TRUE when busy sending a keep-alive
|
||||
! bool busySendingAdv; // TRUE when busy sending an advertisement
|
||||
! uint8_t dsn; // current data sequence number
|
||||
! uint8_t MacMgtTaskCounter; // counter to determine what management task to do
|
||||
! opentimer_id_t timerId;
|
||||
! } res_vars_t;
|
||||
|
||||
res_vars_t res_vars;
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
! error_t res_send_internal(OpenQueueEntry_t* msg);
|
||||
! void sendAdv();
|
||||
! void sendKa();
|
||||
! void res_timer_cb();
|
||||
|
||||
//=========================== public ==========================================
|
||||
|
||||
! void res_init() {
|
||||
res_vars.periodMaintenance = 872+(openrandom_get16b()&0xff); // fires every 1 sec on average
|
||||
res_vars.busySendingKa = FALSE;
|
||||
res_vars.busySendingAdv = FALSE;
|
||||
--- 9,38 ----
|
||||
#include "openrandom.h"
|
||||
#include "scheduler.h"
|
||||
#include "opentimers.h"
|
||||
! //#include "debugpins.h"
|
||||
!
|
||||
! #include "thread.h"
|
||||
!
|
||||
! #define ENABLE_DEBUG (0)
|
||||
! #include "debug.h"
|
||||
|
||||
!
|
||||
! //=========================== variables =======================================
|
||||
|
||||
res_vars_t res_vars;
|
||||
+ //static char openwsn_res_stack[KERNEL_CONF_STACKSIZE_MAIN];
|
||||
|
||||
//=========================== prototypes ======================================
|
||||
|
||||
! owerror_t res_send_internal(OpenQueueEntry_t* msg, uint8_t iePresent,uint8_t frameVersion);
|
||||
! void sendAdv(void);
|
||||
! void sendKa(void);
|
||||
! void res_timer_cb(void);
|
||||
! uint8_t res_copySlotFrameAndLinkIE(OpenQueueEntry_t* adv);//returns reserved size
|
||||
|
||||
//=========================== public ==========================================
|
||||
|
||||
! void res_init(void) {
|
||||
res_vars.periodMaintenance = 872+(openrandom_get16b()&0xff); // fires every 1 sec on average
|
||||
res_vars.busySendingKa = FALSE;
|
||||
res_vars.busySendingAdv = FALSE;
|
||||
***************
|
||||
*** 51,74 ****
|
||||
|
||||
\returns TRUE if this function printed something, FALSE otherwise.
|
||||
*/
|
||||
! bool debugPrint_myDAGrank() {
|
||||
! uint8_t output=0;
|
||||
output = neighbors_getMyDAGrank();
|
||||
! openserial_printStatus(STATUS_DAGRANK,(uint8_t*)&output,sizeof(uint8_t));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//======= from upper layer
|
||||
|
||||
! error_t res_send(OpenQueueEntry_t *msg) {
|
||||
msg->owner = COMPONENT_RES;
|
||||
msg->l2_frameType = IEEE154_TYPE_DATA;
|
||||
! return res_send_internal(msg);
|
||||
}
|
||||
|
||||
//======= from lower layer
|
||||
|
||||
! void task_resNotifSendDone() {
|
||||
OpenQueueEntry_t* msg;
|
||||
// get recently-sent packet from openqueue
|
||||
msg = openqueue_resGetSentPacket();
|
||||
--- 51,75 ----
|
||||
|
||||
\returns TRUE if this function printed something, FALSE otherwise.
|
||||
*/
|
||||
! // TODO: was bool but complained "conflicting types"
|
||||
! uint8_t debugPrint_myDAGrank(void) {
|
||||
! uint16_t output=0;
|
||||
output = neighbors_getMyDAGrank();
|
||||
! openserial_printStatus(STATUS_DAGRANK,(uint8_t*)&output,sizeof(uint16_t));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//======= from upper layer
|
||||
|
||||
! owerror_t res_send(OpenQueueEntry_t *msg) {
|
||||
msg->owner = COMPONENT_RES;
|
||||
msg->l2_frameType = IEEE154_TYPE_DATA;
|
||||
! return res_send_internal(msg,IEEE154_IELIST_NO,IEEE154_FRAMEVERSION_2006);
|
||||
}
|
||||
|
||||
//======= from lower layer
|
||||
|
||||
! void task_resNotifSendDone(void) {
|
||||
OpenQueueEntry_t* msg;
|
||||
// get recently-sent packet from openqueue
|
||||
msg = openqueue_resGetSentPacket();
|
||||
***************
|
||||
*** 120,126 ****
|
||||
}
|
||||
}
|
||||
|
||||
! void task_resNotifReceive() {
|
||||
OpenQueueEntry_t* msg;
|
||||
|
||||
// get received packet from openqueue
|
||||
--- 121,127 ----
|
||||
}
|
||||
}
|
||||
|
||||
! void task_resNotifReceive(void) {
|
||||
OpenQueueEntry_t* msg;
|
||||
|
||||
// get received packet from openqueue
|
||||
***************
|
||||