author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
491,595 |
03.05.2019 13:10:09
| -7,200 |
7147a3e9b90fce32bc8b4f1b686ad2b9eeb3e572
|
using slot duration 80ms.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/board_info.h",
"new_path": "bsp/boards/scum/board_info.h",
"diff": "@@ -52,10 +52,10 @@ to return the board's description.\n//===== IEEE802154E timing\n-#define SLOTDURATION 70 // in miliseconds\n+#define SLOTDURATION 80 // in miliseconds\n//// time-slot related\n-#define PORT_TsSlotDuration 2296 // 491 ticks = 15ms @32768Hz\n+#define PORT_TsSlotDuration 2623 // 491 ticks = 15ms @32768Hz\n#define PORT_maxTxDataPrepare 690 // 66 ticks = 2013us @32768Hz\n#define PORT_maxRxAckPrepare 512 // 20 ticks = 610us @32768Hz\n#define PORT_maxRxDataPrepare 528 // 33 ticks = 1006us @32768Hz\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -287,7 +287,7 @@ void isr_ieee154e_newSlot(opentimers_id_t id) {\nTIME_TICS, // timetype\nisr_ieee154e_newSlot // callback\n);\n- ieee154e_vars.compensatingCounter = 7;\n+ ieee154e_vars.compensatingCounter = 2;\nieee154e_vars.slotDuration = TsSlotDuration+1;\n} else {\nopentimers_scheduleAbsolute(\n@@ -699,7 +699,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\n// change state\nchangeState(S_SYNCPROC);\n- debugpins_debug_set();\n+\n// get a buffer to put the (received) frame in\nieee154e_vars.dataReceived = openqueue_getFreePacketBuffer(COMPONENT_IEEE802154E);\nif (ieee154e_vars.dataReceived==NULL) {\n@@ -715,8 +715,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\nieee154e_vars.dataReceived->creator = COMPONENT_IEEE802154E;\nieee154e_vars.dataReceived->owner = COMPONENT_IEEE802154E;\n- debugpins_debug_clr();\n-\n/*\nThe do-while loop that follows is a little parsing trick.\nBecause it contains a while(0) condition, it gets executed only once.\n@@ -728,7 +726,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\ndoes not get executed. This indicates the received packet is correct.\n*/\ndo { // this \"loop\" is only executed once\n- debugpins_debug_set();\n+\n// retrieve the received data frame from the radio's Rx buffer\nieee154e_vars.dataReceived->payload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]);\nradio_getReceivedFrame( ieee154e_vars.dataReceived->payload,\n@@ -737,7 +735,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\n&ieee154e_vars.dataReceived->l1_rssi,\n&ieee154e_vars.dataReceived->l1_lqi,\n&ieee154e_vars.dataReceived->l1_crc);\n- debugpins_debug_clr();\n// break if packet too short\nif (ieee154e_vars.dataReceived->length<LENGTH_CRC || ieee154e_vars.dataReceived->length>LENGTH_IEEE154_MAX) {\n@@ -757,8 +754,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\nbreak;\n}\n- debugpins_debug_set();\n-\n// parse the IEEE802.15.4 header (synchronize, end of frame)\nieee802154_retrieveHeader(ieee154e_vars.dataReceived,&ieee802514_header);\n@@ -773,8 +768,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\nieee154e_vars.dataReceived->l2_dsn = ieee802514_header.dsn;\nmemcpy(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop),&(ieee802514_header.src),sizeof(open_addr_t));\n- debugpins_debug_clr();\n-\n// verify that incoming security level is acceptable\nif (IEEE802154_security_acceptableLevel(ieee154e_vars.dataReceived, &ieee802514_header) == FALSE) {\nbreak;\n@@ -792,8 +785,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\n}\n}\n- debugpins_debug_set();\n-\n// toss the IEEE802.15.4 header -- this does not include IEs as they are processed\n// next.\npacketfunctions_tossHeader(ieee154e_vars.dataReceived,ieee802514_header.headerLength);\n@@ -812,10 +803,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\nbreak;\n}\n- debugpins_debug_clr();\n-\n- debugpins_debug_set();\n-\n// turn off the radio\nradio_rfOff();\n@@ -828,8 +815,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime)\n// synchronize (for the first time) to the sender's EB\nsynchronizePacket(ieee154e_vars.syncCapturedTime);\n- debugpins_debug_clr();\n-\n// declare synchronized\nchangeIsSync(TRUE);\n// log the info\n@@ -1823,7 +1808,6 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\n*/\ndo { // this \"loop\" is only executed once\n- debugpins_debug_toggle();\n// retrieve the received data frame from the radio's Rx buffer\nieee154e_vars.dataReceived->payload = &(ieee154e_vars.dataReceived->packet[FIRST_FRAME_BYTE]);\nradio_getReceivedFrame(\n@@ -1862,8 +1846,6 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nbreak;\n}\n- debugpins_debug_toggle();\n-\n// store header details in packet buffer\nieee154e_vars.dataReceived->l2_frameType = ieee802514_header.frameType;\nieee154e_vars.dataReceived->l2_dsn = ieee802514_header.dsn;\n@@ -1916,8 +1898,6 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nbreak;\n}\n- debugpins_debug_toggle();\n-\n// record the timeCorrection and print out at end of slot\nieee154e_vars.dataReceived->l2_timeCorrection = (PORT_SIGNED_INT_WIDTH)((PORT_SIGNED_INT_WIDTH)TsTxOffset-(PORT_SIGNED_INT_WIDTH)ieee154e_vars.syncCapturedTime);\n@@ -2007,8 +1987,6 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\n// or in case I'm in the middle of the join process when parent is not yet selected\n// or in case I don't have an autonomous Tx cell cell to my parent yet\n- debugpins_debug_toggle();\n-\nif (\nidmanager_getIsDAGroot() == FALSE &&\n(\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -165,7 +165,7 @@ enum ieee154e_atomicdurations_enum {\nTsTxAckDelay = 33, // 1000us\nTsShortGT = 13, // 500us, The standardlized value for this is 400/2=200us(7ticks). Currectly 7 doesn't work for short packet, change it back to 7 when found the problem.\n#endif\n-#if SLOTDURATION==70\n+#if SLOTDURATION==80\nTsTxOffset = 800, // 5215us\nTsLongGT = 44, // 1300us\nTsTxAckDelay = 1100, // 5521us\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. using slot duration 80ms.
|
491,595 |
03.05.2019 14:20:44
| -7,200 |
bf930bdee7a622a51b1f87b6bba6a7621765e94f
|
update to load openwsn firmware by default.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/scum/SCM3B_bootload_script.py",
"new_path": "projects/scum/SCM3B_bootload_script.py",
"diff": "@@ -12,7 +12,8 @@ import time\n# ---------------------------------------------------------------------\ncom_port = 'COM11';\n-binFilePath = \"{0}\\Objects\\{0}.bin\".format('01bsp_leds')\n+# binFilePath = \"{0}\\Objects\\{0}.bin\".format('01bsp_radio')\n+binFilePath = \"{0}\\Objects\\{0}.bin\".format('03oos_openwsn')\nprint \"bin file path: {0}\".format(binFilePath)\n@@ -53,6 +54,8 @@ with open(binFilePath, 'rb') as f:\ncode_length = len(bindata) - 1\npad_length = 65536 - code_length - 1\n+print code_length, pad_length\n+\n# Optional: pad out payload with random data if desired\n# Otherwise pad out with zeros - uC must receive full 64kB\nif(pad_random_payload == 1):\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. update to load openwsn firmware by default.
|
491,595 |
03.05.2019 15:34:36
| -7,200 |
d0a884b92338a06223cb39bdeb72c3cb1bda869a
|
use SCUM3C_FPGA_PCB_VERSION to separate the code from scum to other board.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/debugpins.h",
"new_path": "bsp/boards/debugpins.h",
"diff": "@@ -58,9 +58,9 @@ void debugpins_intdisabled_toggle(void);\nvoid debugpins_intdisabled_clr(void);\nvoid debugpins_intdisabled_set(void);\n-void debugpins_debug_toggle(void);\n-void debugpins_debug_clr(void);\n-void debugpins_debug_set(void);\n+void debugpins_debug_x_toggle(void);\n+void debugpins_debug_x_clr(void);\n+void debugpins_debug_x_set(void);\nvoid debugpins_debug_y_toggle(void);\nvoid debugpins_debug_y_clr(void);\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/board_info.h",
"new_path": "bsp/boards/scum/board_info.h",
"diff": "@@ -73,6 +73,16 @@ to return the board's description.\n#define SLOT_FSM_IMPLEMENTATION_SINGLE_COMPARE_TIMER_INTERRUPT\n// #define SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n+// The scum setting frequency for tx and rx are seperated,\n+// the radio interface needs to be changed to adapt this feature\n+// Another reason is the setting frequency takes long since we need write the\n+// frequency variables from FPGA to the PCB board. SCuM needs a seperating\n+// timing for when to send the frame which currently is a common value for all board.\n+// Those are the two reasons to define the marco below to insolated the SCuM related code.\n+// This marco shouldn't be used with the new tapeout which should be ready around July 2019.\n+\n+#define SCUM3C_FPGA_PCB_VERSION\n+\n//#define DAGROOT\n//=========================== typedef ========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/debugpins.c",
"new_path": "bsp/boards/scum/debugpins.c",
"diff": "@@ -94,15 +94,15 @@ void debugpins_radio_set(void) {\nGPIO_REG__OUTPUT |= 0x0020;\n}\n-void debugpins_debug_toggle(void) {\n+void debugpins_debug_x_toggle(void) {\nGPIO_REG__OUTPUT ^= 0x0040;\n}\n-void debugpins_debug_clr(void) {\n+void debugpins_debug_x_clr(void) {\nGPIO_REG__OUTPUT &= ~0x0040;\n}\n-void debugpins_debug_set(void) {\n+void debugpins_debug_x_set(void) {\nGPIO_REG__OUTPUT |= 0x0040;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/radio.c",
"new_path": "bsp/boards/scum/radio.c",
"diff": "@@ -194,7 +194,7 @@ void setFrequencyTX(unsigned int channel){\nanalog_scan_chain_load_3B_fromFPGA();\n}\n-void radio_setFrequency(uint8_t frequency, uint8_t tx_or_rx) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/radio.h",
"new_path": "bsp/boards/scum/radio.h",
"diff": "@@ -42,6 +42,11 @@ typedef enum {\nRADIOSTATE_TURNING_OFF = 0x0d, ///< Turning the RF chain off.\n} radio_state_t;\n+typedef enum {\n+ FREQ_TX = 0x01,\n+ FREQ_RX = 0x02,\n+} radio_freq_t;\n+\n//=========================== typedef =========================================\ntypedef void (*radio_capture_cbt)(PORT_TIMER_WIDTH timestamp);\n@@ -57,7 +62,7 @@ void radio_setEndFrameCb(radio_capture_cbt cb);\n// reset\nvoid radio_reset(void);\n// RF admin\n-void radio_setFrequency(uint8_t frequency, uint8_t tx_or_rx);\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx);\n//void radio_setFrequency(uint8_t frequency);\nvoid radio_rfOn(void);\nvoid radio_rfOff(void);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -279,6 +279,9 @@ void isr_ieee154e_newSlot(opentimers_id_t id) {\nieee154e_vars.startOfSlotReference = opentimers_getCurrentCompareValue();\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // the RFTimer clock is sourced from 500KHz clock which can't be well translated to 32768Hz\n+ // so, use the adaptive synchronization to compensate this\nif (ieee154e_vars.compensatingCounter == 0 && idmanager_getIsDAGroot()==FALSE){\nopentimers_scheduleAbsolute(\nieee154e_vars.timerId, // timerId\n@@ -299,17 +302,18 @@ void isr_ieee154e_newSlot(opentimers_id_t id) {\n);\nieee154e_vars.slotDuration = TsSlotDuration;\n}\n-\nieee154e_vars.compensatingCounter -= 1;\n+#else\n+ opentimers_scheduleAbsolute(\n+ ieee154e_vars.timerId, // timerId\n+ TsSlotDuration, // duration\n+ ieee154e_vars.startOfSlotReference, // reference\n+ TIME_TICS, // timetype\n+ isr_ieee154e_newSlot // callback\n+ );\n+ ieee154e_vars.slotDuration = TsSlotDuration;\n+#endif\n-// opentimers_scheduleAbsolute(\n-// ieee154e_vars.timerId, // timerId\n-// TsSlotDuration, // duration\n-// ieee154e_vars.startOfSlotReference, // reference\n-// TIME_TICS, // timetype\n-// isr_ieee154e_newSlot // callback\n-// );\n-// ieee154e_vars.slotDuration = TsSlotDuration;\n// radiotimer_setPeriod(ieee154e_vars.slotDuration);\nif (ieee154e_vars.isSync==FALSE) {\nif (idmanager_getIsDAGroot()==TRUE) {\n@@ -586,8 +590,12 @@ port_INLINE void activity_synchronize_newSlot(void) {\n// update record of current channel\nieee154e_vars.freq = (openrandom_get16b()&0x0F) + 11;\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the frequency\n- radio_setFrequency(ieee154e_vars.freq, 0x02);\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\nsctimer_setCapture(ACTION_RX_SFD_DONE);\n@@ -614,8 +622,13 @@ port_INLINE void activity_synchronize_newSlot(void) {\n// update record of current channel\nieee154e_vars.freq = (openrandom_get16b()&0x0F) + 11;\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the frequency\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n// configure the radio to listen to the frequency\n- radio_setFrequency(ieee154e_vars.freq, 0x02);\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\n}\n// switch on the radio in Rx mode.\n@@ -632,9 +645,12 @@ port_INLINE void activity_synchronize_newSlot(void) {\n// update record of current channel\nieee154e_vars.freq = calculateFrequency(ieee154e_vars.singleChannel);\n-\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\n- radio_setFrequency(ieee154e_vars.freq, 0x02);\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\nsctimer_setCapture(ACTION_RX_SFD_DONE);\n@@ -1058,7 +1074,6 @@ port_INLINE void activity_ti1ORri1(void) {\nchangeState(S_TXDATAOFFSET);\n- debugpins_debug_y_toggle();\n// change owner\nieee154e_vars.dataToSend->owner = COMPONENT_IEEE802154E;\nif (couldSendEB==TRUE) { // I will be sending an EB\n@@ -1069,7 +1084,6 @@ port_INLINE void activity_ti1ORri1(void) {\nmemcpy(ieee154e_vars.dataToSend->l2_ASNpayload,&asn[0],sizeof(asn_t));\nmemcpy(ieee154e_vars.dataToSend->l2_ASNpayload+sizeof(asn_t),&join_priority,sizeof(uint8_t));\n}\n- debugpins_debug_y_toggle();\n// record that I attempt to transmit this packet\nieee154e_vars.dataToSend->l2_numTxAttempts++;\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n@@ -1090,9 +1104,13 @@ port_INLINE void activity_ti1ORri1(void) {\n}\n// add 2 CRC bytes only to the local copy as we end up here for each retransmission\npacketfunctions_reserveFooterSize(&ieee154e_vars.localCopyForTransmission, 2);\n-\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n+#else\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n+#endif\n// set the tx buffer address and length register.(packet is NOT loaded at this moment)\nradio_loadPacket_prepare(ieee154e_vars.localCopyForTransmission.payload,\n@@ -1105,7 +1123,6 @@ port_INLINE void activity_ti1ORri1(void) {\nsctimer_setCapture(ACTION_TX_SFD_DONE);\nsctimer_setCapture(ACTION_TX_SEND_DONE);\n#else\n- debugpins_debug_y_toggle();\n// arm tt1\nopentimers_scheduleAbsolute(\nieee154e_vars.timerId, // timerId\n@@ -1114,7 +1131,6 @@ port_INLINE void activity_ti1ORri1(void) {\nTIME_TICS, // timetype\nisr_ieee154e_timer // callback\n);\n- debugpins_debug_y_toggle();\n// radiotimer_schedule(DURATION_tt1);\n#endif\nbreak;\n@@ -1132,8 +1148,13 @@ port_INLINE void activity_ti1ORri1(void) {\nsctimer_setCapture(ACTION_RX_SFD_DONE);\nsctimer_setCapture(ACTION_RX_DONE);\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n+#endif\n#else\n// arm rt1\nopentimers_scheduleAbsolute(\n@@ -1191,8 +1212,13 @@ port_INLINE void activity_ti2(void) {\n// add 2 CRC bytes only to the local copy as we end up here for each retransmission\npacketfunctions_reserveFooterSize(&ieee154e_vars.localCopyForTransmission, 2);\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n+#else\n// configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq, 0x01);\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\n// load the packet in the radio's Tx buffer\nradio_loadPacket(ieee154e_vars.localCopyForTransmission.payload,\n@@ -1339,8 +1365,13 @@ port_INLINE void activity_ti5(PORT_TIMER_WIDTH capturedTime) {\nsctimer_setCapture(ACTION_RX_SFD_DONE);\nsctimer_setCapture(ACTION_RX_DONE);\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n+#endif\n#else\n// arm tt5\nopentimers_scheduleAbsolute(\n@@ -1382,8 +1413,13 @@ port_INLINE void activity_ti6(void) {\n);\n// radiotimer_schedule(DURATION_tt6);\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n// configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq, 0x02);\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\nradio_rxEnable();\n#endif\n@@ -1658,8 +1694,13 @@ port_INLINE void activity_ri2(void) {\n);\n// radiotimer_schedule(DURATION_rt2);\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n+#else\n// configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq, 0x02);\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\nradio_rxEnable();\n#endif\n@@ -1969,8 +2010,13 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nsctimer_setCapture(ACTION_TX_SFD_DONE);\nsctimer_setCapture(ACTION_TX_SEND_DONE);\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n+#else\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n+#endif\n#else\n// arm rt5\nopentimers_scheduleAbsolute(\n@@ -2095,8 +2141,14 @@ port_INLINE void activity_ri6(void) {\npacketfunctions_reserveFooterSize(ieee154e_vars.ackToSend,2);\nradio_rfOff();\n+\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+ // configure the radio to listen to the default synchronizing channel\n+ radio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n+#else\n// configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq, 0x01);\n+ radio_setFrequency(ieee154e_vars.freq);\n+#endif\n// load the packet in the radio's Tx buffer\nradio_loadPacket(ieee154e_vars.ackToSend->payload,\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -165,11 +165,24 @@ enum ieee154e_atomicdurations_enum {\nTsTxAckDelay = 33, // 1000us\nTsShortGT = 13, // 500us, The standardlized value for this is 400/2=200us(7ticks). Currectly 7 doesn't work for short packet, change it back to 7 when found the problem.\n#endif\n+#ifdef SCUM3C_FPGA_PCB_VERSION\n+\n#if SLOTDURATION==80\nTsTxOffset = 800, // 5215us\nTsLongGT = 44, // 1300us\nTsTxAckDelay = 1100, // 5521us\nTsShortGT = 30, // 500us\n+#endif\n+\n+#else\n+\n+#if SLOTDURATION==20\n+ TsTxOffset = 171, // 5215us\n+ TsLongGT = 43, // 1300us\n+ TsTxAckDelay = 181, // 5521us\n+ TsShortGT = 16, // 500us\n+#endif\n+\n#endif\nTsSlotDuration = PORT_TsSlotDuration, // 10000us\n// execution speed related\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. use SCUM3C_FPGA_PCB_VERSION to separate the code from scum to other board.
|
491,595 |
03.05.2019 15:46:51
| -7,200 |
c9135f94bda62a2df1146c5be3dc63b6db0d994c
|
remove printf function in the stack.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -1049,16 +1049,6 @@ port_INLINE void activity_ti1ORri1(void) {\nif (ieee154e_vars.dataToSend == NULL) {\nieee154e_vars.dataToSend = openqueue_macGet6PResponseAndDownStreamPacket(&neighbor);\n}\n-\n- if (ieee154e_vars.dataToSend != NULL) {\n- printf(\"creator=%d reqORresp=%d neighborType=%d neighbor_addr[6]=%x neighbor_addr[7]=%x\\r\\n\",\n- ieee154e_vars.dataToSend->creator,\n- ieee154e_vars.dataToSend->l2_sixtop_command,\n- autonomousUnicastNeighbor.type,\n- autonomousUnicastNeighbor.addr_64b[6],\n- autonomousUnicastNeighbor.addr_64b[7]\n- );\n- }\n}\n}\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. remove printf function in the stack.
|
491,595 |
13.05.2019 14:25:16
| -7,200 |
0fc4a600f6a03cf89475b3e7fffc072ab79d4a33
|
remove the leds debug code
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -2043,7 +2043,6 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nieee154e_vars.dataReceived = NULL;\n// abort\nendSlot();\n- leds_debug_off();\n}\n// everything went well, return here not to execute the error code below\n@@ -2059,7 +2058,6 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\n// abort\nendSlot();\n- leds_debug_off();\n}\nport_INLINE void activity_ri6(void) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. remove the leds debug code
|
491,595 |
13.05.2019 19:21:53
| -7,200 |
8d2af25c1331570ab7ba2e7225bb25e2902a63b9
|
Add openmotestm board to travis buidling machine.
|
[
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -17,6 +17,7 @@ script:\n# - scons board=telosb toolchain=mspgcc verbose=1 oos_macpong\n# - scons board=telosb kernel=freertos toolchain=mspgcc verbose=1 oos_macpong\n- scons board=openmote-cc2538 toolchain=armgcc verbose=1 oos_macpong\n+- scons board=openmotestm toolchain=armgcc verbose=1 oos_macpong\n# - scons board=wsn430v14 toolchain=mspgcc verbose=1 oos_macpong\n# - scons board=wsn430v13b toolchain=mspgcc verbose=1 oos_macpong\n# - scons board=gina toolchain=mspgcc verbose=1 oos_macpong\n@@ -25,9 +26,9 @@ script:\n- scons board=iot-lab_A8-M3 toolchain=armgcc verbose=1 oos_macpong\n# - scons board=telosb toolchain=mspgcc verbose=1 oos_openwsn\n# - scons board=telosb kernel=freertos toolchain=mspgcc verbose=1 oos_openwsn\n+- scons board=openmotestm toolchain=armgcc verbose=1 oos_openwsn\n- scons board=openmote-cc2538 toolchain=armgcc verbose=1 oos_openwsn\n-- scons board=openmote-cc2538 goldenImage=sniffer toolchain=armgcc verbose=1 oos_sniffer\n-- scons board=openmote-cc2538 goldenImage=root toolchain=armgcc verbose=1 oos_openwsn\n+- scons board=openmote-cc2538 toolchain=armgcc verbose=1 oos_sniffer\n- scons board=openmote-b toolchain=armgcc verbose=1 oos_openwsn\n- scons board=openmote-b-24ghz toolchain=armgcc verbose=1 oos_openwsn\n# - scons board=wsn430v14 toolchain=mspgcc verbose=1 oos_openwsn\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Add openmotestm board to travis buidling machine.
|
491,595 |
16.05.2019 12:03:38
| -7,200 |
ce36c2c061fffdd584307dc86be2fc115e99a225
|
update the callback function name by ending with '_cbt'
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/msf.c",
"new_path": "openstack/02b-MAChigh/msf.c",
"diff": "@@ -44,10 +44,10 @@ void msf_init(void) {\nmemset(&msf_vars,0,sizeof(msf_vars_t));\nmsf_vars.numAppPacketsPerSlotFrame = 0;\nsixtop_setSFcallback(\n- (sixtop_sf_getsfid)msf_getsfid,\n- (sixtop_sf_getmetadata)msf_getMetadata,\n- (sixtop_sf_translatemetadata)msf_translateMetadata,\n- (sixtop_sf_handle_callback)msf_handleRCError\n+ (sixtop_sf_getsfid_cbt)msf_getsfid,\n+ (sixtop_sf_getmetadata_cbt)msf_getMetadata,\n+ (sixtop_sf_translatemetadata_cbt)msf_translateMetadata,\n+ (sixtop_sf_handle_callback_cbt)msf_handleRCError\n);\nmemset(&temp_neighbor,0,sizeof(temp_neighbor));\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -151,10 +151,10 @@ void sixtop_setEBPeriod(uint8_t ebPeriod) {\n}\nvoid sixtop_setSFcallback(\n- sixtop_sf_getsfid cb0,\n- sixtop_sf_getmetadata cb1,\n- sixtop_sf_translatemetadata cb2,\n- sixtop_sf_handle_callback cb3\n+ sixtop_sf_getsfid_cbt cb0,\n+ sixtop_sf_getmetadata_cbt cb1,\n+ sixtop_sf_translatemetadata_cbt cb2,\n+ sixtop_sf_handle_callback_cbt cb3\n){\nsixtop_vars.cb_sf_getsfid = cb0;\nsixtop_vars.cb_sf_getMetadata = cb1;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.h",
"new_path": "openstack/02b-MAChigh/sixtop.h",
"diff": "@@ -82,10 +82,10 @@ typedef enum {\n// on the receiver side of sixtop, it may has mutiple sixtop request in the queue to response (most of them will return with RC BUSY)\n// increase the timeout longer than calculated value\n#define SIX2SIX_TIMEOUT_MS 65535\n-typedef uint8_t (*sixtop_sf_getsfid)(void);\n-typedef uint16_t (*sixtop_sf_getmetadata)(void);\n-typedef metadata_t (*sixtop_sf_translatemetadata)(void);\n-typedef void (*sixtop_sf_handle_callback)(uint8_t arg, open_addr_t* address);\n+typedef uint8_t (*sixtop_sf_getsfid_cbt)(void);\n+typedef uint16_t (*sixtop_sf_getmetadata_cbt)(void);\n+typedef metadata_t (*sixtop_sf_translatemetadata_cbt)(void);\n+typedef void (*sixtop_sf_handle_callback_cbt)(uint8_t arg, open_addr_t* address);\n#define SIXTOP_MINIMAL_EBPERIOD 5 // minist period of sending EB\n@@ -108,10 +108,10 @@ typedef struct {\nbool isResponseEnabled;\nuint8_t cellOptions;\ncellInfo_ht celllist_toDelete[CELLLIST_MAX_LEN];\n- sixtop_sf_getsfid cb_sf_getsfid;\n- sixtop_sf_getmetadata cb_sf_getMetadata;\n- sixtop_sf_translatemetadata cb_sf_translateMetadata;\n- sixtop_sf_handle_callback cb_sf_handleRCError;\n+ sixtop_sf_getsfid_cbt cb_sf_getsfid;\n+ sixtop_sf_getmetadata_cbt cb_sf_getMetadata;\n+ sixtop_sf_translatemetadata_cbt cb_sf_translateMetadata;\n+ sixtop_sf_handle_callback_cbt cb_sf_handleRCError;\nopen_addr_t neighborToClearCells;\n} sixtop_vars_t;\n@@ -122,10 +122,10 @@ void sixtop_init(void);\nvoid sixtop_setKaPeriod(uint16_t kaPeriod);\nvoid sixtop_setEBPeriod(uint8_t ebPeriod);\nvoid sixtop_setSFcallback(\n- sixtop_sf_getsfid cb0,\n- sixtop_sf_getmetadata cb1,\n- sixtop_sf_translatemetadata cb2,\n- sixtop_sf_handle_callback cb3\n+ sixtop_sf_getsfid_cbt cb0,\n+ sixtop_sf_getmetadata_cbt cb1,\n+ sixtop_sf_translatemetadata_cbt cb2,\n+ sixtop_sf_handle_callback_cbt cb3\n);\n// scheduling\nowerror_t sixtop_request(\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -225,8 +225,12 @@ callbackFunctionsToChange = [\n# topology\n# neighbors\n# schedule\n- # otf\n+ # msf\n# sixtop\n+ 'cb_sf_getsfid',\n+ 'cb_sf_getMetadata',\n+ 'cb_sf_translateMetadata',\n+ 'cb_sf_handleRCError',\n# iphc\n# openbridge\n# forwarding\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-837. update the callback function name by ending with '_cbt'
|
491,595 |
16.05.2019 12:05:59
| -7,200 |
80ce527fcbe8148cdafa84f86a0fb94685476655
|
update sequence number for error return code 6P transcation.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/msf.c",
"new_path": "openstack/02b-MAChigh/msf.c",
"diff": "@@ -174,6 +174,8 @@ void msf_handleRCError(uint8_t code, open_addr_t* address){\n// mark neighbor f6NORES\nneighbors_setNeighborNoResource(address);\n}\n+\n+ neighbors_updateSequenceNumber(address);\n}\nvoid msf_timer_waitretry_cb(opentimers_id_t id){\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-838. update sequence number for error return code 6P transcation.
|
491,595 |
17.05.2019 20:18:39
| -7,200 |
5cfcc260c85d57d5cff31b4192a6828d96b7e18a
|
retrieve the celllist to delete from the response frame.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -1522,9 +1522,21 @@ void sixtop_six2six_notifyReceive(\nneighbors_updateSequenceNumber(&(pkt->l2_nextORpreviousHop));\nbreak;\ncase SIX_STATE_WAIT_DELETERESPONSE:\n+ i = 0;\n+ memset(pkt->l2_sixtop_celllist_delete,0,sizeof(pkt->l2_sixtop_celllist_delete));\n+ while(pktLen>0){\n+ pkt->l2_sixtop_celllist_delete[i].slotoffset = *((uint8_t*)(pkt->payload)+ptr);\n+ pkt->l2_sixtop_celllist_delete[i].slotoffset |= (*((uint8_t*)(pkt->payload)+ptr+1))<<8;\n+ pkt->l2_sixtop_celllist_delete[i].channeloffset = *((uint8_t*)(pkt->payload)+ptr+2);\n+ pkt->l2_sixtop_celllist_delete[i].channeloffset |= (*((uint8_t*)(pkt->payload)+ptr+3))<<8;\n+ pkt->l2_sixtop_celllist_delete[i].isUsed = TRUE;\n+ ptr += 4;\n+ pktLen -= 4;\n+ i++;\n+ }\nsixtop_removeCells(\nsixtop_vars.cb_sf_getMetadata(),\n- sixtop_vars.celllist_toDelete,\n+ pkt->l2_sixtop_celllist_delete,\n&(pkt->l2_nextORpreviousHop),\nsixtop_vars.cellOptions\n);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-840. retrieve the celllist to delete from the response frame.
|
491,607 |
25.04.2019 16:04:28
| -7,200 |
5dd6ac6cc534221f15529f8a5a79e0538afae95a
|
Mercator: take a packet only when its CRC is correct
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -443,12 +443,14 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nis_expected = FALSE;\n}\n- if (is_expected == TRUE){\n+ if (is_expected == TRUE && mercator_vars.rxpk_crc == TRUE){\nresp = (IND_RX_ht*)mercator_vars.uartbuftx;\nresp->type = TYPE_IND_RX;\nresp->length = mercator_vars.rxpk_len;\nresp->rssi = mercator_vars.rxpk_rssi;\n+ // resp->flags should have always the same value, 0xc0, but\n+ // keep this attribute for backward compatibility\nresp->flags = mercator_vars.rxpk_crc << 7 | is_expected << 6;\nresp->pkctr = rx_temp->pkctr;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: take a packet only when its CRC is correct
|
491,607 |
25.04.2019 16:46:56
| -7,200 |
b7056e07225580025d58c292683004c64904f96b
|
Mercator: move 'mercator_vars.numnotifications++' to the right place
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -457,9 +457,9 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nmercator_vars.uartbuftxfill = sizeof(IND_RX_ht);\nserial_flushtx();\n- }\nmercator_vars.numnotifications++;\n+ }\nradio_rfOn();\nradio_rxEnable();\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: move 'mercator_vars.numnotifications++' to the right place
|
491,607 |
25.04.2019 17:11:48
| -7,200 |
cf86835bc6cbee30a364e82d9d7b5015c1a1b47d
|
Mercator: add a comment
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -461,6 +461,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nmercator_vars.numnotifications++;\n}\n+ // get ready for a following frame\nradio_rfOn();\nradio_rxEnable();\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: add a comment
|
491,607 |
25.04.2019 19:21:50
| -7,200 |
467fb55eb84ffcacb4e4d12db90ff55955280461
|
Mercator: introduce TYPE_RESP_{TX,RX,IDLE}
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -127,6 +127,9 @@ void serial_tx_RESP_ST(void) {\n}\nvoid serial_rx_REQ_IDLE(void) {\n+ // schedule a response\n+ scheduler_push_task(serial_tx_RESP_IDLE,TASK_PRIO_SERIAL);\n+\nif (mercator_vars.uartbufrxindex!=sizeof(REQ_IDLE_ht)){\n// update stats\nmercator_vars.serialNumRxWrongLength++;\n@@ -141,16 +144,31 @@ void serial_rx_REQ_IDLE(void) {\nmercator_vars.status = ST_IDLE;\n}\n+void serial_tx_RESP_IDLE(void) {\n+ RESP_IDLE_ht* resp;\n+\n+ resp = (RESP_IDLE_ht*)mercator_vars.uartbuftx;\n+\n+ resp->type = TYPE_RESP_IDLE;\n+ mercator_vars.uartbuftxfill = sizeof(RESP_IDLE_ht);\n+\n+ serial_flushtx();\n+}\n+\nvoid serial_rx_REQ_TX(void) {\nuint16_t transctr;\nuint16_t pkctr;\nREQ_TX_ht* req;\n+ // schedule a response\n+ scheduler_push_task(serial_tx_RESP_TX,TASK_PRIO_SERIAL);\n+\nif (mercator_vars.uartbufrxindex!=sizeof(REQ_TX_ht)){\n// update stats\nmercator_vars.serialNumRxWrongLength++;\nreturn;\n}\n+\nmercator_vars.status = ST_TX;\nmercator_vars.numnotifications = 0;\n@@ -193,8 +211,23 @@ void serial_rx_REQ_TX(void) {\nreturn;\n}\n+void serial_tx_RESP_TX(void) {\n+ RESP_TX_ht* resp;\n+\n+ resp = (RESP_TX_ht*)mercator_vars.uartbuftx;\n+\n+ resp->type = TYPE_RESP_TX;\n+ mercator_vars.uartbuftxfill = sizeof(RESP_TX_ht);\n+\n+ serial_flushtx();\n+}\n+\nvoid serial_rx_REQ_RX(void) {\nREQ_RX_ht* req;\n+\n+ // schedule a response\n+ scheduler_push_task(serial_tx_RESP_RX,TASK_PRIO_SERIAL);\n+\nif (mercator_vars.uartbufrxindex!=sizeof(REQ_RX_ht)){\n// update stats\nmercator_vars.serialNumRxWrongLength++;\n@@ -226,6 +259,17 @@ void serial_rx_REQ_RX(void) {\nreturn;\n}\n+void serial_tx_RESP_RX(void) {\n+ RESP_RX_ht* resp;\n+\n+ resp = (RESP_RX_ht*)mercator_vars.uartbuftx;\n+\n+ resp->type = TYPE_RESP_RX;\n+ mercator_vars.uartbuftxfill = sizeof(RESP_RX_ht);\n+\n+ serial_flushtx();\n+}\n+\nvoid serial_tx_IND_UP(void) {\nIND_UP_ht* resp;\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.h",
"new_path": "projects/common/03oos_mercator/03oos_mercator.h",
"diff": "#define TYPE_REQ_RX 6\n#define TYPE_IND_RX 7\n#define TYPE_IND_UP 8\n+#define TYPE_RESP_IDLE 10\n+#define TYPE_RESP_TX 11\n+#define TYPE_RESP_RX 12\n#define ST_IDLE 1\n#define ST_TX 2\n@@ -66,6 +69,12 @@ typedef struct {\n} REQ_TX_ht;\nEND_PACK\n+BEGIN_PACK\n+typedef struct {\n+ uint8_t type;\n+} RESP_TX_ht;\n+END_PACK\n+\nBEGIN_PACK\ntypedef struct {\nuint8_t type;\n@@ -83,6 +92,8 @@ typedef struct {\n} REQ_RX_ht;\nEND_PACK\n+typedef RESP_TX_ht RESP_RX_ht;\n+typedef RESP_TX_ht RESP_IDLE_ht;\nBEGIN_PACK\ntypedef struct {\nuint8_t type;\n@@ -174,8 +185,11 @@ void serial_rx_all(void);\nvoid serial_rx_REQ_ST(void);\nvoid serial_tx_RESP_ST(void);\nvoid serial_rx_REQ_IDLE(void);\n+void serial_tx_RESP_IDLE(void);\nvoid serial_rx_REQ_TX(void);\n+void serial_tx_RESP_TX(void);\nvoid serial_rx_REQ_RX(void);\n+void serial_tx_RESP_RX(void);\nvoid serial_tx_IND_UP(void);\nvoid isr_openserial_tx_mod(void);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: introduce TYPE_RESP_{TX,RX,IDLE}
|
491,607 |
08.05.2019 22:52:38
| -7,200 |
5a9b8ea7311bb0a5cccd17e49192118afbd9cfb9
|
Mercator: use txpk_ attributes to store expected values
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -235,9 +235,10 @@ void serial_rx_REQ_RX(void) {\n}\nreq = (REQ_RX_ht*)mercator_vars.uartbufrx;\n- mercator_vars.rxpk_transctr = htons(req->transctr);\n- mercator_vars.rxpk_txfillbyte = req->txfillbyte;\n- memcpy(mercator_vars.rxpk_srcmac, req->srcmac, 8);\n+ // save the expected values\n+ mercator_vars.txpk_transctr = htons(req->transctr);\n+ mercator_vars.txpk_txfillbyte = req->txfillbyte;\n+ memcpy(mercator_vars.txpk_srcmac, req->srcmac, 8);\n// reset notifications counter\n@@ -473,17 +474,17 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nrx_temp = (RF_PACKET_ht *)mercator_vars.rxpk_buf;\n// check srcmac\n- if (memcmp(rx_temp->srcmac, mercator_vars.rxpk_srcmac, MAC_LEN) != 0){\n+ if (memcmp(rx_temp->srcmac, mercator_vars.txpk_srcmac, MAC_LEN) != 0){\nis_expected = FALSE;\n}\n// check transctr\n- if (rx_temp->transctr != mercator_vars.rxpk_transctr){\n+ if (rx_temp->transctr != mercator_vars.txpk_transctr){\nis_expected = FALSE;\n}\n// check txfillbyte\n- if (rx_temp->txfillbyte != mercator_vars.rxpk_txfillbyte){\n+ if (rx_temp->txfillbyte != mercator_vars.txpk_txfillbyte){\nis_expected = FALSE;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.h",
"new_path": "projects/common/03oos_mercator/03oos_mercator.h",
"diff": "@@ -155,12 +155,15 @@ typedef struct {\nuint16_t serialNumRxUnknownRequest;\n//=== RF\n+ uint8_t mac[MAC_LEN];\n// tx\nuint8_t rfbuftx[RF_BUF_LEN];\nuint16_t txpk_numpk;\nuint8_t txpk_len;\nuint16_t txpk_totalnumpk;\n- uint8_t mac[MAC_LEN];\n+ uint8_t txpk_txfillbyte;\n+ uint8_t txpk_srcmac[MAC_LEN];\n+ uint16_t txpk_transctr;\n// rx\nuint8_t rxpk_buf[RF_BUF_LEN];\nuint8_t rxpk_len;\n@@ -168,9 +171,6 @@ typedef struct {\nint8_t rxpk_rssi;\nuint8_t rxpk_lqi;\nbool rxpk_crc;\n- uint8_t rxpk_txfillbyte;\n- uint8_t rxpk_srcmac[MAC_LEN];\n- uint16_t rxpk_transctr;\n} mercator_vars_t;\nmercator_vars_t mercator_vars;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: use txpk_ attributes to store expected values
|
491,607 |
09.05.2019 00:04:17
| -7,200 |
eb510f08178c25081ca787cabb3fb4de22d8ad9b
|
Mercator: save 'txlen' as an expected value
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -236,6 +236,7 @@ void serial_rx_REQ_RX(void) {\nreq = (REQ_RX_ht*)mercator_vars.uartbufrx;\n// save the expected values\n+ mercator_vars.txpk_len = req->txlength;\nmercator_vars.txpk_transctr = htons(req->transctr);\nmercator_vars.txpk_txfillbyte = req->txfillbyte;\nmemcpy(mercator_vars.txpk_srcmac, req->srcmac, 8);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: save 'txlen' as an expected value
|
491,607 |
09.05.2019 00:06:52
| -7,200 |
eade854ea1256a163756c6e04d2652fd5e51e46d
|
Mercator: add length check for the received frame
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -479,6 +479,11 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nis_expected = FALSE;\n}\n+ // check length\n+ if (mercator_vars.rxpk_len != mercator_vars.txpk_len){\n+ is_expected = FALSE;\n+ }\n+\n// check transctr\nif (rx_temp->transctr != mercator_vars.txpk_transctr){\nis_expected = FALSE;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: add length check for the received frame
|
491,607 |
08.05.2019 22:53:46
| -7,200 |
6792f0ab2a94496ab89436348d8017c80c5a43d3
|
Mercator: check txfillbyte in the padding field
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -490,8 +490,12 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n}\n// check txfillbyte\n- if (rx_temp->txfillbyte != mercator_vars.txpk_txfillbyte){\n+ for (int i = offsetof(RF_PACKET_ht, txfillbyte);\n+ i < mercator_vars.rxpk_len - LENGTH_CRC; i++){\n+ if(mercator_vars.rxpk_buf[i] != mercator_vars.txpk_txfillbyte){\nis_expected = FALSE;\n+ break;\n+ }\n}\nif (is_expected == TRUE && mercator_vars.rxpk_crc == TRUE){\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: check txfillbyte in the padding field
|
491,607 |
09.05.2019 01:21:04
| -7,200 |
5ffe1c369c12fd169a34934939de879382387f3f
|
Mercator: change status to IDLE after sending IND_TXDONE
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -553,6 +553,10 @@ void cb_sendPacket(opentimers_id_t id){\nmercator_vars.numnotifications++;\n+ // goto IDLE\n+ radio_rfOff();\n+ mercator_vars.status = ST_IDLE;\n+\nreturn;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: change status to IDLE after sending IND_TXDONE
|
491,607 |
13.05.2019 13:56:55
| -7,200 |
4c78f24677f5e4e37c34b96ab3199b6f86e93b06
|
Mercator: don't init ST_TX if it's already in that state
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -169,6 +169,11 @@ void serial_rx_REQ_TX(void) {\nreturn;\n}\n+ if (mercator_vars.status == ST_TX){\n+ // we've already in ST_TX; just return a response\n+ return;\n+ }\n+\nmercator_vars.status = ST_TX;\nmercator_vars.numnotifications = 0;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: don't init ST_TX if it's already in that state
|
491,607 |
13.05.2019 13:58:33
| -7,200 |
9bc90a314c1b900be43e623191455fedffa4737f
|
Mercator: send back a response after received length check
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -127,14 +127,13 @@ void serial_tx_RESP_ST(void) {\n}\nvoid serial_rx_REQ_IDLE(void) {\n- // schedule a response\n- scheduler_push_task(serial_tx_RESP_IDLE,TASK_PRIO_SERIAL);\n-\nif (mercator_vars.uartbufrxindex!=sizeof(REQ_IDLE_ht)){\n// update stats\nmercator_vars.serialNumRxWrongLength++;\nreturn;\n}\n+ // schedule a response\n+ scheduler_push_task(serial_tx_RESP_IDLE,TASK_PRIO_SERIAL);\nif (mercator_vars.status == ST_TX){\nopentimers_cancel(mercator_vars.sendTimerId);\n} else if (mercator_vars.status == ST_RX){\n@@ -160,15 +159,15 @@ void serial_rx_REQ_TX(void) {\nuint16_t pkctr;\nREQ_TX_ht* req;\n- // schedule a response\n- scheduler_push_task(serial_tx_RESP_TX,TASK_PRIO_SERIAL);\n-\nif (mercator_vars.uartbufrxindex!=sizeof(REQ_TX_ht)){\n// update stats\nmercator_vars.serialNumRxWrongLength++;\nreturn;\n}\n+ // schedule a response\n+ scheduler_push_task(serial_tx_RESP_TX,TASK_PRIO_SERIAL);\n+\nif (mercator_vars.status == ST_TX){\n// we've already in ST_TX; just return a response\nreturn;\n@@ -230,15 +229,15 @@ void serial_tx_RESP_TX(void) {\nvoid serial_rx_REQ_RX(void) {\nREQ_RX_ht* req;\n- // schedule a response\n- scheduler_push_task(serial_tx_RESP_RX,TASK_PRIO_SERIAL);\n-\nif (mercator_vars.uartbufrxindex!=sizeof(REQ_RX_ht)){\n// update stats\nmercator_vars.serialNumRxWrongLength++;\nreturn;\n}\n+ // schedule a response\n+ scheduler_push_task(serial_tx_RESP_RX,TASK_PRIO_SERIAL);\n+\nreq = (REQ_RX_ht*)mercator_vars.uartbufrx;\n// save the expected values\nmercator_vars.txpk_len = req->txlength;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: send back a response after received length check
|
491,607 |
15.05.2019 15:55:22
| -7,200 |
f69765f39c8be4f7e2db1c111b18cb293a734cab
|
Mercator: add missing radio_rxNow()
Calling radio_rxNow() after radio_rxEnable() seems the right way to
make the radio listen according to IEEE802154E.c.
IoT-LAB M3 doesn't need the radio_rxNow() call since the function is
empty for that board. On the other hand, OpenMote-B needs the function
call, although radio_rxOn() is empty in the OpenMote-B case.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -258,6 +258,7 @@ void serial_rx_REQ_RX(void) {\n// switch in RX\nradio_rxEnable();\n+ radio_rxNow();\n// change status to RX\nmercator_vars.status = ST_RX;\n@@ -523,6 +524,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n// get ready for a following frame\nradio_rfOn();\nradio_rxEnable();\n+ radio_rxNow();\n}\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: add missing radio_rxNow()
Calling radio_rxNow() after radio_rxEnable() seems the right way to
make the radio listen according to IEEE802154E.c.
IoT-LAB M3 doesn't need the radio_rxNow() call since the function is
empty for that board. On the other hand, OpenMote-B needs the function
call, although radio_rxOn() is empty in the OpenMote-B case.
|
491,607 |
16.05.2019 10:21:41
| -7,200 |
480aaddb0f72e754b3bf41e036a57c4478763ad1
|
Mercator: fix a off-by-one bug in cb_sendPacket()
This bug causes openmote-b to send one more packet than
txpk_totalnumpk.
This bug has no effect on IoT-LAB M3. Because its radio
driver (radio_txNow()) doesn't wait SFD and its CPU is fast,
radio_txNow() seems to be canceled by the following radio_rfOff() in
if-block.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -533,15 +533,6 @@ void cb_sendPacket(opentimers_id_t id){\nuint16_t pkctr;\nuint8_t pkctr_offset = 10; // srcmac[8] + transctr[2]\n- // send packet\n- leds_error_on();\n-\n- radio_loadPacket(mercator_vars.rfbuftx, mercator_vars.txpk_len);\n- radio_txEnable();\n- radio_txNow();\n-\n- leds_error_off();\n-\nif (mercator_vars.txpk_numpk == mercator_vars.txpk_totalnumpk) {\nopentimers_cancel(mercator_vars.sendTimerId);\n@@ -566,6 +557,15 @@ void cb_sendPacket(opentimers_id_t id){\nreturn;\n}\n+ // send packet\n+ leds_error_on();\n+\n+ radio_loadPacket(mercator_vars.rfbuftx, mercator_vars.txpk_len);\n+ radio_txEnable();\n+ radio_txNow();\n+\n+ leds_error_off();\n+\n// update pkctr\nmercator_vars.txpk_numpk++;\npkctr = htons(mercator_vars.txpk_numpk);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: fix a off-by-one bug in cb_sendPacket()
This bug causes openmote-b to send one more packet than
txpk_totalnumpk.
This bug has no effect on IoT-LAB M3. Because its radio
driver (radio_txNow()) doesn't wait SFD and its CPU is fast,
radio_txNow() seems to be canceled by the following radio_rfOff() in
if-block.
|
491,607 |
22.05.2019 12:51:35
| -7,200 |
404057c0fdced4342f1d707a2b0fcc5b847f0138
|
Mercator: clear rxpk_buf before getting a received frame
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -467,6 +467,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nif (mercator_vars.status == ST_RX){\n// get packet from radio\n+ memset(mercator_vars.rxpk_buf, 0, sizeof(mercator_vars.rxpk_buf));\nradio_getReceivedFrame(\nmercator_vars.rxpk_buf,\n&mercator_vars.rxpk_len,\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-842. Mercator: clear rxpk_buf before getting a received frame
|
491,607 |
22.05.2019 12:57:05
| -7,200 |
bbec872129b8ffe55010b37cef56cef95de701b8
|
Mercator: move a variable definition for non-C99 compilers
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -461,6 +461,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nRF_PACKET_ht* rx_temp;\nbool is_expected = TRUE;\nIND_RX_ht* resp;\n+ int i;\nradio_rfOff();\n@@ -496,7 +497,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n}\n// check txfillbyte\n- for (int i = offsetof(RF_PACKET_ht, txfillbyte);\n+ for (i = offsetof(RF_PACKET_ht, txfillbyte);\ni < mercator_vars.rxpk_len - LENGTH_CRC; i++){\nif(mercator_vars.rxpk_buf[i] != mercator_vars.txpk_txfillbyte){\nis_expected = FALSE;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Mercator: move a variable definition for non-C99 compilers
|
491,607 |
22.05.2019 19:55:13
| -7,200 |
9618b5efdd46720400835e5f0f0ec251ed361a1c
|
Mercator: keep ST_TX status even after sending IND_TX
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_mercator/03oos_mercator.c",
"new_path": "projects/common/03oos_mercator/03oos_mercator.c",
"diff": "@@ -550,10 +550,10 @@ void cb_sendPacket(opentimers_id_t id){\nmercator_vars.numnotifications++;\n- // goto IDLE\n+ // turn off the radio just in case\nradio_rfOff();\n- mercator_vars.status = ST_IDLE;\n-\n+ // we keep the current status, ST_TX, which will be changed to\n+ // ST_IDLE by the user\nreturn;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-841. Mercator: keep ST_TX status even after sending IND_TX
|
491,595 |
06.06.2019 11:51:06
| -7,200 |
0d8add0b93587d8522b9c7c3884eeac52593dae2
|
add flow control and re-implement the re-transmission timer.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -71,6 +71,7 @@ void cjoin_init(void) {\ncjoin_vars.desc.callbackSendDone = &cjoin_sendDone;\ncjoin_vars.isJoined = FALSE;\n+ cjoin_vars.isBusySending = FALSE;\nopencoap_register(&cjoin_vars.desc);\n@@ -169,6 +170,13 @@ void cjoin_timer_cb(opentimers_id_t id){\nvoid cjoin_retransmission_cb(opentimers_id_t id) {\n// calling the task directly as the timer_cb function is executed in\n// task mode by opentimer already\n+ opentimers_scheduleIn(\n+ cjoin_vars.timerId,\n+ (uint32_t) TIMEOUT,\n+ TIME_MS,\n+ TIMER_ONESHOT,\n+ cjoin_retransmission_cb\n+ );\ncjoin_retransmission_task_cb();\n}\n@@ -177,24 +185,12 @@ void cjoin_retransmission_task_cb(void) {\nif (ieee154e_isSynch() == FALSE){\n// keep the retransmission timer, in case it synchronized at next time\n- opentimers_scheduleIn(cjoin_vars.timerId,\n- (uint32_t) TIMEOUT,\n- TIME_MS,\n- TIMER_ONESHOT,\n- cjoin_retransmission_cb\n- );\nreturn;\n}\njoinProxy = neighbors_getJoinProxy();\nif(joinProxy == NULL) {\n// keep the retransmission timer, in case it synchronized at next time\n- opentimers_scheduleIn(cjoin_vars.timerId,\n- (uint32_t) TIMEOUT,\n- TIME_MS,\n- TIMER_ONESHOT,\n- cjoin_retransmission_cb\n- );\nopenserial_printError(\nCOMPONENT_CJOIN,\nERR_ABORT_JOIN_PROCESS,\n@@ -226,19 +222,25 @@ void cjoin_task_cb(void) {\nreturn;\n}\n- // cancel the startup timer but do not destroy it as we reuse it for retransmissions\n- opentimers_cancel(cjoin_vars.timerId);\n+ // arm the retransmission timer\n+ opentimers_scheduleIn(\n+ cjoin_vars.timerId,\n+ (uint32_t) TIMEOUT,\n+ TIME_MS,\n+ TIMER_ONESHOT,\n+ cjoin_retransmission_cb\n+ );\n// init the security context only here in order to use the latest joinKey\n// that may be set over the serial\ncjoin_init_security_context();\ncjoin_sendJoinRequest(joinProxy);\n-\n- return;\n}\nvoid cjoin_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\n+\n+ cjoin_vars.isBusySending = FALSE;\nopenqueue_freePacketBuffer(msg);\n}\n@@ -252,13 +254,9 @@ owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) {\npayload_len = 0;\n- // immediately arm the retransmission timer\n- opentimers_scheduleIn(cjoin_vars.timerId,\n- (uint32_t) TIMEOUT,\n- TIME_MS,\n- TIMER_ONESHOT,\n- cjoin_retransmission_cb\n- );\n+ if (cjoin_vars.isBusySending){\n+ return E_FAIL;\n+ }\n// create a CoAP RD packet\npkt = openqueue_getFreePacketBuffer(COMPONENT_CJOIN);\n@@ -324,6 +322,8 @@ owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) {\nif (outcome==E_FAIL) {\nopenqueue_freePacketBuffer(pkt);\nreturn E_FAIL;\n+ } else {\n+ cjoin_vars.isBusySending = TRUE;\n}\nreturn E_SUCCESS;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.h",
"new_path": "openapps/cjoin/cjoin.h",
"diff": "@@ -20,6 +20,7 @@ typedef struct {\nbool isJoined;\noscoap_security_context_t context;\nuint8_t medType;\n+ bool isBusySending;\n} cjoin_vars_t;\n//=========================== variables =======================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-844. add flow control and re-implement the re-transmission timer.
|
491,595 |
06.06.2019 12:12:20
| -7,200 |
04236986b58bec795fccae82437fa619035ae3a7
|
ownership of the packets should be COMPONENT_SIXTOP_TO_IEEE802154E and remove 6p request if 6p response is received at wrong state of 6P FSM.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -187,7 +187,7 @@ owerror_t sixtop_request(\nsixtop_vars.six2six_state != SIX_STATE_IDLE ||\nneighbor == NULL\n){\n- // neighbor can't be none or previous transcation doesn't finishe yet\n+ // neighbor can't be none or previous transcation doesn't finish yet\nreturn E_FAIL;\n}\n@@ -1611,10 +1611,8 @@ void sixtop_six2six_notifyReceive(\nneighbors_resetSequenceNumber(&(pkt->l2_nextORpreviousHop));\nbreak;\ndefault:\n- // The sixtop response arrived after 6P TIMEOUT.\n-\n-\n- // it's a duplicated response.\n+ // The sixtop response arrived after 6P TIMEOUT, or\n+ // it's a duplicated response. Remove 6P request if I have.\nopenqueue_remove6PrequestToNeighbor(&(pkt->l2_nextORpreviousHop));\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/openqueue.c",
"new_path": "openstack/cross-layers/openqueue.c",
"diff": "@@ -195,7 +195,7 @@ uint8_t openqueue_getNum6PReq(open_addr_t* neighbor){\nnum6Prequest = 0;\nfor (i=0;i<QUEUELENGTH;i++) {\nif (\n- openqueue_vars.queue[i].owner == COMPONENT_IEEE802154E_TO_SIXTOP &&\n+ openqueue_vars.queue[i].owner == COMPONENT_SIXTOP_TO_IEEE802154E &&\nopenqueue_vars.queue[i].creator == COMPONENT_SIXTOP_RES &&\nopenqueue_vars.queue[i].l2_sixtop_messageType == SIXTOP_CELL_REQUEST&&\npacketfunctions_sameAddress(neighbor,&openqueue_vars.queue[i].l2_nextORpreviousHop)\n@@ -218,7 +218,7 @@ uint8_t openqueue_getNum6PResp(void){\nnum6Presponse = 0;\nfor (i=0;i<QUEUELENGTH;i++) {\nif (\n- openqueue_vars.queue[i].owner == COMPONENT_IEEE802154E_TO_SIXTOP &&\n+ openqueue_vars.queue[i].owner == COMPONENT_SIXTOP_TO_IEEE802154E &&\nopenqueue_vars.queue[i].creator == COMPONENT_SIXTOP_RES &&\nopenqueue_vars.queue[i].l2_sixtop_messageType == SIXTOP_CELL_RESPONSE\n) {\n@@ -238,7 +238,7 @@ void openqueue_remove6PrequestToNeighbor(open_addr_t* neighbor){\nfor (i=0;i<QUEUELENGTH;i++) {\nif (\n- openqueue_vars.queue[i].owner == COMPONENT_IEEE802154E_TO_SIXTOP &&\n+ openqueue_vars.queue[i].owner == COMPONENT_SIXTOP_TO_IEEE802154E &&\nopenqueue_vars.queue[i].creator == COMPONENT_SIXTOP_RES &&\nopenqueue_vars.queue[i].l2_sixtop_messageType == SIXTOP_CELL_REQUEST &&\npacketfunctions_sameAddress(neighbor,&openqueue_vars.queue[i].l2_nextORpreviousHop)\n@@ -509,6 +509,7 @@ void openqueue_reset_entry(OpenQueueEntry_t* entry) {\nentry->l3_sourceAdd.type = ADDR_NONE;\nentry->l3_useSourceRouting = FALSE;\n//l2\n+ entry->l2_sixtop_command = IANA_6TOP_CMD_NONE;\nentry->l2_nextORpreviousHop.type = ADDR_NONE;\nentry->l2_frameType = IEEE154_TYPE_UNDEFINED;\nentry->l2_retriesLeft = 0;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-839. ownership of the packets should be COMPONENT_SIXTOP_TO_IEEE802154E and remove 6p request if 6p response is received at wrong state of 6P FSM.
|
491,595 |
06.06.2019 16:00:03
| -7,200 |
0ea3bec1adff285e34ab6b0bb6d4fd8e1892a713
|
just remove the previous JoinRequest if doesn't sentout before retransmission timeout.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.c",
"new_path": "openapps/cjoin/cjoin.c",
"diff": "@@ -71,7 +71,6 @@ void cjoin_init(void) {\ncjoin_vars.desc.callbackSendDone = &cjoin_sendDone;\ncjoin_vars.isJoined = FALSE;\n- cjoin_vars.isBusySending = FALSE;\nopencoap_register(&cjoin_vars.desc);\n@@ -240,7 +239,6 @@ void cjoin_task_cb(void) {\nvoid cjoin_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\n- cjoin_vars.isBusySending = FALSE;\nopenqueue_freePacketBuffer(msg);\n}\n@@ -254,9 +252,8 @@ owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) {\npayload_len = 0;\n- if (cjoin_vars.isBusySending){\n- return E_FAIL;\n- }\n+ // if previous cjoin is not sent out, remove them\n+ openqueue_removeAllCreatedBy(COMPONENT_CJOIN);\n// create a CoAP RD packet\npkt = openqueue_getFreePacketBuffer(COMPONENT_CJOIN);\n@@ -322,8 +319,6 @@ owerror_t cjoin_sendJoinRequest(open_addr_t* joinProxy) {\nif (outcome==E_FAIL) {\nopenqueue_freePacketBuffer(pkt);\nreturn E_FAIL;\n- } else {\n- cjoin_vars.isBusySending = TRUE;\n}\nreturn E_SUCCESS;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cjoin/cjoin.h",
"new_path": "openapps/cjoin/cjoin.h",
"diff": "@@ -20,7 +20,6 @@ typedef struct {\nbool isJoined;\noscoap_security_context_t context;\nuint8_t medType;\n- bool isBusySending;\n} cjoin_vars_t;\n//=========================== variables =======================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-844. just remove the previous JoinRequest if doesn't sentout before retransmission timeout.
|
491,595 |
07.06.2019 19:46:16
| -7,200 |
8705c1ec6e55560188d275b43d62393327afd541
|
reorder the error code number.
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -183,87 +183,84 @@ enum {\n*/\nenum {\n// l7\n- ERR_RCVD_ECHO_REQUEST = 0x01, // received an echo request\n- ERR_RCVD_ECHO_REPLY = 0x02, // received an echo reply\n- ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x03, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n- ERR_INPUT_BUFFER_OVERFLOW = 0x04, // the input buffer has overflown\n- ERR_COMMAND_NOT_ALLOWED = 0x05, // the command is not allowed, command = {0}\n+ ERR_JOINED = 0x01, // node joined\n+ ERR_SEQUENCE_NUMBER_OVERFLOW = 0x02, // OSCOAP sequence number reached maximum value\n+ ERR_BUFFER_OVERFLOW = 0x03, // OSCOAP buffer overflow detected (code location {0})\n+ ERR_REPLAY_FAILED = 0x04, // OSCOAP replay protection failed\n+ ERR_DECRYPTION_FAILED = 0x05, // OSCOAP decryption and tag verification failed\n+ ERR_ABORT_JOIN_PROCESS = 0x06, // Aborted join process (code location {0})\n// l4\n- ERR_WRONG_TRAN_PROTOCOL = 0x06, // unknown transport protocol {0} (code location {1})\n- ERR_UNSUPPORTED_PORT_NUMBER = 0x07, // unsupported port number {0} (code location {1})\n+ ERR_WRONG_TRAN_PROTOCOL = 0x07, // unknown transport protocol {0} (code location {1})\n+ ERR_UNSUPPORTED_PORT_NUMBER = 0x08, // unsupported port number {0} (code location {1})\n// l3\n- ERR_UNEXPECTED_DAO = 0x08, // unexpected DAO (code location {0}). A change maybe happened on dagroot node.\n- ERR_UNSUPPORTED_ICMPV6_TYPE = 0x09, // unsupported ICMPv6 type {0} (code location {1})\n- ERR_6LOWPAN_UNSUPPORTED = 0x0a, // unsupported 6LoWPAN parameter {1} at location {0}\n- ERR_NO_NEXTHOP = 0x0b, // no next hop for layer 3 destination {0:x}{1:x}\n- ERR_INVALID_PARAM = 0x0c, // invalid parameter\n- ERR_INVALID_FWDMODE = 0x0d, // invalid forward mode\n- ERR_LARGE_DAGRANK = 0x0e, // large DAGrank {0}, set to {1}\n- ERR_HOP_LIMIT_REACHED = 0x0f, // packet discarded hop limit reached\n- ERR_LOOP_DETECTED = 0x10, // loop detected due to previous rank {0} lower than current node rank {1}\n- ERR_WRONG_DIRECTION = 0x11, // upstream packet set to be downstream, possible loop.\n- ERR_FORWARDING_PACKET_DROPPED = 0x12, // packet to forward is dropped (code location {0})\n+ ERR_RCVD_ECHO_REQUEST = 0x09, // received an echo request\n+ ERR_RCVD_ECHO_REPLY = 0x0a, // received an echo reply\n+ ERR_6LORH_DEADLINE_EXPIRED = 0x0b, // the received packet has expired\n+ ERR_6LORH_DEADLINE_DROPPED = 0x0c, // packet expiry time reached, dropped\n+ ERR_UNEXPECTED_DAO = 0x0d, // unexpected DAO (code location {0}). A change maybe happened on dagroot node.\n+ ERR_UNSUPPORTED_ICMPV6_TYPE = 0x0e, // unsupported ICMPv6 type {0} (code location {1})\n+ ERR_6LOWPAN_UNSUPPORTED = 0x0f, // unsupported 6LoWPAN parameter {1} at location {0}\n+ ERR_NO_NEXTHOP = 0x10, // no next hop for layer 3 destination {0:x}{1:x}\n+ ERR_INVALID_PARAM = 0x11, // invalid parameter\n+ ERR_INVALID_FWDMODE = 0x12, // invalid forward mode\n+ ERR_LARGE_DAGRANK = 0x13, // large DAGrank {0}, set to {1}\n+ ERR_HOP_LIMIT_REACHED = 0x14, // packet discarded hop limit reached\n+ ERR_LOOP_DETECTED = 0x15, // loop detected due to previous rank {0} lower than current node rank {1}\n+ ERR_WRONG_DIRECTION = 0x16, // upstream packet set to be downstream, possible loop.\n+ ERR_FORWARDING_PACKET_DROPPED = 0x17, // packet to forward is dropped (code location {0})\n// l2b\n- ERR_NEIGHBORS_FULL = 0x13, // neighbors table is full (max number of neighbor is {0})\n- ERR_NO_SENT_PACKET = 0x14, // there is no sent packet in queue\n- ERR_NO_RECEIVED_PACKET = 0x15, // there is no received packet in queue\n- ERR_SCHEDULE_OVERFLOWN = 0x16, // schedule overflown\n+ ERR_NEIGHBORS_FULL = 0x18, // neighbors table is full (max number of neighbor is {0})\n+ ERR_NO_SENT_PACKET = 0x19, // there is no sent packet in queue\n+ ERR_NO_RECEIVED_PACKET = 0x1a, // there is no received packet in queue\n+ ERR_SCHEDULE_OVERFLOWN = 0x1b, // schedule overflown\n+ ERR_SIXTOP_RETURNCODE = 0x1c, // sixtop return code {0} at sixtop state {1}\n+ ERR_SIXTOP_COUNT = 0x1d, // there are {0} cells to request mote\n+ ERR_SIXTOP_LIST = 0x1e, // the cells reserved to request mote contains slot {0} and slot {1}\n// l2a\n- ERR_WRONG_CELLTYPE = 0x17, // wrong celltype {0} at slotOffset {1}\n- ERR_IEEE154_UNSUPPORTED = 0x18, // unsupported IEEE802.15.4 parameter {1} at location {0}\n- ERR_DESYNCHRONIZED = 0x19, // got desynchronized at slotOffset {0}\n- ERR_SYNCHRONIZED = 0x1a, // synchronized at slotOffset {0}\n- ERR_LARGE_TIMECORRECTION = 0x1b, // large timeCorr.: {0} ticks (code loc. {1})\n- ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x1c, // wrong state {0} in end of frame+sync\n- ERR_WRONG_STATE_IN_STARTSLOT = 0x1d, // wrong state {0} in startSlot, at slotOffset {1}\n- ERR_WRONG_STATE_IN_TIMERFIRES = 0x1e, // wrong state {0} in timer fires, at slotOffset {1}\n- ERR_WRONG_STATE_IN_NEWSLOT = 0x1f, // wrong state {0} in start of frame, at slotOffset {1}\n- ERR_WRONG_STATE_IN_ENDOFFRAME = 0x20, // wrong state {0} in end of frame, at slotOffset {1}\n- ERR_MAXTXDATAPREPARE_OVERFLOW = 0x21, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXACKPREPARE_OVERFLOWS = 0x22, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x23, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_MAXTXACKPREPARE_OVERFLOWS = 0x24, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_WDDATADURATION_OVERFLOWS = 0x25, // wdDataDuration overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIO_OVERFLOWS = 0x26, // wdRadio overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIOTX_OVERFLOWS = 0x27, // wdRadioTx overflows while at state {0} in slotOffset {1}\n- ERR_WDACKDURATION_OVERFLOWS = 0x28, // wdAckDuration overflows while at state {0} in slotOffset {1}\n+ ERR_WRONG_CELLTYPE = 0x1f, // wrong celltype {0} at slotOffset {1}\n+ ERR_IEEE154_UNSUPPORTED = 0x20, // unsupported IEEE802.15.4 parameter {1} at location {0}\n+ ERR_DESYNCHRONIZED = 0x21, // got desynchronized at slotOffset {0}\n+ ERR_SYNCHRONIZED = 0x22, // synchronized at slotOffset {0}\n+ ERR_LARGE_TIMECORRECTION = 0x23, // large timeCorr.: {0} ticks (code loc. {1})\n+ ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x24, // wrong state {0} in end of frame+sync\n+ ERR_WRONG_STATE_IN_STARTSLOT = 0x25, // wrong state {0} in startSlot, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_TIMERFIRES = 0x26, // wrong state {0} in timer fires, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_NEWSLOT = 0x27, // wrong state {0} in start of frame, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_ENDOFFRAME = 0x28, // wrong state {0} in end of frame, at slotOffset {1}\n+ ERR_MAXTXDATAPREPARE_OVERFLOW = 0x29, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXACKPREPARE_OVERFLOWS = 0x2a, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x2b, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_MAXTXACKPREPARE_OVERFLOWS = 0x2c, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_WDDATADURATION_OVERFLOWS = 0x2d, // wdDataDuration overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIO_OVERFLOWS = 0x2e, // wdRadio overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIOTX_OVERFLOWS = 0x2f, // wdRadioTx overflows while at state {0} in slotOffset {1}\n+ ERR_WDACKDURATION_OVERFLOWS = 0x30, // wdAckDuration overflows while at state {0} in slotOffset {1}\n+ ERR_SECURITY = 0x31, // security error on frameType {0}, code location {1}\n+ // cross layer\n+ ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x32, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n+ ERR_INPUT_BUFFER_OVERFLOW = 0x33, // the input buffer has overflown\n// general\n- ERR_BUSY_SENDING = 0x29, // busy sending\n- ERR_UNEXPECTED_SENDDONE = 0x2a, // sendDone for packet I didn't send\n- ERR_NO_FREE_PACKET_BUFFER = 0x2b, // no free packet buffer (code location {0})\n- ERR_FREEING_UNUSED = 0x2c, // freeing unused memory\n- ERR_FREEING_ERROR = 0x2d, // freeing memory unsupported memory\n- ERR_UNSUPPORTED_COMMAND = 0x2e, // unsupported command {0}\n- ERR_MSG_UNKNOWN_TYPE = 0x2f, // unknown message type {0}\n- ERR_WRONG_ADDR_TYPE = 0x30, // wrong address type {0} (code location {1})\n- ERR_BRIDGE_MISMATCH = 0x31, // bridge mismatch (code location {0})\n- ERR_HEADER_TOO_LONG = 0x32, // header too long, length {1} (code location {0})\n- ERR_INPUTBUFFER_LENGTH = 0x33, // input length problem, length={0}\n- ERR_BOOTED = 0x34, // booted\n- ERR_INVALIDSERIALFRAME = 0x35, // invalid serial frame\n- ERR_INVALIDPACKETFROMRADIO = 0x36, // invalid packet frome radio, length {1} (code location {0})\n- ERR_BUSY_RECEIVING = 0x37, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n- ERR_WRONG_CRC_INPUT = 0x38, // wrong CRC in input Buffer\n- ERR_PACKET_SYNC = 0x39, // synchronized when received a packet\n- ERR_SECURITY = 0x3a, // security error on frameType {0}, code location {1}\n- ERR_SIXTOP_RETURNCODE = 0x3b, // sixtop return code {0} at sixtop state {1}\n- ERR_SIXTOP_COUNT = 0x3c, // there are {0} cells to request mote\n- ERR_SIXTOP_LIST = 0x3d, // the cells reserved to request mote contains slot {0} and slot {1}\n- ERR_SCHEDULE_ADDDUPLICATESLOT = 0x3e, // the slot {0} to be added is already in schedule\n- ERR_UNSUPPORTED_FORMAT = 0x3f, // the received packet format is not supported (code location {0})\n- ERR_UNSUPPORTED_METADATA = 0x40, // the metadata type is not suppored\n- // deadline option\n- ERR_6LORH_DEADLINE_EXPIRED = 0x41, // the received packet has expired\n- ERR_6LORH_DEADLINE_DROPPED = 0x42, // packet expiry time reached, dropped\n- // join and OSCOAP\n- ERR_JOINED = 0x43, // node joined\n- ERR_SEQUENCE_NUMBER_OVERFLOW = 0x44, // OSCOAP sequence number reached maximum value\n- ERR_BUFFER_OVERFLOW = 0x45, // OSCOAP buffer overflow detected (code location {0})\n- ERR_REPLAY_FAILED = 0x46, // OSCOAP replay protection failed\n- ERR_DECRYPTION_FAILED = 0x47, // OSCOAP decryption and tag verification failed\n- ERR_ABORT_JOIN_PROCESS = 0x48, // Aborted join process (code location {0})\n- // uinject\n- ERR_UINJECT_PACKET_DROPPED = 0x49, // uinject packet (counter: {0}) is dropped\n+ ERR_BUSY_SENDING = 0x34, // busy sending\n+ ERR_UNEXPECTED_SENDDONE = 0x35, // sendDone for packet I didn't send\n+ ERR_NO_FREE_PACKET_BUFFER = 0x36, // no free packet buffer (code location {0})\n+ ERR_FREEING_UNUSED = 0x37, // freeing unused memory\n+ ERR_FREEING_ERROR = 0x38, // freeing memory unsupported memory\n+ ERR_UNSUPPORTED_COMMAND = 0x39, // unsupported command {0}\n+ ERR_MSG_UNKNOWN_TYPE = 0x3a, // unknown message type {0}\n+ ERR_WRONG_ADDR_TYPE = 0x3b, // wrong address type {0} (code location {1})\n+ ERR_BRIDGE_MISMATCH = 0x3c, // bridge mismatch (code location {0})\n+ ERR_HEADER_TOO_LONG = 0x3d, // header too long, length {1} (code location {0})\n+ ERR_INPUTBUFFER_LENGTH = 0x3e, // input length problem, length={0}\n+ ERR_BOOTED = 0x3f, // booted\n+ ERR_INVALIDSERIALFRAME = 0x40, // invalid serial frame\n+ ERR_INVALIDPACKETFROMRADIO = 0x41, // invalid packet frome radio, length {1} (code location {0})\n+ ERR_BUSY_RECEIVING = 0x42, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n+ ERR_WRONG_CRC_INPUT = 0x43, // wrong CRC in input Buffer\n+ ERR_PACKET_SYNC = 0x44, // synchronized when received a packet\n+ ERR_SCHEDULE_ADDDUPLICATESLOT = 0x45, // the slot {0} to be added is already in schedule\n+ ERR_UNSUPPORTED_FORMAT = 0x46, // the received packet format is not supported (code location {0})\n+ ERR_UNSUPPORTED_METADATA = 0x47, // the metadata type is not suppored\n+ ERR_MAXRETRIES_REACHED = 0x48, // maxretries reached (counter: {0})\n};\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject.c",
"new_path": "openapps/uinject/uinject.c",
"diff": "@@ -61,7 +61,7 @@ void uinject_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nif (error==E_FAIL){\nopenserial_printError(\nCOMPONENT_UINJECT,\n- ERR_UINJECT_PACKET_DROPPED,\n+ ERR_MAXRETRIES_REACHED,\n(errorparameter_t)uinject_vars.counter,\n(errorparameter_t)0\n);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/forwarding.c",
"new_path": "openstack/03b-IPv6/forwarding.c",
"diff": "@@ -237,7 +237,7 @@ void forwarding_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nif (error==E_FAIL) {\nopenserial_printError(\nCOMPONENT_FORWARDING,\n- ERR_FORWARDING_PACKET_DROPPED,\n+ ERR_MAXRETRIES_REACHED,\n(errorparameter_t)1,\n(errorparameter_t)0\n);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-845. reorder the error code number.
|
491,609 |
15.09.2017 19:28:39
| -7,200 |
69a349c9ad61d06d6363dff05cf9a03c7be7cfea
|
Init cryptoengine from board_init.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/SConscript",
"new_path": "bsp/boards/iot-lab_M3/SConscript",
"diff": "@@ -22,6 +22,12 @@ source = \\\nGlob('configure/*.c') + \\\nGlob('library/STM32F10x_StdPeriph_Lib_V3.5.0/Libraries/STM32F10x_StdPeriph_Driver/src/*.c')\n+localEnv.Append(\n+ CPPPATH = [\n+ os.path.join('#','bsp','chips','at86rf231'),\n+ ],\n+)\n+\nboard = localEnv.Object(source=source) + rf231\nReturn('board')\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/board.c",
"new_path": "bsp/boards/iot-lab_M3/board.c",
"diff": "#include \"debugpins.h\"\n#include \"opentimers.h\"\n#include \"gpio.h\"\n+#include \"cryptoengine.h\"\n//=========================== main ============================================\n@@ -91,6 +92,7 @@ void board_init(void)\ndebugpins_init();\n//enable nvic for the radio\nNVIC_radio();\n+ cryptoengine_init();\n}\nvoid board_sleep(void) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Init cryptoengine from board_init.
|
491,609 |
15.09.2017 19:28:57
| -7,200 |
6bfdc003f7e972ca1a5c8c46e304f44dc6e183a5
|
Add defines for AES registers.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/chips/at86rf231/at86rf231.h",
"new_path": "bsp/chips/at86rf231/at86rf231.h",
"diff": "@@ -648,6 +648,9 @@ enum radio_irqstatus_enum {\n# define RG_RX_CTRL (0x0a)\n//controls the sensitivity of the antenna diversity mode\n+# define RG_AES_STATE_KEY (0x84)\n+# define RG_AES_CTRL (0x83)\n+# define RG_AES_STATUS (0x82)\n//=========================== typedef =========================================\n//=========================== variables =======================================\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Add defines for AES registers.
|
491,609 |
15.09.2017 19:29:36
| -7,200 |
c346a9f1caa77de2af29cc35cc3ef94a59ae6b0a
|
First implementation of ECB function passing tests.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"new_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"diff": "#include <stdint.h>\n#include <string.h>\n+#include \"at86rf231.h\"\n#include \"cryptoengine.h\"\n+#include \"spi.h\"\n+#include \"radio.h\"\n+\n+//=========================== prototypes ======================================\n+owerror_t at86rf231_crypto_load_key(uint8_t key[16]);\n+owerror_t at86rf231_crypto_opt_ecb(uint8_t* buffer);\n+\n+//=========================== public ==========================================\nowerror_t cryptoengine_aes_ccms_enc(uint8_t* a,\nuint8_t len_a,\n@@ -31,10 +40,129 @@ owerror_t cryptoengine_aes_ccms_dec(uint8_t* a,\n}\nowerror_t cryptoengine_aes_ecb_enc(uint8_t* buffer, uint8_t* key) {\n+ if (at86rf231_crypto_load_key(key) == E_SUCCESS) {\n+ at86rf231_crypto_opt_ecb(buffer);\n+ return E_SUCCESS;\n+ }\nreturn E_FAIL;\n}\nowerror_t cryptoengine_init(void) {\n+ radio_rfOn();\n+ return E_SUCCESS;\n+}\n+\n+//=========================== private =========================================\n+// Optimized ECB AES encryption that does not load the key beforehand\n+owerror_t at86rf231_crypto_opt_ecb(uint8_t* buffer) {\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+\n+ uint8_t aes_cmd;\n+ uint8_t aes_status;\n+\n+ aes_cmd = 0x80; // AES start\n+ aes_status = 0x00;\n+\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x00; // ECB encryption\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx(&aes_cmd,\n+ sizeof(aes_cmd),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ // Prepare to read the AES status register\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATUS;\n+\n+ // Busy wait reading AES status register until it is done or an error occurs\n+ do {\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_LAST);\n+ aes_status = spi_rx_buffer[2];\n+ } while((aes_status & 0x01) == 0x00);\n+\n+ if ((aes_status & 0x80) == 0x01) {\n+ // an error occured\n+ return E_FAIL;\n+ }\n+\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATE_KEY;\n+\n+ // send the command to read the ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 2,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ 16,\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ // read the actual ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)buffer,\n+ 16,\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ return E_SUCCESS;\n+}\n+\n+\n+owerror_t at86rf231_crypto_load_key(uint8_t key[16]) {\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+ uint8_t aes_cmd;\n+\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x10; // key mode\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)key,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\nreturn E_SUCCESS;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. First implementation of ECB function passing tests.
|
491,609 |
15.09.2017 19:29:58
| -7,200 |
e5356b6c0f5d257d6f112313087e0f69ebcc39cb
|
Make sure leds are off before starting the bsp_cryptoengine test suite.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_cryptoengine/01bsp_cryptoengine.c",
"new_path": "projects/common/01bsp_cryptoengine/01bsp_cryptoengine.c",
"diff": "@@ -335,6 +335,8 @@ int mote_main(void) {\nboard_init();\n+ leds_all_off();\n+\n#if TEST_AES_ECB\nif (run_aes_ecb_suite(aes_ecb_suite, sizeof(aes_ecb_suite)/sizeof(aes_ecb_suite[0])) == E_FAIL) {\nfail++;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Make sure leds are off before starting the bsp_cryptoengine test suite.
|
491,609 |
18.09.2017 17:17:31
| -7,200 |
3f8fd764d0691373e01647a49bdd4d5dece10965
|
Add firmware CCM implementation that uses AT86RF231 hardware AES engine.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"new_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"diff": "//=========================== prototypes ======================================\nowerror_t at86rf231_crypto_load_key(uint8_t key[16]);\nowerror_t at86rf231_crypto_opt_ecb(uint8_t* buffer);\n+static owerror_t aes_cbc_mac(uint8_t* a, uint8_t len_a, uint8_t* m, uint8_t len_m, uint8_t* nonce, uint8_t* mac, uint8_t len_mac, uint8_t l);\n+static owerror_t aes_ctr_enc(uint8_t* m, uint8_t len_m, uint8_t* nonce, uint8_t* mac, uint8_t len_mac, uint8_t l);\n+owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]);\n+owerror_t aes_ctr_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]);\n+static void inc_counter(uint8_t* counter);\n+\n//=========================== public ==========================================\n@@ -23,6 +29,24 @@ owerror_t cryptoengine_aes_ccms_enc(uint8_t* a,\nuint8_t l,\nuint8_t key[16],\nuint8_t len_mac) {\n+ uint8_t mac[CBC_MAX_MAC_SIZE];\n+\n+ if ((len_mac > CBC_MAX_MAC_SIZE) || (l != 2)) {\n+ return E_FAIL;\n+ }\n+\n+ if (at86rf231_crypto_load_key(key) != E_SUCCESS) {\n+ return E_FAIL;\n+ }\n+\n+ if (aes_cbc_mac(a, len_a, m, *len_m, nonce, mac, len_mac, l) == E_SUCCESS) {\n+ if (aes_ctr_enc(m, *len_m, nonce, mac, len_mac, l) == E_SUCCESS) {\n+ memcpy(&m[*len_m], mac, len_mac);\n+ *len_m += len_mac;\n+\n+ return E_SUCCESS;\n+ }\n+ }\nreturn E_FAIL;\n}\n@@ -35,6 +59,27 @@ owerror_t cryptoengine_aes_ccms_dec(uint8_t* a,\nuint8_t l,\nuint8_t key[16],\nuint8_t len_mac) {\n+ uint8_t mac[CBC_MAX_MAC_SIZE];\n+ uint8_t orig_mac[CBC_MAX_MAC_SIZE];\n+\n+ if ((len_mac > CBC_MAX_MAC_SIZE) || (l != 2)) {\n+ return E_FAIL;\n+ }\n+\n+ if (at86rf231_crypto_load_key(key) != E_SUCCESS) {\n+ return E_FAIL;\n+ }\n+\n+ *len_m -= len_mac;\n+ memcpy(mac, &m[*len_m], len_mac);\n+\n+ if (aes_ctr_enc(m, *len_m, nonce, mac, len_mac, l) == E_SUCCESS) {\n+ if (aes_cbc_mac(a, len_a, m, *len_m, nonce, orig_mac, len_mac, l) == E_SUCCESS) {\n+ if (memcmp(mac, orig_mac, len_mac) == 0) {\n+ return E_SUCCESS;\n+ }\n+ }\n+ }\nreturn E_FAIL;\n}\n@@ -141,7 +186,6 @@ owerror_t at86rf231_crypto_opt_ecb(uint8_t* buffer) {\nowerror_t at86rf231_crypto_load_key(uint8_t key[16]) {\nuint8_t spi_tx_buffer[3];\nuint8_t spi_rx_buffer[16];\n- uint8_t aes_cmd;\nspi_tx_buffer[0] = 0x40; // SRAM write\nspi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n@@ -166,3 +210,235 @@ owerror_t at86rf231_crypto_load_key(uint8_t key[16]) {\nreturn E_SUCCESS;\n}\n+/**\n+\\brief CBC-MAC generation specific to CCM*. Assumes key is already loaded in the\n+engine.\n+\\param[in] a Pointer to the authentication only data.\n+\\param[in] len_a Length of authentication only data.\n+\\param[in] m Pointer to the data that is both authenticated and encrypted.\n+\\param[in] len_m Length of data that is both authenticated and encrypted.\n+\\param[in] nonce Buffer containing nonce (13 octets).\n+\\param[out] mac Buffer where the value of the CBC-MAC tag will be written.\n+\\param[in] len_mac Length of the CBC-MAC tag. Must be 4, 8 or 16 octets.\n+\\param[in] l CCM parameter L that allows selection of different nonce length.\n+\n+\\returns E_SUCCESS when the generation was successful, E_FAIL otherwise.\n+*/\n+static owerror_t aes_cbc_mac(uint8_t* a,\n+ uint8_t len_a,\n+ uint8_t* m,\n+ uint8_t len_m,\n+ uint8_t* nonce,\n+ uint8_t* mac,\n+ uint8_t len_mac,\n+ uint8_t l) {\n+\n+ uint8_t pad_len;\n+ uint8_t len;\n+ uint8_t cbc_mac_iv[16];\n+ uint8_t buffer[128+16+16]; // max buffer plus IV\n+\n+ // asserts here\n+ if (!((len_mac == 0) || (len_mac == 4) || (len_mac == 8) || (len_mac == 16))) {\n+ return E_FAIL;\n+ }\n+\n+ if ((len_a > 127) || (len_m > 127) || ((len_a + len_m) > 127)) {\n+ return E_FAIL;\n+ }\n+\n+ if (mac == 0) {\n+ return E_FAIL;\n+ }\n+\n+ memset(cbc_mac_iv, 0x00, 16); // CBC-MAC Initialization Vector is a zero string\n+\n+ // IV: flags (1B) | SADDR (8B) | ASN (5B) | len(m) (2B)\n+ // X0 xor IV in first 16 bytes of buffer: set buffer[:16] as IV)\n+ buffer[0] = 0x00; // set flags to zero including reserved\n+ buffer[0] |= 0x07 & (l-1); // field L\n+ // (len_mac - 2)/2 shifted left es corresponds to (len_mac - 2) << 2\n+ buffer[0] |= len_mac == 0 ? 0 : (0x07 & (len_mac - 2)) << 2; // field M\n+ buffer[0] |= len_a != 0 ? 0x40 : 0; // field Adata\n+\n+ memcpy(&buffer[1], nonce, 13);\n+\n+ if (l == 3) {\n+ buffer[13] = 0;\n+ }\n+\n+ buffer[14] = 0;\n+ buffer[15] = len_m;\n+\n+ len = 16;\n+ // len(a)\n+ if(len_a > 0) {\n+ buffer[16] = 0;\n+ buffer[17] = len_a;\n+ len += 2;\n+ }\n+\n+ // (((x >> 4) + 1)<<4) - x or 16 - (x % 16) ?\n+ // a + padding\n+ pad_len = ((((len_a + len - 16) >> 4) + 1) << 4) - (len_a + len - 16);\n+ pad_len = pad_len == 16 ? 0 : pad_len;\n+ memcpy(&buffer[len], a, len_a);\n+ len += len_a;\n+ memset(&buffer[len], 0, pad_len);\n+ len += pad_len;\n+\n+ // m + padding\n+ pad_len = (((len_m >> 4) + 1) << 4) - len_m;\n+ pad_len = pad_len == 16 ? 0 : pad_len;\n+ memcpy(&buffer[len], m, len_m);\n+ len += len_m;\n+ memset(&buffer[len], 0, pad_len);\n+ len += pad_len;\n+\n+ aes_cbc_enc_raw(buffer, len, cbc_mac_iv);\n+\n+ // copy MAC\n+ memcpy(mac, &buffer[len - 16], len_mac);\n+\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief Counter (CTR) mode encryption specific to IEEE 802.15.4E. Assumes key is already\n+loaded in the engine.\n+\\param[in,out] m Pointer to the data that is both authenticated and encrypted. Data is\n+ overwritten by ciphertext (i.e. plaintext in case of inverse CCM*).\n+\\param[in] len_m Length of data that is both authenticated and encrypted.\n+\\param[in] nonce Buffer containing nonce (13 octets).\n+\\param[in,out] mac Buffer containing the unencrypted or encrypted CBC-MAC tag, which depends\n+ on weather the function is called as part of CCM* forward or inverse transformation. It\n+ is overwrriten by the encrypted, i.e unencrypted, tag on return.\n+\\param[in] len_mac Length of the CBC-MAC tag. Must be 4, 8 or 16 octets.\n+\\param[in] l CCM parameter L that allows selection of different nonce length.\n+\n+\\returns E_SUCCESS when the encryption was successful, E_FAIL otherwise.\n+*/\n+static owerror_t aes_ctr_enc(uint8_t* m,\n+ uint8_t len_m,\n+ uint8_t* nonce,\n+ uint8_t* mac,\n+ uint8_t len_mac,\n+ uint8_t l) {\n+\n+ uint8_t pad_len;\n+ uint8_t len;\n+ uint8_t iv[16];\n+ uint8_t buffer[128 + 16]; // max buffer plus mac\n+\n+ // asserts here\n+ if (!((len_mac == 0) || (len_mac == 4) || (len_mac == 8) || (len_mac == 16))) {\n+ return E_FAIL;\n+ }\n+\n+ if (len_m > 127) {\n+ return E_FAIL;\n+ }\n+\n+ // iv (flag (1B) | source addr (8B) | ASN (5B) | cnt (2B)\n+ iv[0] = 0x00;\n+ iv[0] |= 0x07 & (l-1); // field L\n+\n+ memcpy(&iv[1], nonce, 13);\n+ iv[14] = 0x00;\n+ iv[15] = 0x00;\n+\n+ // first block is mac\n+ memcpy(buffer, mac, len_mac);\n+ memset(&buffer[len_mac], 0, 16 - len_mac);\n+ len = 16;\n+\n+ // (((x >> 4) + 1)<<4) - x or 16 - (x % 16) ?\n+ // m + padding\n+ pad_len = (((len_m >> 4) + 1) << 4) - len_m;\n+ pad_len = pad_len == 16 ? 0 : pad_len;\n+ memcpy(&buffer[len], m, len_m);\n+ len += len_m;\n+ memset(&buffer[len], 0, pad_len);\n+ len += pad_len;\n+\n+ aes_ctr_enc_raw(buffer, len, iv);\n+\n+ memcpy(m, &buffer[16], len_m);\n+ memcpy(mac, buffer, len_mac);\n+\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief Raw AES-CBC encryption. Assumes key is already loaded in the engine.\n+\\param[in,out] buffer Message to be encrypted. Will be overwritten by ciphertext.\n+\\param[in] len Message length. Must be multiple of 16 octets.\n+\\param[in] iv Buffer containing the Initialization Vector (16 octets).\n+\n+\\returns E_SUCCESS when the encryption was successful.\n+*/\n+owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\n+ uint8_t n;\n+ uint8_t k;\n+ uint8_t nb;\n+ uint8_t* pbuf;\n+ uint8_t* pxor;\n+\n+ nb = len >> 4;\n+ pxor = iv;\n+ for (n = 0; n < nb; n++) {\n+ pbuf = &buffer[16 * n];\n+ // may be faster if vector are aligned to 4 bytes (use long instead char in xor)\n+ for (k = 0; k < 16; k++) {\n+ pbuf[k] ^= pxor[k];\n+ }\n+ at86rf231_crypto_opt_ecb(pbuf);\n+ pxor = pbuf;\n+ }\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief Raw AES-CTR encryption. Assumes key is already loaded in the engine.\n+\\param[in,out] buffer Message to be encrypted. Will be overwritten by ciphertext.\n+\\param[in] len Message length. Must be multiple of 16 octets.\n+\\param[in] iv Buffer containing the Initialization Vector (16 octets).\n+\n+\\returns E_SUCCESS when the encryption was successful.\n+*/\n+owerror_t aes_ctr_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\n+ uint8_t n;\n+ uint8_t k;\n+ uint8_t nb;\n+ uint8_t* pbuf;\n+ uint8_t eiv[16];\n+\n+ nb = len >> 4;\n+ for (n = 0; n < nb; n++) {\n+ pbuf = &buffer[16 * n];\n+ memcpy(eiv, iv, 16);\n+ at86rf231_crypto_opt_ecb(eiv);\n+ // may be faster if vector are aligned to 4 bytes (use long instead char in xor)\n+ for (k = 0; k < 16; k++) {\n+ pbuf[k] ^= eiv[k];\n+ }\n+ inc_counter(iv);\n+ }\n+\n+ return E_SUCCESS;\n+}\n+\n+static void inc_counter(uint8_t* counter) {\n+ // from openssl\n+ uint32_t n = 16;\n+ uint8_t c;\n+ do {\n+ --n;\n+ c = counter[n];\n+ ++c;\n+ counter[n] = c;\n+ if (c) return;\n+ } while (n);\n+}\n+\n+\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Add firmware CCM implementation that uses AT86RF231 hardware AES engine.
|
491,609 |
18.09.2017 18:14:55
| -7,200 |
8beb77350dbbaa70c459b1785d43bba093db0702
|
Working CBC encryption in hardware with read access for each block.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"new_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"diff": "@@ -383,18 +383,95 @@ owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\nuint8_t nb;\nuint8_t* pbuf;\nuint8_t* pxor;\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+ uint8_t aes_cmd;\n+ uint8_t aes_status;\nnb = len >> 4;\npxor = iv;\n- for (n = 0; n < nb; n++) {\n- pbuf = &buffer[16 * n];\n- // may be faster if vector are aligned to 4 bytes (use long instead char in xor)\n+ pbuf = buffer;\nfor (k = 0; k < 16; k++) {\npbuf[k] ^= pxor[k];\n}\nat86rf231_crypto_opt_ecb(pbuf);\n- pxor = pbuf;\n+\n+ aes_cmd = 0xA0; // AES-CBC encryption start\n+ aes_status = 0x00;\n+ // first block already done, start actual CBC processing in hardware\n+ for (n = 1; n<nb; n++) {\n+ pbuf = &buffer[16 * n];\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x20; // CBC encryption\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)pbuf,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx(&aes_cmd,\n+ sizeof(aes_cmd),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ // Prepare to read the AES status register\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATUS;\n+\n+ // Busy wait reading AES status register until it is done or an error occurs\n+ do {\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_LAST);\n+ aes_status = spi_rx_buffer[2];\n+ } while((aes_status & 0x01) == 0x00);\n+\n+ if ((aes_status & 0x80) == 0x01) {\n+ // an error occured\n+ return E_FAIL;\n+ }\n+\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATE_KEY;\n+\n+ // send the command to read the ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 2,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ 16,\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ // read the actual ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)pbuf,\n+ 16,\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n}\n+\nreturn E_SUCCESS;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Working CBC encryption in hardware with read access for each block.
|
491,609 |
18.09.2017 18:28:37
| -7,200 |
2a10cd1caed6d09c6a9034905112076786743b6c
|
Skip reading everything but the last CBC block, for performance.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"new_path": "bsp/boards/iot-lab_M3/cryptoengine.c",
"diff": "@@ -210,6 +210,113 @@ owerror_t at86rf231_crypto_load_key(uint8_t key[16]) {\nreturn E_SUCCESS;\n}\n+/**\n+\\brief Raw AES-CBC encryption omitting everything but the last block. Assumes key\n+ is already loaded in the engine.\n+\\param[in,out] buffer Message to be encrypted. First and last block will be overwritten.\n+\\param[in] len Message length. Must be multiple of 16 octets.\n+\\param[in] iv Buffer containing the Initialization Vector (16 octets).\n+\n+\\returns E_SUCCESS when the encryption was successful.\n+*/\n+owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\n+ uint8_t n;\n+ uint8_t k;\n+ uint8_t nb;\n+ uint8_t* pbuf;\n+ uint8_t* pxor;\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+ uint8_t aes_cmd;\n+ uint8_t aes_status;\n+\n+ nb = len >> 4;\n+ pxor = iv;\n+ pbuf = buffer;\n+ for (k = 0; k < 16; k++) {\n+ pbuf[k] ^= pxor[k];\n+ }\n+ at86rf231_crypto_opt_ecb(pbuf);\n+\n+ aes_cmd = 0xA0; // AES-CBC encryption start\n+ aes_status = 0x00;\n+ // first block already done, start actual CBC processing in hardware\n+ for (n = 1; n<nb; n++) {\n+ pbuf = &buffer[16 * n];\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x20; // CBC encryption\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)pbuf,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx(&aes_cmd,\n+ sizeof(aes_cmd),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ // Prepare to read the AES status register\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATUS;\n+\n+ // Busy wait reading AES status register until it is done or an error occurs\n+ do {\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_LAST);\n+ aes_status = spi_rx_buffer[2];\n+ } while((aes_status & 0x01) == 0x00);\n+\n+ if ((aes_status & 0x80) == 0x01) {\n+ // an error occured\n+ return E_FAIL;\n+ }\n+ }\n+\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATE_KEY;\n+\n+ // send the command to read the last block\n+ spi_txrx(spi_tx_buffer,\n+ 2,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ 16,\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ // read the actual ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)pbuf,\n+ 16,\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ return E_SUCCESS;\n+}\n+\n/**\n\\brief CBC-MAC generation specific to CCM*. Assumes key is already loaded in the\nengine.\n@@ -369,112 +476,6 @@ static owerror_t aes_ctr_enc(uint8_t* m,\nreturn E_SUCCESS;\n}\n-/**\n-\\brief Raw AES-CBC encryption. Assumes key is already loaded in the engine.\n-\\param[in,out] buffer Message to be encrypted. Will be overwritten by ciphertext.\n-\\param[in] len Message length. Must be multiple of 16 octets.\n-\\param[in] iv Buffer containing the Initialization Vector (16 octets).\n-\n-\\returns E_SUCCESS when the encryption was successful.\n-*/\n-owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\n- uint8_t n;\n- uint8_t k;\n- uint8_t nb;\n- uint8_t* pbuf;\n- uint8_t* pxor;\n- uint8_t spi_tx_buffer[3];\n- uint8_t spi_rx_buffer[16];\n- uint8_t aes_cmd;\n- uint8_t aes_status;\n-\n- nb = len >> 4;\n- pxor = iv;\n- pbuf = buffer;\n- for (k = 0; k < 16; k++) {\n- pbuf[k] ^= pxor[k];\n- }\n- at86rf231_crypto_opt_ecb(pbuf);\n-\n- aes_cmd = 0xA0; // AES-CBC encryption start\n- aes_status = 0x00;\n- // first block already done, start actual CBC processing in hardware\n- for (n = 1; n<nb; n++) {\n- pbuf = &buffer[16 * n];\n- spi_tx_buffer[0] = 0x40; // SRAM write\n- spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n- spi_tx_buffer[2] = 0x20; // CBC encryption\n-\n- spi_txrx(spi_tx_buffer,\n- sizeof(spi_tx_buffer),\n- SPI_BUFFER,\n- (uint8_t*)spi_rx_buffer,\n- sizeof(spi_rx_buffer),\n- SPI_FIRST,\n- SPI_NOTLAST);\n-\n- spi_txrx((uint8_t*)pbuf,\n- 16,\n- SPI_BUFFER,\n- (uint8_t*)spi_rx_buffer,\n- sizeof(spi_rx_buffer),\n- SPI_NOTFIRST,\n- SPI_NOTLAST);\n-\n- spi_txrx(&aes_cmd,\n- sizeof(aes_cmd),\n- SPI_BUFFER,\n- (uint8_t*)spi_rx_buffer,\n- sizeof(spi_rx_buffer),\n- SPI_NOTFIRST,\n- SPI_LAST);\n-\n- // Prepare to read the AES status register\n- spi_tx_buffer[0] = 0x00;\n- spi_tx_buffer[1] = RG_AES_STATUS;\n-\n- // Busy wait reading AES status register until it is done or an error occurs\n- do {\n- spi_txrx(spi_tx_buffer,\n- sizeof(spi_tx_buffer),\n- SPI_BUFFER,\n- (uint8_t*)spi_rx_buffer,\n- sizeof(spi_rx_buffer),\n- SPI_FIRST,\n- SPI_LAST);\n- aes_status = spi_rx_buffer[2];\n- } while((aes_status & 0x01) == 0x00);\n-\n- if ((aes_status & 0x80) == 0x01) {\n- // an error occured\n- return E_FAIL;\n- }\n-\n- spi_tx_buffer[0] = 0x00;\n- spi_tx_buffer[1] = RG_AES_STATE_KEY;\n-\n- // send the command to read the ciphertext\n- spi_txrx(spi_tx_buffer,\n- 2,\n- SPI_BUFFER,\n- (uint8_t*)spi_rx_buffer,\n- 16,\n- SPI_FIRST,\n- SPI_NOTLAST);\n-\n- // read the actual ciphertext\n- spi_txrx(spi_tx_buffer,\n- 16,\n- SPI_BUFFER,\n- (uint8_t*)pbuf,\n- 16,\n- SPI_NOTFIRST,\n- SPI_LAST);\n- }\n-\n- return E_SUCCESS;\n-}\n-\n/**\n\\brief Raw AES-CTR encryption. Assumes key is already loaded in the engine.\n\\param[in,out] buffer Message to be encrypted. Will be overwritten by ciphertext.\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Skip reading everything but the last CBC block, for performance.
|
491,609 |
03.10.2018 18:03:19
| -7,200 |
e117a1670f6455677d8217146b018abfd7b59438
|
Port the same cryptoengine implementation to iot-lab_A8-M3 board.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_A8-M3/SConscript",
"new_path": "bsp/boards/iot-lab_A8-M3/SConscript",
"diff": "@@ -23,6 +23,12 @@ source = \\\nGlob('configure/*.s') + \\\nGlob('library/src/*.c')\n+localEnv.Append(\n+ CPPPATH = [\n+ os.path.join('#','bsp','chips','at86rf231'),\n+ ],\n+)\n+\nboard = localEnv.Object(source=source) + rf231\nReturn('board')\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/iot-lab_A8-M3/cryptoengine.c",
"new_path": "bsp/boards/iot-lab_A8-M3/cryptoengine.c",
"diff": "/**\n-\\brief Dummy implementation of cryptoengine.\n+\\brief Implementation of cryptoengine based on AT86RF231's hardware accelerator.\n*/\n#include <stdint.h>\n#include <string.h>\n+#include \"at86rf231.h\"\n#include \"cryptoengine.h\"\n+#include \"spi.h\"\n+#include \"radio.h\"\n+\n+//=========================== prototypes ======================================\n+owerror_t at86rf231_crypto_load_key(uint8_t key[16]);\n+owerror_t at86rf231_crypto_opt_ecb(uint8_t* buffer);\n+static owerror_t aes_cbc_mac(uint8_t* a, uint8_t len_a, uint8_t* m, uint8_t len_m, uint8_t* nonce, uint8_t* mac, uint8_t len_mac, uint8_t l);\n+static owerror_t aes_ctr_enc(uint8_t* m, uint8_t len_m, uint8_t* nonce, uint8_t* mac, uint8_t len_mac, uint8_t l);\n+owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]);\n+owerror_t aes_ctr_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]);\n+static void inc_counter(uint8_t* counter);\n+\n+//=========================== public ==========================================\nowerror_t cryptoengine_aes_ccms_enc(uint8_t* a,\nuint8_t len_a,\n@@ -14,6 +28,24 @@ owerror_t cryptoengine_aes_ccms_enc(uint8_t* a,\nuint8_t l,\nuint8_t key[16],\nuint8_t len_mac) {\n+ uint8_t mac[CBC_MAX_MAC_SIZE];\n+\n+ if ((len_mac > CBC_MAX_MAC_SIZE) || (l != 2)) {\n+ return E_FAIL;\n+ }\n+\n+ if (at86rf231_crypto_load_key(key) != E_SUCCESS) {\n+ return E_FAIL;\n+ }\n+\n+ if (aes_cbc_mac(a, len_a, m, *len_m, nonce, mac, len_mac, l) == E_SUCCESS) {\n+ if (aes_ctr_enc(m, *len_m, nonce, mac, len_mac, l) == E_SUCCESS) {\n+ memcpy(&m[*len_m], mac, len_mac);\n+ *len_m += len_mac;\n+\n+ return E_SUCCESS;\n+ }\n+ }\nreturn E_FAIL;\n}\n@@ -26,15 +58,464 @@ owerror_t cryptoengine_aes_ccms_dec(uint8_t* a,\nuint8_t l,\nuint8_t key[16],\nuint8_t len_mac) {\n+ uint8_t mac[CBC_MAX_MAC_SIZE];\n+ uint8_t orig_mac[CBC_MAX_MAC_SIZE];\n+\n+ if ((len_mac > CBC_MAX_MAC_SIZE) || (l != 2)) {\n+ return E_FAIL;\n+ }\n+\n+ if (at86rf231_crypto_load_key(key) != E_SUCCESS) {\n+ return E_FAIL;\n+ }\n+\n+ *len_m -= len_mac;\n+ memcpy(mac, &m[*len_m], len_mac);\n+\n+ if (aes_ctr_enc(m, *len_m, nonce, mac, len_mac, l) == E_SUCCESS) {\n+ if (aes_cbc_mac(a, len_a, m, *len_m, nonce, orig_mac, len_mac, l) == E_SUCCESS) {\n+ if (memcmp(mac, orig_mac, len_mac) == 0) {\n+ return E_SUCCESS;\n+ }\n+ }\n+ }\nreturn E_FAIL;\n}\nowerror_t cryptoengine_aes_ecb_enc(uint8_t* buffer, uint8_t* key) {\n+ if (at86rf231_crypto_load_key(key) == E_SUCCESS) {\n+ at86rf231_crypto_opt_ecb(buffer);\n+ return E_SUCCESS;\n+ }\nreturn E_FAIL;\n}\nowerror_t cryptoengine_init(void) {\n+ radio_rfOn();\nreturn E_SUCCESS;\n}\n+//=========================== private =========================================\n+// Optimized ECB AES encryption that does not load the key beforehand\n+owerror_t at86rf231_crypto_opt_ecb(uint8_t* buffer) {\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+\n+ uint8_t aes_cmd;\n+ uint8_t aes_status;\n+\n+ aes_cmd = 0x80; // AES start\n+ aes_status = 0x00;\n+\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x00; // ECB encryption\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx(&aes_cmd,\n+ sizeof(aes_cmd),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ // Prepare to read the AES status register\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATUS;\n+\n+ // Busy wait reading AES status register until it is done or an error occurs\n+ do {\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_LAST);\n+ aes_status = spi_rx_buffer[2];\n+ } while((aes_status & 0x01) == 0x00);\n+\n+ if ((aes_status & 0x80) == 0x01) {\n+ // an error occured\n+ return E_FAIL;\n+ }\n+\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATE_KEY;\n+\n+ // send the command to read the ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 2,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ 16,\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ // read the actual ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)buffer,\n+ 16,\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ return E_SUCCESS;\n+}\n+\n+\n+owerror_t at86rf231_crypto_load_key(uint8_t key[16]) {\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x10; // key mode\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)key,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief Raw AES-CBC encryption omitting everything but the last block. Assumes key\n+ is already loaded in the engine.\n+\\param[in,out] buffer Message to be encrypted. First and last block will be overwritten.\n+\\param[in] len Message length. Must be multiple of 16 octets.\n+\\param[in] iv Buffer containing the Initialization Vector (16 octets).\n+\n+\\returns E_SUCCESS when the encryption was successful.\n+*/\n+owerror_t aes_cbc_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\n+ uint8_t n;\n+ uint8_t k;\n+ uint8_t nb;\n+ uint8_t* pbuf;\n+ uint8_t* pxor;\n+ uint8_t spi_tx_buffer[3];\n+ uint8_t spi_rx_buffer[16];\n+ uint8_t aes_cmd;\n+ uint8_t aes_status;\n+\n+ nb = len >> 4;\n+ pxor = iv;\n+ pbuf = buffer;\n+ for (k = 0; k < 16; k++) {\n+ pbuf[k] ^= pxor[k];\n+ }\n+ at86rf231_crypto_opt_ecb(pbuf);\n+\n+ aes_cmd = 0xA0; // AES-CBC encryption start\n+ aes_status = 0x00;\n+ // first block already done, start actual CBC processing in hardware\n+ for (n = 1; n<nb; n++) {\n+ pbuf = &buffer[16 * n];\n+ spi_tx_buffer[0] = 0x40; // SRAM write\n+ spi_tx_buffer[1] = RG_AES_CTRL; // AES_CTRL register\n+ spi_tx_buffer[2] = 0x20; // CBC encryption\n+\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx((uint8_t*)pbuf,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_NOTLAST);\n+\n+ spi_txrx(&aes_cmd,\n+ sizeof(aes_cmd),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ // Prepare to read the AES status register\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATUS;\n+\n+ // Busy wait reading AES status register until it is done or an error occurs\n+ do {\n+ spi_txrx(spi_tx_buffer,\n+ sizeof(spi_tx_buffer),\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ sizeof(spi_rx_buffer),\n+ SPI_FIRST,\n+ SPI_LAST);\n+ aes_status = spi_rx_buffer[2];\n+ } while((aes_status & 0x01) == 0x00);\n+\n+ if ((aes_status & 0x80) == 0x01) {\n+ // an error occured\n+ return E_FAIL;\n+ }\n+ }\n+\n+ spi_tx_buffer[0] = 0x00;\n+ spi_tx_buffer[1] = RG_AES_STATE_KEY;\n+\n+ // send the command to read the last block\n+ spi_txrx(spi_tx_buffer,\n+ 2,\n+ SPI_BUFFER,\n+ (uint8_t*)spi_rx_buffer,\n+ 16,\n+ SPI_FIRST,\n+ SPI_NOTLAST);\n+\n+ // read the actual ciphertext\n+ spi_txrx(spi_tx_buffer,\n+ 16,\n+ SPI_BUFFER,\n+ (uint8_t*)pbuf,\n+ 16,\n+ SPI_NOTFIRST,\n+ SPI_LAST);\n+\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief CBC-MAC generation specific to CCM*. Assumes key is already loaded in the\n+engine.\n+\\param[in] a Pointer to the authentication only data.\n+\\param[in] len_a Length of authentication only data.\n+\\param[in] m Pointer to the data that is both authenticated and encrypted.\n+\\param[in] len_m Length of data that is both authenticated and encrypted.\n+\\param[in] nonce Buffer containing nonce (13 octets).\n+\\param[out] mac Buffer where the value of the CBC-MAC tag will be written.\n+\\param[in] len_mac Length of the CBC-MAC tag. Must be 4, 8 or 16 octets.\n+\\param[in] l CCM parameter L that allows selection of different nonce length.\n+\n+\\returns E_SUCCESS when the generation was successful, E_FAIL otherwise.\n+*/\n+static owerror_t aes_cbc_mac(uint8_t* a,\n+ uint8_t len_a,\n+ uint8_t* m,\n+ uint8_t len_m,\n+ uint8_t* nonce,\n+ uint8_t* mac,\n+ uint8_t len_mac,\n+ uint8_t l) {\n+\n+ uint8_t pad_len;\n+ uint8_t len;\n+ uint8_t cbc_mac_iv[16];\n+ uint8_t buffer[128+16+16]; // max buffer plus IV\n+\n+ // asserts here\n+ if (!((len_mac == 0) || (len_mac == 4) || (len_mac == 8) || (len_mac == 16))) {\n+ return E_FAIL;\n+ }\n+\n+ if ((len_a > 127) || (len_m > 127) || ((len_a + len_m) > 127)) {\n+ return E_FAIL;\n+ }\n+\n+ if (mac == 0) {\n+ return E_FAIL;\n+ }\n+\n+ memset(cbc_mac_iv, 0x00, 16); // CBC-MAC Initialization Vector is a zero string\n+\n+ // IV: flags (1B) | SADDR (8B) | ASN (5B) | len(m) (2B)\n+ // X0 xor IV in first 16 bytes of buffer: set buffer[:16] as IV)\n+ buffer[0] = 0x00; // set flags to zero including reserved\n+ buffer[0] |= 0x07 & (l-1); // field L\n+ // (len_mac - 2)/2 shifted left es corresponds to (len_mac - 2) << 2\n+ buffer[0] |= len_mac == 0 ? 0 : (0x07 & (len_mac - 2)) << 2; // field M\n+ buffer[0] |= len_a != 0 ? 0x40 : 0; // field Adata\n+\n+ memcpy(&buffer[1], nonce, 13);\n+\n+ if (l == 3) {\n+ buffer[13] = 0;\n+ }\n+\n+ buffer[14] = 0;\n+ buffer[15] = len_m;\n+\n+ len = 16;\n+ // len(a)\n+ if(len_a > 0) {\n+ buffer[16] = 0;\n+ buffer[17] = len_a;\n+ len += 2;\n+ }\n+\n+ // (((x >> 4) + 1)<<4) - x or 16 - (x % 16) ?\n+ // a + padding\n+ pad_len = ((((len_a + len - 16) >> 4) + 1) << 4) - (len_a + len - 16);\n+ pad_len = pad_len == 16 ? 0 : pad_len;\n+ memcpy(&buffer[len], a, len_a);\n+ len += len_a;\n+ memset(&buffer[len], 0, pad_len);\n+ len += pad_len;\n+\n+ // m + padding\n+ pad_len = (((len_m >> 4) + 1) << 4) - len_m;\n+ pad_len = pad_len == 16 ? 0 : pad_len;\n+ memcpy(&buffer[len], m, len_m);\n+ len += len_m;\n+ memset(&buffer[len], 0, pad_len);\n+ len += pad_len;\n+\n+ aes_cbc_enc_raw(buffer, len, cbc_mac_iv);\n+\n+ // copy MAC\n+ memcpy(mac, &buffer[len - 16], len_mac);\n+\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief Counter (CTR) mode encryption specific to IEEE 802.15.4E. Assumes key is already\n+loaded in the engine.\n+\\param[in,out] m Pointer to the data that is both authenticated and encrypted. Data is\n+ overwritten by ciphertext (i.e. plaintext in case of inverse CCM*).\n+\\param[in] len_m Length of data that is both authenticated and encrypted.\n+\\param[in] nonce Buffer containing nonce (13 octets).\n+\\param[in,out] mac Buffer containing the unencrypted or encrypted CBC-MAC tag, which depends\n+ on weather the function is called as part of CCM* forward or inverse transformation. It\n+ is overwrriten by the encrypted, i.e unencrypted, tag on return.\n+\\param[in] len_mac Length of the CBC-MAC tag. Must be 4, 8 or 16 octets.\n+\\param[in] l CCM parameter L that allows selection of different nonce length.\n+\n+\\returns E_SUCCESS when the encryption was successful, E_FAIL otherwise.\n+*/\n+static owerror_t aes_ctr_enc(uint8_t* m,\n+ uint8_t len_m,\n+ uint8_t* nonce,\n+ uint8_t* mac,\n+ uint8_t len_mac,\n+ uint8_t l) {\n+\n+ uint8_t pad_len;\n+ uint8_t len;\n+ uint8_t iv[16];\n+ uint8_t buffer[128 + 16]; // max buffer plus mac\n+\n+ // asserts here\n+ if (!((len_mac == 0) || (len_mac == 4) || (len_mac == 8) || (len_mac == 16))) {\n+ return E_FAIL;\n+ }\n+\n+ if (len_m > 127) {\n+ return E_FAIL;\n+ }\n+\n+ // iv (flag (1B) | source addr (8B) | ASN (5B) | cnt (2B)\n+ iv[0] = 0x00;\n+ iv[0] |= 0x07 & (l-1); // field L\n+\n+ memcpy(&iv[1], nonce, 13);\n+ iv[14] = 0x00;\n+ iv[15] = 0x00;\n+\n+ // first block is mac\n+ memcpy(buffer, mac, len_mac);\n+ memset(&buffer[len_mac], 0, 16 - len_mac);\n+ len = 16;\n+\n+ // (((x >> 4) + 1)<<4) - x or 16 - (x % 16) ?\n+ // m + padding\n+ pad_len = (((len_m >> 4) + 1) << 4) - len_m;\n+ pad_len = pad_len == 16 ? 0 : pad_len;\n+ memcpy(&buffer[len], m, len_m);\n+ len += len_m;\n+ memset(&buffer[len], 0, pad_len);\n+ len += pad_len;\n+\n+ aes_ctr_enc_raw(buffer, len, iv);\n+\n+ memcpy(m, &buffer[16], len_m);\n+ memcpy(mac, buffer, len_mac);\n+\n+ return E_SUCCESS;\n+}\n+\n+/**\n+\\brief Raw AES-CTR encryption. Assumes key is already loaded in the engine.\n+\\param[in,out] buffer Message to be encrypted. Will be overwritten by ciphertext.\n+\\param[in] len Message length. Must be multiple of 16 octets.\n+\\param[in] iv Buffer containing the Initialization Vector (16 octets).\n+\n+\\returns E_SUCCESS when the encryption was successful.\n+*/\n+owerror_t aes_ctr_enc_raw(uint8_t* buffer, uint8_t len, uint8_t iv[16]) {\n+ uint8_t n;\n+ uint8_t k;\n+ uint8_t nb;\n+ uint8_t* pbuf;\n+ uint8_t eiv[16];\n+\n+ nb = len >> 4;\n+ for (n = 0; n < nb; n++) {\n+ pbuf = &buffer[16 * n];\n+ memcpy(eiv, iv, 16);\n+ at86rf231_crypto_opt_ecb(eiv);\n+ // may be faster if vector are aligned to 4 bytes (use long instead char in xor)\n+ for (k = 0; k < 16; k++) {\n+ pbuf[k] ^= eiv[k];\n+ }\n+ inc_counter(iv);\n+ }\n+\n+ return E_SUCCESS;\n+}\n+\n+static void inc_counter(uint8_t* counter) {\n+ // from openssl\n+ uint32_t n = 16;\n+ uint8_t c;\n+ do {\n+ --n;\n+ c = counter[n];\n+ ++c;\n+ counter[n] = c;\n+ if (c) return;\n+ } while (n);\n+}\n+\n+\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-703. Port the same cryptoengine implementation to iot-lab_A8-M3 board.
|
491,595 |
17.06.2019 12:10:13
| -7,200 |
68f05ffd2157ef73f98178c2f82dc59212d767a8
|
add dutyCycle info in uinject application.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject.c",
"new_path": "openapps/uinject/uinject.c",
"diff": "@@ -96,6 +96,9 @@ void uinject_task_cb(void) {\nopen_addr_t parentNeighbor;\nbool foundNeighbor;\n+ uint32_t ticksOn;\n+ uint32_t ticksInTotal;\n+\n// don't run if not synch\nif (ieee154e_isSynch() == FALSE) {\nreturn;\n@@ -168,6 +171,19 @@ void uinject_task_cb(void) {\npkt->payload[1] = (uint8_t)(idmanager_getMyID(ADDR_16B)->addr_16b[0]);\npkt->payload[0] = (uint8_t)(idmanager_getMyID(ADDR_16B)->addr_16b[1]);\n+ ieee154e_getTicsInfo(&ticksOn, &ticksInTotal);\n+ packetfunctions_reserveHeaderSize(pkt,sizeof(uint32_t));\n+ pkt->payload[3] = (uint8_t)((ticksOn & 0xff000000) >> 24);\n+ pkt->payload[2] = (uint8_t)((ticksOn & 0x00ff0000) >> 16);\n+ pkt->payload[1] = (uint8_t)((ticksOn & 0x0000ff00) >> 8);\n+ pkt->payload[0] = (uint8_t)( ticksOn & 0x000000ff);\n+\n+ packetfunctions_reserveHeaderSize(pkt,sizeof(uint32_t));\n+ pkt->payload[3] = (uint8_t)((ticksInTotal & 0xff000000) >> 24);\n+ pkt->payload[2] = (uint8_t)((ticksInTotal & 0x00ff0000) >> 16);\n+ pkt->payload[1] = (uint8_t)((ticksInTotal & 0x0000ff00) >> 8);\n+ pkt->payload[0] = (uint8_t)( ticksInTotal & 0x000000ff);\n+\nif ((openudp_send(pkt))==E_FAIL) {\nopenqueue_freePacketBuffer(pkt);\n} else {\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -2307,6 +2307,12 @@ port_INLINE uint16_t ieee154e_getTimeCorrection(void) {\nreturn returnVal;\n}\n+void ieee154e_getTicsInfo(uint32_t* numTicsOn, uint32_t* numTicsTotal){\n+\n+ *numTicsOn = (uint32_t)(ieee154e_stats.numTicsOn);\n+ *numTicsTotal = (uint32_t)(ieee154e_stats.numTicsTotal);\n+}\n+\nport_INLINE void joinPriorityStoreFromEB(uint8_t jp){\nieee154e_vars.dataReceived->l2_joinPriority = jp;\nieee154e_vars.dataReceived->l2_joinPriorityPresent = TRUE;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -307,6 +307,7 @@ void ieee154e_setSlotDuration(uint16_t duration);\nuint16_t ieee154e_getSlotDuration(void);\nuint16_t ieee154e_getTimeCorrection(void);\n+void ieee154e_getTicsInfo(uint32_t* numTicsOn, uint32_t* numTicsTotal);\n// events\nvoid ieee154e_startOfFrame(PORT_TIMER_WIDTH capturedTime);\nvoid ieee154e_endOfFrame(PORT_TIMER_WIDTH capturedTime);\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -535,6 +535,7 @@ functionsToChange = [\n'activity_inhibitSerial',\n'ieee154e_processIEs',\n'ieee154e_getTimeCorrection',\n+ 'ieee154e_getTicsInfo',\n'isValidRxFrame',\n'isValidAck',\n'isValidJoin',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-846. add dutyCycle info in uinject application.
|
491,606 |
12.07.2019 11:17:41
| -7,200 |
25008813d81d11c5ef27ef560d3829e1e3d0ba34
|
clear sixtop state if ack is not received after max retries reached
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -931,8 +931,18 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\n// if this is a request send done\nif (msg->l2_sixtop_messageType == SIXTOP_CELL_REQUEST){\nif(error == E_FAIL) {\n+ // max retries, without ack\n+ switch (sixtop_vars.six2six_state) {\n+\n+ case SIX_STATE_WAIT_CLEARREQUEST_SENDDONE:\n+ sixtop_vars.six2six_state = SIX_STATE_WAIT_CLEARRESPONSE;\n+ timer_sixtop_six2six_timeout_fired();\n+ break;\n+ default:\n// reset handler and state if the request is failed to send out\nsixtop_vars.six2six_state = SIX_STATE_IDLE;\n+ break;\n+ }\n} else {\n// the packet has been sent out successfully\nswitch (sixtop_vars.six2six_state) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-775 clear sixtop state if ack is not received after max retries reached (#474)
|
491,595 |
12.07.2019 11:20:39
| -7,200 |
b70d224976ddbbb82d051faf1c7b7f46b1621781
|
don't remove the cell in advance for clear command.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/msf.c",
"new_path": "openstack/02b-MAChigh/msf.c",
"diff": "@@ -165,30 +165,6 @@ void msf_updateCellsUsed(open_addr_t* neighbor, cellType_t type){\n}\n}\n-void msf_trigger6pClear(open_addr_t* neighbor){\n-\n- if (schedule_hasNegotiatedTxCellToNeighbor(neighbor)){\n-\n- // remove the cells at local first\n-\n- schedule_removeAllNegotiatedCellsToNeighbor(\n- SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE,\n- neighbor\n- );\n-\n- sixtop_request(\n- IANA_6TOP_CMD_CLEAR, // code\n- neighbor, // neighbor\n- NUMCELLS_MSF, // number cells\n- CELLOPTIONS_MSF, // cellOptions (not used)\n- NULL, // celllist to add (not used)\n- NULL, // celllist to delete (not used)\n- IANA_6TISCH_SFID_MSF, // sfid\n- 0, // list command offset (not used)\n- 0 // list command maximum celllist (not used)\n- );\n- }\n-}\n//=========================== callback =========================================\nuint8_t msf_getsfid(void){\n@@ -279,13 +255,6 @@ void msf_timer_clear_task(void){\nreturn;\n}\n- // remove the cells at local first\n-\n- schedule_removeAllNegotiatedCellsToNeighbor(\n- SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE,\n- &neighbor\n- );\n-\nsixtop_request(\nIANA_6TOP_CMD_CLEAR, // code\n&neighbor, // neighbor\n@@ -499,13 +468,6 @@ void msf_housekeeping(void){\nif (schedule_hasNegotiatedTxCellToNonParent(&parentNeighbor, &nonParentNeighbor)==TRUE){\n- // remove the cells at local first\n-\n- schedule_removeAllNegotiatedCellsToNeighbor(\n- SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE,\n- &nonParentNeighbor\n- );\n-\n// send a clear request to the non-parent neighbor\nsixtop_request(\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/msf.h",
"new_path": "openstack/02b-MAChigh/msf.h",
"diff": "@@ -70,8 +70,6 @@ bool msf_candidateRemoveCellList(\n// called by schedule\nvoid msf_updateCellsElapsed(open_addr_t* neighbor, cellType_t cellType);\nvoid msf_updateCellsUsed(open_addr_t* neighbor, cellType_t cellType);\n-// called by icmpv6rpl, where parent changed\n-void msf_trigger6pClear(open_addr_t* neighbor);\nuint16_t msf_hashFunction_getSlotoffset(open_addr_t* address);\nuint8_t msf_hashFunction_getChanneloffset(open_addr_t* address);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-775. don't remove the cell in advance for clear command.
|
491,595 |
12.07.2019 13:38:39
| -7,200 |
9a3b99ce1a41df5e050a9964d9272209620760c2
|
should install autoTx cell after the packet's owner changes to COMPONENT_SIXTOP_TO_IEEE802154E.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -363,25 +363,6 @@ owerror_t sixtop_request(\nowerror_t sixtop_send(OpenQueueEntry_t *msg) {\n- if (\n- packetfunctions_isBroadcastMulticast(&(msg->l2_nextORpreviousHop)) == FALSE &&\n- schedule_hasNegotiatedTxCellToNeighbor(&(msg->l2_nextORpreviousHop)) == FALSE &&\n- schedule_hasAutoTxCellToNeighbor(&(msg->l2_nextORpreviousHop)) == FALSE\n- ){\n- // the frame source address is not broadcast/multicast\n- // no negotiated tx cell to that neighbor\n- // no auto tx cell to that neighbor\n-\n- schedule_addActiveSlot(\n- msf_hashFunction_getSlotoffset(&(msg->l2_nextORpreviousHop)), // slot offset\n- CELLTYPE_TX, // type of slot\n- TRUE, // shared?\n- TRUE, // auto cell?\n- msf_hashFunction_getChanneloffset(&(msg->l2_nextORpreviousHop)), // channel offset\n- &(msg->l2_nextORpreviousHop) // neighbor\n- );\n- }\n-\n// set metadata\nmsg->owner = COMPONENT_SIXTOP;\nmsg->l2_frameType = IEEE154_TYPE_DATA;\n@@ -638,6 +619,25 @@ owerror_t sixtop_send_internal(\n);\n// change owner to IEEE802154E fetches it from queue\nmsg->owner = COMPONENT_SIXTOP_TO_IEEE802154E;\n+\n+ if (\n+ packetfunctions_isBroadcastMulticast(&(msg->l2_nextORpreviousHop)) == FALSE &&\n+ schedule_hasNegotiatedTxCellToNeighbor(&(msg->l2_nextORpreviousHop)) == FALSE &&\n+ schedule_hasAutoTxCellToNeighbor(&(msg->l2_nextORpreviousHop)) == FALSE\n+ ){\n+ // the frame source address is not broadcast/multicast\n+ // no negotiated tx cell to that neighbor\n+ // no auto tx cell to that neighbor\n+\n+ schedule_addActiveSlot(\n+ msf_hashFunction_getSlotoffset(&(msg->l2_nextORpreviousHop)), // slot offset\n+ CELLTYPE_TX, // type of slot\n+ TRUE, // shared?\n+ TRUE, // auto cell?\n+ msf_hashFunction_getChanneloffset(&(msg->l2_nextORpreviousHop)), // channel offset\n+ &(msg->l2_nextORpreviousHop) // neighbor\n+ );\n+ }\nreturn E_SUCCESS;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-849. should install autoTx cell after the packet's owner changes to COMPONENT_SIXTOP_TO_IEEE802154E.
|
491,595 |
15.07.2019 15:07:48
| -7,200 |
4e959776c5badf0a1b2dd0cc08d69d12cb7e1a16
|
Update timing for openmote-cc2538 according to openmote-b's timing.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/board_info.h",
"new_path": "bsp/boards/openmote-cc2538/board_info.h",
"diff": "//===== IEEE802154E timing\n-#define SLOTDURATION 10 // in miliseconds\n+#define SLOTDURATION 20 // in miliseconds\n+\n+//===== IEEE802154E timing\n#if SLOTDURATION==10\n// time-slot related\n#define PORT_maxTxDataPrepare 10 // 305us (measured 82us)\n#define PORT_maxRxAckPrepare 10 // 305us (measured 83us)\n#define PORT_maxRxDataPrepare 4 // 122us (measured 22us)\n- #define PORT_maxTxAckPrepare 15 // 122us (measured 94us)\n+ #define PORT_maxTxAckPrepare 10 // 122us (measured 94us)\n// radio speed related\n#ifdef L2_SECURITY_ACTIVE\n#define PORT_delayTx 14 // 366us (measured xxxus)\n#else\n- #define PORT_delayTx 8 // 366us (measured xxxus)\n+ #define PORT_delayTx 12 // 366us (measured xxxus)\n#endif\n#define PORT_delayRx 0 // 0us (can not measure)\n// radio watchdog\n#endif\n#if SLOTDURATION==20\n- // time-slot related\n- #define PORT_TsSlotDuration 492 // counter counts one extra count, see datasheet\n+ #define PORT_TsSlotDuration 655 // 20ms\n+\n// execution speed related\n- #define PORT_maxTxDataPrepare 110 // 3355us (not measured)\n- #define PORT_maxRxAckPrepare 20 // 610us (not measured)\n- #define PORT_maxRxDataPrepare 33 // 1000us (not measured)\n- #define PORT_maxTxAckPrepare 50 // 1525us (not measured)\n+ #define PORT_maxTxDataPrepare 15 // 458us (measured 213us)\n+ #define PORT_maxRxAckPrepare 10 // 305us (measured 86us)\n+ #define PORT_maxRxDataPrepare 10 // 305us (measured 88us)\n+ #define PORT_maxTxAckPrepare 15 // 458us (measured 211us)\n// radio speed related\n- #define PORT_delayTx 18 // 549us (not measured)\n+ #define PORT_delayTx 13 // 397us (measured 388us)\n#define PORT_delayRx 0 // 0us (can not measure)\n- // radio watchdog\n#endif\n//===== adaptive_sync accuracy\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Update timing for openmote-cc2538 according to openmote-b's timing.
|
491,595 |
12.08.2019 17:20:10
| -7,200 |
9243a4276021eba7989a194b1cc6b20ec436f2ed
|
check the bootloader backdoor setting before upload the image.
|
[
{
"change_type": "MODIFY",
"old_path": "bootloader/openmote-cc2538/ot_program.py",
"new_path": "bootloader/openmote-cc2538/ot_program.py",
"diff": "@@ -25,6 +25,21 @@ class program_over_testbed(object):\n# initialize parameters\nself.mote = mote\nself.image = None\n+\n+ # check bootload backdoor is configured correctly\n+\n+ bootloader_backdoor_enabled = False\n+\n+ with open(image_path,'r') as f:\n+ for line in f:\n+ # | 1:3 byte count | 3:7 address | 9:17 32-bit field of the lock bit page (the last byte is backdoor configuration) |\n+ # 'F6' = 111 1 0 110\n+ # reserved backdoor and bootloader enable active low PA pin used for backdoor enabling (PA6)\n+ if line[3:7] == 'FFD4' and int(line[1:3], 16)>4 and line[9:17] == 'FFFFFFF6':\n+ bootloader_backdoor_enabled = True\n+\n+ assert bootloader_backdoor_enabled\n+\nself.image_name = ''\nwith open(image_path,'rb') as f:\nself.image = base64.b64encode(f.read())\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-852. check the bootloader backdoor setting before upload the image.
|
491,595 |
14.08.2019 11:23:41
| -7,200 |
73baf7a243c9bac90d34b40545d75090994f1ee1
|
check the whole 32bit address.
|
[
{
"change_type": "MODIFY",
"old_path": "bootloader/openmote-cc2538/ot_program.py",
"new_path": "bootloader/openmote-cc2538/ot_program.py",
"diff": "@@ -29,13 +29,24 @@ class program_over_testbed(object):\n# check bootload backdoor is configured correctly\nbootloader_backdoor_enabled = False\n+ extended_linear_address_found = False\nwith open(image_path,'r') as f:\nfor line in f:\n+\n+ # looking for data at address 0027FFD4\n+ # refer to: https://en.wikipedia.org/wiki/Intel_HEX#Record_types\n+\n+ # looking for upper 16bit address 0027\n+ if line[:-1] == ':020000040027D3':\n+ extended_linear_address_found = True\n+\n+ # check the lower 16bit address FFD4\n+\n# | 1:3 byte count | 3:7 address | 9:17 32-bit field of the lock bit page (the last byte is backdoor configuration) |\n# 'F6' = 111 1 0 110\n# reserved backdoor and bootloader enable active low PA pin used for backdoor enabling (PA6)\n- if line[3:7] == 'FFD4' and int(line[1:3], 16)>4 and line[9:17] == 'FFFFFFF6':\n+ if extended_linear_address_found and line[3:7] == 'FFD4' and int(line[1:3], 16)>4 and line[9:17] == 'FFFFFFF6':\nbootloader_backdoor_enabled = True\nassert bootloader_backdoor_enabled\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-852. check the whole 32bit address.
|
491,595 |
14.08.2019 13:27:54
| -7,200 |
b5e597f1f6ad6903bfc67cfada7ade40ca7ecb94
|
resolve the windows/linux ending charactor issue.
|
[
{
"change_type": "MODIFY",
"old_path": "bootloader/openmote-cc2538/ot_program.py",
"new_path": "bootloader/openmote-cc2538/ot_program.py",
"diff": "@@ -38,7 +38,7 @@ class program_over_testbed(object):\n# refer to: https://en.wikipedia.org/wiki/Intel_HEX#Record_types\n# looking for upper 16bit address 0027\n- if line[:-1] == ':020000040027D3':\n+ if line[:15] == ':020000040027D3':\nextended_linear_address_found = True\n# check the lower 16bit address FFD4\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-852. resolve the windows/linux ending charactor issue.
|
491,595 |
30.08.2019 11:43:46
| -7,200 |
f0c0ba9978d5bc67dff3a068f569ebd1c788de1e
|
check current slot type according current slotOffset.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/cexample/cexample.c",
"new_path": "openapps/cexample/cexample.c",
"diff": "@@ -116,7 +116,7 @@ void cexample_task_cb(void) {\nreturn;\n}\n- if (schedule_hasNegotiatedTxCellToNeighbor(&parentNeighbor) == FALSE) {\n+ if (schedule_hasNegotiatedCellToNeighbor(&parentNeighbor, CELLTYPE_TX) == FALSE) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/cstorm/cstorm.c",
"new_path": "openapps/cstorm/cstorm.c",
"diff": "@@ -177,7 +177,7 @@ void cstorm_task_cb(void) {\nreturn;\n}\n- if (schedule_hasNegotiatedTxCellToNeighbor(&parentNeighbor) == FALSE) {\n+ if (schedule_hasNegotiatedCellToNeighbor(&parentNeighbor, CELLTYPE_TX) == FALSE) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject.c",
"new_path": "openapps/uinject/uinject.c",
"diff": "@@ -115,7 +115,7 @@ void uinject_task_cb(void) {\nreturn;\n}\n- if (schedule_hasNegotiatedTxCellToNeighbor(&parentNeighbor) == FALSE) {\n+ if (schedule_hasNegotiatedCellToNeighbor(&parentNeighbor, CELLTYPE_TX) == FALSE) {\nreturn;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -1695,6 +1695,7 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nieee802154_header_iht ieee802514_header;\nuint16_t lenIE=0;\nopen_addr_t addressToWrite;\n+ open_addr_t parentAddress;\n// change state\nchangeState(S_TXACKOFFSET);\n@@ -1833,6 +1834,12 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nbreak;\n}\n+ if (icmpv6rpl_getPreferredParentEui64(&parentAddress)){\n+ if (packetfunctions_sameAddress(&ieee802514_header.src, &parentAddress)){\n+ ieee154e_vars.receivedFrameFromParent = TRUE;\n+ }\n+ }\n+\n// record the timeCorrection and print out at end of slot\nieee154e_vars.dataReceived->l2_timeCorrection = (PORT_SIGNED_INT_WIDTH)((PORT_SIGNED_INT_WIDTH)TsTxOffset-(PORT_SIGNED_INT_WIDTH)ieee154e_vars.syncCapturedTime);\n@@ -1929,7 +1936,7 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nicmpv6rpl_getPreferredParentEui64(&addressToWrite) == FALSE ||\n(\nicmpv6rpl_getPreferredParentEui64(&addressToWrite) &&\n- schedule_hasNegotiatedTxCellToNeighbor(&addressToWrite)== FALSE\n+ schedule_hasNegotiatedCellToNeighbor(&addressToWrite, CELLTYPE_TX)== FALSE\n)\n)\n) {\n@@ -2850,9 +2857,9 @@ will do that for you, but assume that something went wrong.\n*/\nvoid endSlot(void) {\n- cellType_t cellType;\nopen_addr_t slotNeighbor;\nopen_addr_t parentAddress;\n+ slotinfo_element_t info;\n// turn off the radio\nradio_rfOff();\n@@ -2914,24 +2921,28 @@ void endSlot(void) {\nieee154e_vars.dataToSend = NULL;\n}\n- cellType = schedule_getType();\n- if (cellType==CELLTYPE_RX){\n+ schedule_getSlotInfo(ieee154e_vars.slotOffset, &info);\n+ if (info.link_type==CELLTYPE_RX){\n// update numcellelapsed and numcellused on Rx cell\n// update numcellused if received something\n- if (ieee154e_vars.dataReceived!=NULL) {\n+ if (ieee154e_vars.receivedFrameFromParent) {\n+ if (icmpv6rpl_getPreferredParentEui64(&parentAddress)){\nmsf_updateCellsUsed(\n- &(ieee154e_vars.dataReceived->l2_nextORpreviousHop),\n+ &parentAddress,\nCELLTYPE_RX\n);\n}\n+ }\n// update numcellelapsed if this is auto rx or rx cell to parent\nif (schedule_getIsAutoCell()){\nif (icmpv6rpl_getPreferredParentEui64(&parentAddress)){\n+ if (schedule_hasNegotiatedCellToNeighbor(&parentAddress, CELLTYPE_RX) == FALSE) {\n// adapt traffic on auto rx for downstream traffic\nmsf_updateCellsElapsed(&parentAddress, CELLTYPE_RX);\n}\n+ }\n} else {\n// update numelapsed on rx cell (msf will check whether it\n// is to parent or not)\n@@ -2939,6 +2950,7 @@ void endSlot(void) {\nmsf_updateCellsElapsed(&slotNeighbor, CELLTYPE_RX);\n}\n}\n+ ieee154e_vars.receivedFrameFromParent = FALSE;\n// clean up dataReceived\nif (ieee154e_vars.dataReceived!=NULL) {\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.h",
"new_path": "openstack/02a-MAClow/IEEE802154E.h",
"diff": "@@ -266,6 +266,9 @@ typedef struct {\nopentimers_id_t timerId; // id of timer used for implementing TSCH slot FSM\nuint32_t startOfSlotReference; // the time refer to the beginning of slot\nopentimers_id_t serialInhibitTimerId; // id of serial inhibit timer used for scheduling serial output\n+\n+ // for msf downstream traffic adaptation\n+ uint32_t receivedFrameFromParent; // True when received a frame from parent\n} ieee154e_vars_t;\nBEGIN_PACK\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/msf.c",
"new_path": "openstack/02b-MAChigh/msf.c",
"diff": "@@ -119,7 +119,7 @@ void msf_updateCellsElapsed(open_addr_t* neighbor, cellType_t type){\n// adapt to downward traffic when there are negotiated Tx cells in schedule\n- if (schedule_getNumberOfNegotiatedTxCells(neighbor)==0){\n+ if (schedule_getNumberOfNegotiatedCells(neighbor, CELLTYPE_TX)==0){\nreturn;\n}\n@@ -345,7 +345,7 @@ void msf_trigger6pDelete(void){\n}\nif (msf_vars.needDeleteTx) {\n- if (schedule_getNumberOfNegotiatedTxCells(&neighbor)<=1){\n+ if (schedule_getNumberOfNegotiatedCells(&neighbor, CELLTYPE_TX)<=1){\n// at least one negotiated Tx cell presents\nmsf_vars.needDeleteTx = FALSE;\n}\n@@ -484,7 +484,7 @@ void msf_housekeeping(void){\nreturn;\n}\n- if (schedule_getNumberOfNegotiatedTxCells(&parentNeighbor)==0){\n+ if (schedule_getNumberOfNegotiatedCells(&parentNeighbor, CELLTYPE_TX)==0){\nmsf_vars.needAddTx = TRUE;\nmsf_trigger6pAdd();\nreturn;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/msf.h",
"new_path": "openstack/02b-MAChigh/msf.h",
"diff": "#define CELLOPTIONS_MSF CELLOPTIONS_TX\n#define NUMCELLS_MSF 1\n-#define MAX_NUMCELLS 64\n-#define LIM_NUMCELLSUSED_HIGH 48\n-#define LIM_NUMCELLSUSED_LOW 16\n+#define MAX_NUMCELLS 32\n+#define LIM_NUMCELLSUSED_HIGH 24\n+#define LIM_NUMCELLSUSED_LOW 8\n#define HOUSEKEEPING_PERIOD 30000 // miliseconds\n#define QUARANTINE_DURATION 300 // seconds\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/schedule.c",
"new_path": "openstack/02b-MAChigh/schedule.c",
"diff": "@@ -720,7 +720,7 @@ uint8_t schedule_getNumberOfFreeEntries(){\nreturn counter;\n}\n-uint8_t schedule_getNumberOfNegotiatedTxCells(open_addr_t* neighbor){\n+uint8_t schedule_getNumberOfNegotiatedCells(open_addr_t* neighbor, cellType_t cell_type){\nuint8_t i;\nuint8_t j;\nuint8_t counter;\n@@ -732,7 +732,7 @@ uint8_t schedule_getNumberOfNegotiatedTxCells(open_addr_t* neighbor){\nfor(i=0;i<MAXACTIVESLOTS;i++) {\nif(\nschedule_vars.scheduleBuf[i].shared == FALSE &&\n- schedule_vars.scheduleBuf[i].type == CELLTYPE_TX &&\n+ schedule_vars.scheduleBuf[i].type == cell_type &&\npacketfunctions_sameAddress(&schedule_vars.scheduleBuf[i].neighbor, neighbor) == TRUE\n){\ncounter++;\n@@ -880,7 +880,7 @@ bool schedule_hasAutoTxCellToNeighbor(open_addr_t* neighbor){\nreturn FALSE;\n}\n-bool schedule_hasNegotiatedTxCellToNeighbor(open_addr_t* neighbor){\n+bool schedule_hasNegotiatedCellToNeighbor(open_addr_t* neighbor, cellType_t cell_type){\nuint8_t i;\nINTERRUPT_DECLARATION();\n@@ -889,7 +889,7 @@ bool schedule_hasNegotiatedTxCellToNeighbor(open_addr_t* neighbor){\nfor(i=0;i<MAXACTIVESLOTS;i++) {\nif(\nschedule_vars.scheduleBuf[i].shared == FALSE &&\n- schedule_vars.scheduleBuf[i].type == CELLTYPE_TX &&\n+ schedule_vars.scheduleBuf[i].type == cell_type &&\nschedule_vars.scheduleBuf[i].neighbor.type == ADDR_64B &&\npacketfunctions_sameAddress(neighbor,&schedule_vars.scheduleBuf[i].neighbor)\n){\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/schedule.h",
"new_path": "openstack/02b-MAChigh/schedule.h",
"diff": "@@ -208,16 +208,15 @@ void schedule_removeAllNegotiatedCellsToNeighbor(\nopen_addr_t* neighbor\n);\nuint8_t schedule_getNumberOfFreeEntries(void);\n-uint8_t schedule_getNumberOfNegotiatedTxCells(open_addr_t* neighbor);\n+uint8_t schedule_getNumberOfNegotiatedCells(open_addr_t* neighbor, cellType_t cell_type);\nbool schedule_isNumTxWrapped(open_addr_t* neighbor);\nbool schedule_getCellsToBeRelocated(open_addr_t* neighbor, cellInfo_ht* celllist);\nbool schedule_hasAutonomousTxRxCellUnicast(open_addr_t* neighbor);\nbool schedule_getAutonomousTxRxCellUnicastNeighbor(open_addr_t* neighbor);\nbool schedule_hasAutoTxCellToNeighbor(open_addr_t* neighbor);\n-bool schedule_hasNegotiatedTxCellToNeighbor(open_addr_t* neighbor);\n+bool schedule_hasNegotiatedCellToNeighbor(open_addr_t* neighbor, cellType_t cell_type);\nbool schedule_getAutonomousTxRxCellAnycast(uint16_t* slotoffset);\nbool schedule_hasNonParentManagedTxCell(open_addr_t* neighbor);\n-bool schedule_getNonParentsNegotiatedTxCell(open_addr_t* neighbor, open_addr_t* nonParentNeighbor);\nvoid schedule_hasNegotiatedTxCell(open_addr_t* address);\nbool schedule_hasNegotiatedTxCellToNonParent(\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02b-MAChigh/sixtop.c",
"new_path": "openstack/02b-MAChigh/sixtop.c",
"diff": "@@ -622,7 +622,7 @@ owerror_t sixtop_send_internal(\nif (\npacketfunctions_isBroadcastMulticast(&(msg->l2_nextORpreviousHop)) == FALSE &&\n- schedule_hasNegotiatedTxCellToNeighbor(&(msg->l2_nextORpreviousHop)) == FALSE &&\n+ schedule_hasNegotiatedCellToNeighbor(&(msg->l2_nextORpreviousHop), CELLTYPE_TX) == FALSE &&\nschedule_hasAutoTxCellToNeighbor(&(msg->l2_nextORpreviousHop)) == FALSE\n){\n// the frame source address is not broadcast/multicast\n@@ -856,7 +856,7 @@ port_INLINE void sixtop_sendKA(void) {\nreturn;\n}\n- if (schedule_hasNegotiatedTxCellToNeighbor(kaNeighAddr) == FALSE){\n+ if (schedule_hasNegotiatedCellToNeighbor(kaNeighAddr, CELLTYPE_TX) == FALSE){\n// delete packets genereted by this module (EB and KA) from openqueue\nopenqueue_removeAllCreatedBy(COMPONENT_SIXTOP);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -714,7 +714,7 @@ void sendDIO(void) {\nicmpv6rpl_getPreferredParentEui64(&addressToWrite) == FALSE ||\n(\nicmpv6rpl_getPreferredParentEui64(&addressToWrite) &&\n- schedule_hasNegotiatedTxCellToNeighbor(&addressToWrite) == FALSE\n+ schedule_hasNegotiatedCellToNeighbor(&addressToWrite, CELLTYPE_TX) == FALSE\n)\n)\n){\n@@ -886,7 +886,7 @@ void sendDAO(void) {\nicmpv6rpl_getPreferredParentEui64(&address) == FALSE ||\n(\nicmpv6rpl_getPreferredParentEui64(&address) &&\n- schedule_hasNegotiatedTxCellToNeighbor(&address) == FALSE\n+ schedule_hasNegotiatedCellToNeighbor(&address, CELLTYPE_TX) == FALSE\n)\n){\n// delete packets genereted by this module (EB and KA) from openqueue\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -637,10 +637,10 @@ functionsToChange = [\n'schedule_resetEntry',\n'schedule_resetBackupEntry',\n'schedule_getNumberOfFreeEntries',\n- 'schedule_getNumberOfNegotiatedTxCells',\n+ 'schedule_getNumberOfNegotiatedCells',\n'schedule_hasAutonomousTxRxCellUnicast',\n'schedule_getAutonomousTxRxCellUnicastNeighbor',\n- 'schedule_hasNegotiatedTxCellToNeighbor',\n+ 'schedule_hasNegotiatedCellToNeighbor',\n'schedule_hasAutoTxCellToNeighbor',\n'schedule_isNumTxWrapped',\n'schedule_getCellsToBeRelocated',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-853. check current slot type according current slotOffset. (#484)
|
491,595 |
02.09.2019 10:23:11
| -7,200 |
365cf91cd22c7f660f7b6567e84feaa380aeb35e
|
get isAutoCell from link information.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -2936,7 +2936,7 @@ void endSlot(void) {\n}\n// update numcellelapsed if this is auto rx or rx cell to parent\n- if (schedule_getIsAutoCell()){\n+ if (info.isAutoCell){\nif (icmpv6rpl_getPreferredParentEui64(&parentAddress)){\nif (schedule_hasNegotiatedCellToNeighbor(&parentAddress, CELLTYPE_RX) == FALSE) {\n// adapt traffic on auto rx for downstream traffic\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-853. get isAutoCell from link information.
|
491,595 |
03.09.2019 13:49:27
| -7,200 |
d4e5228559b92720e063b2e26312852aec2b45ea
|
Fix the wrong component ownership.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/forwarding.c",
"new_path": "openstack/03b-IPv6/forwarding.c",
"diff": "@@ -784,7 +784,7 @@ owerror_t forwarding_send_internal_SourceRouting(\n} else {\n// log error\nopenserial_printError(\n- COMPONENT_IPHC,\n+ COMPONENT_FORWARDING,\nERR_6LOWPAN_UNSUPPORTED,\n(errorparameter_t)16,\n(errorparameter_t)(temp_addr64.addr_64b[7])\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6rpl.c",
"new_path": "openstack/03b-IPv6/icmpv6rpl.c",
"diff": "@@ -347,7 +347,7 @@ bool icmpv6rpl_isPreferredParent(open_addr_t* address) {\nneighbors_getNeighborEui64(&temp,ADDR_64B,icmpv6rpl_vars.ParentIndex);\nreturn packetfunctions_sameAddress(address,&temp);\ndefault:\n- openserial_printCritical(COMPONENT_NEIGHBORS,ERR_WRONG_ADDR_TYPE,\n+ openserial_printCritical(COMPONENT_ICMPv6RPL,ERR_WRONG_ADDR_TYPE,\n(errorparameter_t)address->type,\n(errorparameter_t)3);\nreturn FALSE;\n@@ -553,7 +553,7 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\nuint8_t* current;\nuint8_t optionsLen;\n// take ownership over the packet\n- msg->owner = COMPONENT_NEIGHBORS;\n+ msg->owner = COMPONENT_ICMPv6RPL;\n// update some fields of our DIO\nmemcpy(\n@@ -630,7 +630,7 @@ void icmpv6rpl_indicateRxDIO(OpenQueueEntry_t* msg) {\n) {\n// the new DAGrank looks suspiciously high, only increment a bit\nneighbors_setNeighborRank(i,neighborRank + ((3*DEFAULTLINKCOST-2)*2*MINHOPRANKINCREASE));\n- openserial_printError(COMPONENT_NEIGHBORS,ERR_LARGE_DAGRANK,\n+ openserial_printError(COMPONENT_ICMPv6RPL,ERR_LARGE_DAGRANK,\n(errorparameter_t)icmpv6rpl_vars.incomingDio->rank,\n(errorparameter_t)neighborRank);\n} else {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Fix the wrong component ownership.
|
491,595 |
03.09.2019 15:55:41
| -7,200 |
22c9c95224a412441c6c9284e62adffdaca467f5
|
update nextActiveSlotOffset before using in case the currentScheduleEntry's next pointer changes. (new cell added/deleted)
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -906,6 +906,8 @@ port_INLINE void activity_ti1ORri1(void) {\n// Reset sleep slots\nieee154e_vars.numOfSleepSlots = 1;\n+ // update nextActiveSlotOffset before using\n+ ieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\nif (ieee154e_vars.slotOffset==ieee154e_vars.nextActiveSlotOffset) {\n// this is the next active slot\n@@ -2946,8 +2948,7 @@ void endSlot(void) {\n} else {\n// update numelapsed on rx cell (msf will check whether it\n// is to parent or not)\n- schedule_getNeighbor(&slotNeighbor);\n- msf_updateCellsElapsed(&slotNeighbor, CELLTYPE_RX);\n+ msf_updateCellsElapsed(&info.address, CELLTYPE_RX);\n}\n}\nieee154e_vars.receivedFrameFromParent = FALSE;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-855. update nextActiveSlotOffset before using in case the currentScheduleEntry's next pointer changes. (new cell added/deleted) (#485)
|
491,595 |
05.09.2019 12:18:43
| -7,200 |
4acbc4da876b3b08e81b2e81cc5612ea6f13759d
|
fix bsp_leds project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_leds/01bsp_leds.uvprojx",
"new_path": "projects/scum/01bsp_leds/01bsp_leds.uvprojx",
"diff": "<FileType>5</FileType>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n</File>\n+ <File>\n+ <FileName>bucket_o_functions.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>bucket_o_functions.h</FileName>\n+ <FileType>5</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ </File>\n</Files>\n</Group>\n<Group>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix bsp_leds project.
|
491,595 |
04.10.2019 14:29:42
| -7,200 |
014e11ca14cae76760aaed4b46e73d8cef30bf56
|
add numcellused for rx cell.
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/uinject/uinject.c",
"new_path": "openapps/uinject/uinject.c",
"diff": "@@ -167,6 +167,10 @@ void uinject_task_cb(void) {\nnumCellsUsed = msf_getPreviousNumCellsUsed(CELLTYPE_TX);\npkt->payload[0] = numCellsUsed;\n+ packetfunctions_reserveHeaderSize(pkt,sizeof(uint8_t));\n+ numCellsUsed = msf_getPreviousNumCellsUsed(CELLTYPE_RX);\n+ pkt->payload[0] = numCellsUsed;\n+\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint16_t));\npkt->payload[1] = (uint8_t)(idmanager_getMyID(ADDR_16B)->addr_16b[0]);\npkt->payload[0] = (uint8_t)(idmanager_getMyID(ADDR_16B)->addr_16b[1]);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-858. add numcellused for rx cell. (#488)
|
491,595 |
10.10.2019 16:29:43
| -7,200 |
c6422f3f824d15a1798b04b426d804cc72289b13
|
add getFrequencyOffset function to radio of cc2538.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b-24ghz/radio.c",
"new_path": "bsp/boards/openmote-b-24ghz/radio.c",
"diff": "@@ -221,6 +221,15 @@ void radio_rfOff(void) {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n+int8_t radio_getFrequencyOffset(void){\n+\n+ int8_t freq_offset;\n+\n+ freq_offset = HWREG(RFCORE_XREG_FREQEST);\n+\n+ return freq_offset;\n+}\n+\n//===== TX\nvoid radio_loadPacket(uint8_t* packet, uint16_t len) {\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/radio.c",
"new_path": "bsp/boards/openmote-cc2538/radio.c",
"diff": "@@ -221,6 +221,15 @@ void radio_rfOff(void) {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n+int8_t radio_getFrequencyOffset(void){\n+\n+ int8_t freq_offset;\n+\n+ freq_offset = HWREG(RFCORE_XREG_FREQEST);\n+\n+ return freq_offset;\n+}\n+\n//===== TX\nvoid radio_loadPacket(uint8_t* packet, uint16_t len) {\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/radio.h",
"new_path": "bsp/boards/radio.h",
"diff": "@@ -60,6 +60,7 @@ void radio_reset(void);\nvoid radio_setFrequency(uint8_t frequency);\nvoid radio_rfOn(void);\nvoid radio_rfOff(void);\n+int8_t radio_getFrequencyOffset(void);\n// TX\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\nvoid radio_loadPacket_prepare(uint8_t* packet, uint16_t len);\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio_rx/01bsp_radio_rx.c",
"new_path": "projects/common/01bsp_radio_rx/01bsp_radio_rx.c",
"diff": "@@ -74,7 +74,7 @@ len=17 num=84 rssi=-81 lqi=108 crc=1\n#define LENGTH_PACKET 125+LENGTH_CRC // maximum length is 127 bytes\n#define CHANNEL 11 // 24ghz: 11 = 2.405GHz, subghz: 11 = 865.325 in FSK operating mode #1\n-#define LENGTH_SERIAL_FRAME 8 // length of the serial frame\n+#define LENGTH_SERIAL_FRAME 9 // length of the serial frame\n//=========================== variables =======================================\n@@ -95,6 +95,7 @@ typedef struct {\nint8_t rxpk_rssi;\nuint8_t rxpk_lqi;\nbool rxpk_crc;\n+ uint8_t rxpk_freq_offset;\n// uart\nuint8_t uart_txFrame[LENGTH_SERIAL_FRAME];\nuint8_t uart_lastTxByte;\n@@ -121,6 +122,8 @@ uint8_t cb_uartRxCb(void);\n*/\nint mote_main(void) {\n+ uint8_t i;\n+\n// clear local variables\nmemset(&app_vars,0,sizeof(app_vars_t));\n@@ -159,14 +162,16 @@ int mote_main(void) {\nleds_error_on();\n// format frame to send over serial port\n- app_vars.uart_txFrame[0] = app_vars.rxpk_len; // packet length\n- app_vars.uart_txFrame[1] = app_vars.rxpk_num; // packet number\n- app_vars.uart_txFrame[2] = app_vars.rxpk_rssi; // RSSI\n- app_vars.uart_txFrame[3] = app_vars.rxpk_lqi; // LQI\n- app_vars.uart_txFrame[4] = app_vars.rxpk_crc; // CRC\n- app_vars.uart_txFrame[5] = 0xff; // closing flag\n- app_vars.uart_txFrame[6] = 0xff; // closing flag\n- app_vars.uart_txFrame[7] = 0xff; // closing flag\n+ i = 0;\n+ app_vars.uart_txFrame[i++] = app_vars.rxpk_len; // packet length\n+ app_vars.uart_txFrame[i++] = app_vars.rxpk_num; // packet number\n+ app_vars.uart_txFrame[i++] = app_vars.rxpk_rssi; // RSSI\n+ app_vars.uart_txFrame[i++] = app_vars.rxpk_lqi; // LQI\n+ app_vars.uart_txFrame[i++] = app_vars.rxpk_crc; // CRC\n+ app_vars.uart_txFrame[i++] = app_vars.rxpk_freq_offset; // freq_offset\n+ app_vars.uart_txFrame[i++] = 0xff; // closing flag\n+ app_vars.uart_txFrame[i++] = 0xff; // closing flag\n+ app_vars.uart_txFrame[i++] = 0xff; // closing flag\napp_vars.uart_done = 0;\napp_vars.uart_lastTxByte = 0;\n@@ -204,6 +209,8 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nmemset(&app_vars.rxpk_buf[0],0,LENGTH_PACKET);\n+ app_vars.rxpk_freq_offset = radio_getFrequencyOffset();\n+\n// get packet from radio\nradio_getReceivedFrame(\napp_vars.rxpk_buf,\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio_rx/01bsp_radio_rx.py",
"new_path": "projects/common/01bsp_radio_rx/01bsp_radio_rx.py",
"diff": "@@ -85,7 +85,7 @@ while True:\nbyte = mote.read(1)\nrawFrame += [ord(byte)]\n- if rawFrame[-3:]==[0xff]*3 and len(rawFrame)>=8:\n+ if rawFrame[-3:]==[0xff]*3 and len(rawFrame)>=9:\nfor byte in rawFrame:\nif byte==XONXOFF_ESCAPE:\n@@ -96,16 +96,18 @@ while True:\nxonxoffEscaping=False\nelif byte!=XON and byte!=XOFF:\nrawFrame_decoded += [byte]\n- (rxpk_len,rxpk_num,rxpk_rssi,rxpk_lqi,rxpk_crc) = \\\n- struct.unpack('>BBbBB', ''.join([chr(b) for b in rawFrame_decoded[-8:-3]]))\n+\n+ (rxpk_len,rxpk_num,rxpk_rssi,rxpk_lqi,rxpk_crc, rxpk_freq_offset) = \\\n+ struct.unpack('>BBbBBb', ''.join([chr(b) for b in rawFrame_decoded[-9:-3]]))\n# debug info\n- output = 'len={0:<3} num={1:<3} rssi={2:<4} lqi={3:<3} crc={4}'.format(\n+ output = 'len={0:<3} num={1:<3} rssi={2:<4} lqi={3:<3} crc={4} freq_offset={5:<4}'.format(\nrxpk_len,\nrxpk_num,\nrxpk_rssi,\nrxpk_lqi,\n- rxpk_crc\n+ rxpk_crc,\n+ rxpk_freq_offset\n)\nprint output\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-859. add getFrequencyOffset function to radio of cc2538. (#489)
|
491,595 |
14.10.2019 11:38:45
| -7,200 |
ee2edded9cf9e5c1ed7128741f0fc3f8923134f8
|
fix the bsp_radio_rx project
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/chips/at86rf215/radio.c",
"new_path": "bsp/chips/at86rf215/radio.c",
"diff": "@@ -227,6 +227,12 @@ void radio_rfOff(void) {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n+int8_t radio_getFrequencyOffset(void){\n+\n+ // not available\n+ return 0;\n+}\n+\n//===== TX\nvoid radio_loadPacket(uint8_t* packet, uint16_t len) {\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/at86rf231/radio.c",
"new_path": "bsp/chips/at86rf231/radio.c",
"diff": "@@ -119,6 +119,12 @@ void radio_rfOff(void) {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n+int8_t radio_getFrequencyOffset(void){\n+\n+ // not available\n+ return 0;\n+}\n+\n//===== TX\nvoid radio_loadPacket(uint8_t* packet, uint16_t len) {\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/cc2420/radio.c",
"new_path": "bsp/chips/cc2420/radio.c",
"diff": "@@ -169,6 +169,12 @@ void radio_rfOff(void) {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n+int8_t radio_getFrequencyOffset(void){\n+\n+ // not available\n+ return 0;\n+}\n+\n//===== TX\nvoid radio_loadPacket(uint8_t* packet, uint16_t len) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-859. fix the bsp_radio_rx project
|
491,595 |
16.10.2019 12:31:55
| -7,200 |
cc5adaf7723bce1d28b6bc30a6347b3127183047
|
fix for wsn430b13b port.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/chips/cc1101/radio.c",
"new_path": "bsp/chips/cc1101/radio.c",
"diff": "@@ -213,6 +213,12 @@ void radio_rfOff(void) {\n}\n+int8_t radio_getFrequencyOffset(void){\n+\n+ // not available\n+ return 0;\n+}\n+\n//==== TX\nvoid radio_loadPacket(uint8_t* packet, uint16_t len) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-859. fix for wsn430b13b port.
|
491,595 |
23.10.2019 15:43:37
| -7,200 |
b2771ab945f616efb0f895bc8d79fba27c596d1b
|
print more info in bsp_radio project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio/01bsp_radio.c",
"new_path": "projects/common/01bsp_radio/01bsp_radio.c",
"diff": "@@ -31,7 +31,7 @@ end of frame event), it will turn on its error LED.\n#define TIMER_PERIOD (0xffff>>4) ///< 0xffff = 2s@32kHz\n#define ID 0x99 ///< byte sent in the packets\n-uint8_t stringToSend[] = \"+002 Ptest\\r\\n\";\n+uint8_t stringToSend[] = \"+002 Ptest.24.00.12\\n\";\n//=========================== variables =======================================\n@@ -86,7 +86,6 @@ uint8_t cb_uart_rx(void);\n*/\nint mote_main(void) {\nuint8_t i;\n- uint8_t j;\nuint8_t freq_offset;\nuint8_t sign;\n@@ -207,14 +206,10 @@ int mote_main(void) {\nstringToSend[i++] = ' ';\nstringToSend[i++] = 'P';\n- j = 0;\n- stringToSend[i++] = app_vars.packet[j++];\n- stringToSend[i++] = app_vars.packet[j++];\n- stringToSend[i++] = app_vars.packet[j++];\n- stringToSend[i++] = app_vars.packet[j++];\n-\n- stringToSend[i++] = '\\r';\n- stringToSend[i++] = '\\n';\n+ memcpy(&stringToSend[i],&app_vars.packet[0],sizeof(stringToSend)-i-1);\n+\n+ stringToSend[sizeof(stringToSend)-2] = '\\r';\n+ stringToSend[sizeof(stringToSend)-1] = '\\n';\n// send string over UART\nif (app_vars.uartDone == 1) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
SW-10. print more info in bsp_radio project.
|
491,595 |
30.10.2019 10:49:15
| -3,600 |
a66869ba78e220ff3c8c253cca3ee5bc0b4e0636
|
print rssi and customize tx packet payload (for scum)
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio/01bsp_radio.c",
"new_path": "projects/common/01bsp_radio/01bsp_radio.c",
"diff": "@@ -31,7 +31,7 @@ end of frame event), it will turn on its error LED.\n#define TIMER_PERIOD (0xffff>>4) ///< 0xffff = 2s@32kHz\n#define ID 0x99 ///< byte sent in the packets\n-uint8_t stringToSend[] = \"+002 Ptest.24.00.12\\n\";\n+uint8_t stringToSend[] = \"+002 Ptest.24.00.12.-010\\n\";\n//=========================== variables =======================================\n@@ -206,7 +206,24 @@ int mote_main(void) {\nstringToSend[i++] = ' ';\nstringToSend[i++] = 'P';\n- memcpy(&stringToSend[i],&app_vars.packet[0],sizeof(stringToSend)-i-1);\n+ memcpy(&stringToSend[i],&app_vars.packet[0],14);\n+ i += 14;\n+\n+ sign = (app_vars.rxpk_rssi & 0x80) >> 7;\n+ if (sign){\n+ read = 0xff - (uint8_t)(app_vars.rxpk_rssi) + 1;\n+ } else {\n+ read = app_vars.rxpk_rssi;\n+ }\n+\n+ if (sign) {\n+ stringToSend[i++] = '-';\n+ } else {\n+ stringToSend[i++] = '+';\n+ }\n+ stringToSend[i++] = '0'+read/100;\n+ stringToSend[i++] = '0'+read/10;\n+ stringToSend[i++] = '0'+read%10;\nstringToSend[sizeof(stringToSend)-2] = '\\r';\nstringToSend[sizeof(stringToSend)-1] = '\\n';\n@@ -247,8 +264,13 @@ int mote_main(void) {\n// prepare packet\napp_vars.packet_len = sizeof(app_vars.packet);\n- for (i=0;i<app_vars.packet_len;i++) {\n- app_vars.packet[i] = ID;\n+ i = 0;\n+ app_vars.packet[i++] = 't';\n+ app_vars.packet[i++] = 'e';\n+ app_vars.packet[i++] = 's';\n+ app_vars.packet[i++] = 't';\n+ while (i<app_vars.packet_len) {\n+ app_vars.packet[i++] = ID;\n}\n// start transmitting packet\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
SW-10. print rssi and customize tx packet payload (for scum)
|
491,595 |
09.12.2019 14:16:39
| -3,600 |
faced32ae8467678f8538b4c3de147cd81758132
|
add channel info in packet.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_radio/01bsp_radio.c",
"new_path": "projects/common/01bsp_radio/01bsp_radio.c",
"diff": "@@ -25,7 +25,7 @@ end of frame event), it will turn on its error LED.\n//=========================== defines =========================================\n-#define LENGTH_PACKET 30+LENGTH_CRC ///< maximum length is 127 bytes\n+#define LENGTH_PACKET 125+LENGTH_CRC ///< maximum length is 127 bytes\n#define LEN_PKT_TO_SEND 20+LENGTH_CRC\n#define CHANNEL 11 ///< 11=2.405GHz\n#define TIMER_PERIOD (0xffff>>4) ///< 0xffff = 2s@32kHz\n@@ -269,6 +269,7 @@ int mote_main(void) {\napp_vars.packet[i++] = 'e';\napp_vars.packet[i++] = 's';\napp_vars.packet[i++] = 't';\n+ app_vars.packet[i++] = CHANNEL;\nwhile (i<app_vars.packet_len) {\napp_vars.packet[i++] = ID;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
SW-10. add channel info in packet.
|
491,595 |
11.12.2019 15:36:24
| -3,600 |
8c566a076157b2980b192fd3822862172029f654
|
implement the whole algorithm
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -17,18 +17,22 @@ can use this project with any platform.\n//=========================== defines =========================================\n-#define LENGTH_PACKET 2+LENGTH_CRC ///< maximum length is 127 bytes\n-#define SLOT_DURATION (0xffff>>1) ///< 0xffff = 2s@32kHz\n-#define SUB_SLOT_DURATION 20 ///< 32 = 1ms@32kHz\n+#define MAX_PKT_BUFFER 125+LENGTH_CRC ///< maximum packet buffer size is 127 bytes\n+#define TARGET_PKT_LEN 2+LENGTH_CRC ///< frame length sent by mote\n#define ID 0x99 ///< byte sent in the packets\n-#define NUM_PKT_SLOT (2*32*32) ///< slot duration = SUB_SLOT_DURATION *\n- // num_pkt_slot\n+#define NUM_PKT_PER_SLOT (2*32*32) ///< slot duration = SUB_SLOT_DURATION *\n+ // NUM_PKT_PER_SLOT\n#define CAL_STEPS 2\n#define NUM_CHANNELS 16\n#define SLOTFRAME_LEN 16\n#define SYNC_CHANNEL 11\n+// timing\n+#define TXOFFSET 100 ///< measured, todo\n+#define SLOT_DURATION (0xffff>>1) ///< 0xffff = 2s@32kHz\n+#define SUB_SLOT_DURATION 20 ///< 32 = 1ms@32kHz\n+\n#define DEBUGGING\n// 16 mote eui64\n@@ -53,6 +57,10 @@ can use this project with any platform.\n#define OTBOX19_MOTE_3 0xb565\n#define OTBOX19_MOTE_4 0xb648\n+// debugging\n+\n+#define UART_BUFFER_LEN 100\n+\n//=========================== variables =======================================\ntypedef struct{\n@@ -60,19 +68,60 @@ typedef struct{\nuint16_t short_address;\n}ch_motes_t;\n+typedef enum{\n+ T_IDLE = 0,\n+ T_TX = 1,\n+ T_RX = 2,\n+}type_t;\n+\n+typedef enum{\n+ S_IDLE = 0,\n+ S_LISTENING = 1,\n+ S_RECEIVING = 2,\n+ S_RXPROC = 3,\n+ S_DATA_SENDING = 4,\n+ S_ACK_SENDING = 5,\n+ S_DATA_SENDDONE = 6,\n+ S_ACK_SENDDONE = 7,\n+ S_DATA_SEND = 8,\n+ S_ACK_SEND = 9,\n+}state_t;\n+\ntypedef struct{\n+ uint8_t packet[MAX_PKT_BUFFER];\n+ uint8_t packet_len;\n+ int8_t rxpk_rssi;\n+ uint8_t rxpk_lqi;\n+ bool rxpk_crc;\n+\nuint8_t myId[8];\nch_motes_t ch_motes[NUM_CHANNELS];\n- uint8_t packet[LENGTH_PACKET];\n- uint8_t packet_len;\n- uint8_t channel;\n+ uint8_t myChannel;\n+\n+ bool isTimeRerence;\nbool isSync;\nuint8_t currentSlotOffset;\nuint16_t seqNum;\nuint32_t slotRerference;\n+ type_t type;\n+ state_t state;\n+ uint32_t lastCaptureTime;\n}app_vars_t;\n+// debugging\n+\n+typedef enum{\n+ D_ERROR = 0,\n+ D_INFO = 1,\n+}debug_type_t;\n+\n+typedef struct{\n+ uint8_t uart_to_send[UART_BUFFER_LEN];\n+ uint8_t index;\n+}debug_vars_t;\n+\napp_vars_t app_vars;\n+debug_vars_t debug_vars;\n//=========================== prototypes ======================================\n@@ -85,6 +134,10 @@ void cb_uart_tx_done(void);\nuint8_t cb_uart_rx(void);\nuint8_t get_mychannel(uint8_t* myId);\n+void synchronize(uint32_t capturedTime, uint8_t pkt_channel, uint16_t pkt_seqNum);\n+\n+// debugging\n+void debug_output(debug_type_t type, uint8_t* buffer, uint8_t length);\n//=========================== main ============================================\n@@ -140,16 +193,17 @@ int mote_main(void) {\n// get eui64 and calculate channel assignment\neui64_get(myId);\n- app_vars.channel = get_mychannel(myId);\n+ app_vars.myChannel = get_mychannel(myId);\n#ifdef DEBUGGING\n- app_vars.channel = SYNC_CHANNEL;\n+ app_vars.myChannel = SYNC_CHANNEL;\napp_vars.currentSlotOffset = SLOTFRAME_LEN - 1 ;\n#endif\n// the mote assigned with SYNC_CHANNEL is the time reference\n- if (app_vars.channel==SYNC_CHANNEL) {\n+ if (app_vars.myChannel==SYNC_CHANNEL) {\napp_vars.isSync = TRUE;\n+ app_vars.isTimeRerence = TRUE;\n}\n// setup UART\n@@ -161,7 +215,7 @@ int mote_main(void) {\nradio_setEndFrameCb(cb_endFrame);\n// prepare packet\n- temp = (app_vars.channel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\n+ temp = (app_vars.myChannel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\napp_vars.packet[0] = temp;\ntemp = app_vars.seqNum & 0x00ff;\n@@ -173,11 +227,6 @@ int mote_main(void) {\nsctimer_setCompare(sctimer_readCounter()+SLOT_DURATION);\nsctimer_enable();\n- // prepare radio\n- radio_rfOn();\n- radio_setFrequency(app_vars.channel);\n- radio_rfOff();\n-\nwhile (1) {\nboard_sleep();\n}\n@@ -245,51 +294,283 @@ uint8_t get_mychannel(uint8_t* address){\nreturn channel;\n}\n+void synchronize(uint32_t capturedTime, uint8_t pkt_channel, uint16_t pkt_seqNum){\n+\n+ uint32_t slot_boudary;\n+\n+ // synchronize currentslotoffset\n+ app_vars.currentSlotOffset = pkt_channel-SYNC_CHANNEL;\n+\n+ // synchronize to slot boudary\n+ sctimer_disable();\n+ slot_boudary = capturedTime - pkt_seqNum*SUB_SLOT_DURATION - TXOFFSET;\n+ sctimer_set_callback(cb_slot_timer);\n+ sctimer_setCompare(slot_boudary+SLOT_DURATION);\n+}\n+\n+void debug_output(debug_type_t type, uint8_t* buffer, uint8_t length){\n+\n+ // copy content\n+ debug_vars.uart_to_send[0] = type;\n+ memcpy(&debug_vars.uart_to_send[1], buffer, length);\n+\n+ // add ending chars\n+ debug_vars.uart_to_send[1+length] = '\\r';\n+ debug_vars.uart_to_send[1+length+1] = '\\n';\n+\n+ // write to uart\n+ debug_vars.index = 0;\n+ uart_writeByte(debug_vars.uart_to_send[0]);\n+}\n+\n//=========================== callbacks =======================================\nvoid cb_startFrame(PORT_TIMER_WIDTH timestamp) {\n+ app_vars.lastCaptureTime = timestamp;\n+\n+ switch(app_vars.type){\n+ case T_TX:\n+ switch(app_vars.state) {\n+ case S_DATA_SEND:\n+ app_vars.state = S_DATA_SENDING;\n+ break;\n+ case S_ACK_SEND:\n+ app_vars.state = S_ACK_SENDING;\n+ break;\n+ default:\n+ // wrong state\n+\n+ debug_output(D_ERROR, (uint8_t*)(&app_vars.state), 1);\n+ return;\n+ }\n+ break;\n+ case T_RX:\n+ switch(app_vars.state){\n+ case S_LISTENING:\n+ app_vars.state = S_RECEIVING;\n+ break;\n+ default:\n+ // wrong state\n+\n+ debug_output(D_ERROR, (uint8_t*)(&app_vars.state), 1);\n+ return;\n+ }\n+ break;\n+ }\n}\nvoid cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n+ bool isValidFrame;\n+ uint8_t pkt_channel;\n+ uint16_t pkt_seqNum;\n+\n+ // todo\n+ //uint8_t freq_offset;\n+\n+ // turn radio off first\n+ radio_rfOff();\n+\n+ switch(app_vars.type){\n+ case T_TX:\n+\n+ switch(app_vars.state){\n+ case S_DATA_SENDING:\n+ app_vars.state = S_DATA_SENDDONE;\n+\n+ // nothing need to do\n+\n+ break;\n+ case S_ACK_SENDING:\n+ app_vars.state = S_ACK_SENDDONE;\n+\n+ // set radio back to listen on myChannel\n+\n+ radio_rfOn();\n+ radio_setFrequency(app_vars.myChannel);\n+ radio_rxEnable();\n+ radio_rxNow();\n+\n+ app_vars.state = S_LISTENING;\n+\n+ break;\n+ default:\n+ // wrong status, todo\n+ return;\n+ }\n+\n+ break;\n+ case T_RX:\n+\n+ // received frames\n+ switch(app_vars.state){\n+ case S_RECEIVING:\n+ app_vars.state = S_RXPROC;\n+ break;\n+ default:\n+ // wrong state\n+\n+ debug_output(D_ERROR, (uint8_t*)(&app_vars.state), 1);\n+ return;\n+ }\n+\n+ memset(app_vars.packet,0,MAX_PKT_BUFFER);\n+ app_vars.rxpk_crc = 0;\n+\n+ // get packet from radio\n+ radio_getReceivedFrame(\n+ app_vars.packet,\n+ &app_vars.packet_len,\n+ sizeof(app_vars.packet),\n+ &app_vars.rxpk_rssi,\n+ &app_vars.rxpk_lqi,\n+ &app_vars.rxpk_crc\n+ );\n+\n+ // check the frame is valid or not\n+\n+ isValidFrame = FALSE;\n+\n+ if (app_vars.rxpk_crc && app_vars.packet_len == TARGET_PKT_LEN){\n+ pkt_channel = (app_vars.packet[0] & 0xf0)>>4;\n+ pkt_seqNum = ((uint16_t)(app_vars.packet[0] & 0x0f))<<8 |\n+ (uint16_t)(app_vars.packet[1]);\n+ if (\n+ pkt_channel>=11 &&\n+ pkt_channel<=26 &&\n+ pkt_seqNum<NUM_PKT_PER_SLOT\n+ ){\n+ isValidFrame = TRUE;\n+ }\n+ }\n+\n+ if (isValidFrame){\n+ if (app_vars.isSync){\n+ if (app_vars.currentSlotOffset==0){\n+ // received from time reference, re-synchronize\n+\n+ synchronize(app_vars.lastCaptureTime, pkt_channel, pkt_seqNum);\n+ } else {\n+ // received from SCuM, prepare Ack to send back\n+\n+ // read the freq_offset\n+ // freq_offset = radio_getFrequencyOffset();\n+\n+ radio_rfOn();\n+ radio_setFrequency(app_vars.myChannel);\n+\n+ // the ack is the same with frame? todo\n+ radio_loadPacket(app_vars.packet, TARGET_PKT_LEN);\n+ radio_txEnable();\n+ radio_txNow();\n+\n+ app_vars.state = S_ACK_SEND;\n+ }\n+ } else {\n+ // received from timer reference, synchronize\n+\n+ synchronize(app_vars.lastCaptureTime, pkt_channel, pkt_seqNum);\n+ }\n+\n+ } else {\n+ // continous to listen on myChannel\n+\n+ radio_rfOn();\n+ radio_setFrequency(app_vars.myChannel);\n+ radio_rxEnable();\n+ radio_rxNow();\n+\n+ app_vars.state = S_LISTENING;\n+ }\n+ break;\n+ }\n}\nvoid cb_slot_timer(void) {\ndebugpins_slot_toggle();\n+ // schedule next slot timer\n+\napp_vars.slotRerference = sctimer_readCounter();\nsctimer_setCompare(app_vars.slotRerference+SLOT_DURATION);\napp_vars.currentSlotOffset = \\\n(app_vars.currentSlotOffset + 1) % SLOTFRAME_LEN;\n- // check the slot offset to decide to tx or rx:\n- // - if channel == current slotoffset: tx\n- // - else: rx\n+ // initial seqNum\n+ app_vars.seqNum = 0;\n- if ((app_vars.channel - SYNC_CHANNEL)==app_vars.currentSlotOffset){\n+ // prepare radio\n+ radio_rfOn();\n- // slot to tx\n+ if (app_vars.isSync){\n- // initial seqNum\n- app_vars.seqNum = 0;\n+ if ((app_vars.myChannel - SYNC_CHANNEL)==app_vars.currentSlotOffset){\n- radio_txEnable();\n+ // this is my slot\n- // change sctimer callback to sub_slot cb\n+ // slot to tx\n+ app_vars.type = T_TX;\n+\n+ radio_setFrequency(app_vars.myChannel);\n+ // change sctimer callback to sub_slot cb\nsctimer_disable();\nsctimer_set_callback(cb_sub_slot_timer);\n// call the callback first time directly\ncb_sub_slot_timer();\n+ } else {\n+\n+ // this is NOT my slot\n+\n+ // slot to rx\n+ app_vars.type = T_RX;\n+\n+ if (app_vars.currentSlotOffset==0){\n+ radio_setFrequency(SYNC_CHANNEL);\n} else {\n+\n+ radio_setFrequency(app_vars.myChannel);\n+ }\n+\n+ // start to listen\n+ radio_rxEnable();\n+ radio_rxNow();\n+ app_vars.state = S_LISTENING;\n+ }\n+\n+ } else {\n+\n// slot to rx\n+ app_vars.type = T_RX;\n+\n+ switch(app_vars.state){\n+ case S_IDLE:\n+ radio_setFrequency(SYNC_CHANNEL);\n+ // start to listen\nradio_rxEnable();\n+ radio_rxNow();\n+ app_vars.state = S_LISTENING;\n+\n+ break;\n+ case S_LISTENING:\n+ break;\n+ case S_RECEIVING:\n+ break;\n+ case S_RXPROC:\n+ break;\n+ default:\n+ // wrong state\n+\n+ debug_output(D_ERROR, (uint8_t*)(&app_vars.state), 1);\n+ break;\n+ }\n+\n}\n}\n@@ -300,20 +581,24 @@ void cb_sub_slot_timer(void) {\ndebugpins_fsm_toggle();\n// schedule next sub-slot\n- sctimer_setCompare(sctimer_readCounter()+SUB_SLOT_DURATION);\n+ sctimer_setCompare(app_vars.slotRerference+app_vars.seqNum*SUB_SLOT_DURATION);\n// load pkt and transmit\n- app_vars.packet_len = sizeof(app_vars.packet);\n+ radio_rfOn();\n+ radio_txEnable();\n+ app_vars.packet_len = TARGET_PKT_LEN;\nradio_loadPacket(app_vars.packet,app_vars.packet_len);\nradio_txNow();\n+ app_vars.state = S_DATA_SEND;\n+\n// update the seqNum in payload\n- if (app_vars.seqNum<NUM_PKT_SLOT/CAL_STEPS) {\n+ if (app_vars.seqNum<NUM_PKT_PER_SLOT/CAL_STEPS) {\napp_vars.seqNum += 1;\n// prepare packet\n- temp = (app_vars.channel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\n+ temp = (app_vars.myChannel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\napp_vars.packet[0] = temp;\ntemp = app_vars.seqNum & 0x00ff;\n@@ -322,11 +607,17 @@ void cb_sub_slot_timer(void) {\nsctimer_disable();\nsctimer_set_callback(cb_slot_timer);\nsctimer_setCompare(app_vars.slotRerference+SLOT_DURATION);\n+ radio_rfOff();\n}\n}\nvoid cb_uart_tx_done(void) {\n-\n+ debug_vars.index++;\n+ if (debug_vars.uart_to_send[debug_vars.index-1]!='\\n'){\n+ uart_writeByte(debug_vars.uart_to_send[debug_vars.index]);\n+ } else {\n+ debug_vars.index = 0;\n+ }\n}\nuint8_t cb_uart_rx(void) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. implement the whole algorithm
|
491,595 |
11.12.2019 18:49:18
| -3,600 |
447ded7a676edf7bae8690f75a36b13efcdcbad3
|
Add debug support.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -33,12 +33,17 @@ can use this project with any platform.\n#define SLOT_DURATION (0xffff>>1) ///< 0xffff = 2s@32kHz\n#define SUB_SLOT_DURATION 20 ///< 32 = 1ms@32kHz\n-#define DEBUGGING\n-\n// 16 mote eui64\n+#define DEBUGGING\n+\n+#ifdef DEBUGGING\n+#define OTBOX08_MOTE_1 0xb5b3 // COM91\n+#else\n#define OTBOX08_MOTE_1 0xb5f3\n-#define OTBOX08_MOTE_2 0xb5d0\n+#endif\n+\n+#define OTBOX08_MOTE_2 0xb5d0 // COM89\n#define OTBOX08_MOTE_3 0xb595\n#define OTBOX08_MOTE_4 0xb5d1\n@@ -98,7 +103,7 @@ typedef struct{\nch_motes_t ch_motes[NUM_CHANNELS];\nuint8_t myChannel;\n- bool isTimeRerence;\n+ bool isTimeMaster;\nbool isSync;\nuint8_t currentSlotOffset;\nuint16_t seqNum;\n@@ -111,8 +116,8 @@ typedef struct{\n// debugging\ntypedef enum{\n- D_ERROR = 0,\n- D_INFO = 1,\n+ D_ERROR = 'E',\n+ D_INFO = 'I',\n}debug_type_t;\ntypedef struct{\n@@ -138,6 +143,7 @@ void synchronize(uint32_t capturedTime, uint8_t pkt_channel, uint16_t pkt_se\n// debugging\nvoid debug_output(debug_type_t type, uint8_t* buffer, uint8_t length);\n+uint8_t int_to_char(uint8_t temp);\n//=========================== main ============================================\n@@ -195,15 +201,11 @@ int mote_main(void) {\neui64_get(myId);\napp_vars.myChannel = get_mychannel(myId);\n-#ifdef DEBUGGING\n- app_vars.myChannel = SYNC_CHANNEL;\n- app_vars.currentSlotOffset = SLOTFRAME_LEN - 1 ;\n-#endif\n-\n// the mote assigned with SYNC_CHANNEL is the time reference\nif (app_vars.myChannel==SYNC_CHANNEL) {\napp_vars.isSync = TRUE;\n- app_vars.isTimeRerence = TRUE;\n+ app_vars.isTimeMaster = TRUE;\n+ app_vars.currentSlotOffset = SLOTFRAME_LEN-1;\n}\n// setup UART\n@@ -306,21 +308,48 @@ void synchronize(uint32_t capturedTime, uint8_t pkt_channel, uint16_t pkt_seqNum\nslot_boudary = capturedTime - pkt_seqNum*SUB_SLOT_DURATION - TXOFFSET;\nsctimer_set_callback(cb_slot_timer);\nsctimer_setCompare(slot_boudary+SLOT_DURATION);\n+\n+ app_vars.isSync = TRUE;\n+\n+ leds_sync_on();\n+}\n+\n+uint8_t int_to_char(uint8_t temp){\n+\n+ uint8_t returnVal;\n+\n+ if (temp>0x09){\n+ returnVal = (temp-0x0a)+'a';\n+ } else {\n+ returnVal = (temp)+'0';\n+ }\n+\n+ return returnVal;\n}\nvoid debug_output(debug_type_t type, uint8_t* buffer, uint8_t length){\n- // copy content\n- debug_vars.uart_to_send[0] = type;\n- memcpy(&debug_vars.uart_to_send[1], buffer, length);\n+ uint8_t temp;\n+ uint8_t i;\n+ uint8_t len;\n+\n+ len = 0;\n+ debug_vars.uart_to_send[len++] = type;\n+\n+ for (i=0;i<length;i++){\n+ temp = (buffer[i] & 0xf0)>>4;\n+ debug_vars.uart_to_send[len++] = int_to_char(temp);\n+ temp = buffer[i] & 0x0f;\n+ debug_vars.uart_to_send[len++] = int_to_char(temp);\n+ }\n// add ending chars\n- debug_vars.uart_to_send[1+length] = '\\r';\n- debug_vars.uart_to_send[1+length+1] = '\\n';\n+ debug_vars.uart_to_send[len++] = '\\r';\n+ debug_vars.uart_to_send[len++] = '\\n';\n// write to uart\ndebug_vars.index = 0;\n- uart_writeByte(debug_vars.uart_to_send[0]);\n+ uart_writeByte(debug_vars.uart_to_send[debug_vars.index]);\n}\n//=========================== callbacks =======================================\n@@ -349,6 +378,7 @@ void cb_startFrame(PORT_TIMER_WIDTH timestamp) {\nswitch(app_vars.state){\ncase S_LISTENING:\napp_vars.state = S_RECEIVING;\n+\nbreak;\ndefault:\n// wrong state\n@@ -396,7 +426,9 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nbreak;\ndefault:\n- // wrong status, todo\n+ // wrong status\n+\n+ debug_output(D_ERROR, (uint8_t*)(&app_vars.state), 1);\nreturn;\n}\n@@ -432,7 +464,12 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nisValidFrame = FALSE;\n+ debug_output(D_INFO, app_vars.packet, 2);\n+\nif (app_vars.rxpk_crc && app_vars.packet_len == TARGET_PKT_LEN){\n+\n+ leds_debug_toggle();\n+\npkt_channel = (app_vars.packet[0] & 0xf0)>>4;\npkt_seqNum = ((uint16_t)(app_vars.packet[0] & 0x0f))<<8 |\n(uint16_t)(app_vars.packet[1]);\n@@ -446,6 +483,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n}\nif (isValidFrame){\n+\nif (app_vars.isSync){\nif (app_vars.currentSlotOffset==0){\n// received from time reference, re-synchronize\n@@ -474,16 +512,25 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n}\n} else {\n+\n// continous to listen on myChannel\nradio_rfOn();\n+ if (app_vars.isSync){\nradio_setFrequency(app_vars.myChannel);\n+ } else {\n+ radio_setFrequency(SYNC_CHANNEL);\n+ }\nradio_rxEnable();\nradio_rxNow();\napp_vars.state = S_LISTENING;\n}\nbreak;\n+ default:\n+ // wrong type\n+\n+ leds_error_blink();\n}\n}\n@@ -507,6 +554,8 @@ void cb_slot_timer(void) {\nif (app_vars.isSync){\n+ leds_sync_on();\n+\nif ((app_vars.myChannel - SYNC_CHANNEL)==app_vars.currentSlotOffset){\n// this is my slot\n@@ -545,6 +594,8 @@ void cb_slot_timer(void) {\n} else {\n+ leds_sync_off();\n+\n// slot to rx\napp_vars.type = T_RX;\n@@ -555,20 +606,23 @@ void cb_slot_timer(void) {\n// start to listen\nradio_rxEnable();\nradio_rxNow();\n+\napp_vars.state = S_LISTENING;\nbreak;\ncase S_LISTENING:\n+\nbreak;\ncase S_RECEIVING:\n+\nbreak;\ncase S_RXPROC:\n+\nbreak;\ndefault:\n// wrong state\ndebug_output(D_ERROR, (uint8_t*)(&app_vars.state), 1);\n- break;\n}\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
Add debug support.
|
491,595 |
11.12.2019 19:39:22
| -3,600 |
5f48aae3674d71800b2ee148143988a436df1a59
|
length of frame can be 4 bytes.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b-24ghz/radio.c",
"new_path": "bsp/boards/openmote-b-24ghz/radio.c",
"diff": "@@ -349,7 +349,7 @@ void radio_getReceivedFrame(uint8_t* pBufRead,\n}\n- if(len <= CC2538_RF_MIN_PACKET_LEN) {\n+ if(len < CC2538_RF_MIN_PACKET_LEN) {\n//too short\nCC2538_RF_CSP_ISFLUSHRX();\nreturn;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. length of frame can be 4 bytes.
|
491,595 |
11.12.2019 19:40:24
| -3,600 |
a3222c9d1e03ead06f9fbc724a3da4223ccff8ef
|
fix SUB_SLOT timer schedule issue.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -29,7 +29,7 @@ can use this project with any platform.\n#define SYNC_CHANNEL 11\n// timing\n-#define TXOFFSET 100 ///< measured, todo\n+#define TXOFFSET 13 ///< measured, 382ms\n#define SLOT_DURATION (0xffff>>1) ///< 0xffff = 2s@32kHz\n#define SUB_SLOT_DURATION 20 ///< 32 = 1ms@32kHz\n@@ -314,6 +314,8 @@ void synchronize(uint32_t capturedTime, uint8_t pkt_channel, uint16_t pkt_seqNum\nleds_sync_on();\n}\n+// debugging\n+\nuint8_t int_to_char(uint8_t temp){\nuint8_t returnVal;\n@@ -464,8 +466,6 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nisValidFrame = FALSE;\n- debug_output(D_INFO, app_vars.packet, 2);\n-\nif (app_vars.rxpk_crc && app_vars.packet_len == TARGET_PKT_LEN){\nleds_debug_toggle();\n@@ -635,7 +635,9 @@ void cb_sub_slot_timer(void) {\ndebugpins_fsm_toggle();\n// schedule next sub-slot\n- sctimer_setCompare(app_vars.slotRerference+app_vars.seqNum*SUB_SLOT_DURATION);\n+ sctimer_setCompare(\n+ app_vars.slotRerference + (app_vars.seqNum+1) * SUB_SLOT_DURATION\n+ );\n// load pkt and transmit\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. fix SUB_SLOT timer schedule issue.
|
491,595 |
17.12.2019 14:35:57
| -3,600 |
03ce63aa9e5b4ac25b144fcb26bc14b481f07eee
|
send more frame to fill up the whole slot.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -29,7 +29,7 @@ can use this project with any platform.\n#define SYNC_CHANNEL 11\n// timing\n-#define TXOFFSET 13 ///< measured, 382ms\n+#define TXOFFSET 13 ///< measured, 382us\n#define SLOT_DURATION (0xffff>>1) ///< 0xffff = 2s@32kHz\n#define SUB_SLOT_DURATION 20 ///< 32 = 1ms@32kHz\n@@ -651,7 +651,8 @@ void cb_sub_slot_timer(void) {\n// update the seqNum in payload\n- if (app_vars.seqNum<NUM_PKT_PER_SLOT/CAL_STEPS) {\n+ // if (app_vars.seqNum<NUM_PKT_PER_SLOT/CAL_STEPS) {\n+ if (app_vars.seqNum<(SLOT_DURATION/SUB_SLOT_DURATION-2)) {\napp_vars.seqNum += 1;\n// prepare packet\ntemp = (app_vars.myChannel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. send more frame to fill up the whole slot.
|
491,595 |
18.12.2019 14:28:05
| -3,600 |
38da87f75c371aa20da4dc823a6fdd33154a171c
|
use 0-15 represent channel in packet and change the validFrame filtering condition to avoid receiving frame from unexpected channel (because of abnormal behavior)
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -217,7 +217,7 @@ int mote_main(void) {\nradio_setEndFrameCb(cb_endFrame);\n// prepare packet\n- temp = (app_vars.myChannel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\n+ temp = ((app_vars.myChannel-SYNC_CHANNEL) << 4) | ((app_vars.seqNum & 0x0f00)>>8);\napp_vars.packet[0] = temp;\ntemp = app_vars.seqNum & 0x00ff;\n@@ -464,22 +464,33 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n// check the frame is valid or not\n- isValidFrame = FALSE;\n+ isValidFrame = TRUE;\nif (app_vars.rxpk_crc && app_vars.packet_len == TARGET_PKT_LEN){\nleds_debug_toggle();\n- pkt_channel = (app_vars.packet[0] & 0xf0)>>4;\n+ pkt_channel = SYNC_CHANNEL+((app_vars.packet[0] & 0xf0)>>4);\npkt_seqNum = ((uint16_t)(app_vars.packet[0] & 0x0f))<<8 |\n(uint16_t)(app_vars.packet[1]);\n- if (\n- pkt_channel>=11 &&\n- pkt_channel<=26 &&\n- pkt_seqNum<NUM_PKT_PER_SLOT\n- ){\n- isValidFrame = TRUE;\n+\n+ if (pkt_seqNum>=NUM_PKT_PER_SLOT){\n+ isValidFrame = FALSE;\n+ }\n+\n+ if (app_vars.isSync){\n+ if ((pkt_channel - SYNC_CHANNEL)!= app_vars.currentSlotOffset){\n+ // maybe received from other channel: abnormal behavior of cc2538\n+\n+ isValidFrame = FALSE;\n+ }\n+ } else {\n+ if (pkt_channel != SYNC_CHANNEL){\n+ isValidFrame = FALSE;\n+ }\n}\n+ } else {\n+ isValidFrame = FALSE;\n}\nif (isValidFrame){\n@@ -655,7 +666,7 @@ void cb_sub_slot_timer(void) {\nif (app_vars.seqNum<(SLOT_DURATION/SUB_SLOT_DURATION-2)) {\napp_vars.seqNum += 1;\n// prepare packet\n- temp = (app_vars.myChannel << 4) | ((app_vars.seqNum & 0x0f00)>>8);\n+ temp = ((app_vars.myChannel-SYNC_CHANNEL) << 4) | ((app_vars.seqNum & 0x0f00)>>8);\napp_vars.packet[0] = temp;\ntemp = app_vars.seqNum & 0x00ff;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. use 0-15 represent channel in packet and change the validFrame filtering condition to avoid receiving frame from unexpected channel (because of abnormal behavior)
|
491,595 |
26.12.2019 13:16:59
| -3,600 |
574942be88136768c5e356fbfe26a4d593d426fc
|
update slot type that radio isr refers to.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -128,6 +128,8 @@ typedef struct{\napp_vars_t app_vars;\ndebug_vars_t debug_vars;\n+const uint8_t debuginfo[] = \"ack sent\";\n+\n//=========================== prototypes ======================================\nvoid cb_startFrame(PORT_TIMER_WIDTH timestamp);\n@@ -380,7 +382,6 @@ void cb_startFrame(PORT_TIMER_WIDTH timestamp) {\nswitch(app_vars.state){\ncase S_LISTENING:\napp_vars.state = S_RECEIVING;\n-\nbreak;\ndefault:\n// wrong state\n@@ -424,6 +425,8 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nradio_rxEnable();\nradio_rxNow();\n+ app_vars.type = T_RX;\n+\napp_vars.state = S_LISTENING;\nbreak;\n@@ -468,8 +471,6 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nif (app_vars.rxpk_crc && app_vars.packet_len == TARGET_PKT_LEN){\n- leds_debug_toggle();\n-\npkt_channel = SYNC_CHANNEL+((app_vars.packet[0] & 0xf0)>>4);\npkt_seqNum = ((uint16_t)(app_vars.packet[0] & 0x0f))<<8 |\n(uint16_t)(app_vars.packet[1]);\n@@ -514,6 +515,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nradio_txEnable();\nradio_txNow();\n+ app_vars.type = T_TX;\napp_vars.state = S_ACK_SEND;\n}\n} else {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. update slot type that radio isr refers to.
|
491,595 |
29.12.2019 18:23:35
| -3,600 |
6cc46d77946585d789470c394f5b8c9942ba7a35
|
use 3 seconds as slot duration.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -30,7 +30,7 @@ can use this project with any platform.\n// timing\n#define TXOFFSET 13 ///< measured, 382us\n-#define SLOT_DURATION (0xffff>>1) ///< 0xffff = 2s@32kHz\n+#define SLOT_DURATION (0x17fff) ///< 0xffff = 2s@32kHz\n#define SUB_SLOT_DURATION 20 ///< 32 = 1ms@32kHz\n// 16 mote eui64\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. use 3 seconds as slot duration.
|
491,595 |
07.01.2020 14:01:29
| -3,600 |
032bbfc957a0585c053d5fbf8a1396d2984faed3
|
put freq_offset in ack frame.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -399,8 +399,7 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nuint8_t pkt_channel;\nuint16_t pkt_seqNum;\n- // todo\n- //uint8_t freq_offset;\n+ int8_t freq_offset;\n// turn radio off first\nradio_rfOff();\n@@ -505,12 +504,13 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\n// received from SCuM, prepare Ack to send back\n// read the freq_offset\n- // freq_offset = radio_getFrequencyOffset();\n+ freq_offset = radio_getFrequencyOffset();\nradio_rfOn();\nradio_setFrequency(app_vars.myChannel);\n- // the ack is the same with frame? todo\n+ // the ack use freq_offset as second byte\n+ app_vars.packet[1] = (uint8_t)freq_offset;\nradio_loadPacket(app_vars.packet, TARGET_PKT_LEN);\nradio_txEnable();\nradio_txNow();\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. put freq_offset in ack frame.
|
491,595 |
07.01.2020 20:36:36
| -3,600 |
4bf2d657f2b0ae5fc22975bc362dafcf65ff1001
|
reply ack by checking MAGIC_BYTE.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"new_path": "projects/common/01bsp_quick_cal/01bsp_quick_cal.c",
"diff": "@@ -19,7 +19,7 @@ can use this project with any platform.\n#define MAX_PKT_BUFFER 125+LENGTH_CRC ///< maximum packet buffer size is 127 bytes\n#define TARGET_PKT_LEN 2+LENGTH_CRC ///< frame length sent by mote\n-#define ID 0x99 ///< byte sent in the packets\n+#define MAGIC_BYTE 0x0FFF ///< byte sent in the packets\n#define NUM_PKT_PER_SLOT (2*32*32) ///< slot duration = SUB_SLOT_DURATION *\n// NUM_PKT_PER_SLOT\n@@ -35,17 +35,10 @@ can use this project with any platform.\n// 16 mote eui64\n-#define DEBUGGING\n-\n-#ifdef DEBUGGING\n#define OTBOX08_MOTE_1 0xb5b3 // COM91\n-#else\n-#define OTBOX08_MOTE_1 0xb5f3\n-#endif\n-\n#define OTBOX08_MOTE_2 0xb5d0 // COM89\n#define OTBOX08_MOTE_3 0xb595\n-#define OTBOX08_MOTE_4 0xb5d1\n+#define OTBOX08_MOTE_4 0xb5f3\n#define OTBOX09_MOTE_1 0xb5e7\n#define OTBOX09_MOTE_2 0xb5d8\n@@ -474,7 +467,10 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\npkt_seqNum = ((uint16_t)(app_vars.packet[0] & 0x0f))<<8 |\n(uint16_t)(app_vars.packet[1]);\n- if (pkt_seqNum>=NUM_PKT_PER_SLOT){\n+ if (\n+ pkt_seqNum >= NUM_PKT_PER_SLOT &&\n+ pkt_seqNum != MAGIC_BYTE\n+ ){\nisValidFrame = FALSE;\n}\n@@ -497,11 +493,20 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nif (app_vars.isSync){\nif (app_vars.currentSlotOffset==0){\n+\n// received from time reference, re-synchronize\n+ if (\n+ app_vars.isTimeMaster == FALSE &&\n+ pkt_seqNum != MAGIC_BYTE\n+ ) {\nsynchronize(app_vars.lastCaptureTime, pkt_channel, pkt_seqNum);\n+ }\n} else {\n- // received from SCuM, prepare Ack to send back\n+\n+ if (pkt_seqNum == MAGIC_BYTE){\n+\n+ // received from SCuM, prepare ack to send back\n// read the freq_offset\nfreq_offset = radio_getFrequencyOffset();\n@@ -517,6 +522,17 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\napp_vars.type = T_TX;\napp_vars.state = S_ACK_SEND;\n+ } else {\n+\n+ // not sent by SCuM, keep listening\n+\n+ radio_rfOn();\n+ radio_setFrequency(app_vars.myChannel);\n+ radio_rxEnable();\n+ radio_rxNow();\n+\n+ app_vars.state = S_LISTENING;\n+ }\n}\n} else {\n// received from timer reference, synchronize\n@@ -582,6 +598,9 @@ void cb_slot_timer(void) {\nsctimer_disable();\nsctimer_set_callback(cb_sub_slot_timer);\n+ app_vars.packet[0] = ((app_vars.myChannel-SYNC_CHANNEL) << 4) & 0xf0;\n+ app_vars.packet[1] = 0;\n+\n// call the callback first time directly\ncb_sub_slot_timer();\n} else {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-862. reply ack by checking MAGIC_BYTE.
|
491,595 |
09.01.2020 15:57:06
| -3,600 |
4edbeafd3288213049dbac77b047d60d9d3af758
|
update bootload script
|
[
{
"change_type": "MODIFY",
"old_path": "bootloader/scum/scum_bootloader.py",
"new_path": "bootloader/scum/scum_bootloader.py",
"diff": "-import getopt\n-import sys\nimport serial\n+import random\n+import argparse\n-if __name__ == \"__main__\":\n+def program_cortex(teensy_port=\"COM15\", scum_port=\"COM18\", binary_image=\"./code.bin\",\n+ boot_mode='optical', skip_reset=False, insert_CRC=False,\n+ pad_random_payload=False):\n+ \"\"\"\n+ Inputs:\n+ teensy_port: String. Name of the COM port that the Teensy\n+ is connected to.\n+ scum_port: String. Name of the COM port that the UART\n+ is connected to. If None, does not attempt to connect\n+ to SCM via UART.\n+ binary_image: String. Path to the binary file to\n+ feed to Teensy to program SCM. This binary file shold be\n+ compiled using whatever software is meant to end up\n+ on the Cortex. This group tends to compile it using Keil\n+ projects.\n+ boot_mode: String. 'optical' or '3wb'. The former will assume an\n+ optical bootload, whereas the latter will use the 3-wire\n+ bus.\n+ skip_reset: Boolean. True: Skip hard reset before optical\n+ programming. False: Perform hard reset before optical programming.\n+ insert_CRC: Boolean. True = insert CRC for payload integrity\n+ checking. False = do not insert CRC. Note that SCM C code\n+ must also be set up for CRC check for this to work.\n+ pad_random_payload: Boolean. True = pad unused payload space with\n+ random data and check it with CRC. False = pad with zeros, do\n+ not check integrity of padding. This is useful to check for\n+ programming errors over full 64kB payload.\n+ Outputs:\n+ No return value. Feeds the input from binary_image to the Teensy to program SCM\n+ and programs SCM.\n+ Raises:\n+ ValueError if the boot_mode isn't 'optical' or '3wb'.\n+ Notes:\n+ When setting optical parameters, all values can be toggled to improve\n+ success when programming. In particular, too small a third value can\n+ cause the optical programmer to lose/eat the short pulses.\n+ \"\"\"\n+ # Open COM port to Teensy\n+ teensy_ser = serial.Serial(\n+ port=teensy_port,\n+ baudrate=19200,\n+ parity=serial.PARITY_NONE,\n+ stopbits=serial.STOPBITS_ONE,\n+ bytesize=serial.EIGHTBITS)\n+\n+ # Open binary file from Keil\n+ with open(binary_image, 'rb') as f:\n+ bindata = bytearray(f.read())\n+\n+ # Need to know how long the binary payload is for computing CRC\n+ code_length = len(bindata) - 1\n+ pad_length = 65536 - code_length - 1\n+\n+ # Optional: pad out payload with random data if desired\n+ # Otherwise pad out with zeros - uC must receive full 64kB\n+ if(pad_random_payload):\n+ for i in range(pad_length):\n+ bindata.append(random.randint(0,255))\n+ code_length = len(bindata) - 1 - 8\n+ else:\n+ for i in range(pad_length):\n+ bindata.append(0)\n+\n+ if insert_CRC:\n+ # Insert code length at address 0x0000FFF8 for CRC calculation\n+ # Teensy will use this length value for calculating CRC\n+ bindata[65528] = code_length % 256\n+ bindata[65529] = code_length // 256\n+ bindata[65530] = 0\n+ bindata[65531] = 0\n+\n+ # Transfer payload to Teensy\n+ teensy_ser.write(b'transfersram\\n')\n+ print(teensy_ser.readline())\n+ # Send the binary data over uart\n+ teensy_ser.write(bindata)\n+\n+ if insert_CRC:\n+ # Have Teensy calculate 32-bit CRC over the code length\n+ # It will store the 32-bit result at address 0x0000FFFC\n+ teensy_ser.write(b'insertcrc\\n')\n+\n+ if boot_mode == 'optical':\n+ # Configure parameters for optical TX\n+ teensy_ser.write(b'configopt\\n')\n+ teensy_ser.write(b'80\\n')\n+ teensy_ser.write(b'80\\n')\n+ teensy_ser.write(b'3\\n')\n+ teensy_ser.write(b'80\\n')\n+\n+ # Encode the payload into 4B5B for optical transmission\n+ teensy_ser.write(b'encode4b5b\\n')\n+\n+ if not skip_reset:\n+ # Do a hard reset and then optically boot\n+ teensy_ser.write(b'bootopt4b5b\\n')\n+ else:\n+ # Skip the hard reset before booting\n+ teensy_ser.write(b'bootopt4b5bnorst\\n')\n+\n+ # Display confirmation message from Teensy\n+ print(teensy_ser.readline())\n+ teensy_ser.write(b'opti_cal\\n');\n+ elif boot_mode == '3wb':\n+ # Execute 3-wire bus bootloader on Teensy\n+ teensy_ser.write(b'boot3wb\\n')\n+\n+ # Display confirmation message from Teensy\n+ print(teensy_ser.readline())\n+ print(teensy_ser.readline())\n+ teensy_ser.write(b'3wb_cal\\n')\n+ else:\n+ raise ValueError(\"Boot mode '{}' invalid.\".format(boot_mode))\n+\n+ teensy_ser.close()\n- conf = {\n- 'port': 'auto',\n- 'baud': 1000000,\n- }\n-\n- try:\n- opts, args = getopt.getopt(sys.argv[1:], \"hp:b:\", ['help'])\n- except getopt.GetoptError as err:\n- print(str(err))\n- usage()\n- sys.exit(2)\n-\n- for o, a in opts:\n- if o == '-p':\n- conf['port'] = a\n- elif o == '-b':\n- conf['baud'] = eval(a)\n-\n- try:\n- args[0]\n- except:\n- raise Exception('No file path given.')\n-\n- # open serial port\n- ser = serial.Serial(\n- port=conf['port'],\n- baudrate=conf['baud'],\n+ # Open UART connection to SCM\n+ if scum_port != None:\n+ uart_ser = serial.Serial(\n+ port=scum_port,\n+ baudrate=19200,\nparity=serial.PARITY_NONE,\nstopbits=serial.STOPBITS_ONE,\n- bytesize=serial.EIGHTBITS\n+ bytesize=serial.EIGHTBITS,\n+ timeout=.5)\n+\n+ # After programming, several lines are sent from SCM over UART\n+ for _ in range(5):\n+ print(uart_ser.readline())\n+\n+ uart_ser.close()\n+\n+ return\n+\n+if __name__ == \"__main__\":\n+\n+ parser = argparse.ArgumentParser(description='bootlaod script arguments')\n+\n+ parser.add_argument('-tp', '--teensy_port',\n+ dest='teensy_port',\n+ default='COM12',\n+ action='store',\n+ help='Name of the COM port that the Teensy\\\n+ is connected to.'\n)\n- with open(args[0], \"rb\") as f:\n- data = f.read()\n- assert len(data)<65535, 'the image has to be smaller than 64KB!'\n+ parser.add_argument('-sp', '--scum_port',\n+ dest='scum_port',\n+ action='store',\n+ default=None,\n+ help='Name of the COM port that the UART \\\n+ is connected to. If None, does not attempt to connect\\\n+ to SCM via UART.'\n+ )\n- # write secret characters\n- ser.write(\"transfersram\\n\")\n- print ser.readline()\n+ parser.add_argument('-i','--image',\n+ dest='binary_image',\n+ default='pingpong_test.bin',\n+ help='Path to the binary file to \\\n+ feed to Teensy to program SCM. This binary file shold be\\\n+ compiled using whatever software is meant to end up \\\n+ on the Cortex. This group tends to compile it using Keil\\\n+ projects.'\n+ )\n- # Send the binary data over uart\n- ser.write(data[0:65535])\n- # Send all zeros to pad out to the full size of sram (64kB)\n- ser.write(\"\\0\" * (65536-len(data)))\n- print ser.readline()\n+ parser.add_argument('-bm','--boot_mode',\n+ dest='boot_mode',\n+ default='optical',\n+ help=\"'optical' or '3wb'. \\\n+ The former will assume an optical bootload,\\\n+ whereas the latter will use the 3-wire \\\n+ bus.\"\n+ )\n- ser.write(\"boot3wb\\n\")\n- print ser.readline()\n+ parser.add_argument('-sr','--skip_reset',\n+ dest='skip_reset',\n+ default=False,\n+ help='Boolean. True: Skip hard reset before optical \\\n+ programming. False: Perform hard reset before \\\n+ optical programming.'\n+ )\n- print \"transfer complete\"\n+ parser.add_argument('-c','--insert_CRC',\n+ dest='insert_CRC',\n+ default=True,\n+ help='True = insert CRC for payload integrity \\\n+ checking. False = do not insert CRC. Note that SCM C code \\\n+ must also be set up for CRC check for this to work.'\n+ )\n+\n+ parser.add_argument('-pl','--pad_random_payload',\n+ dest='pad_random_payload',\n+ default=False,\n+ help='True = True = pad unused payload space with \\\n+ random data and check it with CRC. False = pad with zeros, do \\\n+ not check integrity of padding. This is useful to check for \\\n+ programming errors over full 64kB payload.'\n+ )\n- ser.close()\n\\ No newline at end of file\n+ argspace = vars(parser.parse_args())\n+ program_cortex(**argspace)\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. update bootload script
|
491,595 |
10.01.2020 13:31:53
| -3,600 |
ceefd02bcd8c4481662f90de326a9113f187cce8
|
fix the crc variable type error and update the project file.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/board.c",
"new_path": "bsp/boards/scum/board.c",
"diff": "@@ -64,8 +64,6 @@ void build_channel_table(unsigned int channel_11_LC_code);\n//=========================== interrupt ========================================\n-void optical_sfd_isr(void);\n-\n//=========================== main =============================================\nextern int mote_main(void);\n@@ -78,7 +76,7 @@ int main(void) {\nvoid board_init(void) {\nuint8_t eui[8];\n- uint8_t calc_crc;\n+ uint32_t calc_crc;\nprintf(\"Initializing...\");\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/debugpins.c",
"new_path": "bsp/boards/scum/debugpins.c",
"diff": "@@ -23,7 +23,7 @@ void debugpins_init(void) {\n// frame\nvoid debugpins_frame_toggle(void) {\n- GPIO_REG__OUTPUT |= 0x0002;\n+ GPIO_REG__OUTPUT ^= 0x0002;\n}\nvoid debugpins_frame_clr(void) {\n@@ -31,7 +31,7 @@ void debugpins_frame_clr(void) {\n}\nvoid debugpins_frame_set(void) {\n- GPIO_REG__OUTPUT ^= 0x0002;\n+ GPIO_REG__OUTPUT |= 0x0002;\n}\n// slot\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_debugpins/01bsp_debugpins.uvprojx",
"new_path": "projects/scum/01bsp_debugpins/01bsp_debugpins.uvprojx",
"diff": "<Optim>1</Optim>\n<oTime>0</oTime>\n<SplitLS>0</SplitLS>\n- <OneElfS>1</OneElfS>\n+ <OneElfS>0</OneElfS>\n<Strict>0</Strict>\n<EnumInt>0</EnumInt>\n<PlainCh>0</PlainCh>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\uart.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>optical.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n+ <FileName>scm3c_hw_interface.h</FileName>\n<FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.h</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>adc.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n</Files>\n</Group>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix the crc variable type error and update the project file.
|
491,595 |
10.01.2020 13:35:47
| -3,600 |
2cd9661768c14227d1e7bb54e37a04b7d0454df7
|
fix bsp_sctimer project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_sctimer/01bsp_sctimer.uvprojx",
"new_path": "projects/scum/01bsp_sctimer/01bsp_sctimer.uvprojx",
"diff": "<FilePath>..\\..\\..\\bsp\\boards\\scum\\memory_map.h</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>retarget.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n- </File>\n- <File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.c</FileName>\n+ <FileName>scm3c_hw_interface.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n</File>\n<File>\n- <FileName>retarget.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n</Files>\n</Group>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix bsp_sctimer project.
|
491,595 |
10.01.2020 13:40:09
| -3,600 |
12de4c629764f450332cd52cd5d255e06cc77228
|
fix bsp_action_timer_radio project.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_action_timer_radio/01bsp_action_timer_radio.uvprojx",
"new_path": "projects/scum/01bsp_action_timer_radio/01bsp_action_timer_radio.uvprojx",
"diff": "<v6Rtti>0</v6Rtti>\n<VariousControls>\n<MiscControls></MiscControls>\n- <Define></Define>\n+ <Define>SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT</Define>\n<Undefine></Undefine>\n<IncludePath>..\\..\\..\\bsp\\boards;..\\..\\..\\bsp\\boards\\scum</IncludePath>\n</VariousControls>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\sctimer.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix bsp_action_timer_radio project.
|
491,595 |
10.01.2020 13:58:30
| -3,600 |
60f28ef9016e2953f8ed4691994000d2d73fafad
|
fix the bsp projects.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_leds/01bsp_leds.uvprojx",
"new_path": "projects/scum/01bsp_leds/01bsp_leds.uvprojx",
"diff": "<FilePath>..\\..\\..\\bsp\\boards\\scum\\uart.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>retarget.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n- </File>\n- <File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n</File>\n<File>\n- <FileName>retarget.c</FileName>\n+ <FileName>scm3c_hw_interface.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_multipletimer_radio/01bsp_multipletimer_radio.uvprojx",
"new_path": "projects/scum/01bsp_multipletimer_radio/01bsp_multipletimer_radio.uvprojx",
"diff": "<v6Rtti>0</v6Rtti>\n<VariousControls>\n<MiscControls></MiscControls>\n- <Define></Define>\n+ <Define>SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT</Define>\n<Undefine></Undefine>\n<IncludePath>..\\..\\..\\bsp\\boards;..\\..\\..\\bsp\\boards\\scum</IncludePath>\n</VariousControls>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\uart.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_radio/01bsp_radio.uvprojx",
"new_path": "projects/scum/01bsp_radio/01bsp_radio.uvprojx",
"diff": "<FilePath>..\\..\\..\\bsp\\boards\\scum\\sctimer.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>retarget.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n+ <FileName>radio.h</FileName>\n<FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\radio.h</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n- </File>\n- <File>\n- <FileName>bucket_o_functions.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>retarget.c</FileName>\n+ <FileName>optical.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n</File>\n<File>\n- <FileName>radio.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\radio.h</FilePath>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_sctimer_gpio/01bsp_sctimer_gpio.uvprojx",
"new_path": "projects/scum/01bsp_sctimer_gpio/01bsp_sctimer_gpio.uvprojx",
"diff": "<FilePath>..\\..\\..\\bsp\\boards\\scum\\memory_map.h</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>retarget.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n- </File>\n- <File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n</File>\n<File>\n- <FileName>retarget.c</FileName>\n+ <FileName>scm3c_hw_interface.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/01bsp_uart/01bsp_uart.uvprojx",
"new_path": "projects/scum/01bsp_uart/01bsp_uart.uvprojx",
"diff": "<FilePath>..\\..\\..\\bsp\\boards\\scum\\debugpins.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>retarget.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n- </File>\n- <File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n</File>\n<File>\n- <FileName>retarget.c</FileName>\n+ <FileName>scm3c_hw_interface.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/02drv_openserial/02drv_openserial.uvprojx",
"new_path": "projects/scum/02drv_openserial/02drv_openserial.uvprojx",
"diff": "<MiscControls>--gnu</MiscControls>\n<Define></Define>\n<Undefine></Undefine>\n- <IncludePath>..\\..\\..\\bsp\\boards;..\\..\\..\\bsp\\boards\\scum;..\\..\\..\\drivers\\common;..\\..\\..\\inc;..\\..\\..\\openstack\\02a-MAClow;..\\..\\..\\openstack\\02b-MAChigh;..\\..\\..\\openstack\\03a-IPHC;..\\..\\..\\openstack\\03b-IPv6;..\\..\\..\\openstack\\04-TRAN;..\\..\\..\\openstack\\cross-layers</IncludePath>\n+ <IncludePath>..\\..\\..\\bsp\\boards;..\\..\\..\\bsp\\boards\\scum;..\\..\\..\\drivers\\common;..\\..\\..\\inc;..\\..\\..\\drivers\\common;..\\..\\..\\kernel;..\\..\\..\\openstack\\02a-MAClow;..\\..\\..\\openstack\\02b-MAChigh;..\\..\\..\\openstack\\03a-IPHC;..\\..\\..\\openstack\\03b-IPv6;..\\..\\..\\openstack\\04-TRAN;..\\..\\..\\openstack\\cross-layers</IncludePath>\n</VariousControls>\n</Cads>\n<Aads>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\eui64.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/02drv_opentimers/02drv_opentimers.uvprojx",
"new_path": "projects/scum/02drv_opentimers/02drv_opentimers.uvprojx",
"diff": "<MiscControls>--gnu</MiscControls>\n<Define></Define>\n<Undefine></Undefine>\n- <IncludePath>..\\..\\..\\bsp\\boards;..\\..\\..\\bsp\\boards\\scum;..\\..\\..\\drivers\\common;..\\..\\..\\inc;..\\..\\..\\openstack\\02a-MAClow;..\\..\\..\\openstack\\02b-MAChigh;..\\..\\..\\openstack\\03a-IPHC;..\\..\\..\\openstack\\03b-IPv6;..\\..\\..\\openstack\\04-TRAN;..\\..\\..\\openstack\\cross-layers</IncludePath>\n+ <IncludePath>..\\..\\..\\bsp\\boards;..\\..\\..\\bsp\\boards\\scum;..\\..\\..\\drivers\\common;..\\..\\..\\inc;..\\..\\..\\drivers\\common;..\\..\\..\\kernel;..\\..\\..\\openstack\\02a-MAClow;..\\..\\..\\openstack\\02b-MAChigh;..\\..\\..\\openstack\\03a-IPHC;..\\..\\..\\openstack\\03b-IPv6;..\\..\\..\\openstack\\04-TRAN;..\\..\\..\\openstack\\cross-layers</IncludePath>\n</VariousControls>\n</Cads>\n<Aads>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\sctimer.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n</File>\n</Files>\n</Group>\n+ <Group>\n+ <GroupName>kernel</GroupName>\n+ <Files>\n+ <File>\n+ <FileName>scheduler.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\kernel\\openos\\scheduler.c</FilePath>\n+ </File>\n+ </Files>\n+ </Group>\n</Groups>\n</Target>\n</Targets>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix the bsp projects.
|
491,595 |
13.01.2020 12:30:57
| -3,600 |
d77537f723fd3d196394512d7bb958e6c9fe10c7
|
fix the oos projects.
|
[
{
"change_type": "MODIFY",
"old_path": "projects/scum/03oos_macpong/03oos_macpong.uvprojx",
"new_path": "projects/scum/03oos_macpong/03oos_macpong.uvprojx",
"diff": "<FilePath>..\\..\\..\\bsp\\boards\\uart.h</FilePath>\n</File>\n<File>\n- <FileName>radio.h</FileName>\n+ <FileName>sctimer.h</FileName>\n<FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\radio.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\sctimer.h</FilePath>\n</File>\n<File>\n- <FileName>sctimer.h</FileName>\n+ <FileName>radio.h</FileName>\n<FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\sctimer.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\radio.h</FilePath>\n</File>\n</Files>\n</Group>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\sctimer.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>retarget.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/scum/03oos_openwsn/03oos_openwsn.uvprojx",
"new_path": "projects/scum/03oos_openwsn/03oos_openwsn.uvprojx",
"diff": "<FileType>1</FileType>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\eui64.c</FilePath>\n</File>\n- <File>\n- <FileName>scm3_hardware_interface.c</FileName>\n- <FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.c</FilePath>\n- </File>\n- <File>\n- <FileName>scm3_hardware_interface.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3_hardware_interface.h</FilePath>\n- </File>\n<File>\n<FileName>sctimer.c</FileName>\n<FileType>1</FileType>\n<FilePath>..\\..\\..\\bsp\\boards\\scum\\cryptoengine.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.c</FileName>\n+ <FileName>retarget.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n</File>\n<File>\n- <FileName>bucket_o_functions.h</FileName>\n+ <FileName>radio.h</FileName>\n<FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\bucket_o_functions.h</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\radio.h</FilePath>\n</File>\n<File>\n- <FileName>retarget.c</FileName>\n+ <FileName>adc.c</FileName>\n<FileType>1</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\retarget.c</FilePath>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\adc.c</FilePath>\n</File>\n<File>\n- <FileName>radio.h</FileName>\n- <FileType>5</FileType>\n- <FilePath>..\\..\\..\\bsp\\boards\\scum\\radio.h</FilePath>\n+ <FileName>optical.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\optical.c</FilePath>\n+ </File>\n+ <File>\n+ <FileName>scm3c_hw_interface.c</FileName>\n+ <FileType>1</FileType>\n+ <FilePath>..\\..\\..\\bsp\\boards\\scum\\scm3c_hw_interface.c</FilePath>\n</File>\n</Files>\n</Group>\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix the oos projects.
|
491,595 |
13.01.2020 15:05:23
| -3,600 |
65ea02505d6f02d0f2c4617f6e4d3e6f27358c8b
|
donot use timer converter
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/sctimer.c",
"new_path": "bsp/boards/scum/sctimer.c",
"diff": "// ========================== define ==========================================\n-#define RFTIMER_MAX_COUNT 0x3ffffff // use a value less than 0xffffffff/61 and also equal to 2^n-1\n+#define RFTIMER_MAX_COUNT 0xffffffff\n#define TIMERLOOP_THRESHOLD 0xfffff // 0xffff is 2 seconds @ 32768Hz clock\n#define MINIMUM_COMPAREVALE_ADVANCE 5\n@@ -58,7 +58,7 @@ void sctimer_setCompare(PORT_TIMER_WIDTH val){\nPORT_TIMER_WIDTH currentTime;\n- currentTime = TIMER_COUNTER_CONVERT_RFTIMER_CLK_TO_32K(RFTIMER_REG__COUNTER);\n+ currentTime = RFTIMER_REG__COUNTER;\nsctimer_enable();\nif (currentTime - val < TIMERLOOP_THRESHOLD){\n@@ -75,9 +75,7 @@ void sctimer_setCompare(PORT_TIMER_WIDTH val){\n} else {\n// mark clear the flag here\n// schedule the timer at val\n- RFTIMER_REG__COMPARE0 = (PORT_TIMER_WIDTH)(TIMER_COUNTER_CONVERT_32K_TO_RFTIMER_CLK(val) & RFTIMER_MAX_COUNT);\n- RFTIMER_REG__COMPARE0_CONTROL = RFTIMER_COMPARE_ENABLE | \\\n- RFTIMER_COMPARE_INTERRUPT_ENABLE;\n+ RFTIMER_REG__COMPARE0 = (PORT_TIMER_WIDTH)(val) & RFTIMER_MAX_COUNT;\n}\n}\n}\n@@ -88,7 +86,7 @@ void sctimer_setCompare(PORT_TIMER_WIDTH val){\n\\returns The current value of the timer's counter.\n*/\nPORT_TIMER_WIDTH sctimer_readCounter(void){\n- return TIMER_COUNTER_CONVERT_RFTIMER_CLK_TO_32K(RFTIMER_REG__COUNTER);\n+ return RFTIMER_REG__COUNTER;\n}\nvoid sctimer_enable(void){\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. donot use timer converter
|
491,595 |
13.01.2020 15:05:54
| -3,600 |
a8fc3ea17367c49a37127df153ced5127b749d8b
|
use pre-configured freq_settings.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/radio.c",
"new_path": "bsp/boards/scum/radio.c",
"diff": "//=========================== variables =======================================\n+// freq_settings\n+typedef struct {\n+ uint16_t fine:5;\n+ uint16_t mid:5;\n+ uint16_t coarse:5;\n+ uint16_t not_used:1;\n+} freq_setting_t;\n+\ntypedef struct {\nradio_capture_cbt startFrame_cb;\nradio_capture_cbt endFrame_cb;\n@@ -88,6 +96,10 @@ unsigned char FIR_coeff[11] = {4,16,37,64,87,96,87,64,37,16,4};\nunsigned int IF_estimate_history[11] = {500,500,500,500,500,500,500,500,500,500};\nsigned short cdr_tau_history[11] = {0};\n+\n+uint16_t freq_setting_rx[16] = {24878, 25070, 25265, 25852, 26094, 26286, 26504, 27091, 27306, 27449, 28109, 28252, 28466, 29078, 29291, 29456};\n+uint16_t freq_setting_tx[16] = {24473, 25133, 25749, 25918, 26183, 26377, 26968, 27203, 27840, 28005, 28153, 28364, 28975, 29117, 29376, 29965};\n+\n//=========================== prototypes ======================================\nvoid setFrequencyTX(uint8_t channel);\n@@ -174,17 +186,31 @@ void radio_reset(void) {\n// Call this to setup RX, followed quickly by a TX ack\n// Note that due to the two ASC program cycles, this function takes about 27ms to execute (@5MHz HCLK)\nvoid setFrequencyRX(uint8_t channel){\n+ uint8_t coarse;\n+ uint8_t mid;\n+ uint8_t fine;\n+\n+ coarse = (freq_setting_rx[channel-11]>>10) & 0x001f;\n+ mid = (freq_setting_rx[channel-11]>>5) & 0x001f;\n+ fine = freq_setting_rx[channel-11] & 0x001f;\n+\n+ LC_FREQCHANGE(coarse,mid,fine);\n- // Set LO code for RX channel\n- LC_monotonic(radio_vars.rx_channel_codes[channel-11]);\n}\n// Call this to setup TX, followed quickly by a RX ack\nvoid setFrequencyTX(uint8_t channel){\n- // Set LO code for TX channel\n- LC_monotonic(radio_vars.tx_channel_codes[channel-11]);\n+ uint8_t coarse;\n+ uint8_t mid;\n+ uint8_t fine;\n+\n+ coarse = (freq_setting_tx[channel-11]>>10) & 0x001f;\n+ mid = (freq_setting_tx[channel-11]>>5) & 0x001f;\n+ fine = freq_setting_tx[channel-11] & 0x001f;\n+\n+ LC_FREQCHANGE(coarse,mid,fine);\n}\nvoid radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. use pre-configured freq_settings.
|
491,595 |
13.01.2020 15:19:31
| -3,600 |
0061a09d26fff034c7e3b57385362c449c1ca13f
|
use the new radio-setFrequency interface.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b-24ghz/radio.c",
"new_path": "bsp/boards/openmote-b-24ghz/radio.c",
"diff": "@@ -181,7 +181,7 @@ void radio_reset(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/radio.h",
"new_path": "bsp/boards/radio.h",
"diff": "@@ -42,6 +42,11 @@ typedef enum {\nRADIOSTATE_TURNING_OFF = 0x0d, ///< Turning the RF chain off.\n} radio_state_t;\n+typedef enum {\n+ FREQ_TX = 0x01,\n+ FREQ_RX = 0x02,\n+} radio_freq_t;\n+\n//=========================== typedef =========================================\ntypedef void (*radio_capture_cbt)(PORT_TIMER_WIDTH timestamp);\n@@ -57,7 +62,8 @@ void radio_setEndFrameCb(radio_capture_cbt cb);\n// reset\nvoid radio_reset(void);\n// RF admin\n-void radio_setFrequency(uint8_t frequency);\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx);\n+//void radio_setFrequency(uint8_t frequency);\nvoid radio_rfOn(void);\nvoid radio_rfOff(void);\n// TX\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/02a-MAClow/IEEE802154E.c",
"new_path": "openstack/02a-MAClow/IEEE802154E.c",
"diff": "@@ -590,12 +590,8 @@ port_INLINE void activity_synchronize_newSlot(void) {\n// update record of current channel\nieee154e_vars.freq = (openrandom_get16b()&0x0F) + 11;\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the frequency\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\nsctimer_setCapture(ACTION_RX_SFD_DONE);\n@@ -622,13 +618,8 @@ port_INLINE void activity_synchronize_newSlot(void) {\n// update record of current channel\nieee154e_vars.freq = (openrandom_get16b()&0x0F) + 11;\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the frequency\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- // configure the radio to listen to the frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n}\n// switch on the radio in Rx mode.\n@@ -645,12 +636,9 @@ port_INLINE void activity_synchronize_newSlot(void) {\n// update record of current channel\nieee154e_vars.freq = calculateFrequency(ieee154e_vars.singleChannel);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n+\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\nsctimer_setCapture(ACTION_RX_SFD_DONE);\n@@ -1094,13 +1082,9 @@ port_INLINE void activity_ti1ORri1(void) {\n}\n// add 2 CRC bytes only to the local copy as we end up here for each retransmission\npacketfunctions_reserveFooterSize(&ieee154e_vars.localCopyForTransmission, 2);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n+\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n// set the tx buffer address and length register.(packet is NOT loaded at this moment)\nradio_loadPacket_prepare(ieee154e_vars.localCopyForTransmission.payload,\n@@ -1138,13 +1122,8 @@ port_INLINE void activity_ti1ORri1(void) {\nsctimer_setCapture(ACTION_RX_SFD_DONE);\nsctimer_setCapture(ACTION_RX_DONE);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n#else\n// arm rt1\nopentimers_scheduleAbsolute(\n@@ -1202,13 +1181,8 @@ port_INLINE void activity_ti2(void) {\n// add 2 CRC bytes only to the local copy as we end up here for each retransmission\npacketfunctions_reserveFooterSize(&ieee154e_vars.localCopyForTransmission, 2);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n// load the packet in the radio's Tx buffer\nradio_loadPacket(ieee154e_vars.localCopyForTransmission.payload,\n@@ -1355,13 +1329,8 @@ port_INLINE void activity_ti5(PORT_TIMER_WIDTH capturedTime) {\nsctimer_setCapture(ACTION_RX_SFD_DONE);\nsctimer_setCapture(ACTION_RX_DONE);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n#else\n// arm tt5\nopentimers_scheduleAbsolute(\n@@ -1403,13 +1372,8 @@ port_INLINE void activity_ti6(void) {\n);\n// radiotimer_schedule(DURATION_tt6);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\nradio_rxEnable();\n#endif\n@@ -1684,13 +1648,8 @@ port_INLINE void activity_ri2(void) {\n);\n// radiotimer_schedule(DURATION_rt2);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_RX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\nradio_rxEnable();\n#endif\n@@ -2000,13 +1959,9 @@ port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nsctimer_setCapture(ACTION_TX_SFD_DONE);\nsctimer_setCapture(ACTION_TX_SEND_DONE);\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n+\n#else\n// arm rt5\nopentimers_scheduleAbsolute(\n@@ -2130,13 +2085,8 @@ port_INLINE void activity_ri6(void) {\nradio_rfOff();\n-#ifdef SCUM3C_FPGA_PCB_VERSION\n// configure the radio to listen to the default synchronizing channel\nradio_setFrequency(ieee154e_vars.freq, FREQ_TX);\n-#else\n- // configure the radio for that frequency\n- radio_setFrequency(ieee154e_vars.freq);\n-#endif\n// load the packet in the radio's Tx buffer\nradio_loadPacket(ieee154e_vars.ackToSend->payload,\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. use the new radio-setFrequency interface.
|
491,595 |
13.01.2020 18:13:01
| -3,600 |
00fb006ce7534d215680a4af6935c6288547c3b5
|
update radio_setFrequency interface.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b-24ghz/radio.c",
"new_path": "bsp/boards/openmote-b-24ghz/radio.c",
"diff": "@@ -194,7 +194,7 @@ void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n/* Changes to FREQCTRL take effect after the next recalibration */\nHWREG(RFCORE_XREG_FREQCTRL) = (CC2538_RF_CHANNEL_MIN\n- + (frequency - CC2538_RF_CHANNEL_MIN) * CC2538_RF_CHANNEL_SPACING);\n+ + (11 - CC2538_RF_CHANNEL_MIN) * CC2538_RF_CHANNEL_SPACING);\n//radio_on();\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b/radio.c",
"new_path": "bsp/boards/openmote-b/radio.c",
"diff": "@@ -181,13 +181,13 @@ void radio_reset(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\nradio_off();\n- // configure the radio to the right frequecy\n+ // configure the radio to the right frequency\nif((frequency < CC2538_RF_CHANNEL_MIN) || (frequency > CC2538_RF_CHANNEL_MAX)) {\nwhile(1);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/radio.c",
"new_path": "bsp/boards/openmote-cc2538/radio.c",
"diff": "@@ -181,7 +181,7 @@ void radio_reset(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/python/radio_obj.c",
"new_path": "bsp/boards/python/radio_obj.c",
"diff": "@@ -87,7 +87,7 @@ void radio_reset(OpenMote* self) {\n//===== RF admin\n-void radio_setFrequency(OpenMote* self, uint8_t frequency) {\n+void radio_setFrequency(OpenMote* self, uint8_t frequency, radio_freq_t tx_or_rx) {\nPyObject* result;\nPyObject* arglist;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/at86rf215/radio.c",
"new_path": "bsp/chips/at86rf215/radio.c",
"diff": "@@ -177,7 +177,7 @@ void radio_setEndFrameCb(radio_capture_cbt cb) {\n//channel spacing in KHz\n//frequency_0 in kHz\n//frequency_nb integer\n-void radio_setFrequency(uint16_t channel) {\n+void radio_setFrequency(uint16_t channel, radio_freq_t tx_or_rx) {\nuint16_t frequency_0;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/at86rf231/radio.c",
"new_path": "bsp/chips/at86rf231/radio.c",
"diff": "@@ -86,7 +86,7 @@ void radio_reset(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/at86rf233/radio.c",
"new_path": "bsp/chips/at86rf233/radio.c",
"diff": "@@ -137,7 +137,7 @@ PORT_TIMER_WIDTH radio_getTimerPeriod(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/cc1101/radio.c",
"new_path": "bsp/chips/cc1101/radio.c",
"diff": "@@ -156,7 +156,7 @@ void radio_reset(void) {\n//==== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\ncc1101_FREQ0_reg_t cc1101_FREQ0_reg;\ncc1101_FREQ1_reg_t cc1101_FREQ1_reg;\ncc1101_FREQ2_reg_t cc1101_FREQ2_reg;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/cc1200/radio.c",
"new_path": "bsp/chips/cc1200/radio.c",
"diff": "@@ -102,7 +102,7 @@ uint16_t radio_getTimerPeriod(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_FREQUENCY_SET;\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/chips/cc2420/radio.c",
"new_path": "bsp/chips/cc2420/radio.c",
"diff": "@@ -121,7 +121,7 @@ void radio_reset(void) {\n//===== RF admin\n-void radio_setFrequency(uint8_t frequency) {\n+void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\ncc2420_FSCTRL_reg_t cc2420_FSCTRL_reg;\n// change state\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. update radio_setFrequency interface.
|
491,595 |
14.01.2020 14:01:41
| -3,600 |
4787c642821c0c3340a44d613f009b44910cfa4f
|
fix oos_macpong projects.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/board_info.h",
"new_path": "bsp/boards/scum/board_info.h",
"diff": "@@ -57,9 +57,9 @@ to return the board's description.\n#define SLOTDURATION 20 // in miliseconds\n//// time-slot related\n-#define PORT_TsSlotDuration 10000 // 10000 ticks = 15ms @500000hz\n+#define PORT_TsSlotDuration 9992 // 10000 ticks = 20ms @500000hz\n#define PORT_maxTxDataPrepare 1650 // 1650 ticks = 2013us @500000hz\n-#define PORT_maxRxAckPrepare 305 // 305 ticks = 610us @500000hz\n+#define PORT_maxRxAckPrepare 504 // 504 ticks = 1006us @500000hz\n#define PORT_maxRxDataPrepare 504 // 504 ticks = 1006us @500000hz\n#define PORT_maxTxAckPrepare 763 // 763 ticks = 915us @500000hz\n// radio speed related\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/radio.c",
"new_path": "bsp/boards/scum/radio.c",
"diff": "@@ -97,8 +97,8 @@ unsigned int IF_estimate_history[11] = {500,500,500,500,500,500,500,500,500,500}\nsigned short cdr_tau_history[11] = {0};\n-uint16_t freq_setting_rx[16] = {24878, 25070, 25265, 25852, 26094, 26286, 26504, 27091, 27306, 27449, 28109, 28252, 28466, 29078, 29291, 29456};\n-uint16_t freq_setting_tx[16] = {24473, 25133, 25749, 25918, 26183, 26377, 26968, 27203, 27840, 28005, 28153, 28364, 28975, 29117, 29376, 29965};\n+uint16_t freq_setting_rx[16] = {24901, 25070, 25265, 25852, 26094, 26286, 26504, 27091, 27306, 27449, 28109, 28252, 28466, 29078, 29291, 29456};\n+uint16_t freq_setting_tx[16] = {24495, 25133, 25749, 25918, 26183, 26377, 26968, 27203, 27840, 28005, 28153, 28364, 28975, 29117, 29376, 29965};\n//=========================== prototypes ======================================\n@@ -326,8 +326,6 @@ void radio_txEnable(void) {\n// change state\nradio_vars.state = RADIOSTATE_TX_ENABLED;\n-\n- RFCONTROLLER_REG__CONTROL = RF_RESET;\n}\nvoid radio_txNow(void) {\n@@ -335,10 +333,6 @@ void radio_txNow(void) {\n// change state\nRFCONTROLLER_REG__CONTROL = TX_SEND;\n- if (radio_vars.startFrame_cb!=NULL) {\n- // call the callback\n- radio_vars.startFrame_cb(sctimer_readCounter());\n- }\n}\n//===== RX\n@@ -804,10 +798,10 @@ kick_scheduler_t radio_isr(void) {\n// call the callback\nradio_vars.endFrame_cb(capturedTime);\n- if (irq_status & RX_DONE_INT) {\n- radio_calibration(IF_estimate, LQI_chip_errors, cdr_tau_value);\n- radio_rxEnable();\n- }\n+// if (irq_status & RX_DONE_INT) {\n+// radio_calibration(IF_estimate, LQI_chip_errors, cdr_tau_value);\n+// radio_rxEnable();\n+// }\ndebugpins_isr_clr();\n// kick the OS\n@@ -826,7 +820,7 @@ kick_scheduler_t radio_isr(void) {\n// To Be Done. add error description deifinition for this type of errors.\nRFCONTROLLER_REG__ERROR_CLEAR = irq_error;\n- radio_rxEnable();\n+ radio_reset();\n}\ndebugpins_isr_clr();\nreturn DO_NOT_KICK_SCHEDULER;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. fix oos_macpong projects.
|
491,595 |
03.02.2020 14:30:17
| -3,600 |
0f1d2a2fb3c2295eb44ae729093d9faad93a7e20
|
update radio driver of scum.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/radio.c",
"new_path": "bsp/boards/scum/radio.c",
"diff": "@@ -97,7 +97,18 @@ unsigned int IF_estimate_history[11] = {500,500,500,500,500,500,500,500,500,500}\nsigned short cdr_tau_history[11] = {0};\n-uint16_t freq_setting_rx[16] = {24901, 25070, 25265, 25852, 26094, 26286, 26504, 27091, 27306, 27449, 28109, 28252, 28466, 29078, 29291, 29456};\n+// 10:02am rx 24850 tx 24473\n+// 11:24am rx 24435 tx 24929 (freq_sweep)\n+// 3:30pm rx 24458 tx 24521\n+// 5:49pm rx 24434 tx 24498\n+\n+//3:50pm rx 24410 tx 24442 (freq_sweep)\n+// rx=24408, tx=24497\n+\n+// rx = 24458 tx= 24495\n+\n+\n+uint16_t freq_setting_rx[16] = {24458, 25070, 25265, 25852, 26094, 26286, 26504, 27091, 27306, 27449, 28109, 28252, 28466, 29078, 29291, 29456};\nuint16_t freq_setting_tx[16] = {24495, 25133, 25749, 25918, 26183, 26377, 26968, 27203, 27840, 28005, 28153, 28364, 28975, 29117, 29376, 29965};\n//=========================== prototypes ======================================\n@@ -190,9 +201,9 @@ void setFrequencyRX(uint8_t channel){\nuint8_t mid;\nuint8_t fine;\n- coarse = (freq_setting_rx[channel-11]>>10) & 0x001f;\n- mid = (freq_setting_rx[channel-11]>>5) & 0x001f;\n- fine = freq_setting_rx[channel-11] & 0x001f;\n+ coarse = (uint8_t)((freq_setting_rx[channel-11]>>10) & 0x001f);\n+ mid = (uint8_t)((freq_setting_rx[channel-11]>>5) & 0x001f);\n+ fine = (uint8_t)( freq_setting_rx[channel-11] & 0x001f);\nLC_FREQCHANGE(coarse,mid,fine);\n@@ -206,9 +217,9 @@ void setFrequencyTX(uint8_t channel){\nuint8_t mid;\nuint8_t fine;\n- coarse = (freq_setting_tx[channel-11]>>10) & 0x001f;\n- mid = (freq_setting_tx[channel-11]>>5) & 0x001f;\n- fine = freq_setting_tx[channel-11] & 0x001f;\n+ coarse = (uint8_t)((freq_setting_tx[channel-11]>>10) & 0x001f);\n+ mid = (uint8_t)((freq_setting_tx[channel-11]>>5) & 0x001f);\n+ fine = (uint8_t)( freq_setting_tx[channel-11] & 0x001f);\nLC_FREQCHANGE(coarse,mid,fine);\n}\n@@ -248,9 +259,6 @@ void radio_rfOff(void) {\n// reset state machine first\nradio_reset();\n- // turn SCuM radio off\n- RFCONTROLLER_REG__CONTROL = RF_RESET;\n-\n// Hold digital baseband in reset\nANALOG_CFG_REG__4 = 0x2000;\n@@ -364,17 +372,11 @@ void radio_rxEnable(void) {\n// Enable polyphase and mixers via memory-mapped I/O\nANALOG_CFG_REG__16 = 0x1;\n- // reset\n- RFCONTROLLER_REG__CONTROL = RF_RESET;\n-\n// set receiving buffer address\nDMA_REG__RF_RX_ADDR = &(radio_vars.radio_rx_buffer[0]);\n- // Reset digital baseband\n- ANALOG_CFG_REG__4 = 0x2000;\n- ANALOG_CFG_REG__4 = 0x2800;\n- // start to listen\n- RFCONTROLLER_REG__CONTROL = RX_START;\n+ // reset\n+ RFCONTROLLER_REG__CONTROL = RF_RESET;\n// wiggle debug pin\ndebugpins_radio_set();\n@@ -397,7 +399,13 @@ void radio_rxEnable_scum(void){\n}\nvoid radio_rxNow(void) {\n- // nothing to do\n+\n+ // Reset digital baseband\n+ ANALOG_CFG_REG__4 = 0x2000;\n+ ANALOG_CFG_REG__4 = 0x2800;\n+\n+ // start to listen\n+ RFCONTROLLER_REG__CONTROL = RX_START;\n}\nvoid radio_getReceivedFrame(uint8_t* pBufRead,\n@@ -820,7 +828,7 @@ kick_scheduler_t radio_isr(void) {\n// To Be Done. add error description deifinition for this type of errors.\nRFCONTROLLER_REG__ERROR_CLEAR = irq_error;\n- radio_reset();\n+// radio_reset();\n}\ndebugpins_isr_clr();\nreturn DO_NOT_KICK_SCHEDULER;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. update radio driver of scum.
|
491,595 |
03.02.2020 14:30:55
| -3,600 |
2c6807bc18d83d4ce89654dcfb890b5b8e2a0359
|
add delay before optical calibration starts.
|
[
{
"change_type": "MODIFY",
"old_path": "bootloader/scum/scum_bootloader.py",
"new_path": "bootloader/scum/scum_bootloader.py",
"diff": "import serial\nimport random\nimport argparse\n+import time\ndef program_cortex(teensy_port=\"COM15\", scum_port=\"COM18\", binary_image=\"./code.bin\",\nboot_mode='optical', skip_reset=False, insert_CRC=False,\n@@ -104,6 +105,8 @@ def program_cortex(teensy_port=\"COM15\", scum_port=\"COM18\", binary_image=\"./code.\n# Display confirmation message from Teensy\nprint(teensy_ser.readline())\n+ # in case the large image's CRC-check takes long, delay 2 seconds to start optical calibration\n+ time.sleep(2)\nteensy_ser.write(b'opti_cal\\n');\nelif boot_mode == '3wb':\n# Execute 3-wire bus bootloader on Teensy\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. add delay before optical calibration starts.
|
491,595 |
03.02.2020 14:40:15
| -3,600 |
63c209a67b580e456e1928291e31a0b5ad08c776
|
add debug pin z
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/debugpins.h",
"new_path": "bsp/boards/debugpins.h",
"diff": "@@ -66,6 +66,10 @@ void debugpins_debug_y_toggle(void);\nvoid debugpins_debug_y_clr(void);\nvoid debugpins_debug_y_set(void);\n+void debugpins_debug_z_toggle(void);\n+void debugpins_debug_z_clr(void);\n+void debugpins_debug_z_set(void);\n+\n#ifdef OPENSIM\nvoid debugpins_ka_clr(void);\nvoid debugpins_ka_set(void);\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/debugpins.c",
"new_path": "bsp/boards/scum/debugpins.c",
"diff": "@@ -125,6 +125,19 @@ void debugpins_debug_y_set(void){\nGPIO_REG__OUTPUT |= 0x0100;\n}\n+// debug z\n+void debugpins_debug_z_toggle(void){\n+ GPIO_REG__OUTPUT ^= 0x0200;\n+}\n+\n+void debugpins_debug_z_clr(void){\n+ GPIO_REG__OUTPUT &= ~0x0200;\n+}\n+\n+void debugpins_debug_z_set(void){\n+ GPIO_REG__OUTPUT |= 0x0200;\n+}\n+\n// ISRs for external interrupts\nvoid ext_gpio3_activehigh_debounced_isr(){\nprintf(\"External Interrupt GPIO3 triggered\\r\\n\");\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. add debug pin z
|
491,595 |
03.02.2020 14:41:12
| -3,600 |
8f6aa2cdc0e0016276c23455f540edeaceaa895f
|
update scum timing.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/board_info.h",
"new_path": "bsp/boards/scum/board_info.h",
"diff": "@@ -61,7 +61,7 @@ to return the board's description.\n#define PORT_maxTxDataPrepare 1650 // 1650 ticks = 3300us @500000hz\n#define PORT_maxRxAckPrepare 504 // 504 ticks = 1006us @500000hz\n#define PORT_maxRxDataPrepare 504 // 504 ticks = 1006us @500000hz\n-#define PORT_maxTxAckPrepare 1000 // 1000 ticks = 2000us @500000hz\n+#define PORT_maxTxAckPrepare 1500 // 1500 ticks = 3000us @500000hz\n// radio speed related\n#define PORT_delayTx 39 // 39 ticks = 78us @500000hz\n#define PORT_delayRx 0 // 0us (can not measure)\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. update scum timing.
|
491,595 |
03.02.2020 14:50:37
| -3,600 |
83f62dc25c071624de7f6844e3820f2b69ce7dad
|
channel hopping by default.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/scum/radio.c",
"new_path": "bsp/boards/scum/radio.c",
"diff": "@@ -228,8 +228,8 @@ void radio_setFrequency(uint8_t frequency, radio_freq_t tx_or_rx) {\n// change state\nradio_vars.state = RADIOSTATE_SETTING_FREQUENCY;\n-// radio_vars.current_frequency = frequency;\n- radio_vars.current_frequency = DEFAULT_FREQ;\n+ radio_vars.current_frequency = frequency;\n+ // radio_vars.current_frequency = DEFAULT_FREQ;\nswitch(tx_or_rx){\ncase FREQ_TX:\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-830. channel hopping by default.
|
491,587 |
04.02.2020 18:30:27
| -3,600 |
4699be6cb3e82066457cc74632bae67174f6c987
|
Refactor openbridge.c/.h
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/openbridge.h",
"new_path": "openstack/03a-IPHC/openbridge.h",
"diff": "//=========================== prototypes ======================================\nvoid openbridge_init(void);\n+\nvoid openbridge_triggerData(void);\n+\nvoid openbridge_sendDone(OpenQueueEntry_t *msg, owerror_t error);\n+\nvoid openbridge_receive(OpenQueueEntry_t *msg);\n/**\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Refactor openbridge.c/.h
|
491,587 |
10.01.2020 18:04:17
| -3,600 |
08854bef310c503eedd68cff8e6458621700ac05
|
Add support for simulation mode
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/python/openwsnmodule.c",
"new_path": "bsp/boards/python/openwsnmodule.c",
"diff": "@@ -54,6 +54,7 @@ static PyObject* OpenMote_getState(OpenMote* self) {\nPyObject* icmpv6rpl_vars;\nPyObject* opencoap_vars;\nPyObject* monitor_expiration_vars;\n+ PyObject* frag_vars;\nPyObject* neighbors_vars;\nPyObject* sixtop_vars;\nPyObject* msf_vars;\n@@ -99,6 +100,11 @@ static PyObject* OpenMote_getState(OpenMote* self) {\n// TODO\nPyDict_SetItemString(returnVal, \"opencoap_vars\", opencoap_vars);\n+ // frag_vars\n+ frag_vars = PyDict_New();\n+ // TODO\n+ PyDict_SetItemString(returnVal, \"frag_vars\", frag_vars);\n+\n// monitor_expiration_vars\nmonitor_expiration_vars = PyDict_New();\n// TODO\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/python/openwsnmodule_obj.h",
"new_path": "bsp/boards/python/openwsnmodule_obj.h",
"diff": "#include \"idmanager_obj.h\"\n#include \"openqueue_obj.h\"\n#include \"openrandom_obj.h\"\n+#include \"frag_obj.h\"\n// applications\n#include \"c6t_obj.h\"\n#include \"cexample_obj.h\"\n@@ -201,6 +202,7 @@ struct OpenMote {\nopenudp_vars_t openudp_vars;\n// l3\nmonitor_expiration_vars_t monitor_expiration_vars;\n+ frag_vars_t frag_vars;\n// l2b\nsixtop_vars_t sixtop_vars;\nneighbors_vars_t neighbors_vars;\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -138,6 +138,7 @@ varsToChange = [\n'msf_vars',\n# 03a-IPHC\n'monitor_expiration_vars',\n+ 'frag_vars',\n# 03b-IPv6\n'icmpv6echo_vars',\n'icmpv6rpl_vars',\n@@ -704,6 +705,14 @@ functionsToChange = [\n'sixtop_removeCells',\n'sixtop_areAvailableCellsToBeScheduled',\n'sixtop_areAvailableCellsToBeRemoved',\n+ # frag\n+ 'frag_init',\n+ 'frag_fragment6LoPacket',\n+ 'frag_sendDone',\n+ 'frag_receive',\n+ 'cleanup_fragments',\n+ 'store_fragment',\n+ 'reassemble_fragments',\n# iphc\n'iphc_init',\n'iphc_sendFromForwarding',\n@@ -830,6 +839,7 @@ functionsToChange = [\n'openqueue_init',\n'debugPrint_queue',\n'openqueue_getFreePacketBuffer',\n+ 'openqueue_getFreeBigPacketBuffer',\n'openqueue_freePacketBuffer',\n'openqueue_removeAllCreatedBy',\n'openqueue_isHighPriorityEntryEnough',\n@@ -838,6 +848,7 @@ functionsToChange = [\n'openqueue_macGetEBPacket',\n'openqueue_macGetKaPacket',\n'openqueue_reset_entry',\n+ 'openqueue_reset_big_entry',\n'openqueue_macGetDIOPacket',\n'openqueue_macGetUnicastPakcet',\n'openqueue_updateNextHopPayload',\n@@ -1011,6 +1022,7 @@ headerFiles = [\n# TODO\n# 03a-IPHC\n'iphc',\n+ 'frag',\n'openbridge',\n# 03b-IPv6\n'forwarding',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Add support for simulation mode
|
491,587 |
17.01.2020 19:35:52
| -3,600 |
9fa87ff213d93574f58435560433ef4184381b40
|
Reformatted iphc.c
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/iphc.c",
"new_path": "openstack/03a-IPHC/iphc.c",
"diff": "//=========================== variables =======================================\n-static const uint8_t dagroot_mac64b[] = {0x02,\n- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01\n-};\n+static const uint8_t dagroot_mac64b[] = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};\n#ifdef DEADLINE_OPTION_ENABLED\nstatic monitor_expiration_vars_t monitor_expiration_vars;\n@@ -22,13 +20,6 @@ static const uint8_t dagroot_mac64b[] = {0x02,\n//=========================== prototypes ======================================\n-//===== IPv6 header\n-void iphc_retrieveIPv6Header(\n- OpenQueueEntry_t* msg,\n- ipv6_header_iht* ipv6_outer_header,\n- ipv6_header_iht* ipv6_inner_header,\n- uint8_t* page_length\n-);\nuint8_t iphc_retrieveIphcHeader(open_addr_t *temp_addr_16b,\nopen_addr_t *temp_addr_64b,\nuint8_t *dispatch,\n@@ -145,7 +136,8 @@ owerror_t iphc_sendFromForwarding(\n} else {\nif (packetfunctions_isBroadcastMulticast(&(msg->l3_destinationAdd)) == FALSE) {\nmemset(&(temp_dagroot_ip128b), 0, sizeof(open_addr_t));\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),(open_addr_t*)dagroot_mac64b,&(temp_dagroot_ip128b));\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), (open_addr_t *) dagroot_mac64b,\n+ &(temp_dagroot_ip128b));\nif (\n(\nipv6_outer_header->src.type == ADDR_NONE &&\n@@ -165,8 +157,7 @@ owerror_t iphc_sendFromForwarding(\n// length\npacketfunctions_reserveHeaderSize(msg, sizeof(uint8_t));\n*((uint8_t * )(msg->payload)) = ELECTIVE_6LoRH | 1;\n- }\n- else {\n+ } else {\nif (sam == IPHC_SAM_128B) {\n// encapsulate address\npacketfunctions_writeAddress(msg, &(msg->l3_sourceAdd), OW_BIG_ENDIAN);\n@@ -574,7 +565,8 @@ owerror_t iphc_prependIPv6Header(\n/**\n\\brief Retrieve an IPv6 header from a message.\n*/\n-void iphc_retrieveIPv6Header(OpenQueueEntry_t* msg, ipv6_header_iht* ipv6_outer_header, ipv6_header_iht* ipv6_inner_header,uint8_t* page_length) {\n+void iphc_retrieveIPv6Header(OpenQueueEntry_t *msg, ipv6_header_iht *ipv6_outer_header,\n+ ipv6_header_iht *ipv6_inner_header, uint8_t *page_length) {\nuint8_t temp_8b;\nopen_addr_t temp_addr_16b;\nopen_addr_t temp_addr_64b;\n@@ -701,12 +693,16 @@ void iphc_retrieveIPv6Header(OpenQueueEntry_t* msg, ipv6_header_iht* ipv6_outer_\ncase ELECTIVE_6LoRH :\n// this is an elective 6LoRH\nlorh_length = temp_8b & IPINIP_LEN_6LORH_MASK;\n- lorh_type = *(uint8_t*)(msg->payload+ipv6_outer_header->header_length+*page_length+extention_header_length+1);\n+ lorh_type = *(uint8_t * )(\n+ msg->payload + ipv6_outer_header->header_length + *page_length + extention_header_length +\n+ 1);\nif (lorh_type == IPINIP_TYPE_6LORH) {\nipv6_outer_header->header_length += 1;\n// this is IpinIP 6LoRH\nipv6_outer_header->header_length += 1;\n- ipv6_outer_header->hop_limit = *(uint8_t*)(msg->payload+ipv6_outer_header->header_length+*page_length+extention_header_length);\n+ ipv6_outer_header->hop_limit = *(uint8_t * )(\n+ msg->payload + ipv6_outer_header->header_length + *page_length +\n+ extention_header_length);\nipv6_outer_header->header_length += 1;\n// destination address maybe is the first address in RH3 6LoRH OR dest adress in IPHC, reset first\n// update destination address if necessary after the processing\n@@ -715,20 +711,27 @@ void iphc_retrieveIPv6Header(OpenQueueEntry_t* msg, ipv6_header_iht* ipv6_outer_\nif (lorh_length == 1) {\n// source address is root\nmemset(&(ipv6_outer_header->src), 0, sizeof(open_addr_t));\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),(open_addr_t*)dagroot_mac64b,&(ipv6_outer_header->src));\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),\n+ (open_addr_t *) dagroot_mac64b, &(ipv6_outer_header->src));\n// destination address is the first address in RH3 6LoRH OR dest adress in IPHC\n} else {\nswitch (lorh_length - 1) {\ncase 16:\n// this is source address\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_outer_header->header_length+*page_length+extention_header_length)),ADDR_128B,&ipv6_outer_header->src,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(\n+ msg->payload + ipv6_outer_header->header_length + *page_length +\n+ extention_header_length)), ADDR_128B, &ipv6_outer_header->src,\n+ OW_BIG_ENDIAN);\nipv6_outer_header->header_length += 16 * sizeof(uint8_t);\nbreak;\ncase 8:\n// this is source address\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_outer_header->header_length+*page_length+extention_header_length)),ADDR_64B,&temp_addr_64b,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(\n+ msg->payload + ipv6_outer_header->header_length + *page_length +\n+ extention_header_length)), ADDR_64B, &temp_addr_64b, OW_BIG_ENDIAN);\nipv6_outer_header->header_length += 8 * sizeof(uint8_t);\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&temp_addr_64b,&ipv6_outer_header->src);\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), &temp_addr_64b,\n+ &ipv6_outer_header->src);\nbreak;\ndefault:\n// do not support other length yet and destination address will be in RH3 or IPHC\n@@ -853,11 +856,14 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\ncase IPHC_TF_3B:\nipv6_header->flow_label = 0;\n- ipv6_header->flow_label |= ((uint32_t) *((uint8_t*)(msg->payload)+ipv6_header->header_length+previousLen)) << 0;\n+ ipv6_header->flow_label |=\n+ ((uint32_t) * ((uint8_t * )(msg->payload) + ipv6_header->header_length + previousLen)) << 0;\nipv6_header->header_length += sizeof(uint8_t);\n- ipv6_header->flow_label |= ((uint32_t) *((uint8_t*)(msg->payload)+ipv6_header->header_length+previousLen)) << 8;\n+ ipv6_header->flow_label |=\n+ ((uint32_t) * ((uint8_t * )(msg->payload) + ipv6_header->header_length + previousLen)) << 8;\nipv6_header->header_length += sizeof(uint8_t);\n- ipv6_header->flow_label |= ((uint32_t) *((uint8_t*)(msg->payload)+ipv6_header->header_length+previousLen)) << 16;\n+ ipv6_header->flow_label |=\n+ ((uint32_t) * ((uint8_t * )(msg->payload) + ipv6_header->header_length + previousLen)) << 16;\nipv6_header->header_length += sizeof(uint8_t);\nbreak;\ncase IPHC_TF_ELIDED:\n@@ -931,21 +937,25 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\n// source address\nswitch (*sam) {\ncase IPHC_SAM_ELIDED:\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),&(msg->l2_nextORpreviousHop),&ipv6_header->src);\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), &(msg->l2_nextORpreviousHop),\n+ &ipv6_header->src);\nbreak;\ncase IPHC_SAM_16B:\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_16B,temp_addr_16b,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_16B, temp_addr_16b, OW_BIG_ENDIAN);\nipv6_header->header_length += 2 * sizeof(uint8_t);\npacketfunctions_mac16bToMac64b(temp_addr_16b, temp_addr_64b);\npacketfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), temp_addr_64b, &ipv6_header->src);\nbreak;\ncase IPHC_SAM_64B:\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_64B,temp_addr_64b,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_64B, temp_addr_64b, OW_BIG_ENDIAN);\nipv6_header->header_length += 8 * sizeof(uint8_t);\npacketfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), temp_addr_64b, &ipv6_header->src);\nbreak;\ncase IPHC_SAM_128B:\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_128B,&ipv6_header->src,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_128B, &ipv6_header->src, OW_BIG_ENDIAN);\nipv6_header->header_length += 16 * sizeof(uint8_t);\nbreak;\ndefault:\n@@ -988,21 +998,25 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\n} else {\nswitch (*dam) {\ncase IPHC_DAM_ELIDED:\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),idmanager_getMyID(ADDR_64B),&(ipv6_header->dest));\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), idmanager_getMyID(ADDR_64B),\n+ &(ipv6_header->dest));\nbreak;\ncase IPHC_DAM_16B:\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_16B,temp_addr_16b,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_16B, temp_addr_16b, OW_BIG_ENDIAN);\nipv6_header->header_length += 2 * sizeof(uint8_t);\npacketfunctions_mac16bToMac64b(temp_addr_16b, temp_addr_64b);\npacketfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), temp_addr_64b, &ipv6_header->dest);\nbreak;\ncase IPHC_DAM_64B:\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_64B,temp_addr_64b,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_64B, temp_addr_64b, OW_BIG_ENDIAN);\nipv6_header->header_length += 8 * sizeof(uint8_t);\npacketfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), temp_addr_64b, &ipv6_header->dest);\nbreak;\ncase IPHC_DAM_128B:\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_128B,&ipv6_header->dest,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_128B, &ipv6_header->dest, OW_BIG_ENDIAN);\nipv6_header->header_length += 16 * sizeof(uint8_t);\nbreak;\ndefault:\n@@ -1017,11 +1031,11 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\n}\n//TODO, check NH if compressed no?\nif (ipv6_header->next_header_compressed) {\n- lowpan_nhc = *(msg->payload+ipv6_header->header_length+previousLen);//get the next element after addresses\n+ lowpan_nhc = *(msg->payload + ipv6_header->header_length +\n+ previousLen);//get the next element after addresses\nif ((lowpan_nhc & NHC_UDP_MASK) == NHC_UDP_ID) { //check if it is UDP LOWPAN_NHC\nipv6_header->next_header = IANA_UDP;\n- }\n- else{\n+ } else {\n//error?\n}\n}\n@@ -1046,20 +1060,26 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\nif (ipinip_length == 1) {\n// source address is root\nmemset(&(ipv6_header->src), 0, sizeof(open_addr_t));\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),(open_addr_t*)dagroot_mac64b,&(ipv6_header->src));\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), (open_addr_t *) dagroot_mac64b,\n+ &(ipv6_header->src));\n// destination address is the first address in RH3 6LoRH OR dest adress in IPHC\n} else {\nswitch (ipinip_length - 1) {\ncase 16:\n// this is source address\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_128B,&ipv6_header->src,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(\n+ ((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_128B, &ipv6_header->src, OW_BIG_ENDIAN);\nipv6_header->header_length += 16 * sizeof(uint8_t);\nbreak;\ncase 8:\n// this is source address\n- packetfunctions_readAddress(((uint8_t*)(msg->payload+ipv6_header->header_length+previousLen)),ADDR_64B,temp_addr_64b,OW_BIG_ENDIAN);\n+ packetfunctions_readAddress(\n+ ((uint8_t * )(msg->payload + ipv6_header->header_length + previousLen)),\n+ ADDR_64B, temp_addr_64b, OW_BIG_ENDIAN);\nipv6_header->header_length += 8 * sizeof(uint8_t);\n- packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX),temp_addr_64b,&ipv6_header->src);\n+ packetfunctions_mac64bToIp128b(idmanager_getMyID(ADDR_PREFIX), temp_addr_64b,\n+ &ipv6_header->src);\nbreak;\ndefault:\n// do not support other length yet and destination address will be in RH3 or IPHC\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/iphc.h",
"new_path": "openstack/03a-IPHC/iphc.h",
"diff": "@@ -248,6 +248,7 @@ typedef struct {\n//=========================== prototypes ======================================\nvoid iphc_init(void);\n+\nowerror_t iphc_sendFromForwarding(\nOpenQueueEntry_t *msg,\nipv6_header_iht *ipv6_outer_header,\n@@ -261,9 +262,13 @@ owerror_t iphc_sendFromForwarding(\nuint8_t rh3_length,\nuint8_t fw_SendOrfw_Rcv\n);\n+\nowerror_t iphc_sendFromBridge(OpenQueueEntry_t *msg);\n+\nvoid iphc_sendDone(OpenQueueEntry_t *msg, owerror_t error);\n+\nvoid iphc_receive(OpenQueueEntry_t *msg);\n+\n// called by forwarding when IPHC inner header required\nowerror_t iphc_prependIPv6Header(\nOpenQueueEntry_t *msg,\n@@ -283,6 +288,7 @@ owerror_t iphc_prependIPv6Header(\nopen_addr_t *value_src,\nuint8_t fw_SendOrfw_Rcv\n);\n+\nuint8_t iphc_retrieveIPv6HopByHopHeader(\nOpenQueueEntry_t *msg,\nrpl_option_ht *rpl_option\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Reformatted iphc.c
|
491,587 |
20.01.2020 14:46:44
| -3,600 |
b840592f60fdd522813d333073e48a5e587a8bb6
|
Delete redundant code from IPv6 header parsing function
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/iphc.c",
"new_path": "openstack/03a-IPHC/iphc.c",
"diff": "@@ -651,10 +651,6 @@ void iphc_retrieveIPv6Header(OpenQueueEntry_t *msg, ipv6_header_iht *ipv6_outer_\nextention_header_length += 2 + 16 * size;\nbreak;\n}\n- temp_8b = *(uint8_t * )((msg->payload) + \\\n- *page_length + \\\n- extention_header_length + \\\n- ipv6_outer_header->header_length);\n} else {\nif (lorh_type == 5) {\nif (ipv6_outer_header->routing_header[0] == NULL) {\n@@ -675,10 +671,6 @@ void iphc_retrieveIPv6Header(OpenQueueEntry_t *msg, ipv6_header_iht *ipv6_outer_\nextention_header_length += 2 + 1;\nbreak;\n}\n- temp_8b = *(uint8_t * )((msg->payload) + \\\n- *page_length + \\\n- extention_header_length + \\\n- ipv6_outer_header->header_length);\n} else {\n//log wrong inf\nopenserial_printError(\n@@ -763,12 +755,13 @@ void iphc_retrieveIPv6Header(OpenQueueEntry_t *msg, ipv6_header_iht *ipv6_outer_\nextention_header_length += 2 + lorh_length;\nipv6_outer_header->rhe_length += 2 + lorh_length;\n}\n+ break;\n+ }\ntemp_8b = *(uint8_t * )((msg->payload) + \\\n*page_length + \\\nextention_header_length + \\\nipv6_outer_header->header_length);\n- break;\n- }\n+ rh3_index++;\n}\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Delete redundant code from IPv6 header parsing function
|
491,587 |
21.01.2020 10:08:11
| -3,600 |
59841e890d986d7a53fc61526ce31dd13b32e644
|
Correctly format forwarding.c
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/forwarding.c",
"new_path": "openstack/03b-IPv6/forwarding.c",
"diff": "//=========================== prototypes ======================================\n-void forwarding_getNextHop(\n- open_addr_t* destination,\n- open_addr_t* addressToWrite\n-);\n+void forwarding_getNextHop(open_addr_t *destination, open_addr_t *addressToWrite);\n+\nowerror_t forwarding_send_internal_RoutingTable(\nOpenQueueEntry_t *msg,\nipv6_header_iht *ipv6_outer_header,\n@@ -31,6 +29,7 @@ owerror_t forwarding_send_internal_RoutingTable(\nuint32_t *flow_label,\nuint8_t fw_SendOrfw_Rcv\n);\n+\nowerror_t forwarding_send_internal_SourceRouting(\nOpenQueueEntry_t *msg,\nipv6_header_iht *ipv6_outer_header,\n@@ -40,15 +39,11 @@ owerror_t forwarding_send_internal_SourceRouting(\n#endif\nrpl_option_ht *rpl_option\n);\n-void forwarding_createRplOption(\n- rpl_option_ht* rpl_option,\n- uint8_t flags\n-);\n+\n+void forwarding_createRplOption(rpl_option_ht *rpl_option, uint8_t flags);\n#ifdef DEADLINE_OPTION_ENABLED\n-void forwarding_createDeadlineOption(\n- deadline_option_ht* deadline_option\n-);\n+void forwarding_createDeadlineOption( deadline_option_ht* deadline_option);\n#endif\n//=========================== public ==========================================\n@@ -117,7 +112,8 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nmyprefix = &temp_src_prefix;\nsac = IPHC_SAC_STATELESS;\ndac = IPHC_DAC_STATELESS;\n- } else if (packetfunctions_sameAddress(&temp_dest_prefix,idmanager_getMyID(ADDR_PREFIX))==FALSE && packetfunctions_isBroadcastMulticast(&(msg->l3_destinationAdd))==FALSE) {\n+ } else if (packetfunctions_sameAddress(&temp_dest_prefix, idmanager_getMyID(ADDR_PREFIX)) == FALSE &&\n+ packetfunctions_isBroadcastMulticast(&(msg->l3_destinationAdd)) == FALSE) {\nmyprefix = idmanager_getMyID(ADDR_PREFIX);\nsac = IPHC_SAC_STATELESS;\ndac = IPHC_DAC_STATELESS;\n@@ -502,7 +498,8 @@ owerror_t forwarding_send_internal_RoutingTable(\n) {\nif (neighbors_isStableNeighbor(&(msg->l3_destinationAdd)) || msg->is_cjoin_response) {\n// IP destination is 1-hop neighbor, send directly\n- packetfunctions_ip128bToMac64b(&(msg->l3_destinationAdd),&temp_prefix64btoWrite,&(msg->l2_nextORpreviousHop));\n+ packetfunctions_ip128bToMac64b(&(msg->l3_destinationAdd), &temp_prefix64btoWrite,\n+ &(msg->l2_nextORpreviousHop));\n}\n} else {\nforwarding_getNextHop(&(msg->l3_destinationAdd), &(msg->l2_nextORpreviousHop));\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Correctly format forwarding.c
|
491,587 |
21.01.2020 16:13:25
| -3,600 |
f10b1e2e3fb83545b4500ff7c93a592006d4ce6e
|
Add support for source routing of fragments
(1) Bug fixes for upward routing.
(2) Fixed a bug in fragmentation layer.
(3) Update definitions opendefs.h
(4) Support for out-of-order fragment fast-forwarding
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -43,7 +43,7 @@ static const uint8_t infoStackName[] = \"OpenWSN \";\n// frame sizes\n#define IEEE802154_FRAME_SIZE 127\n-#define BIG_PACKET_SIZE (6*127)\n+#define BIG_PACKET_SIZE (10*127)\nenum {\nE_SUCCESS = 0,\n@@ -197,78 +197,81 @@ enum {\n// l4\nERR_WRONG_TRAN_PROTOCOL = 0x07, // unknown transport protocol {0} (code location {1})\nERR_UNSUPPORTED_PORT_NUMBER = 0x08, // unsupported port number {0} (code location {1})\n+ ERR_INVALID_CHECKSUM = 0x09, // invalid checksum, expected 0x{:04x}, found 0x{:04x}\n// l3\n- ERR_RCVD_ECHO_REQUEST = 0x09, // received an echo request\n- ERR_RCVD_ECHO_REPLY = 0x0a, // received an echo reply\n- ERR_6LORH_DEADLINE_EXPIRED = 0x0b, // the received packet has expired\n- ERR_6LORH_DEADLINE_DROPPED = 0x0c, // packet expiry time reached, dropped\n- ERR_UNEXPECTED_DAO = 0x0d, // unexpected DAO (code location {0}). A change maybe happened on dagroot node.\n- ERR_UNSUPPORTED_ICMPV6_TYPE = 0x0e, // unsupported ICMPv6 type {0} (code location {1})\n- ERR_6LOWPAN_UNSUPPORTED = 0x0f, // unsupported 6LoWPAN parameter {1} at location {0}\n- ERR_NO_NEXTHOP = 0x10, // no next hop for layer 3 destination {0:x}{1:x}\n- ERR_INVALID_PARAM = 0x11, // invalid parameter\n- ERR_INVALID_FWDMODE = 0x12, // invalid forward mode\n- ERR_LARGE_DAGRANK = 0x13, // large DAGrank {0}, set to {1}\n- ERR_HOP_LIMIT_REACHED = 0x14, // packet discarded hop limit reached\n- ERR_LOOP_DETECTED = 0x15, // loop detected due to previous rank {0} lower than current node rank {1}\n- ERR_WRONG_DIRECTION = 0x16, // upstream packet set to be downstream, possible loop.\n- ERR_FORWARDING_PACKET_DROPPED = 0x17, // packet to forward is dropped (code location {0})\n- ERR_FRAG_BUFFER_OV = 0x18, // fragmentation buffer overflowed ({0} fragments queued)\n- ERR_FRAG_INVALID_SIZE = 0x19, // invalid original packet size ({0} > {1})\n- ERR_FRAG_REASSEMBLED = 0x1a, // reassembled fragments into big packet (size: {0}, tag: {1})\n+ ERR_RCVD_ECHO_REQUEST = 0x0a, // received an echo request\n+ ERR_RCVD_ECHO_REPLY = 0x0b, // received an echo reply\n+ ERR_6LORH_DEADLINE_EXPIRED = 0x0c, // the received packet has expired\n+ ERR_6LORH_DEADLINE_DROPPED = 0x0d, // packet expiry time reached, dropped\n+ ERR_UNEXPECTED_DAO = 0x0e, // unexpected DAO (code location {0}). A change maybe happened on dagroot node.\n+ ERR_UNSUPPORTED_ICMPV6_TYPE = 0x0f, // unsupported ICMPv6 type {0} (code location {1})\n+ ERR_6LOWPAN_UNSUPPORTED = 0x10, // unsupported 6LoWPAN parameter {1} at location {0}\n+ ERR_NO_NEXTHOP = 0x11, // no next hop for layer 3 destination {0:x}{1:x}\n+ ERR_INVALID_PARAM = 0x12, // invalid parameter\n+ ERR_INVALID_FWDMODE = 0x13, // invalid forward mode\n+ ERR_LARGE_DAGRANK = 0x14, // large DAGrank {0}, set to {1}\n+ ERR_HOP_LIMIT_REACHED = 0x15, // packet discarded hop limit reached\n+ ERR_LOOP_DETECTED = 0x16, // loop detected due to previous rank {0} lower than current node rank {1}\n+ ERR_WRONG_DIRECTION = 0x17, // upstream packet set to be downstream, possible loop.\n+ ERR_FORWARDING_PACKET_DROPPED = 0x18, // packet to forward is dropped (code location {0})\n+ ERR_FRAG_BUFFER_OV = 0x19, // fragmentation buffer overflowed ({0} fragments queued)\n+ ERR_FRAG_INVALID_SIZE = 0x1a, // invalid original packet size ({0} > {1})\n+ ERR_FRAG_REASSEMBLED = 0x1b, // reassembled fragments into big packet (size: {0}, tag: {1})\n+ ERR_FRAG_FAST_FORWARD = 0x1c, // fast-forwarded all fragments with tag {0} (total size: {1})\n+ ERR_FRAG_STORED = 0x1d, // stored a fragment (currently in buffer: {0})\n// l2b\n- ERR_NEIGHBORS_FULL = 0x1b, // neighbors table is full (max number of neighbor is {0})\n- ERR_NO_SENT_PACKET = 0x1c, // there is no sent packet in queue\n- ERR_NO_RECEIVED_PACKET = 0x1d, // there is no received packet in queue\n- ERR_SCHEDULE_OVERFLOWN = 0x1e, // schedule overflown\n- ERR_SIXTOP_RETURNCODE = 0x1f, // sixtop return code {0} at sixtop state {1}\n- ERR_SIXTOP_COUNT = 0x20, // there are {0} cells to request mote\n- ERR_SIXTOP_LIST = 0x21, // the cells reserved to request mote contains slot {0} and slot {1}\n+ ERR_NEIGHBORS_FULL = 0x1e, // neighbors table is full (max number of neighbor is {0})\n+ ERR_NO_SENT_PACKET = 0x1f, // there is no sent packet in queue\n+ ERR_NO_RECEIVED_PACKET = 0x20, // there is no received packet in queue\n+ ERR_SCHEDULE_OVERFLOWN = 0x21, // schedule overflown\n+ ERR_SIXTOP_RETURNCODE = 0x22, // sixtop return code {0} at sixtop state {1}\n+ ERR_SIXTOP_COUNT = 0x23, // there are {0} cells to request mote\n+ ERR_SIXTOP_LIST = 0x24, // the cells reserved to request mote contains slot {0} and slot {1}\n// l2a\n- ERR_WRONG_CELLTYPE = 0x22, // wrong celltype {0} at slotOffset {1}\n- ERR_IEEE154_UNSUPPORTED = 0x23, // unsupported IEEE802.15.4 parameter {1} at location {0}\n- ERR_DESYNCHRONIZED = 0x24, // got desynchronized at slotOffset {0}\n- ERR_SYNCHRONIZED = 0x25, // synchronized at slotOffset {0}\n- ERR_LARGE_TIMECORRECTION = 0x26, // large timeCorr.: {0} ticks (code loc. {1})\n- ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x27, // wrong state {0} in end of frame+sync\n- ERR_WRONG_STATE_IN_STARTSLOT = 0x28, // wrong state {0} in startSlot, at slotOffset {1}\n- ERR_WRONG_STATE_IN_TIMERFIRES = 0x29, // wrong state {0} in timer fires, at slotOffset {1}\n- ERR_WRONG_STATE_IN_NEWSLOT = 0x2a, // wrong state {0} in start of frame, at slotOffset {1}\n- ERR_WRONG_STATE_IN_ENDOFFRAME = 0x2b, // wrong state {0} in end of frame, at slotOffset {1}\n- ERR_MAXTXDATAPREPARE_OVERFLOW = 0x2c, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXACKPREPARE_OVERFLOWS = 0x2d, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x2e, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_MAXTXACKPREPARE_OVERFLOWS = 0x2f, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_WDDATADURATION_OVERFLOWS = 0x30, // wdDataDuration overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIO_OVERFLOWS = 0x31, // wdRadio overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIOTX_OVERFLOWS = 0x32, // wdRadioTx overflows while at state {0} in slotOffset {1}\n- ERR_WDACKDURATION_OVERFLOWS = 0x33, // wdAckDuration overflows while at state {0} in slotOffset {1}\n- ERR_SECURITY = 0x34, // security error on frameType {0}, code location {1}\n+ ERR_WRONG_CELLTYPE = 0x25, // wrong celltype {0} at slotOffset {1}\n+ ERR_IEEE154_UNSUPPORTED = 0x26, // unsupported IEEE802.15.4 parameter {1} at location {0}\n+ ERR_DESYNCHRONIZED = 0x27, // got desynchronized at slotOffset {0}\n+ ERR_SYNCHRONIZED = 0x28, // synchronized at slotOffset {0}\n+ ERR_LARGE_TIMECORRECTION = 0x29, // large timeCorr.: {0} ticks (code loc. {1})\n+ ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x2a, // wrong state {0} in end of frame+sync\n+ ERR_WRONG_STATE_IN_STARTSLOT = 0x2b, // wrong state {0} in startSlot, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_TIMERFIRES = 0x2c, // wrong state {0} in timer fires, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_NEWSLOT = 0x2d, // wrong state {0} in start of frame, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_ENDOFFRAME = 0x2e, // wrong state {0} in end of frame, at slotOffset {1}\n+ ERR_MAXTXDATAPREPARE_OVERFLOW = 0x2f, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXACKPREPARE_OVERFLOWS = 0x30, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x31, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_MAXTXACKPREPARE_OVERFLOWS = 0x32, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_WDDATADURATION_OVERFLOWS = 0x33, // wdDataDuration overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIO_OVERFLOWS = 0x34, // wdRadio overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIOTX_OVERFLOWS = 0x35, // wdRadioTx overflows while at state {0} in slotOffset {1}\n+ ERR_WDACKDURATION_OVERFLOWS = 0x36, // wdAckDuration overflows while at state {0} in slotOffset {1}\n+ ERR_SECURITY = 0x37, // security error on frameType {0}, code location {1}\n// cross layer\n- ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x35, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n- ERR_INPUT_BUFFER_OVERFLOW = 0x36, // the input buffer has overflown\n+ ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x38, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n+ ERR_INPUT_BUFFER_OVERFLOW = 0x39, // the input buffer has overflown\n// general\n- ERR_BUSY_SENDING = 0x37, // busy sending\n- ERR_UNEXPECTED_SENDDONE = 0x38, // sendDone for packet I didn't send\n- ERR_NO_FREE_PACKET_BUFFER = 0x39, // no free packet buffer (code location {0})\n- ERR_FREEING_UNUSED = 0x3a, // freeing unused memory\n- ERR_FREEING_ERROR = 0x3b, // freeing memory unsupported memory\n- ERR_UNSUPPORTED_COMMAND = 0x3c, // unsupported command {0}\n- ERR_MSG_UNKNOWN_TYPE = 0x3d, // unknown message type {0}\n- ERR_WRONG_ADDR_TYPE = 0x3e, // wrong address type {0} (code location {1})\n- ERR_BRIDGE_MISMATCH = 0x3f, // bridge mismatch (code location {0})\n- ERR_HEADER_TOO_LONG = 0x40, // header too long, length {1} (code location {0})\n- ERR_INPUTBUFFER_LENGTH = 0x41, // input length problem, length={0}\n- ERR_BOOTED = 0x42, // booted\n- ERR_INVALIDSERIALFRAME = 0x43, // invalid serial frame\n- ERR_INVALIDPACKETFROMRADIO = 0x44, // invalid packet from radio, length {1} (code location {0})\n- ERR_BUSY_RECEIVING = 0x45, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n- ERR_WRONG_CRC_INPUT = 0x46, // wrong CRC in input Buffer\n- ERR_PACKET_SYNC = 0x47, // synchronized when received a packet\n- ERR_SCHEDULE_ADDDUPLICATESLOT = 0x48, // the slot {0} to be added is already in schedule\n- ERR_UNSUPPORTED_FORMAT = 0x49, // the received packet format is not supported (code location {0})\n- ERR_UNSUPPORTED_METADATA = 0x4a, // the metadata type is not suppored\n- ERR_MAXRETRIES_REACHED = 0x4b, // maxretries reached (counter: {0})\n+ ERR_BUSY_SENDING = 0x3a, // busy sending\n+ ERR_UNEXPECTED_SENDDONE = 0x3b, // sendDone for packet I didn't send\n+ ERR_NO_FREE_PACKET_BUFFER = 0x3c, // no free packet buffer (code location {0})\n+ ERR_FREEING_UNUSED = 0x3d, // freeing unused memory\n+ ERR_FREEING_ERROR = 0x3e, // freeing memory unsupported memory\n+ ERR_UNSUPPORTED_COMMAND = 0x3f, // unsupported command {0}\n+ ERR_MSG_UNKNOWN_TYPE = 0x40, // unknown message type {0}\n+ ERR_WRONG_ADDR_TYPE = 0x41, // wrong address type {0} (code location {1})\n+ ERR_BRIDGE_MISMATCH = 0x42, // bridge mismatch (code location {0})\n+ ERR_HEADER_TOO_LONG = 0x43, // header too long, length {1} (code location {0})\n+ ERR_INPUTBUFFER_LENGTH = 0x44, // input length problem, length={0}\n+ ERR_BOOTED = 0x45, // booted\n+ ERR_INVALIDSERIALFRAME = 0x46, // invalid serial frame\n+ ERR_INVALIDPACKETFROMRADIO = 0x47, // invalid packet from radio, length {1} (code location {0})\n+ ERR_BUSY_RECEIVING = 0x48, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n+ ERR_WRONG_CRC_INPUT = 0x49, // wrong CRC in input Buffer\n+ ERR_PACKET_SYNC = 0x4a, // synchronized when received a packet\n+ ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4b, // the slot {0} to be added is already in schedule\n+ ERR_UNSUPPORTED_FORMAT = 0x4c, // the received packet format is not supported (code location {0})\n+ ERR_UNSUPPORTED_METADATA = 0x4d, // the metadata type is not suppored\n+ ERR_MAXRETRIES_REACHED = 0x4e, // maxretries reached (counter: {0})\n};\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "#define CHECK_OVERSIZED(size) \\\ndo { \\\n- if (size > ( MAX_PACKET_SIZE)) { \\\n+ if ((size) > (MAX_PACKET_SIZE)) { \\\nopenqueue_freePacketBuffer(msg); \\\nopenserial_printError( \\\nCOMPONENT_FRAG, \\\nERR_FRAG_INVALID_SIZE, \\\n- (errorparameter_t) size, \\\n+ (errorparameter_t) (size), \\\n(errorparameter_t) MAX_PACKET_SIZE \\\n); \\\nreturn; \\\n@@ -48,30 +48,39 @@ frag_vars_t frag_vars;\n//=========================== prototypes ======================================\nstatic void cleanup_fragments(uint16_t datagram_tag);\n-static void store_fragment(OpenQueueEntry_t* msg, uint8_t dispatch, uint16_t size, uint16_t tag, uint8_t offset);\n+\n+static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, uint8_t offset);\n+\nstatic void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *reassembled_msg);\n+static owerror_t allocate_vrb(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag);\n+\n+static void prepend_frag1_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag);\n+\n+static void prepend_fragn_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag, uint8_t offset);\n+\n+static void fast_forward_frags(uint16_t tag, uint16_t size);\n+\n//============================= public ========================================\nvoid frag_init() {\nmemset(&frag_vars, 0, sizeof(frag_vars_t));\n// unspecified start value, wraps around at 65535\n- frag_vars.tag = openrandom_get16b();\n+ frag_vars.tag = openrandom_get16b() & 0x7FF;\n}\nowerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nOpenQueueEntry_t *lowpan_fragment;\nuint16_t remaining_bytes;\n- uint16_t ds_field; // temporary dispatch | size field for fragmentation header\nuint8_t fragment_length;\nuint8_t fragment_offset;\nint8_t bpos;\n// check if fragmentation is necessary\n- if (msg->length > MAX_FRAGMENT_SIZE) {\n+ if (msg->is_big_packet && msg->length > (MAX_FRAGMENT_SIZE + FRAGN_HEADER_SIZE)) {\n- // update the global 6lowpan datagram tag\n+ // update the global 6LoWPAN datagram tag\nfrag_vars.tag++;\nremaining_bytes = msg->length;\nfragment_offset = 0;\n@@ -82,7 +91,7 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t* msg){\nlowpan_fragment = openqueue_getFreePacketBuffer(COMPONENT_FRAG);\nif (lowpan_fragment == NULL) {\n- // 6lowpan packet couldn't be entirely fragmented, thus clean up previously created fragments and exit.\n+ // 6LoWPAN packet couldn't be entirely fragmented, thus clean up previously created fragments and exit.\nopenserial_printError(\nCOMPONENT_FRAG,\nERR_NO_FREE_PACKET_BUFFER,\n@@ -109,7 +118,7 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t* msg){\n}\n}\n- // if fragmentation buffer is full, delete already created fragments and abandon here\n+ // if fragmentation buffer is full, delete previously created fragments and abandon here\nif (bpos == -1) {\nopenqueue_freePacketBuffer(lowpan_fragment);\n@@ -136,20 +145,10 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t* msg){\nremaining_bytes -= fragment_length;\n- // if first fragment, use frag1 header else use fragn header\nif (fragment_offset == 0) {\n- packetfunctions_reserveHeaderSize(lowpan_fragment, FRAG1_HEADER_SIZE);\n- ds_field = ((DISPATCH_FRAG_FIRST & 0x1F) << 11);\n- ds_field |= (msg->length & 0x7FF);\n- packetfunctions_htons(ds_field, (uint8_t *) &(((frag1_t *) lowpan_fragment->payload)->dispatch_size_field));\n- packetfunctions_htons(frag_vars.tag, (uint8_t *) &(((frag1_t *) lowpan_fragment->payload)->datagram_tag));\n+ prepend_frag1_header(lowpan_fragment, msg->length, frag_vars.tag);\n} else {\n- packetfunctions_reserveHeaderSize(lowpan_fragment, FRAGN_HEADER_SIZE);\n- ds_field = ((DISPATCH_FRAG_SUBSEQ & 0x1F) << 11);\n- ds_field |= (msg->length & 0x7FF);\n- packetfunctions_htons(ds_field, (uint8_t *) &(((fragn_t *) lowpan_fragment->payload)->dispatch_size_field));\n- packetfunctions_htons(frag_vars.tag, (uint8_t *) &(((fragn_t *) lowpan_fragment->payload)->datagram_tag));\n- ((fragn_t *) lowpan_fragment->payload)->datagram_offset = fragment_offset;\n+ prepend_fragn_header(lowpan_fragment, msg->length, frag_vars.tag, fragment_offset);\n}\n// update the fragment offset\n@@ -173,6 +172,21 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t* msg){\n// if we arrive here, all fragments were successfully created and passed to the MAC layer\nreturn E_SUCCESS;\n+ } else if (msg->l3_isFragment) {\n+ // this is a fragment (type frag1) that's being source routed\n+ // set nexthop in vrb and restore original frag1 header\n+\n+ for (uint8_t i = 0; i < NUM_OF_VRBS; i++) {\n+ if (frag_vars.vrbs[i].frag1 == msg) {\n+ memcpy(&frag_vars.vrbs[i].nexthop, &msg->l2_nextORpreviousHop, sizeof(open_addr_t));\n+ prepend_frag1_header(msg, frag_vars.vrbs[i].size, frag_vars.vrbs[i].tag);\n+ fast_forward_frags(frag_vars.vrbs[i].tag, frag_vars.vrbs[i].size);\n+ break;\n+ }\n+ }\n+\n+ // forward source routed fragment\n+ return sixtop_send(msg);\n} else {\nmsg->l3_isFragment = FALSE;\nreturn sixtop_send(msg);\n@@ -181,16 +195,18 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t* msg){\nvoid frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\n- bool frags_queued;\n+ bool frags_queued, upward_relay;\nuint16_t datagram_tag;\nOpenQueueEntry_t *original_msg;\n- if (msg->l3_isFragment){\n+ if (msg->l3_isFragment && !msg->l3_useSourceRouting) {\nfrags_queued = FALSE;\n+ upward_relay = FALSE;\n// delete sent fragment from fragment buffer\n- for (int i=0; i<FRAGMENT_BUFFER_SIZE; i++) {\n+ uint8_t i;\n+ for (i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\nif (frag_vars.fragmentBuf[i].pFragment == msg) {\ndatagram_tag = frag_vars.fragmentBuf[i].datagram_tag;\noriginal_msg = frag_vars.fragmentBuf[i].pOriginalMsg;\n@@ -200,7 +216,11 @@ void frag_sendDone(OpenQueueEntry_t* msg, owerror_t sendError) {\n}\n}\n- if (sendError == E_SUCCESS) {\n+ if (i >= FRAGMENT_BUFFER_SIZE) {\n+ upward_relay = TRUE;\n+ }\n+\n+ if (sendError == E_SUCCESS && upward_relay == FALSE) {\n// check if we have send all other fragments of the original packet\nfor (int i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\nif (frag_vars.fragmentBuf[i].datagram_tag == datagram_tag) {\n@@ -209,14 +229,19 @@ void frag_sendDone(OpenQueueEntry_t* msg, owerror_t sendError) {\n}\n}\n- if (frags_queued == FALSE)\n+ if (frags_queued == FALSE) {\niphc_sendDone(original_msg, sendError);\n+ }\n- } else {\n+ } else if (sendError == E_FAIL && upward_relay == FALSE) {\n// transmission failed, remove the other fragments that are not locked in for transmission\ncleanup_fragments(datagram_tag);\niphc_sendDone(original_msg, sendError);\n+ } else {\n+ openqueue_freePacketBuffer(msg);\n}\n+ } else if (msg->l3_isFragment && msg->l3_useSourceRouting) {\n+ openqueue_freePacketBuffer(msg);\n} else {\n// if the sent msg is not a fragment, just pass along to higher layer\niphc_sendDone(msg, sendError);\n@@ -229,23 +254,17 @@ void frag_receive(OpenQueueEntry_t* msg) {\nuint16_t size;\nuint16_t tag;\nuint8_t offset;\n-\n-\n- // ----- fast-forwarding fragments ------\nuint8_t page_length;\nipv6_header_iht ipv6_outer_header;\nipv6_header_iht ipv6_inner_header;\nmemset(&ipv6_outer_header, 0, sizeof(ipv6_header_iht));\nmemset(&ipv6_inner_header, 0, sizeof(ipv6_header_iht));\n- // --------------------------------------\n-\nmsg->owner = COMPONENT_FRAG;\ndispatch = (uint8_t)(packetfunctions_ntohs(msg->payload) >> 11);\nif (dispatch == DISPATCH_FRAG_FIRST) {\n-\n// first part of a fragment message\nsize = (uint16_t)(packetfunctions_ntohs(msg->payload) & 0x7FF);\ntag = (uint16_t)(packetfunctions_ntohs(msg->payload + 2));\n@@ -265,14 +284,16 @@ void frag_receive(OpenQueueEntry_t* msg) {\niphc_retrieveIPv6Header(msg, &ipv6_outer_header, &ipv6_inner_header, &page_length);\nif (idmanager_isMyAddress(&ipv6_inner_header.dest)) {\n- // if ipv6 packet is for me store\n- store_fragment(msg, dispatch, size, tag, offset);\n+ // if LoWPAN packet is for me, store it for reassembly\n+ store_fragment(msg, size, tag, offset);\n} else {\n// fast forwarding / source routing\n+ msg->creator = COMPONENT_FRAG;\n+ allocate_vrb(msg, size, tag);\n+ return iphc_receive(msg);\n}\n}\n} else if (dispatch == DISPATCH_FRAG_SUBSEQ) {\n-\nsize = (uint16_t)(packetfunctions_ntohs(msg->payload) & 0x7FF);\ntag = (uint16_t)(packetfunctions_ntohs(msg->payload + 2));\noffset = (uint8_t)((((fragn_t *) msg->payload)->datagram_offset));\n@@ -284,16 +305,49 @@ void frag_receive(OpenQueueEntry_t* msg) {\nif (idmanager_getIsDAGroot() == TRUE) {\nopenbridge_receive(msg);\n- return;\n} else {\n- // if I am not the dagroot, check for reassembly buffer\npacketfunctions_tossHeader(msg, FRAGN_HEADER_SIZE);\n- store_fragment(msg, dispatch, size, tag, offset);\n+\n+ uint8_t i;\n+ for (i = 0; i < NUM_OF_VRBS; i++) {\n+ if (frag_vars.vrbs[i].tag == tag &&\n+ frag_vars.vrbs[i].size == size &&\n+ frag_vars.vrbs[i].nexthop.type != ADDR_NONE)\n+ break;\n+ }\n+\n+ if (i < NUM_OF_VRBS) {\n+ // we have found a corresponding VRB for this subsequent fragment, update the fragment next hop\n+ msg->l3_useSourceRouting = TRUE;\n+ msg->creator = COMPONENT_FRAG;\n+\n+ memcpy(&msg->l2_nextORpreviousHop, &frag_vars.vrbs[i].nexthop, sizeof(open_addr_t));\n+ // update the VRB\n+ frag_vars.vrbs[i].left -= msg->length;\n+\n+ if (frag_vars.vrbs[i].left == 0) {\n+ // clear VRB entry\n+ openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_FAST_FORWARD, (errorparameter_t) tag,\n+ (errorparameter_t) size);\n+ memset(&frag_vars.vrbs[i], 0, sizeof(vrb_t));\n+ }\n+\n+ // restore fragn header\n+ prepend_fragn_header(msg, size, tag, offset);\n+ sixtop_send(msg);\n+ } else {\n+ // If VRB buffer does not exist, there are two scenarios\n+ // (1) I am the destination, thus store the fragment and attempt reassembly\n+ // (2) Subsequent fragment arrived out-of-order, also store and forward later\n+\n+ // TODO: temporarily store and send later\n+ store_fragment(msg, size, tag, offset);\n+ }\n}\n} else {\n// not a fragment\n- return iphc_receive(msg);\n+ iphc_receive(msg);\n}\n}\n@@ -307,9 +361,9 @@ static void cleanup_fragments(uint16_t datagram_tag) {\n}\n}\n-static void store_fragment(OpenQueueEntry_t* msg, uint8_t dispatch, uint16_t size, uint16_t tag, uint8_t offset) {\n- uint16_t total_wanted_bytes;\n- uint16_t received_bytes;\n+static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, uint8_t offset) {\n+ uint16_t total_wanted_bytes, received_bytes;\n+ uint8_t dropped_srh_len, count;\nbool do_reassemble;\n// we detect a duplicate fragment (if datagram_tag and offset are the same)\n@@ -334,36 +388,44 @@ static void store_fragment(OpenQueueEntry_t* msg, uint8_t dispatch, uint16_t siz\n// if we don't find any buffer space, delete all the related fragments\nif (i == FRAGMENT_BUFFER_SIZE) {\n- cleanup_fragments(tag);\nopenserial_printError(COMPONENT_FRAG, ERR_FRAG_BUFFER_OV, (errorparameter_t) 0, (errorparameter_t) 0);\n+ cleanup_fragments(tag);\nreturn;\n}\n// check if we have all the fragments\ntotal_wanted_bytes = size;\n- received_bytes = 0;\n+ received_bytes = dropped_srh_len = count = 0;\ndo_reassemble = FALSE;\nfor (int j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\nif (tag == frag_vars.fragmentBuf[j].datagram_tag) {\n- received_bytes += frag_vars.fragmentBuf[j].pFragment->length;\n+ if (frag_vars.fragmentBuf[j].datagram_offset == 0) {\n+ dropped_srh_len = MAX_FRAGMENT_SIZE - frag_vars.fragmentBuf[j].pFragment->length;\n+ received_bytes += (frag_vars.fragmentBuf[j].pFragment->length + dropped_srh_len);\n} else {\n- // TODO: packet from the future? Can happen when datagram_tag wraps around\n+ received_bytes += (frag_vars.fragmentBuf[j].pFragment->length);\n+ }\n+ }\n+ if (frag_vars.fragmentBuf[j].pFragment != NULL) {\n+ count++;\n}\n}\n- if (total_wanted_bytes == received_bytes)\n+ if (total_wanted_bytes == received_bytes) {\ndo_reassemble = TRUE;\n- else if (total_wanted_bytes < received_bytes)\n+ } else if (total_wanted_bytes < received_bytes) {\nboard_reset();\n- else\n+ } else {\ndo_reassemble = FALSE;\n+ openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_STORED, (errorparameter_t) count, (errorparameter_t) 0);\n+ }\nif (do_reassemble) {\nOpenQueueEntry_t *reassembled_msg;\nreassembled_msg = openqueue_getFreeBigPacketBuffer(COMPONENT_FRAG);\n- reassemble_fragments(tag, size, reassembled_msg);\n+ reassemble_fragments(tag, size - dropped_srh_len, reassembled_msg);\nif (reassembled_msg == NULL) {\nreturn;\n@@ -375,7 +437,7 @@ static void store_fragment(OpenQueueEntry_t* msg, uint8_t dispatch, uint16_t siz\nstatic void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *reassembled_msg) {\nuint8_t *ptr;\n- uint8_t offset;\n+ uint8_t offset = 0;\nif (reassembled_msg == NULL) {\nopenserial_printError(COMPONENT_FRAG, ERR_NO_FREE_PACKET_BUFFER, (errorparameter_t) 1, (errorparameter_t) 0);\n@@ -384,14 +446,15 @@ static void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *\n}\nreassembled_msg->is_big_packet = TRUE;\n+ reassembled_msg->length = size;\nfor (int i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\nif (frag_vars.fragmentBuf[i].pFragment != NULL && frag_vars.fragmentBuf[i].datagram_tag == tag) {\n- if (frag_vars.fragmentBuf[i].datagram_offset == 0 && frag_vars.fragmentBuf[i].pFragment->length < MAX_FRAGMENT_SIZE) {\n+ if (frag_vars.fragmentBuf[i].datagram_offset == 0 &&\n+ frag_vars.fragmentBuf[i].pFragment->length < MAX_FRAGMENT_SIZE) {\noffset = (MAX_FRAGMENT_SIZE - frag_vars.fragmentBuf[i].pFragment->length);\nptr = reassembled_msg->packet + offset;\n} else {\n- offset = 0;\nptr = reassembled_msg->packet + (frag_vars.fragmentBuf[i].datagram_offset * 8);\n}\n@@ -401,8 +464,60 @@ static void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *\n}\nopenserial_printInfo(COMPONENT_FRAG, ERR_FRAG_REASSEMBLED, (errorparameter_t) size, (errorparameter_t) tag);\n-\n- // update length and pointer to the start of the packet\n- reassembled_msg->length = size;\nreassembled_msg->payload = reassembled_msg->packet + offset;\n}\n+\n+static owerror_t allocate_vrb(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag) {\n+ // find an a vrb spot\n+ uint8_t i;\n+ for (i = 0; i < NUM_OF_VRBS; i++) {\n+ if (frag_vars.vrbs[i].tag == 0 && frag_vars.vrbs[i].size == 0) {\n+ frag_vars.vrbs[i].tag = tag;\n+ frag_vars.vrbs[i].size = size;\n+ frag_vars.vrbs[i].left = (size - MAX_FRAGMENT_SIZE);\n+ frag_vars.vrbs[i].frag1 = frag1;\n+ break;\n+ }\n+ }\n+\n+ if (i >= NUM_OF_VRBS)\n+ return E_FAIL;\n+ else\n+ return E_SUCCESS;\n+}\n+\n+static void fast_forward_frags(uint16_t tag, uint16_t size) {\n+ for (int i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\n+ // check if we have subsequent fragments stored.\n+ if (frag_vars.fragmentBuf[i].pFragment != NULL &&\n+ frag_vars.fragmentBuf[i].datagram_tag == tag &&\n+ frag_vars.fragmentBuf[i].datagram_offset != 0) {\n+ prepend_fragn_header(\n+ frag_vars.fragmentBuf[i].pFragment,\n+ size,\n+ frag_vars.fragmentBuf[i].datagram_tag,\n+ frag_vars.fragmentBuf[i].datagram_offset);\n+ sixtop_send(frag_vars.fragmentBuf[i].pFragment);\n+ }\n+ }\n+}\n+\n+static void prepend_frag1_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag) {\n+ uint16_t ds_field; // temporary dispatch | size field for fragmentation header\n+ packetfunctions_reserveHeaderSize(frag1, FRAG1_HEADER_SIZE);\n+ ds_field = ((DISPATCH_FRAG_FIRST & 0x1F) << 11);\n+ ds_field |= (size & 0x7FF);\n+ packetfunctions_htons(ds_field, (uint8_t * ) & (((frag1_t *) frag1->payload)->dispatch_size_field));\n+ packetfunctions_htons(tag, (uint8_t * ) & (((frag1_t *) frag1->payload)->datagram_tag));\n+}\n+\n+static void prepend_fragn_header(OpenQueueEntry_t *fragn, uint16_t size, uint16_t tag, uint8_t offset) {\n+ uint16_t ds_field; // temporary dispatch | size field for fragmentation header\n+ packetfunctions_reserveHeaderSize(fragn, FRAGN_HEADER_SIZE);\n+ ds_field = ((DISPATCH_FRAG_SUBSEQ & 0x1F) << 11);\n+ ds_field |= (size & 0x7FF);\n+ packetfunctions_htons(ds_field, (uint8_t * ) & (((fragn_t *) fragn->payload)->dispatch_size_field));\n+ packetfunctions_htons(tag, (uint8_t * ) & (((fragn_t *) fragn->payload)->datagram_tag));\n+ ((fragn_t *) fragn->payload)->datagram_offset = offset;\n+}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.h",
"new_path": "openstack/03a-IPHC/frag.h",
"diff": "//=========================== define ==========================================\n-#define FRAGMENT_BUFFER_SIZE 11\n+#define FRAGMENT_BUFFER_SIZE 15\n#define MAX_FRAGMENT_SIZE 96\n#define NUM_OF_VRBS 3\n#define MAX_PACKET_SIZE (FRAGMENT_BUFFER_SIZE * MAX_FRAGMENT_SIZE)\n@@ -56,7 +56,7 @@ typedef struct {\nuint16_t tag;\nuint16_t left;\nuint16_t size;\n- bool sourceRouting;\n+ OpenQueueEntry_t *frag1;\nopen_addr_t nexthop;\n} vrb_t;\n@@ -74,7 +74,9 @@ typedef struct {\n//=========================== prototypes ======================================\nvoid frag_init(void);\n+\nvoid frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError);\n+\nvoid frag_receive(OpenQueueEntry_t *msg);\nowerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg);\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/iphc.c",
"new_path": "openstack/03a-IPHC/iphc.c",
"diff": "#include \"opendefs.h\"\n#include \"iphc.h\"\n+#include \"sixtop.h\"\n#include \"packetfunctions.h\"\n#include \"idmanager.h\"\n#include \"openserial.h\"\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -713,6 +713,10 @@ functionsToChange = [\n'cleanup_fragments',\n'store_fragment',\n'reassemble_fragments',\n+ 'allocate_vrb',\n+ 'prepend_frag1_header',\n+ 'prepend_fragn_header',\n+ 'fast_forward_frags',\n# iphc\n'iphc_init',\n'iphc_sendFromForwarding',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Add support for source routing of fragments
(1) Bug fixes for upward routing.
(2) Fixed a bug in fragmentation layer.
(3) Update definitions opendefs.h
(4) Support for out-of-order fragment fast-forwarding
|
491,587 |
22.01.2020 15:44:25
| -3,600 |
b1afb38c5c8817566cf1da473334604166680aeb
|
Correctly formatted packetfunctions.c/.h
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -29,6 +29,7 @@ void packetfunctions_ip128bToMac64b(\nmac64btoWrite->type = ADDR_64B;\nmemcpy(mac64btoWrite->addr_64b, &(ip128b->addr_128b[8]), 8);\n}\n+\nvoid packetfunctions_mac64bToIp128b(\nopen_addr_t *prefix64b,\nopen_addr_t *mac64b,\n@@ -58,6 +59,7 @@ void packetfunctions_mac64bToMac16b(open_addr_t* mac64b, open_addr_t* mac16btoWr\nmac16btoWrite->addr_16b[0] = mac64b->addr_64b[6];\nmac16btoWrite->addr_16b[1] = mac64b->addr_64b[7];\n}\n+\nvoid packetfunctions_mac16bToMac64b(open_addr_t *mac16b, open_addr_t *mac64btoWrite) {\nif (mac16b->type != ADDR_16B) {\nopenserial_printCritical(COMPONENT_PACKETFUNCTIONS, ERR_WRONG_ADDR_TYPE,\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.h",
"new_path": "openstack/cross-layers/packetfunctions.h",
"diff": "// address translation\nvoid packetfunctions_ip128bToMac64b(open_addr_t *ip128b, open_addr_t *prefix64btoWrite, open_addr_t *mac64btoWrite);\n+\nvoid packetfunctions_mac64bToIp128b(open_addr_t *prefix64b, open_addr_t *mac64b, open_addr_t *ip128bToWrite);\n+\nvoid packetfunctions_mac64bToMac16b(open_addr_t *mac64b, open_addr_t *mac16btoWrite);\n+\nvoid packetfunctions_mac16bToMac64b(open_addr_t *mac16b, open_addr_t *mac64btoWrite);\n// address recognition\nbool packetfunctions_isBroadcastMulticast(open_addr_t *address);\n+\nbool packetfunctions_isAllRoutersMulticast(open_addr_t *address);\n+\nbool packetfunctions_isAllHostsMulticast(open_addr_t *address);\n+\nbool packetfunctions_sameAddress(open_addr_t *address_1, open_addr_t *address_2);\n+\nbool packetfunctions_isLinkLocal(open_addr_t *address);\n// read/write addresses to/from packets\nvoid packetfunctions_readAddress(uint8_t *payload, uint8_t type, open_addr_t *writeToAddress, bool littleEndian);\n+\nvoid packetfunctions_writeAddress(OpenQueueEntry_t *msg, open_addr_t *address, bool littleEndian);\n// reserving/tossing headers and footers\nvoid packetfunctions_reserveHeaderSize(OpenQueueEntry_t *pkt, uint16_t header_length);\n+\nvoid packetfunctions_tossHeader(OpenQueueEntry_t *pkt, uint16_t header_length);\n+\nvoid packetfunctions_reserveFooterSize(OpenQueueEntry_t *pkt, uint16_t header_length);\n+\nvoid packetfunctions_tossFooter(OpenQueueEntry_t *pkt, uint16_t header_length);\n// packet duplication\n@@ -46,6 +57,7 @@ void packetfunctions_duplicatePacket(OpenQueueEntry_t* dst, OpenQueueEntry_t* sr\n// calculate CRC\nvoid packetfunctions_calculateCRC(OpenQueueEntry_t *msg);\n+\nbool packetfunctions_checkCRC(OpenQueueEntry_t *msg);\n// calculate checksum\n@@ -53,9 +65,13 @@ void packetfunctions_calculateChecksum(OpenQueueEntry_t* msg, uint8_t* check\n// endianness\nvoid packetfunctions_htons(uint16_t val, uint8_t *dest);\n+\nuint16_t packetfunctions_ntohs(uint8_t *src);\n+\nvoid packetfunctions_htonl(uint32_t val, uint8_t *dest);\n+\nuint32_t packetfunctions_ntohl(uint8_t *src);\n+\nvoid packetfunctions_reverseArrayByteOrder(uint8_t *start, uint8_t len);\n/**\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Correctly formatted packetfunctions.c/.h
|
491,587 |
23.01.2020 16:04:39
| -3,600 |
906cbc31042c3327836a3cae309a224fb68465c9
|
Formatting uecho.c
|
[
{
"change_type": "MODIFY",
"old_path": "openapps/uecho/uecho.c",
"new_path": "openapps/uecho/uecho.c",
"diff": "@@ -24,7 +24,6 @@ void uecho_init(void) {\n}\nvoid uecho_receive(OpenQueueEntry_t *request) {\n- uint16_t temp_l4_destination_port;\nOpenQueueEntry_t *reply;\nif (request->length > 60) {\n@@ -49,9 +48,8 @@ void uecho_receive(OpenQueueEntry_t* request) {\n// reply with the same OpenQueueEntry_t\nreply->creator = COMPONENT_UECHO;\nreply->l4_protocol = IANA_UDP;\n- temp_l4_destination_port = request->l4_destination_port;\nreply->l4_destination_port = request->l4_sourcePortORicmpv6Type;\n- reply->l4_sourcePortORicmpv6Type = temp_l4_destination_port;\n+ reply->l4_sourcePortORicmpv6Type = request->l4_destination_port;\nreply->l3_destinationAdd.type = ADDR_128B;\n// copy source to destination to echo.\n@@ -59,6 +57,7 @@ void uecho_receive(OpenQueueEntry_t* request) {\npacketfunctions_reserveHeaderSize(reply, request->length);\nmemcpy(&reply->payload[0], &request->payload[0], request->length);\n+\nopenqueue_freePacketBuffer(request);\nif ((openudp_send(reply)) == E_FAIL) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Formatting uecho.c
|
491,587 |
27.01.2020 11:44:37
| -3,600 |
2a6200d7dd80cb5c790e1038a3d2b757c8ad8547
|
Add a reassembly timeout mechanism
+ support for large ICMPv6 echo response
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -218,60 +218,62 @@ enum {\nERR_FRAG_INVALID_SIZE = 0x1a, // invalid original packet size ({0} > {1})\nERR_FRAG_REASSEMBLED = 0x1b, // reassembled fragments into big packet (size: {0}, tag: {1})\nERR_FRAG_FAST_FORWARD = 0x1c, // fast-forwarded all fragments with tag {0} (total size: {1})\n- ERR_FRAG_STORED = 0x1d, // stored a fragment (currently in buffer: {0})\n+ ERR_FRAG_STORED = 0x1d, // stored a fragment with offset {0} (currently in buffer: {1})\n+ ERR_FRAG_TX_FAIL = 0x1e, // failed to send fragment with tag {0} (offset: {1})\n+ ERR_FRAG_REASSEMBLY_TIMEOUT = 0x1f, // reassembly timer expired for fragments with tag {0}\n// l2b\n- ERR_NEIGHBORS_FULL = 0x1e, // neighbors table is full (max number of neighbor is {0})\n- ERR_NO_SENT_PACKET = 0x1f, // there is no sent packet in queue\n- ERR_NO_RECEIVED_PACKET = 0x20, // there is no received packet in queue\n- ERR_SCHEDULE_OVERFLOWN = 0x21, // schedule overflown\n- ERR_SIXTOP_RETURNCODE = 0x22, // sixtop return code {0} at sixtop state {1}\n- ERR_SIXTOP_COUNT = 0x23, // there are {0} cells to request mote\n- ERR_SIXTOP_LIST = 0x24, // the cells reserved to request mote contains slot {0} and slot {1}\n- // l2a\n- ERR_WRONG_CELLTYPE = 0x25, // wrong celltype {0} at slotOffset {1}\n- ERR_IEEE154_UNSUPPORTED = 0x26, // unsupported IEEE802.15.4 parameter {1} at location {0}\n- ERR_DESYNCHRONIZED = 0x27, // got desynchronized at slotOffset {0}\n- ERR_SYNCHRONIZED = 0x28, // synchronized at slotOffset {0}\n- ERR_LARGE_TIMECORRECTION = 0x29, // large timeCorr.: {0} ticks (code loc. {1})\n- ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x2a, // wrong state {0} in end of frame+sync\n- ERR_WRONG_STATE_IN_STARTSLOT = 0x2b, // wrong state {0} in startSlot, at slotOffset {1}\n- ERR_WRONG_STATE_IN_TIMERFIRES = 0x2c, // wrong state {0} in timer fires, at slotOffset {1}\n- ERR_WRONG_STATE_IN_NEWSLOT = 0x2d, // wrong state {0} in start of frame, at slotOffset {1}\n- ERR_WRONG_STATE_IN_ENDOFFRAME = 0x2e, // wrong state {0} in end of frame, at slotOffset {1}\n- ERR_MAXTXDATAPREPARE_OVERFLOW = 0x2f, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXACKPREPARE_OVERFLOWS = 0x30, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x31, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_MAXTXACKPREPARE_OVERFLOWS = 0x32, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_WDDATADURATION_OVERFLOWS = 0x33, // wdDataDuration overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIO_OVERFLOWS = 0x34, // wdRadio overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIOTX_OVERFLOWS = 0x35, // wdRadioTx overflows while at state {0} in slotOffset {1}\n- ERR_WDACKDURATION_OVERFLOWS = 0x36, // wdAckDuration overflows while at state {0} in slotOffset {1}\n- ERR_SECURITY = 0x37, // security error on frameType {0}, code location {1}\n+ ERR_NEIGHBORS_FULL = 0x20, // neighbors table is full (max number of neighbor is {0})\n+ ERR_NO_SENT_PACKET = 0x21, // there is no sent packet in queue\n+ ERR_NO_RECEIVED_PACKET = 0x22, // there is no received packet in queue\n+ ERR_SCHEDULE_OVERFLOWN = 0x23, // schedule overflown\n+ ERR_SIXTOP_RETURNCODE = 0x24, // sixtop return code {0} at sixtop state {1}\n+ ERR_SIXTOP_COUNT = 0x25, // there are {0} cells to request mote\n+ ERR_SIXTOP_LIST = 0x26, // the cells reserved to request mote contains slot {0} and slot {1}\n+ // l3a\n+ ERR_WRONG_CELLTYPE = 0x27, // wrong celltype {0} at slotOffset {1}\n+ ERR_IEEE154_UNSUPPORTED = 0x28, // unsupported IEEE802.15.4 parameter {1} at location {0}\n+ ERR_DESYNCHRONIZED = 0x29, // got desynchronized at slotOffset {0}\n+ ERR_SYNCHRONIZED = 0x2a, // synchronized at slotOffset {0}\n+ ERR_LARGE_TIMECORRECTION = 0x2b, // large timeCorr.: {0} ticks (code loc. {1})\n+ ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x2c, // wrong state {0} in end of frame+sync\n+ ERR_WRONG_STATE_IN_STARTSLOT = 0x2d, // wrong state {0} in startSlot, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_TIMERFIRES = 0x2e, // wrong state {0} in timer fires, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_NEWSLOT = 0x2f, // wrong state {0} in start of frame, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_ENDOFFRAME = 0x30, // wrong state {0} in end of frame, at slotOffset {1}\n+ ERR_MAXTXDATAPREPARE_OVERFLOW = 0x31, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXACKPREPARE_OVERFLOWS = 0x32, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x33, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_MAXTXACKPREPARE_OVERFLOWS = 0x34, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_WDDATADURATION_OVERFLOWS = 0x35, // wdDataDuration overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIO_OVERFLOWS = 0x36, // wdRadio overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIOTX_OVERFLOWS = 0x37, // wdRadioTx overflows while at state {0} in slotOffset {1}\n+ ERR_WDACKDURATION_OVERFLOWS = 0x38, // wdAckDuration overflows while at state {0} in slotOffset {1}\n+ ERR_SECURITY = 0x39, // security error on frameType {0}, code location {1}\n// cross layer\n- ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x38, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n- ERR_INPUT_BUFFER_OVERFLOW = 0x39, // the input buffer has overflown\n+ ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x3a, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n+ ERR_INPUT_BUFFER_OVERFLOW = 0x3b, // the input buffer has overflown\n// general\n- ERR_BUSY_SENDING = 0x3a, // busy sending\n- ERR_UNEXPECTED_SENDDONE = 0x3b, // sendDone for packet I didn't send\n- ERR_NO_FREE_PACKET_BUFFER = 0x3c, // no free packet buffer (code location {0})\n- ERR_FREEING_UNUSED = 0x3d, // freeing unused memory\n- ERR_FREEING_ERROR = 0x3e, // freeing memory unsupported memory\n- ERR_UNSUPPORTED_COMMAND = 0x3f, // unsupported command {0}\n- ERR_MSG_UNKNOWN_TYPE = 0x40, // unknown message type {0}\n- ERR_WRONG_ADDR_TYPE = 0x41, // wrong address type {0} (code location {1})\n- ERR_BRIDGE_MISMATCH = 0x42, // bridge mismatch (code location {0})\n- ERR_HEADER_TOO_LONG = 0x43, // header too long, length {1} (code location {0})\n- ERR_INPUTBUFFER_LENGTH = 0x44, // input length problem, length={0}\n- ERR_BOOTED = 0x45, // booted\n- ERR_INVALIDSERIALFRAME = 0x46, // invalid serial frame\n- ERR_INVALIDPACKETFROMRADIO = 0x47, // invalid packet from radio, length {1} (code location {0})\n- ERR_BUSY_RECEIVING = 0x48, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n- ERR_WRONG_CRC_INPUT = 0x49, // wrong CRC in input Buffer\n- ERR_PACKET_SYNC = 0x4a, // synchronized when received a packet\n- ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4b, // the slot {0} to be added is already in schedule\n- ERR_UNSUPPORTED_FORMAT = 0x4c, // the received packet format is not supported (code location {0})\n- ERR_UNSUPPORTED_METADATA = 0x4d, // the metadata type is not suppored\n- ERR_MAXRETRIES_REACHED = 0x4e, // maxretries reached (counter: {0})\n+ ERR_BUSY_SENDING = 0x3c, // busy sending\n+ ERR_UNEXPECTED_SENDDONE = 0x3d, // sendDone for packet I didn't send\n+ ERR_NO_FREE_PACKET_BUFFER = 0x3e, // no free packet buffer (code location {0})\n+ ERR_FREEING_UNUSED = 0x3f, // freeing unused memory\n+ ERR_FREEING_ERROR = 0x40, // freeing memory unsupported memory\n+ ERR_UNSUPPORTED_COMMAND = 0x41, // unsupported command {0}\n+ ERR_MSG_UNKNOWN_TYPE = 0x42, // unknown message type {0}\n+ ERR_WRONG_ADDR_TYPE = 0x43, // wrong address type {0} (code location {1})\n+ ERR_BRIDGE_MISMATCH = 0x44, // bridge mismatch (code location {0})\n+ ERR_HEADER_TOO_LONG = 0x45, // header too long, length {1} (code location {0})\n+ ERR_INPUTBUFFER_LENGTH = 0x46, // input length problem, length={0}\n+ ERR_BOOTED = 0x47, // booted\n+ ERR_INVALIDSERIALFRAME = 0x48, // invalid serial frame\n+ ERR_INVALIDPACKETFROMRADIO = 0x49, // invalid packet from radio, length {1} (code location {0})\n+ ERR_BUSY_RECEIVING = 0x4a, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n+ ERR_WRONG_CRC_INPUT = 0x4b, // wrong CRC in input Buffer\n+ ERR_PACKET_SYNC = 0x4c, // synchronized when received a packet\n+ ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4d, // the slot {0} to be added is already in schedule\n+ ERR_UNSUPPORTED_FORMAT = 0x4e, // the received packet format is not supported (code location {0})\n+ ERR_UNSUPPORTED_METADATA = 0x4f, // the metadata type is not suppored\n+ ERR_MAXRETRIES_REACHED = 0x50, // maxretries reached (counter: {0})\n};\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "kernel/scheduler.h",
"new_path": "kernel/scheduler.h",
"diff": "@@ -20,18 +20,19 @@ typedef enum {\n// tasks triggered by timers\nTASKPRIO_OPENTIMERS = 0x03,\nTASKPRIO_SIXTOP = 0x04,\n- TASKPRIO_IPHC = 0x05,\n- TASKPRIO_RPL = 0x06,\n- TASKPRIO_UDP = 0x07,\n- TASKPRIO_COAP = 0x08,\n- TASKPRIO_ADAPTIVE_SYNC = 0x09,\n- TASKPRIO_MSF = 0x0a,\n+ TASKPRIO_FRAG = 0x05,\n+ TASKPRIO_IPHC = 0x06,\n+ TASKPRIO_RPL = 0x07,\n+ TASKPRIO_UDP = 0x08,\n+ TASKPRIO_COAP = 0x09,\n+ TASKPRIO_ADAPTIVE_SYNC = 0x0a,\n+ TASKPRIO_MSF = 0x0b,\n// tasks trigger by other interrupts\n- TASKPRIO_BUTTON = 0x0b,\n- TASKPRIO_SIXTOP_TIMEOUT = 0x0c,\n- TASKPRIO_SNIFFER = 0x0d,\n- TASKPRIO_OPENSERIAL = 0X0e,\n- TASKPRIO_MAX = 0x0f,\n+ TASKPRIO_BUTTON = 0x0c,\n+ TASKPRIO_SIXTOP_TIMEOUT = 0x0d,\n+ TASKPRIO_SNIFFER = 0x0e,\n+ TASKPRIO_OPENSERIAL = 0X0f,\n+ TASKPRIO_MAX = 0x10,\n} task_prio_t;\n#define TASK_LIST_DEPTH 10\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "#include \"packetfunctions.h\"\n#include \"idmanager.h\"\n#include \"board.h\"\n-\n+#include \"opentimers.h\"\n+#include \"scheduler.h\"\n//============================= macros ========================================\n@@ -59,7 +60,9 @@ static void prepend_frag1_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_\nstatic void prepend_fragn_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag, uint8_t offset);\n-static void fast_forward_frags(uint16_t tag, uint16_t size);\n+static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos);\n+\n+void frag_timeout_cb(opentimers_id_t id);\n//============================= public ========================================\n@@ -160,6 +163,9 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nif (frag_vars.fragmentBuf[i].datagram_tag == frag_vars.tag) {\n// try to send the fragment. If this fails, abort the transmission of the other fragments.\nif (sixtop_send(frag_vars.fragmentBuf[i].pFragment) == E_FAIL) {\n+ openserial_printError(COMPONENT_FRAG, ERR_FRAG_TX_FAIL,\n+ (errorparameter_t) frag_vars.tag,\n+ (errorparameter_t) frag_vars.fragmentBuf[i].datagram_offset);\ncleanup_fragments(frag_vars.tag);\nreturn E_FAIL;\n} else {\n@@ -180,7 +186,7 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nif (frag_vars.vrbs[i].frag1 == msg) {\nmemcpy(&frag_vars.vrbs[i].nexthop, &msg->l2_nextORpreviousHop, sizeof(open_addr_t));\nprepend_frag1_header(msg, frag_vars.vrbs[i].size, frag_vars.vrbs[i].tag);\n- fast_forward_frags(frag_vars.vrbs[i].tag, frag_vars.vrbs[i].size);\n+ fast_forward_frags(frag_vars.vrbs[i].tag, frag_vars.vrbs[i].size, i);\nbreak;\n}\n}\n@@ -364,14 +370,21 @@ static void cleanup_fragments(uint16_t datagram_tag) {\nstatic void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, uint8_t offset) {\nuint16_t total_wanted_bytes, received_bytes;\nuint8_t dropped_srh_len, count;\n- bool do_reassemble;\n+ bool do_reassemble, has_timer;\n// we detect a duplicate fragment (if datagram_tag and offset are the same)\n+ // check if we have running reassembly timer\nfor (int i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\nif (frag_vars.fragmentBuf[i].datagram_tag == tag && frag_vars.fragmentBuf[i].datagram_offset == offset) {\nopenqueue_freePacketBuffer(msg);\nreturn;\n}\n+\n+ if (frag_vars.fragmentBuf[i].datagram_tag == tag && frag_vars.fragmentBuf[i].reassembly_timer != 0) {\n+ has_timer = TRUE;\n+ } else {\n+ has_timer = FALSE;\n+ }\n}\n// we find buffer space for a new fragment (new datagram_tag)\n@@ -382,6 +395,17 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\nfrag_vars.fragmentBuf[i].datagram_offset = offset;\nfrag_vars.fragmentBuf[i].pFragment = msg;\nfrag_vars.fragmentBuf[i].pOriginalMsg = NULL;\n+\n+ if (has_timer) {\n+ frag_vars.fragmentBuf[i].reassembly_timer = opentimers_create(TIMER_GENERAL_PURPOSE, TASKPRIO_FRAG);\n+ opentimers_scheduleAbsolute(\n+ frag_vars.fragmentBuf[i].reassembly_timer,\n+ FRAG_REASSEMBLY_TIMEOUT,\n+ opentimers_getValue(),\n+ TIME_MS,\n+ frag_timeout_cb\n+ );\n+ }\nbreak;\n}\n}\n@@ -418,7 +442,7 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\nboard_reset();\n} else {\ndo_reassemble = FALSE;\n- openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_STORED, (errorparameter_t) count, (errorparameter_t) 0);\n+ openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_STORED, (errorparameter_t) offset, (errorparameter_t) count);\n}\nif (do_reassemble) {\n@@ -459,6 +483,13 @@ static void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *\n}\nmemcpy(ptr, frag_vars.fragmentBuf[i].pFragment->payload, frag_vars.fragmentBuf[i].pFragment->length);\n+\n+ if (frag_vars.fragmentBuf[i].reassembly_timer != 0) {\n+ opentimers_cancel(frag_vars.fragmentBuf[i].reassembly_timer);\n+ opentimers_destroy(frag_vars.fragmentBuf[i].reassembly_timer);\n+ }\n+\n+\nRESET_FRAG_BUFFER_ENTRY(i);\n}\n}\n@@ -486,18 +517,39 @@ static owerror_t allocate_vrb(OpenQueueEntry_t *frag1, uint16_t size, uint16_t t\nreturn E_SUCCESS;\n}\n-static void fast_forward_frags(uint16_t tag, uint16_t size) {\n+static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos) {\nfor (int i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\n// check if we have subsequent fragments stored.\nif (frag_vars.fragmentBuf[i].pFragment != NULL &&\nfrag_vars.fragmentBuf[i].datagram_tag == tag &&\nfrag_vars.fragmentBuf[i].datagram_offset != 0) {\n+\n+ frag_vars.fragmentBuf[i].pFragment->creator = COMPONENT_FRAG;\n+ frag_vars.fragmentBuf[i].pFragment->l3_useSourceRouting = TRUE;\n+\n+ // provide the stored fragment with the right next hop address\n+ memcpy(&frag_vars.fragmentBuf[i].pFragment->l2_nextORpreviousHop,\n+ &frag_vars.vrbs[vrb_pos].nexthop,\n+ sizeof(open_addr_t)\n+ );\n+ // update the VRB\n+ frag_vars.vrbs[vrb_pos].left -= frag_vars.fragmentBuf[i].pFragment->length;\n+\n+ if (frag_vars.vrbs[i].left == 0) {\n+ // clear VRB entry\n+ openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_FAST_FORWARD, (errorparameter_t) tag,\n+ (errorparameter_t) size);\n+ memset(&frag_vars.vrbs[i], 0, sizeof(vrb_t));\n+ }\n+\nprepend_fragn_header(\nfrag_vars.fragmentBuf[i].pFragment,\nsize,\nfrag_vars.fragmentBuf[i].datagram_tag,\nfrag_vars.fragmentBuf[i].datagram_offset);\n+\nsixtop_send(frag_vars.fragmentBuf[i].pFragment);\n+ RESET_FRAG_BUFFER_ENTRY(i);\n}\n}\n}\n@@ -521,3 +573,21 @@ static void prepend_fragn_header(OpenQueueEntry_t *fragn, uint16_t size, uint16_\n((fragn_t *) fragn->payload)->datagram_offset = offset;\n}\n+void frag_timeout_cb(opentimers_id_t id) {\n+ uint16_t expired_tag;\n+ uint8_t j;\n+\n+ // find the tag of the expired fragments\n+ for (j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\n+ if (frag_vars.fragmentBuf[j].reassembly_timer == id) {\n+ expired_tag = frag_vars.fragmentBuf[j].datagram_tag;\n+ }\n+ }\n+\n+\n+ if (j < FRAGMENT_BUFFER_SIZE) {\n+ openserial_printError(COMPONENT_FRAG, ERR_FRAG_REASSEMBLY_TIMEOUT, (errorparameter_t) expired_tag,\n+ (errorparameter_t) 0);\n+ cleanup_fragments(expired_tag);\n+ }\n+}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.h",
"new_path": "openstack/03a-IPHC/frag.h",
"diff": "#include \"opendefs.h\"\n#include \"openqueue.h\"\n+#include \"opentimers.h\"\n//=========================== define ==========================================\n#define DISPATCH_FRAG_FIRST 24\n#define DISPATCH_FRAG_SUBSEQ 28\n+#define FRAG_REASSEMBLY_TIMEOUT 60000\n// 6lowpan fragment1 header\ntypedef struct {\n@@ -44,6 +46,7 @@ struct fragment_t {\nbool lock;\nuint8_t datagram_offset;\nuint16_t datagram_tag;\n+ opentimers_id_t reassembly_timer;\nOpenQueueEntry_t *pFragment;\nOpenQueueEntry_t *pOriginalMsg;\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6echo.c",
"new_path": "openstack/03b-IPv6/icmpv6echo.c",
"diff": "@@ -102,7 +102,11 @@ void icmpv6echo_receive(OpenQueueEntry_t* msg) {\n(errorparameter_t) 0);\nif (icmpv6echo_vars.isReplyEnabled) {\n// get a new openqueuEntry_t for the echo reply\n+ if (msg->length > 65)\n+ reply = openqueue_getFreeBigPacketBuffer(COMPONENT_ICMPv6ECHO);\n+ else\nreply = openqueue_getFreePacketBuffer(COMPONENT_ICMPv6ECHO);\n+\nif (reply == NULL) {\nopenserial_printError(COMPONENT_ICMPv6ECHO, ERR_NO_FREE_PACKET_BUFFER,\n(errorparameter_t) 1,\n@@ -125,7 +129,8 @@ void icmpv6echo_receive(OpenQueueEntry_t* msg) {\nreply->l4_protocol = IANA_ICMPv6;\nreply->l4_sourcePortORicmpv6Type = IANA_ICMPv6_ECHO_REPLY;\n((ICMPv6_ht *) (reply->payload))->type = reply->l4_sourcePortORicmpv6Type;\n- packetfunctions_calculateChecksum(reply,(uint8_t*)&(((ICMPv6_ht*)(reply->payload))->checksum));//do last\n+ packetfunctions_calculateChecksum(reply,\n+ (uint8_t * ) & (((ICMPv6_ht *) (reply->payload))->checksum));//do last\nicmpv6echo_vars.busySending = TRUE;\nif (icmpv6_send(reply) != E_SUCCESS) {\nicmpv6echo_vars.busySending = FALSE;\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -233,6 +233,7 @@ callbackFunctionsToChange = [\n'cb_sf_getMetadata',\n'cb_sf_translateMetadata',\n'cb_sf_handleRCError',\n+ # frag\n# iphc\n# openbridge\n# forwarding\n@@ -717,6 +718,7 @@ functionsToChange = [\n'prepend_frag1_header',\n'prepend_fragn_header',\n'fast_forward_frags',\n+ 'frag_timeout_cb',\n# iphc\n'iphc_init',\n'iphc_sendFromForwarding',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Add a reassembly timeout mechanism
+ support for large ICMPv6 echo response
|
491,587 |
03.02.2020 18:57:43
| -3,600 |
ba4010514352b48e4e923e449e4e0b6aa06d3269
|
Fixes issue when forwarding out-of-order fragments.
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "@@ -247,7 +247,23 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\nopenqueue_freePacketBuffer(msg);\n}\n} else if (msg->l3_isFragment && msg->l3_useSourceRouting) {\n+ uint8_t k;\n+\n+ for (k = 0; k < FRAGMENT_BUFFER_SIZE; k++) {\n+ if (frag_vars.fragmentBuf[k].pFragment == msg) {\n+ datagram_tag = frag_vars.fragmentBuf[k].datagram_tag;\n+ original_msg = frag_vars.fragmentBuf[k].pOriginalMsg;\n+ UNLOCK(frag_vars.fragmentBuf[k]);\n+ RESET_FRAG_BUFFER_ENTRY(k);\n+ break;\n+ }\n+ }\n+\n+ if (k >= FRAGMENT_BUFFER_SIZE) {\n+ // fragment not found in buffer\nopenqueue_freePacketBuffer(msg);\n+ }\n+\n} else {\n// if the sent msg is not a fragment, just pass along to higher layer\niphc_sendDone(msg, sendError);\n@@ -370,7 +386,7 @@ static void cleanup_fragments(uint16_t datagram_tag) {\nstatic void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, uint8_t offset) {\nuint16_t total_wanted_bytes, received_bytes;\nuint8_t dropped_srh_len, count;\n- bool do_reassemble, has_timer;\n+ bool do_reassemble, has_timer = FALSE;\n// we detect a duplicate fragment (if datagram_tag and offset are the same)\n// check if we have running reassembly timer\n@@ -382,8 +398,6 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\nif (frag_vars.fragmentBuf[i].datagram_tag == tag && frag_vars.fragmentBuf[i].reassembly_timer != 0) {\nhas_timer = TRUE;\n- } else {\n- has_timer = FALSE;\n}\n}\n@@ -396,7 +410,7 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\nfrag_vars.fragmentBuf[i].pFragment = msg;\nfrag_vars.fragmentBuf[i].pOriginalMsg = NULL;\n- if (has_timer) {\n+ if (!has_timer) {\nfrag_vars.fragmentBuf[i].reassembly_timer = opentimers_create(TIMER_GENERAL_PURPOSE, TASKPRIO_FRAG);\nopentimers_scheduleAbsolute(\nfrag_vars.fragmentBuf[i].reassembly_timer,\n@@ -438,6 +452,7 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\nif (total_wanted_bytes == received_bytes) {\ndo_reassemble = TRUE;\n+ openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_STORED, (errorparameter_t) offset, (errorparameter_t) count);\n} else if (total_wanted_bytes < received_bytes) {\nboard_reset();\n} else {\n@@ -489,7 +504,6 @@ static void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *\nopentimers_destroy(frag_vars.fragmentBuf[i].reassembly_timer);\n}\n-\nRESET_FRAG_BUFFER_ENTRY(i);\n}\n}\n@@ -532,14 +546,20 @@ static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos) {\n&frag_vars.vrbs[vrb_pos].nexthop,\nsizeof(open_addr_t)\n);\n+\n// update the VRB\nfrag_vars.vrbs[vrb_pos].left -= frag_vars.fragmentBuf[i].pFragment->length;\n- if (frag_vars.vrbs[i].left == 0) {\n- // clear VRB entry\n+ if (frag_vars.vrbs[vrb_pos].left == 0) {\n+ // clear VRB entry if all data is forwarded\nopenserial_printInfo(COMPONENT_FRAG, ERR_FRAG_FAST_FORWARD, (errorparameter_t) tag,\n(errorparameter_t) size);\n- memset(&frag_vars.vrbs[i], 0, sizeof(vrb_t));\n+ memset(&frag_vars.vrbs[vrb_pos], 0, sizeof(vrb_t));\n+ }\n+\n+ if (frag_vars.fragmentBuf[i].reassembly_timer != 0) {\n+ opentimers_cancel(frag_vars.fragmentBuf[i].reassembly_timer);\n+ opentimers_destroy(frag_vars.fragmentBuf[i].reassembly_timer);\n}\nprepend_fragn_header(\n@@ -548,8 +568,12 @@ static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos) {\nfrag_vars.fragmentBuf[i].datagram_tag,\nfrag_vars.fragmentBuf[i].datagram_offset);\n- sixtop_send(frag_vars.fragmentBuf[i].pFragment);\n- RESET_FRAG_BUFFER_ENTRY(i);\n+ LOCK(frag_vars.fragmentBuf[i]);\n+ if (sixtop_send(frag_vars.fragmentBuf[i].pFragment) == E_FAIL) {\n+ openserial_printError(COMPONENT_FRAG, ERR_FRAG_TX_FAIL,\n+ (errorparameter_t) frag_vars.fragmentBuf[i].datagram_tag,\n+ (errorparameter_t) frag_vars.fragmentBuf[i].datagram_offset);\n+ };\n}\n}\n}\n@@ -577,6 +601,7 @@ void frag_timeout_cb(opentimers_id_t id) {\nuint16_t expired_tag;\nuint8_t j;\n+\n// find the tag of the expired fragments\nfor (j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\nif (frag_vars.fragmentBuf[j].reassembly_timer == id) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Fixes issue when forwarding out-of-order fragments.
|
491,587 |
04.02.2020 18:12:11
| -3,600 |
a2adc2160e7a678890921b48bf3c52ec3ac14faf
|
Fixes the fragment buffer and VRB cleanup functions
When a fragment is received, a node schedules a 60 timeout either for the reassembly buffer or fast-forwarding VRB. If not all bytes are received within this 60s interval, all fragments are dropped and the buffers are liberated.
|
[
{
"change_type": "MODIFY",
"old_path": "drivers/common/opentimers.c",
"new_path": "drivers/common/opentimers.c",
"diff": "@@ -269,8 +269,7 @@ This function should be called in the callback of the timer interrupt.\n\\param[in] id the timer id\n\\param[in] duration the timer duration\n*/\n-void opentimers_updateDuration(opentimers_id_t id,\n- PORT_TIMER_WIDTH duration){\n+void opentimers_updateDuration(opentimers_id_t id, PORT_TIMER_WIDTH duration){\nINTERRUPT_DECLARATION();\nDISABLE_INTERRUPTS();\n"
},
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -220,7 +220,7 @@ enum {\nERR_FRAG_FAST_FORWARD = 0x1c, // fast-forwarded all fragments with tag {0} (total size: {1})\nERR_FRAG_STORED = 0x1d, // stored a fragment with offset {0} (currently in buffer: {1})\nERR_FRAG_TX_FAIL = 0x1e, // failed to send fragment with tag {0} (offset: {1})\n- ERR_FRAG_REASSEMBLY_TIMEOUT = 0x1f, // reassembly timer expired for fragments with tag {0}\n+ ERR_FRAG_REASSEMBLY_OR_VRB_TIMEOUT = 0x1f, // reassembly or vrb timer expired for fragments with tag {0}\n// l2b\nERR_NEIGHBORS_FULL = 0x20, // neighbors table is full (max number of neighbor is {0})\nERR_NO_SENT_PACKET = 0x21, // there is no sent packet in queue\n@@ -256,24 +256,26 @@ enum {\nERR_BUSY_SENDING = 0x3c, // busy sending\nERR_UNEXPECTED_SENDDONE = 0x3d, // sendDone for packet I didn't send\nERR_NO_FREE_PACKET_BUFFER = 0x3e, // no free packet buffer (code location {0})\n- ERR_FREEING_UNUSED = 0x3f, // freeing unused memory\n- ERR_FREEING_ERROR = 0x40, // freeing memory unsupported memory\n- ERR_UNSUPPORTED_COMMAND = 0x41, // unsupported command {0}\n- ERR_MSG_UNKNOWN_TYPE = 0x42, // unknown message type {0}\n- ERR_WRONG_ADDR_TYPE = 0x43, // wrong address type {0} (code location {1})\n- ERR_BRIDGE_MISMATCH = 0x44, // bridge mismatch (code location {0})\n- ERR_HEADER_TOO_LONG = 0x45, // header too long, length {1} (code location {0})\n- ERR_INPUTBUFFER_LENGTH = 0x46, // input length problem, length={0}\n- ERR_BOOTED = 0x47, // booted\n- ERR_INVALIDSERIALFRAME = 0x48, // invalid serial frame\n- ERR_INVALIDPACKETFROMRADIO = 0x49, // invalid packet from radio, length {1} (code location {0})\n- ERR_BUSY_RECEIVING = 0x4a, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n- ERR_WRONG_CRC_INPUT = 0x4b, // wrong CRC in input Buffer\n- ERR_PACKET_SYNC = 0x4c, // synchronized when received a packet\n- ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4d, // the slot {0} to be added is already in schedule\n- ERR_UNSUPPORTED_FORMAT = 0x4e, // the received packet format is not supported (code location {0})\n- ERR_UNSUPPORTED_METADATA = 0x4f, // the metadata type is not suppored\n- ERR_MAXRETRIES_REACHED = 0x50, // maxretries reached (counter: {0})\n+ ERR_NO_FREE_TIMER_OR_QUEUE_ENTRY = 0x3f, // no free timer or queue entry (code location {0})\n+ ERR_FREEING_UNUSED = 0x40, // freeing unused memory\n+ ERR_FREEING_ERROR = 0x41, // freeing memory unsupported memory\n+ ERR_UNSUPPORTED_COMMAND = 0x42, // unsupported command {0}\n+ ERR_MSG_UNKNOWN_TYPE = 0x43, // unknown message type {0}\n+ ERR_WRONG_ADDR_TYPE = 0x44, // wrong address type {0} (code location {1})\n+ ERR_BRIDGE_MISMATCH = 0x45, // bridge mismatch (code location {0})\n+ ERR_HEADER_TOO_LONG = 0x46, // header too long, length {1} (code location {0})\n+ ERR_INPUTBUFFER_LENGTH = 0x47, // input length problem, length={0}\n+ ERR_BOOTED = 0x48, // booted\n+ ERR_INVALIDSERIALFRAME = 0x49, // invalid serial frame\n+ ERR_INVALIDPACKETFROMRADIO = 0x4a, // invalid packet from radio, length {1} (code location {0})\n+ ERR_BUSY_RECEIVING = 0x4b, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n+ ERR_WRONG_CRC_INPUT = 0x4c, // wrong CRC in input Buffer\n+ ERR_PACKET_SYNC = 0x4d, // synchronized when received a packet\n+ ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4e, // the slot {0} to be added is already in schedule\n+ ERR_UNSUPPORTED_FORMAT = 0x4f, // the received packet format is not supported (code location {0})\n+ ERR_UNSUPPORTED_METADATA = 0x50, // the metadata type is not suppored\n+ ERR_MAXRETRIES_REACHED = 0x51, // maxretries reached (counter: {0})\n+ ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER = 0x52, // empty queue or trying to remove unknown timer id (code location {0})\n};\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "+/**\n+\\brief Definition of the \"6LoWPAN fragmentation\" module.\n+\n+This module implements 6LoWPAN fragmentation according to RFC 4944,\n+ RFC 6282 and https://hal.inria.fr/hal-02061838/document.\n+\n+\\author Timothy Claeys <timothy.claeys@inria.fr>, January 2020.\n+*/\n+\n+\n#include \"opendefs.h\"\n#include \"frag.h\"\n#include \"iphc.h\"\n@@ -64,27 +74,31 @@ static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos);\nvoid frag_timeout_cb(opentimers_id_t id);\n+owerror_t frag_timerq_enqueue(opentimers_id_t id);\n+\n+owerror_t frag_timerq_remove(opentimers_id_t id);\n+\n+opentimers_id_t frag_timerq_dequeue(void);\n//============================= public ========================================\nvoid frag_init() {\nmemset(&frag_vars, 0, sizeof(frag_vars_t));\n// unspecified start value, wraps around at 65535\n- frag_vars.tag = openrandom_get16b() & 0x7FF;\n+ frag_vars.global_tag = openrandom_get16b() & 0x7FF;\n}\nowerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nOpenQueueEntry_t *lowpan_fragment;\nuint16_t remaining_bytes;\n- uint8_t fragment_length;\n- uint8_t fragment_offset;\n+ uint8_t fragment_length, fragment_offset;\nint8_t bpos;\n// check if fragmentation is necessary\nif (msg->is_big_packet && msg->length > (MAX_FRAGMENT_SIZE + FRAGN_HEADER_SIZE)) {\n// update the global 6LoWPAN datagram tag\n- frag_vars.tag++;\n+ frag_vars.global_tag++;\nremaining_bytes = msg->length;\nfragment_offset = 0;\nbpos = -1;\n@@ -125,14 +139,14 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nif (bpos == -1) {\nopenqueue_freePacketBuffer(lowpan_fragment);\n- cleanup_fragments(frag_vars.tag);\n+ cleanup_fragments(frag_vars.global_tag);\nopenserial_printError(COMPONENT_FRAG, ERR_FRAG_BUFFER_OV, (errorparameter_t) 0, (errorparameter_t) 0);\nreturn E_FAIL;\n}\n// populate a fragment buffer\n- frag_vars.fragmentBuf[bpos].datagram_tag = frag_vars.tag;\n+ frag_vars.fragmentBuf[bpos].datagram_tag = frag_vars.global_tag;\nfrag_vars.fragmentBuf[bpos].datagram_offset = fragment_offset;\nfrag_vars.fragmentBuf[bpos].pFragment = lowpan_fragment;\nfrag_vars.fragmentBuf[bpos].pOriginalMsg = msg;\n@@ -149,9 +163,9 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nremaining_bytes -= fragment_length;\nif (fragment_offset == 0) {\n- prepend_frag1_header(lowpan_fragment, msg->length, frag_vars.tag);\n+ prepend_frag1_header(lowpan_fragment, msg->length, frag_vars.global_tag);\n} else {\n- prepend_fragn_header(lowpan_fragment, msg->length, frag_vars.tag, fragment_offset);\n+ prepend_fragn_header(lowpan_fragment, msg->length, frag_vars.global_tag, fragment_offset);\n}\n// update the fragment offset\n@@ -160,13 +174,13 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\n// send all the fragments with the current datagram tag\nfor (int i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\n- if (frag_vars.fragmentBuf[i].datagram_tag == frag_vars.tag) {\n+ if (frag_vars.fragmentBuf[i].datagram_tag == frag_vars.global_tag) {\n// try to send the fragment. If this fails, abort the transmission of the other fragments.\nif (sixtop_send(frag_vars.fragmentBuf[i].pFragment) == E_FAIL) {\nopenserial_printError(COMPONENT_FRAG, ERR_FRAG_TX_FAIL,\n- (errorparameter_t) frag_vars.tag,\n+ (errorparameter_t) frag_vars.global_tag,\n(errorparameter_t) frag_vars.fragmentBuf[i].datagram_offset);\n- cleanup_fragments(frag_vars.tag);\n+ cleanup_fragments(frag_vars.global_tag);\nreturn E_FAIL;\n} else {\n// fragment succesfully scheduled, lock it\n@@ -247,8 +261,8 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\nopenqueue_freePacketBuffer(msg);\n}\n} else if (msg->l3_isFragment && msg->l3_useSourceRouting) {\n- uint8_t k;\n+ uint8_t k;\nfor (k = 0; k < FRAGMENT_BUFFER_SIZE; k++) {\nif (frag_vars.fragmentBuf[k].pFragment == msg) {\ndatagram_tag = frag_vars.fragmentBuf[k].datagram_tag;\n@@ -260,7 +274,7 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\n}\nif (k >= FRAGMENT_BUFFER_SIZE) {\n- // fragment not found in buffer\n+ // fragment not found in fragment buffer (it was never stored locally, immediately fast-forwarded)\nopenqueue_freePacketBuffer(msg);\n}\n@@ -272,13 +286,9 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\nvoid frag_receive(OpenQueueEntry_t *msg) {\n- uint8_t dispatch;\n- uint16_t size;\n- uint16_t tag;\n- uint8_t offset;\n- uint8_t page_length;\n- ipv6_header_iht ipv6_outer_header;\n- ipv6_header_iht ipv6_inner_header;\n+ uint8_t dispatch, offset, page_length;\n+ uint16_t size, tag;\n+ ipv6_header_iht ipv6_outer_header, ipv6_inner_header;\nmemset(&ipv6_outer_header, 0, sizeof(ipv6_header_iht));\nmemset(&ipv6_inner_header, 0, sizeof(ipv6_header_iht));\n@@ -340,30 +350,41 @@ void frag_receive(OpenQueueEntry_t *msg) {\n}\nif (i < NUM_OF_VRBS) {\n- // we have found a corresponding VRB for this subsequent fragment, update the fragment next hop\n+ // we have found a corresponding VRB for this subsequent fragment, update the fragment's next hop\nmsg->l3_useSourceRouting = TRUE;\nmsg->creator = COMPONENT_FRAG;\nmemcpy(&msg->l2_nextORpreviousHop, &frag_vars.vrbs[i].nexthop, sizeof(open_addr_t));\n- // update the VRB\n+\n+ // update the VRB (how many bytes do we still need to forward)\nfrag_vars.vrbs[i].left -= msg->length;\nif (frag_vars.vrbs[i].left == 0) {\n- // clear VRB entry\n+ // all bytes forwarded, remove VRB entry\nopenserial_printInfo(COMPONENT_FRAG, ERR_FRAG_FAST_FORWARD, (errorparameter_t) tag,\n(errorparameter_t) size);\n+ opentimers_cancel(frag_vars.vrbs[i].forward_timer);\n+ opentimers_destroy(frag_vars.vrbs[i].forward_timer);\n+ if (frag_timerq_remove(frag_vars.vrbs[i].forward_timer) == E_FAIL) {\n+ openserial_printCritical(COMPONENT_FRAG, ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER,\n+ (errorparameter_t) 1,\n+ (errorparameter_t) 0);\n+ }\nmemset(&frag_vars.vrbs[i], 0, sizeof(vrb_t));\n+\n}\n// restore fragn header\nprepend_fragn_header(msg, size, tag, offset);\nsixtop_send(msg);\n} else {\n- // If VRB buffer does not exist, there are two scenarios\n- // (1) I am the destination, thus store the fragment and attempt reassembly\n- // (2) Subsequent fragment arrived out-of-order, also store and forward later\n-\n- // TODO: temporarily store and send later\n+ /*\n+ * If VRB buffer does not exist, there are two scenarios:\n+ * (1) I am the destination, but I have not yet received the first fragment containing the address\n+ * information. Store the fragment and attempt reassembly later.\n+ * (2) A subsequent fragment arrived out-of-order. Store temporarily and wait for first fragment to\n+ * create a VRB and fast-forward to the next hop.\n+ */\nstore_fragment(msg, size, tag, offset);\n}\n}\n@@ -412,6 +433,17 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\nif (!has_timer) {\nfrag_vars.fragmentBuf[i].reassembly_timer = opentimers_create(TIMER_GENERAL_PURPOSE, TASKPRIO_FRAG);\n+\n+ // get a timer for the fragment reassembly and add it to the timer queue\n+ if ((frag_vars.fragmentBuf[i].reassembly_timer == ERROR_NO_AVAILABLE_ENTRIES) ||\n+ (frag_timerq_enqueue(frag_vars.fragmentBuf[i].reassembly_timer) == E_FAIL)) {\n+\n+ openserial_printError(COMPONENT_FRAG, ERR_NO_FREE_TIMER_OR_QUEUE_ENTRY,\n+ (errorparameter_t) 0, (errorparameter_t) 0);\n+ RESET_FRAG_BUFFER_ENTRY(i);\n+ return;\n+ }\n+\nopentimers_scheduleAbsolute(\nfrag_vars.fragmentBuf[i].reassembly_timer,\nFRAG_REASSEMBLY_TIMEOUT,\n@@ -502,6 +534,11 @@ static void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *\nif (frag_vars.fragmentBuf[i].reassembly_timer != 0) {\nopentimers_cancel(frag_vars.fragmentBuf[i].reassembly_timer);\nopentimers_destroy(frag_vars.fragmentBuf[i].reassembly_timer);\n+ if (frag_timerq_remove(frag_vars.fragmentBuf[i].reassembly_timer) == E_FAIL) {\n+ openserial_printCritical(COMPONENT_FRAG, ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER,\n+ (errorparameter_t) 2,\n+ (errorparameter_t) 0);\n+ }\n}\nRESET_FRAG_BUFFER_ENTRY(i);\n@@ -521,6 +558,27 @@ static owerror_t allocate_vrb(OpenQueueEntry_t *frag1, uint16_t size, uint16_t t\nfrag_vars.vrbs[i].size = size;\nfrag_vars.vrbs[i].left = (size - MAX_FRAGMENT_SIZE);\nfrag_vars.vrbs[i].frag1 = frag1;\n+\n+ frag_vars.vrbs[i].forward_timer = opentimers_create(TIMER_GENERAL_PURPOSE, TASKPRIO_FRAG);\n+\n+ // get a timer for the fragment forwarding and add it to the timer queue\n+ if ((frag_vars.vrbs[i].forward_timer == ERROR_NO_AVAILABLE_ENTRIES) ||\n+ (frag_timerq_enqueue(frag_vars.vrbs[i].forward_timer) == E_FAIL)) {\n+\n+ openserial_printError(COMPONENT_FRAG, ERR_NO_FREE_TIMER_OR_QUEUE_ENTRY,\n+ (errorparameter_t) 0, (errorparameter_t) 0);\n+ memset(&frag_vars.vrbs[i], 0, sizeof(vrb_t));\n+ return E_FAIL;\n+ }\n+\n+ opentimers_scheduleAbsolute(\n+ frag_vars.vrbs[i].forward_timer,\n+ FRAG_REASSEMBLY_TIMEOUT,\n+ opentimers_getValue(),\n+ TIME_MS,\n+ frag_timeout_cb\n+ );\n+\nbreak;\n}\n}\n@@ -554,12 +612,24 @@ static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos) {\n// clear VRB entry if all data is forwarded\nopenserial_printInfo(COMPONENT_FRAG, ERR_FRAG_FAST_FORWARD, (errorparameter_t) tag,\n(errorparameter_t) size);\n+ opentimers_cancel(frag_vars.vrbs[vrb_pos].forward_timer);\n+ opentimers_destroy(frag_vars.vrbs[vrb_pos].forward_timer);\n+ if (frag_timerq_remove(frag_vars.vrbs[vrb_pos].forward_timer) == E_FAIL) {\n+ openserial_printCritical(COMPONENT_FRAG, ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER,\n+ (errorparameter_t) 3,\n+ (errorparameter_t) 0);\n+ }\nmemset(&frag_vars.vrbs[vrb_pos], 0, sizeof(vrb_t));\n}\nif (frag_vars.fragmentBuf[i].reassembly_timer != 0) {\nopentimers_cancel(frag_vars.fragmentBuf[i].reassembly_timer);\nopentimers_destroy(frag_vars.fragmentBuf[i].reassembly_timer);\n+ if (frag_timerq_remove(frag_vars.fragmentBuf[i].reassembly_timer) == E_FAIL) {\n+ openserial_printCritical(COMPONENT_FRAG, ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER,\n+ (errorparameter_t) 4,\n+ (errorparameter_t) 0);\n+ }\n}\nprepend_fragn_header(\n@@ -597,22 +667,74 @@ static void prepend_fragn_header(OpenQueueEntry_t *fragn, uint16_t size, uint16_\n((fragn_t *) fragn->payload)->datagram_offset = offset;\n}\n+owerror_t frag_timerq_enqueue(opentimers_id_t id) {\n+ uint8_t i;\n+ for (i = 0; i < NUM_OF_CONCURRENT_TIMERS; i++) {\n+ if (frag_vars.frag_timerq[i] == 0) {\n+ frag_vars.frag_timerq[i] = id;\n+ return E_SUCCESS;\n+ }\n+ }\n+\n+ return E_FAIL;\n+}\n+\n+opentimers_id_t frag_timerq_dequeue(void) {\n+ opentimers_id_t expired;\n+ expired = frag_vars.frag_timerq[0];\n+\n+ memcpy((uint8_t *) frag_vars.frag_timerq, (uint8_t * ) & (frag_vars.frag_timerq[1]), NUM_OF_CONCURRENT_TIMERS - 1);\n+ frag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS] = 0;\n+\n+ return expired;\n+}\n+\n+owerror_t frag_timerq_remove(opentimers_id_t id) {\n+ for (uint8_t i = 0; i < NUM_OF_CONCURRENT_TIMERS - 1; i++) {\n+ if (frag_vars.frag_timerq[i] == id) {\n+ memcpy(&frag_vars.frag_timerq[i], &frag_vars.frag_timerq[i + 1], NUM_OF_CONCURRENT_TIMERS - 1 - i);\n+ frag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS - 1] = 0;\n+ return E_SUCCESS;\n+ }\n+ }\n+\n+ if (frag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS - 1] == id) {\n+ frag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS - 1] = 0;\n+ return E_SUCCESS;\n+ }\n+\n+ return E_FAIL;\n+}\n+\nvoid frag_timeout_cb(opentimers_id_t id) {\n- uint16_t expired_tag;\n- uint8_t j;\n+ opentimers_id_t expired_timer;\n+ if ((expired_timer = frag_timerq_dequeue()) == 0) {\n+ // timer id can never be 0, if we get zero we have \"dequeued\" and empty queue!\n+ openserial_printCritical(COMPONENT_FRAG, ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER,\n+ (errorparameter_t) 0,\n+ (errorparameter_t) 0);\n+ }\n// find the tag of the expired fragments\n- for (j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\n- if (frag_vars.fragmentBuf[j].reassembly_timer == id) {\n- expired_tag = frag_vars.fragmentBuf[j].datagram_tag;\n+ for (uint8_t j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\n+ if (frag_vars.fragmentBuf[j].pFragment != NULL && frag_vars.fragmentBuf[j].reassembly_timer == expired_timer) {\n+ openserial_printError(COMPONENT_FRAG, ERR_FRAG_REASSEMBLY_OR_VRB_TIMEOUT,\n+ (errorparameter_t) frag_vars.fragmentBuf[j].datagram_tag,\n+ (errorparameter_t) 0);\n+ opentimers_destroy(frag_vars.fragmentBuf[j].reassembly_timer);\n+ cleanup_fragments(frag_vars.fragmentBuf[j].datagram_tag);\n+ break;\n}\n}\n-\n- if (j < FRAGMENT_BUFFER_SIZE) {\n- openserial_printError(COMPONENT_FRAG, ERR_FRAG_REASSEMBLY_TIMEOUT, (errorparameter_t) expired_tag,\n+ for (uint8_t j = 0; j < NUM_OF_VRBS; j++) {\n+ if (frag_vars.vrbs[j].tag != 0 && frag_vars.vrbs[j].forward_timer == expired_timer) {\n+ openserial_printError(COMPONENT_FRAG, ERR_FRAG_REASSEMBLY_OR_VRB_TIMEOUT,\n+ (errorparameter_t) frag_vars.vrbs[j].tag,\n(errorparameter_t) 0);\n- cleanup_fragments(expired_tag);\n+ opentimers_destroy(frag_vars.vrbs[j].forward_timer);\n+ memset(&frag_vars.vrbs[j], 0, sizeof(vrb_t));\n+ }\n}\n}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.h",
"new_path": "openstack/03a-IPHC/frag.h",
"diff": "+/**\n+\\brief Definition of the \"6LoWPAN fragmentation\" module.\n+\n+\n+\\author Timothy Claeys <timothy.claeys@inria.fr>, January 2020.\n+*/\n+\n#ifndef __FRAG_H\n#define __FRAG_H\n+/**\n+\\addtogroup LoWPAN\n+\\{\n+\\addtogroup FRAG\n+\\{\n+*/\n+\n+\n#include \"opendefs.h\"\n#include \"openqueue.h\"\n#include \"opentimers.h\"\n#define FRAGMENT_BUFFER_SIZE 15\n#define MAX_FRAGMENT_SIZE 96\n#define NUM_OF_VRBS 3\n+#define NUM_OF_CONCURRENT_TIMERS 5\n+\n+// maximum size of packet we can fragment\n#define MAX_PACKET_SIZE (FRAGMENT_BUFFER_SIZE * MAX_FRAGMENT_SIZE)\n#define FRAG1_HEADER_SIZE 4\n#define DISPATCH_FRAG_FIRST 24\n#define DISPATCH_FRAG_SUBSEQ 28\n+// specifies how long we store fragments or keep vrb allocated\n#define FRAG_REASSEMBLY_TIMEOUT 60000\n-// 6lowpan fragment1 header\n+// 6LoWPAN fragment1 header\ntypedef struct {\nuint16_t dispatch_size_field;\nuint16_t datagram_tag;\n} frag1_t;\n-// 6lowpan fragmentN header\n+// 6LoWPAN fragmentN header\ntypedef struct {\nuint16_t dispatch_size_field;\nuint16_t datagram_tag;\n@@ -36,10 +55,12 @@ typedef struct {\n/*\n* Describes an entry in the fragment buffer, contains:\n-* - if lock is TRUE, fragment is scheduled for Tx (do not delete until cb sendDone!!)\n-* - the tag value used for this fragment\n-* - a pointer to the fragment\n-* - a pointer to the original 6lowpan packet\n+ * - If lock is TRUE, fragment is scheduled for Tx (do not delete until cb sendDone!!).\n+ * - The fragment offset value (multiple of 8)\n+ * - The tag value used for this fragment.\n+ * - The reassembly timer (60s after the arrival of the first fragment, reassembly must be completed).\n+ * - A pointer to the fragment's location in the OpenQueue.\n+ * - A pointer to the original unfragmented 6LoWPAN packet in the OpenQueue.\n*/\nBEGIN_PACK\nstruct fragment_t {\n@@ -59,15 +80,17 @@ typedef struct {\nuint16_t tag;\nuint16_t left;\nuint16_t size;\n+ opentimers_id_t forward_timer;\nOpenQueueEntry_t *frag1;\nopen_addr_t nexthop;\n} vrb_t;\n// state information for fragmentation\ntypedef struct {\n- uint16_t tag;\n+ uint16_t global_tag;\nvrb_t vrbs[NUM_OF_VRBS];\nfragment fragmentBuf[FRAGMENT_BUFFER_SIZE];\n+ opentimers_id_t frag_timerq[NUM_OF_CONCURRENT_TIMERS];\n} frag_vars_t;\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/python/SConscript.env",
"new_path": "projects/python/SConscript.env",
"diff": "@@ -719,6 +719,9 @@ functionsToChange = [\n'prepend_fragn_header',\n'fast_forward_frags',\n'frag_timeout_cb',\n+ 'frag_timerq_enqueue',\n+ 'frag_timerq_dequeue',\n+ 'frag_timerq_remove',\n# iphc\n'iphc_init',\n'iphc_sendFromForwarding',\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Fixes the fragment buffer and VRB cleanup functions
When a fragment is received, a node schedules a 60 timeout either for the reassembly buffer or fast-forwarding VRB. If not all bytes are received within this 60s interval, all fragments are dropped and the buffers are liberated.
|
491,587 |
05.02.2020 15:16:48
| -3,600 |
e380c8259dcd1ef01b75559f2248a23ad7812c71
|
Fix segmentation fault when L2 security is active
When L2 security is active, the fragmentation payload size must be reduced to make place for the auxiliary security header and the authentication tag
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -43,7 +43,7 @@ static const uint8_t infoStackName[] = \"OpenWSN \";\n// frame sizes\n#define IEEE802154_FRAME_SIZE 127\n-#define BIG_PACKET_SIZE (10*127)\n+#define IPV6_PACKET_SIZE 1320\nenum {\nE_SUCCESS = 0,\n@@ -384,7 +384,7 @@ typedef struct {\ntypedef struct {\nOpenQueueEntry_t standard_entry;\n- uint8_t packet_remainder[BIG_PACKET_SIZE];\n+ uint8_t packet_remainder[IPV6_PACKET_SIZE - 130]; // 130 byts alread allocated in the normal OpenQueueEntry\n} OpenQueueBigEntry_t;\n"
},
{
"change_type": "MODIFY",
"old_path": "openapps/uecho/uecho.c",
"new_path": "openapps/uecho/uecho.c",
"diff": "@@ -26,11 +26,7 @@ void uecho_init(void) {\nvoid uecho_receive(OpenQueueEntry_t *request) {\nOpenQueueEntry_t *reply;\n- if (request->length > 60) {\nreply = openqueue_getFreeBigPacketBuffer(COMPONENT_UECHO);\n- } else {\n- reply = openqueue_getFreePacketBuffer(COMPONENT_UECHO);\n- }\nif (reply == NULL) {\nopenserial_printError(\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "@@ -40,13 +40,13 @@ This module implements 6LoWPAN fragmentation according to RFC 4944,\n#define CHECK_OVERSIZED(size) \\\ndo { \\\n- if ((size) > (MAX_PACKET_SIZE)) { \\\n+ if ((size) > (IPV6_PACKET_SIZE)) { \\\nopenqueue_freePacketBuffer(msg); \\\nopenserial_printError( \\\nCOMPONENT_FRAG, \\\nERR_FRAG_INVALID_SIZE, \\\n(errorparameter_t) (size), \\\n- (errorparameter_t) MAX_PACKET_SIZE \\\n+ (errorparameter_t) IPV6_PACKET_SIZE \\\n); \\\nreturn; \\\n} \\\n@@ -95,7 +95,7 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nint8_t bpos;\n// check if fragmentation is necessary\n- if (msg->is_big_packet && msg->length > (MAX_FRAGMENT_SIZE + FRAGN_HEADER_SIZE)) {\n+ if (!msg->l3_isFragment && msg->length > (MAX_FRAGMENT_SIZE + FRAGN_HEADER_SIZE)) {\n// update the global 6LoWPAN datagram tag\nfrag_vars.global_tag++;\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.h",
"new_path": "openstack/03a-IPHC/frag.h",
"diff": "#include \"opendefs.h\"\n#include \"openqueue.h\"\n#include \"opentimers.h\"\n+#include \"IEEE802154_security.h\"\n//=========================== define ==========================================\n+/* Pick a conservative maximum payload size for the fragments in case L2 security is active\n+ * If L2 security is not active MAX_FRAGMENT_SIZE can be set to 96 bytes, but the corresponding variable in\n+ * openvisualizer must then also be updated to the same value.\n+ */\n+#define MAX_FRAGMENT_SIZE 80\n-#define FRAGMENT_BUFFER_SIZE 15\n-#define MAX_FRAGMENT_SIZE 96\n-#define NUM_OF_VRBS 3\n-#define NUM_OF_CONCURRENT_TIMERS 5\n-\n-// maximum size of packet we can fragment\n-#define MAX_PACKET_SIZE (FRAGMENT_BUFFER_SIZE * MAX_FRAGMENT_SIZE)\n+#define FRAGMENT_BUFFER_SIZE (((IPV6_PACKET_SIZE / MAX_FRAGMENT_SIZE) + 1) * BIGQUEUELENGTH)\n+#define NUM_OF_VRBS 2\n+#define NUM_OF_CONCURRENT_TIMERS (NUM_OF_VRBS + BIGQUEUELENGTH)\n#define FRAG1_HEADER_SIZE 4\n#define FRAGN_HEADER_SIZE 5\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03b-IPv6/icmpv6echo.c",
"new_path": "openstack/03b-IPv6/icmpv6echo.c",
"diff": "@@ -101,11 +101,8 @@ void icmpv6echo_receive(OpenQueueEntry_t *msg) {\n(errorparameter_t) 0,\n(errorparameter_t) 0);\nif (icmpv6echo_vars.isReplyEnabled) {\n- // get a new openqueuEntry_t for the echo reply\n- if (msg->length > 65)\n+ // get a new OpenQueuEntry_t for the echo reply\nreply = openqueue_getFreeBigPacketBuffer(COMPONENT_ICMPv6ECHO);\n- else\n- reply = openqueue_getFreePacketBuffer(COMPONENT_ICMPv6ECHO);\nif (reply == NULL) {\nopenserial_printError(COMPONENT_ICMPv6ECHO, ERR_NO_FREE_PACKET_BUFFER,\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/openqueue.c",
"new_path": "openstack/cross-layers/openqueue.c",
"diff": "@@ -463,7 +463,7 @@ void openqueue_reset_entry(OpenQueueEntry_t* entry) {\n//admin\nentry->creator = COMPONENT_NULL;\nentry->owner = COMPONENT_NULL;\n- entry->payload = &(entry->packet[127 - IEEE802154_SECURITY_TAG_LEN]); // Footer is longer if security is used\n+ entry->payload = &(entry->packet[IEEE802154_FRAME_SIZE - IEEE802154_SECURITY_TAG_LEN]); // Footer is longer if security is used\nentry->length = 0;\nentry->is_cjoin_response = FALSE;\nentry->is_big_packet = FALSE;\n@@ -492,5 +492,5 @@ void openqueue_reset_entry(OpenQueueEntry_t* entry) {\nvoid openqueue_reset_big_entry(OpenQueueBigEntry_t *entry) {\nopenqueue_reset_entry(&(entry->standard_entry));\n- entry->standard_entry.payload = &(entry->standard_entry.packet[IEEE802154_FRAME_SIZE + BIG_PACKET_SIZE]); // make pointer point to the end op the extended buffer\n+ entry->standard_entry.payload = &(entry->standard_entry.packet[IPV6_PACKET_SIZE]); // make pointer point to the end op the extended buffer\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/openqueue.h",
"new_path": "openstack/cross-layers/openqueue.h",
"diff": "//=========================== define ==========================================\n#define QUEUELENGTH 20\n-#define BIGQUEUELENGTH 4\n+#define BIGQUEUELENGTH 2\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/packetfunctions.c",
"new_path": "openstack/cross-layers/packetfunctions.c",
"diff": "@@ -303,11 +303,9 @@ void packetfunctions_reserveHeaderSize(OpenQueueEntry_t *pkt, uint16_t header_le\nvoid packetfunctions_tossHeader(OpenQueueEntry_t *pkt, uint16_t header_length) {\nuint16_t size;\n- if (pkt->is_big_packet) {\n- size = BIG_PACKET_SIZE + 127;\n- } else {\n- size = 127;\n- }\n+\n+ size = pkt->is_big_packet == TRUE ? IPV6_PACKET_SIZE : IEEE802154_FRAME_SIZE;\n+\npkt->payload += header_length;\npkt->length -= header_length;\n@@ -320,11 +318,7 @@ void packetfunctions_tossHeader(OpenQueueEntry_t *pkt, uint16_t header_length) {\nvoid packetfunctions_reserveFooterSize(OpenQueueEntry_t *pkt, uint16_t header_length) {\nuint16_t size;\n- if (pkt->is_big_packet) {\n- size = BIG_PACKET_SIZE + 127;\n- } else {\n- size = 127;\n- }\n+ size = pkt->is_big_packet == TRUE ? IPV6_PACKET_SIZE : IEEE802154_FRAME_SIZE;\npkt->length += header_length;\n@@ -337,7 +331,7 @@ void packetfunctions_reserveFooterSize(OpenQueueEntry_t *pkt, uint16_t header_le\nvoid packetfunctions_tossFooter(OpenQueueEntry_t *pkt, uint16_t header_length) {\npkt->length -= header_length;\n- if (pkt->length > BIG_PACKET_SIZE + 128) {//wraps around, so a negative value will be >128\n+ if (pkt->length > IPV6_PACKET_SIZE) {//wraps around, so a negative value will be >128\nopenserial_printError(COMPONENT_PACKETFUNCTIONS, ERR_HEADER_TOO_LONG,\n(errorparameter_t) 3,\n(errorparameter_t) pkt->length);\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Fix segmentation fault when L2 security is active
- When L2 security is active, the fragmentation payload size must be reduced to make place for the auxiliary security header and the authentication tag
|
491,587 |
05.02.2020 17:19:30
| -3,600 |
7b2d0e416433ef289eca85c4f0a470e57008db9c
|
Allocate all the SRAM memory
+ Tell linker that there is 32kB of SRAM instead of 16kB.
|
[
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b-24ghz/cc2538sf53.lds",
"new_path": "bsp/boards/openmote-b-24ghz/cc2538sf53.lds",
"diff": "@@ -19,7 +19,7 @@ MEMORY\n{\nFLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0007FFD4\nFLASH_CCA (RX) : ORIGIN = 0x0027FFD4, LENGTH = 12\n- SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000\n+ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00008000\n}\nSECTIONS\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b-subghz/cc2538sf53.lds",
"new_path": "bsp/boards/openmote-b-subghz/cc2538sf53.lds",
"diff": "@@ -19,7 +19,7 @@ MEMORY\n{\nFLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0007FFD4\nFLASH_CCA (RX) : ORIGIN = 0x0027FFD4, LENGTH = 12\n- SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000\n+ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00008000\n}\nSECTIONS\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b/cc2538sf23.lds",
"new_path": "bsp/boards/openmote-b/cc2538sf23.lds",
"diff": "@@ -19,7 +19,7 @@ MEMORY\n{\nFLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0003FFD4\nFLASH_CCA (RX) : ORIGIN = 0x0023FFD4, LENGTH = 12\n- SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000\n+ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00008000\n}\nSECTIONS\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-b/cc2538sf53.lds",
"new_path": "bsp/boards/openmote-b/cc2538sf53.lds",
"diff": "@@ -19,7 +19,7 @@ MEMORY\n{\nFLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0007FFD4\nFLASH_CCA (RX) : ORIGIN = 0x0027FFD4, LENGTH = 12\n- SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000\n+ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00008000\n}\nSECTIONS\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/cc2538sf23.lds",
"new_path": "bsp/boards/openmote-cc2538/cc2538sf23.lds",
"diff": "@@ -19,7 +19,7 @@ MEMORY\n{\nFLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0003FFD4\nFLASH_CCA (RX) : ORIGIN = 0x0023FFD4, LENGTH = 12\n- SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000\n+ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00008000\n}\nSECTIONS\n"
},
{
"change_type": "MODIFY",
"old_path": "bsp/boards/openmote-cc2538/cc2538sf53.lds",
"new_path": "bsp/boards/openmote-cc2538/cc2538sf53.lds",
"diff": "@@ -19,7 +19,7 @@ MEMORY\n{\nFLASH (rx) : ORIGIN = 0x00200000, LENGTH = 0x0007FFD4\nFLASH_CCA (RX) : ORIGIN = 0x0027FFD4, LENGTH = 12\n- SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000\n+ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00008000\n}\nSECTIONS\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Allocate all the SRAM memory
+ Tell linker that there is 32kB of SRAM instead of 16kB.
|
491,587 |
06.02.2020 11:35:19
| -3,600 |
7ccaf69698c8dc1bfdf701798ca01a1a203b8422
|
Fix compile errors macpong project and samr21_xpro
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/cross-layers/openqueue.c",
"new_path": "openstack/cross-layers/openqueue.c",
"diff": "@@ -142,9 +142,10 @@ OpenQueueEntry_t* openqueue_getFreeBigPacketBuffer(uint8_t creator) {\nowerror_t openqueue_freePacketBuffer(OpenQueueEntry_t* pkt) {\nuint8_t i;\n- if (pkt->is_big_packet){\nINTERRUPT_DECLARATION();\nDISABLE_INTERRUPTS();\n+\n+ if (pkt->is_big_packet){\nfor (i = 0; i < BIGQUEUELENGTH; i++) {\nif ((OpenQueueBigEntry_t *) pkt == &openqueue_vars.big_queue[i]) {\nif (openqueue_vars.big_queue[i].standard_entry.owner == COMPONENT_NULL) {\n@@ -161,8 +162,6 @@ owerror_t openqueue_freePacketBuffer(OpenQueueEntry_t* pkt) {\n}\n} else {\n- INTERRUPT_DECLARATION();\n- DISABLE_INTERRUPTS();\nfor (i=0;i<QUEUELENGTH;i++) {\nif (&openqueue_vars.queue[i]==pkt) {\nif (openqueue_vars.queue[i].owner==COMPONENT_NULL) {\n"
},
{
"change_type": "MODIFY",
"old_path": "projects/common/03oos_macpong/03oos_macpong.c",
"new_path": "projects/common/03oos_macpong/03oos_macpong.c",
"diff": "@@ -103,6 +103,12 @@ void macpong_send(uint8_t payloadCtr) {\n//=========================== stubbing ========================================\n+//===== FRAG\n+\n+void frag_init(void) {return; }\n+void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {return; }\n+void frag_receive(OpenQueueEntry_t *msg) {return; }\n+\n//===== IPHC\nvoid iphc_init(void) {\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Fix compile errors macpong project and samr21_xpro
|
491,587 |
06.02.2020 15:15:55
| -3,600 |
3bce81d5c4cbcd6673ec3d4689079b24a088ea57
|
Bug fixes and formatting
implicit declarations
out-of-bounds array
clang-tidy remarks
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "@@ -21,6 +21,12 @@ This module implements 6LoWPAN fragmentation according to RFC 4944,\n#include \"opentimers.h\"\n#include \"scheduler.h\"\n+//============================ defines ========================================\n+\n+#define DISPATCH_SHIFT 11\n+#define DISPATCH_MASK 0x1F\n+#define SIZE_MASK 0x7FF\n+\n//============================= macros ========================================\n#define LOCK(fragment) ((fragment).lock = TRUE)\n@@ -68,7 +74,7 @@ static owerror_t allocate_vrb(OpenQueueEntry_t *frag1, uint16_t size, uint16_t t\nstatic void prepend_frag1_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag);\n-static void prepend_fragn_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag, uint8_t offset);\n+static void prepend_fragn_header(OpenQueueEntry_t *fragn, uint16_t size, uint16_t tag, uint8_t offset);\nstatic void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos);\n@@ -91,7 +97,7 @@ void frag_init() {\nowerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nOpenQueueEntry_t *lowpan_fragment;\nuint16_t remaining_bytes;\n- uint8_t fragment_length, fragment_offset;\n+ uint8_t fragment_length; uint8_t fragment_offset;\nint8_t bpos;\n// check if fragmentation is necessary\n@@ -153,7 +159,7 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\n// copy 'fragment_length' bytes from the original packet to the fragment\npacketfunctions_reserveHeaderSize(lowpan_fragment, fragment_length);\n- memcpy(lowpan_fragment->payload, msg->payload + (fragment_offset * 8), fragment_length);\n+ memcpy(lowpan_fragment->payload, msg->payload + (fragment_offset * OFFSET_MULTIPLE), fragment_length);\n// copy address information\nlowpan_fragment->l3_destinationAdd = msg->l3_destinationAdd;\n@@ -169,7 +175,7 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\n}\n// update the fragment offset\n- fragment_offset += (fragment_length / 8);\n+ fragment_offset += (fragment_length / OFFSET_MULTIPLE);\n}\n// send all the fragments with the current datagram tag\n@@ -215,7 +221,8 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nvoid frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\n- bool frags_queued, upward_relay;\n+ bool frags_queued;\n+ bool upward_relay;\nuint16_t datagram_tag;\nOpenQueueEntry_t *original_msg;\n@@ -225,7 +232,7 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\nupward_relay = FALSE;\n// delete sent fragment from fragment buffer\n- uint8_t i;\n+ int i;\nfor (i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\nif (frag_vars.fragmentBuf[i].pFragment == msg) {\ndatagram_tag = frag_vars.fragmentBuf[i].datagram_tag;\n@@ -262,7 +269,7 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\n}\n} else if (msg->l3_isFragment && msg->l3_useSourceRouting) {\n- uint8_t k;\n+ int k;\nfor (k = 0; k < FRAGMENT_BUFFER_SIZE; k++) {\nif (frag_vars.fragmentBuf[k].pFragment == msg) {\ndatagram_tag = frag_vars.fragmentBuf[k].datagram_tag;\n@@ -286,19 +293,23 @@ void frag_sendDone(OpenQueueEntry_t *msg, owerror_t sendError) {\nvoid frag_receive(OpenQueueEntry_t *msg) {\n- uint8_t dispatch, offset, page_length;\n- uint16_t size, tag;\n- ipv6_header_iht ipv6_outer_header, ipv6_inner_header;\n+ uint8_t dispatch;\n+ uint8_t offset;\n+ uint8_t page_length;\n+ uint16_t size;\n+ uint16_t tag;\n+ ipv6_header_iht ipv6_outer_header;\n+ ipv6_header_iht ipv6_inner_header;\nmemset(&ipv6_outer_header, 0, sizeof(ipv6_header_iht));\nmemset(&ipv6_inner_header, 0, sizeof(ipv6_header_iht));\nmsg->owner = COMPONENT_FRAG;\n- dispatch = (uint8_t)(packetfunctions_ntohs(msg->payload) >> 11);\n+ dispatch = (uint8_t)(packetfunctions_ntohs(msg->payload) >> DISPATCH_SHIFT);\nif (dispatch == DISPATCH_FRAG_FIRST) {\n// first part of a fragment message\n- size = (uint16_t)(packetfunctions_ntohs(msg->payload) & 0x7FF);\n+ size = (uint16_t)(packetfunctions_ntohs(msg->payload) & SIZE_MASK);\ntag = (uint16_t)(packetfunctions_ntohs(msg->payload + 2));\noffset = 0;\n@@ -326,7 +337,7 @@ void frag_receive(OpenQueueEntry_t *msg) {\n}\n}\n} else if (dispatch == DISPATCH_FRAG_SUBSEQ) {\n- size = (uint16_t)(packetfunctions_ntohs(msg->payload) & 0x7FF);\n+ size = (uint16_t)(packetfunctions_ntohs(msg->payload) & SIZE_MASK);\ntag = (uint16_t)(packetfunctions_ntohs(msg->payload + 2));\noffset = (uint8_t)((((fragn_t *) msg->payload)->datagram_offset));\n@@ -405,9 +416,13 @@ static void cleanup_fragments(uint16_t datagram_tag) {\n}\nstatic void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, uint8_t offset) {\n- uint16_t total_wanted_bytes, received_bytes;\n- uint8_t dropped_srh_len, count;\n- bool do_reassemble, has_timer = FALSE;\n+ uint8_t dropped_srh_len;\n+ uint8_t count;\n+ uint16_t total_wanted_bytes;\n+ uint16_t received_bytes;\n+\n+ bool do_reassemble = FALSE;\n+ bool has_timer = FALSE;\n// we detect a duplicate fragment (if datagram_tag and offset are the same)\n// check if we have running reassembly timer\n@@ -423,7 +438,7 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\n}\n// we find buffer space for a new fragment (new datagram_tag)\n- uint8_t i;\n+ int i;\nfor (i = 0; i < FRAGMENT_BUFFER_SIZE; i++) {\nif (frag_vars.fragmentBuf[i].pFragment == NULL) {\nfrag_vars.fragmentBuf[i].datagram_tag = tag;\n@@ -466,7 +481,6 @@ static void store_fragment(OpenQueueEntry_t *msg, uint16_t size, uint16_t tag, u\n// check if we have all the fragments\ntotal_wanted_bytes = size;\nreceived_bytes = dropped_srh_len = count = 0;\n- do_reassemble = FALSE;\nfor (int j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\nif (tag == frag_vars.fragmentBuf[j].datagram_tag) {\n@@ -526,7 +540,7 @@ static void reassemble_fragments(uint16_t tag, uint16_t size, OpenQueueEntry_t *\noffset = (MAX_FRAGMENT_SIZE - frag_vars.fragmentBuf[i].pFragment->length);\nptr = reassembled_msg->packet + offset;\n} else {\n- ptr = reassembled_msg->packet + (frag_vars.fragmentBuf[i].datagram_offset * 8);\n+ ptr = reassembled_msg->packet + (frag_vars.fragmentBuf[i].datagram_offset * OFFSET_MULTIPLE);\n}\nmemcpy(ptr, frag_vars.fragmentBuf[i].pFragment->payload, frag_vars.fragmentBuf[i].pFragment->length);\n@@ -651,8 +665,8 @@ static void fast_forward_frags(uint16_t tag, uint16_t size, uint8_t vrb_pos) {\nstatic void prepend_frag1_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_t tag) {\nuint16_t ds_field; // temporary dispatch | size field for fragmentation header\npacketfunctions_reserveHeaderSize(frag1, FRAG1_HEADER_SIZE);\n- ds_field = ((DISPATCH_FRAG_FIRST & 0x1F) << 11);\n- ds_field |= (size & 0x7FF);\n+ ds_field = ((DISPATCH_FRAG_FIRST & DISPATCH_MASK) << DISPATCH_SHIFT);\n+ ds_field |= (size & SIZE_MASK);\npacketfunctions_htons(ds_field, (uint8_t * ) & (((frag1_t *) frag1->payload)->dispatch_size_field));\npacketfunctions_htons(tag, (uint8_t * ) & (((frag1_t *) frag1->payload)->datagram_tag));\n}\n@@ -660,8 +674,8 @@ static void prepend_frag1_header(OpenQueueEntry_t *frag1, uint16_t size, uint16_\nstatic void prepend_fragn_header(OpenQueueEntry_t *fragn, uint16_t size, uint16_t tag, uint8_t offset) {\nuint16_t ds_field; // temporary dispatch | size field for fragmentation header\npacketfunctions_reserveHeaderSize(fragn, FRAGN_HEADER_SIZE);\n- ds_field = ((DISPATCH_FRAG_SUBSEQ & 0x1F) << 11);\n- ds_field |= (size & 0x7FF);\n+ ds_field = ((DISPATCH_FRAG_SUBSEQ & DISPATCH_MASK) << DISPATCH_SHIFT);\n+ ds_field |= (size & SIZE_MASK);\npacketfunctions_htons(ds_field, (uint8_t * ) & (((fragn_t *) fragn->payload)->dispatch_size_field));\npacketfunctions_htons(tag, (uint8_t * ) & (((fragn_t *) fragn->payload)->datagram_tag));\n((fragn_t *) fragn->payload)->datagram_offset = offset;\n@@ -684,13 +698,13 @@ opentimers_id_t frag_timerq_dequeue(void) {\nexpired = frag_vars.frag_timerq[0];\nmemcpy((uint8_t *) frag_vars.frag_timerq, (uint8_t * ) & (frag_vars.frag_timerq[1]), NUM_OF_CONCURRENT_TIMERS - 1);\n- frag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS] = 0;\n+ frag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS - 1] = 0;\nreturn expired;\n}\nowerror_t frag_timerq_remove(opentimers_id_t id) {\n- for (uint8_t i = 0; i < NUM_OF_CONCURRENT_TIMERS - 1; i++) {\n+ for (int i = 0; i < NUM_OF_CONCURRENT_TIMERS - 1; i++) {\nif (frag_vars.frag_timerq[i] == id) {\nmemcpy(&frag_vars.frag_timerq[i], &frag_vars.frag_timerq[i + 1], NUM_OF_CONCURRENT_TIMERS - 1 - i);\nfrag_vars.frag_timerq[NUM_OF_CONCURRENT_TIMERS - 1] = 0;\n@@ -717,7 +731,7 @@ void frag_timeout_cb(opentimers_id_t id) {\n}\n// find the tag of the expired fragments\n- for (uint8_t j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\n+ for (int j = 0; j < FRAGMENT_BUFFER_SIZE; j++) {\nif (frag_vars.fragmentBuf[j].pFragment != NULL && frag_vars.fragmentBuf[j].reassembly_timer == expired_timer) {\nopenserial_printError(COMPONENT_FRAG, ERR_FRAG_REASSEMBLY_OR_VRB_TIMEOUT,\n(errorparameter_t) frag_vars.fragmentBuf[j].datagram_tag,\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.h",
"new_path": "openstack/03a-IPHC/frag.h",
"diff": "#define DISPATCH_FRAG_FIRST 24\n#define DISPATCH_FRAG_SUBSEQ 28\n+#define OFFSET_MULTIPLE 8\n+\n// specifies how long we store fragments or keep vrb allocated\n#define FRAG_REASSEMBLY_TIMEOUT 60000\n@@ -78,6 +80,7 @@ END_PACK\ntypedef struct fragment_t fragment;\n// virtual reassembly buffer struct\n+BEGIN_PACK\ntypedef struct {\nuint16_t tag;\nuint16_t left;\n@@ -86,6 +89,7 @@ typedef struct {\nOpenQueueEntry_t *frag1;\nopen_addr_t nexthop;\n} vrb_t;\n+END_PACK\n// state information for fragmentation\ntypedef struct {\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/iphc.h",
"new_path": "openstack/03a-IPHC/iphc.h",
"diff": "@@ -224,15 +224,15 @@ END_PACK\nBEGIN_PACK\ntypedef struct {\nuint8_t optionType;\n- uint8_t o_flag:1; //\n- uint8_t d_flag:1; //\n- uint8_t exp_etl:3; //\n- uint8_t org_otl:3; //\n+ uint8_t o_flag:1;\n+ uint8_t d_flag:1;\n+ uint8_t exp_etl:3;\n+ uint8_t org_otl:3;\nuint8_t time_unit:2; //exp_er,org_or\n- uint8_t exponent:3; //\n- uint8_t rsv:3; //\n- uint8_t et_val[8]; //\n- uint8_t ot_val[8]; //\n+ uint8_t exponent:3;\n+ uint8_t rsv:3;\n+ uint8_t et_val[8];\n+ uint8_t ot_val[8];\nint16_t time_left;\n} deadline_option_ht;\nEND_PACK\n@@ -294,6 +294,13 @@ uint8_t iphc_retrieveIPv6HopByHopHeader(\nrpl_option_ht *rpl_option\n);\n+void iphc_retrieveIPv6Header(\n+ OpenQueueEntry_t* msg,\n+ ipv6_header_iht* ipv6_outer_header,\n+ ipv6_header_iht* ipv6_inner_header,\n+ uint8_t* page_length\n+);\n+\n#ifdef DEADLINE_OPTION_ENABLED\nvoid iphc_retrieveIPv6DeadlineHeader(\nOpenQueueEntry_t* msg,\n@@ -305,13 +312,6 @@ void iphc_getDeadlineInfo(\nmonitor_expiration_vars_t* stats\n);\n-void iphc_retrieveIPv6Header(\n- OpenQueueEntry_t* msg,\n- ipv6_header_iht* ipv6_outer_header,\n- ipv6_header_iht* ipv6_inner_header,\n- uint8_t* page_length\n-);\n-\n#endif\n/**\n\\}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Bug fixes and formatting
- implicit declarations
- out-of-bounds array
- clang-tidy remarks
|
491,587 |
06.02.2020 18:19:46
| -3,600 |
99a0dfb2a252d0d7d571e8faab0a126c307ec738
|
Additional log for fragmentation
|
[
{
"change_type": "MODIFY",
"old_path": "inc/opendefs.h",
"new_path": "inc/opendefs.h",
"diff": "@@ -221,61 +221,62 @@ enum {\nERR_FRAG_STORED = 0x1d, // stored a fragment with offset {0} (currently in buffer: {1})\nERR_FRAG_TX_FAIL = 0x1e, // failed to send fragment with tag {0} (offset: {1})\nERR_FRAG_REASSEMBLY_OR_VRB_TIMEOUT = 0x1f, // reassembly or vrb timer expired for fragments with tag {0}\n+ ERR_FRAG_FRAGMENTING = 0x20, // fragmenting a big packet, original size {0}, number of fragments {1}\n// l2b\n- ERR_NEIGHBORS_FULL = 0x20, // neighbors table is full (max number of neighbor is {0})\n- ERR_NO_SENT_PACKET = 0x21, // there is no sent packet in queue\n- ERR_NO_RECEIVED_PACKET = 0x22, // there is no received packet in queue\n- ERR_SCHEDULE_OVERFLOWN = 0x23, // schedule overflown\n- ERR_SIXTOP_RETURNCODE = 0x24, // sixtop return code {0} at sixtop state {1}\n- ERR_SIXTOP_COUNT = 0x25, // there are {0} cells to request mote\n- ERR_SIXTOP_LIST = 0x26, // the cells reserved to request mote contains slot {0} and slot {1}\n+ ERR_NEIGHBORS_FULL = 0x21, // neighbors table is full (max number of neighbor is {0})\n+ ERR_NO_SENT_PACKET = 0x22, // there is no sent packet in queue\n+ ERR_NO_RECEIVED_PACKET = 0x23, // there is no received packet in queue\n+ ERR_SCHEDULE_OVERFLOWN = 0x24, // schedule overflown\n+ ERR_SIXTOP_RETURNCODE = 0x25, // sixtop return code {0} at sixtop state {1}\n+ ERR_SIXTOP_COUNT = 0x26, // there are {0} cells to request mote\n+ ERR_SIXTOP_LIST = 0x27, // the cells reserved to request mote contains slot {0} and slot {1}\n// l3a\n- ERR_WRONG_CELLTYPE = 0x27, // wrong celltype {0} at slotOffset {1}\n- ERR_IEEE154_UNSUPPORTED = 0x28, // unsupported IEEE802.15.4 parameter {1} at location {0}\n- ERR_DESYNCHRONIZED = 0x29, // got desynchronized at slotOffset {0}\n- ERR_SYNCHRONIZED = 0x2a, // synchronized at slotOffset {0}\n- ERR_LARGE_TIMECORRECTION = 0x2b, // large timeCorr.: {0} ticks (code loc. {1})\n- ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x2c, // wrong state {0} in end of frame+sync\n- ERR_WRONG_STATE_IN_STARTSLOT = 0x2d, // wrong state {0} in startSlot, at slotOffset {1}\n- ERR_WRONG_STATE_IN_TIMERFIRES = 0x2e, // wrong state {0} in timer fires, at slotOffset {1}\n- ERR_WRONG_STATE_IN_NEWSLOT = 0x2f, // wrong state {0} in start of frame, at slotOffset {1}\n- ERR_WRONG_STATE_IN_ENDOFFRAME = 0x30, // wrong state {0} in end of frame, at slotOffset {1}\n- ERR_MAXTXDATAPREPARE_OVERFLOW = 0x31, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXACKPREPARE_OVERFLOWS = 0x32, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n- ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x33, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_MAXTXACKPREPARE_OVERFLOWS = 0x34, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n- ERR_WDDATADURATION_OVERFLOWS = 0x35, // wdDataDuration overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIO_OVERFLOWS = 0x36, // wdRadio overflows while at state {0} in slotOffset {1}\n- ERR_WDRADIOTX_OVERFLOWS = 0x37, // wdRadioTx overflows while at state {0} in slotOffset {1}\n- ERR_WDACKDURATION_OVERFLOWS = 0x38, // wdAckDuration overflows while at state {0} in slotOffset {1}\n- ERR_SECURITY = 0x39, // security error on frameType {0}, code location {1}\n+ ERR_WRONG_CELLTYPE = 0x28, // wrong celltype {0} at slotOffset {1}\n+ ERR_IEEE154_UNSUPPORTED = 0x29, // unsupported IEEE802.15.4 parameter {1} at location {0}\n+ ERR_DESYNCHRONIZED = 0x2a, // got desynchronized at slotOffset {0}\n+ ERR_SYNCHRONIZED = 0x2b, // synchronized at slotOffset {0}\n+ ERR_LARGE_TIMECORRECTION = 0x2c, // large timeCorr.: {0} ticks (code loc. {1})\n+ ERR_WRONG_STATE_IN_ENDFRAME_SYNC = 0x2d, // wrong state {0} in end of frame+sync\n+ ERR_WRONG_STATE_IN_STARTSLOT = 0x2e, // wrong state {0} in startSlot, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_TIMERFIRES = 0x2f, // wrong state {0} in timer fires, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_NEWSLOT = 0x30, // wrong state {0} in start of frame, at slotOffset {1}\n+ ERR_WRONG_STATE_IN_ENDOFFRAME = 0x31, // wrong state {0} in end of frame, at slotOffset {1}\n+ ERR_MAXTXDATAPREPARE_OVERFLOW = 0x32, // maxTxDataPrepare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXACKPREPARE_OVERFLOWS = 0x33, // maxRxAckPrepapare overflows while at state {0} in slotOffset {1}\n+ ERR_MAXRXDATAPREPARE_OVERFLOWS = 0x34, // maxRxDataPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_MAXTXACKPREPARE_OVERFLOWS = 0x35, // maxTxAckPrepapre overflows while at state {0} in slotOffset {1}\n+ ERR_WDDATADURATION_OVERFLOWS = 0x36, // wdDataDuration overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIO_OVERFLOWS = 0x37, // wdRadio overflows while at state {0} in slotOffset {1}\n+ ERR_WDRADIOTX_OVERFLOWS = 0x38, // wdRadioTx overflows while at state {0} in slotOffset {1}\n+ ERR_WDACKDURATION_OVERFLOWS = 0x39, // wdAckDuration overflows while at state {0} in slotOffset {1}\n+ ERR_SECURITY = 0x3a, // security error on frameType {0}, code location {1}\n// cross layer\n- ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x3a, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n- ERR_INPUT_BUFFER_OVERFLOW = 0x3b, // the input buffer has overflown\n+ ERR_GETDATA_ASKS_TOO_FEW_BYTES = 0x3b, // getData asks for too few bytes, maxNumBytes={0}, fill level={1}\n+ ERR_INPUT_BUFFER_OVERFLOW = 0x3c, // the input buffer has overflown\n// general\n- ERR_BUSY_SENDING = 0x3c, // busy sending\n- ERR_UNEXPECTED_SENDDONE = 0x3d, // sendDone for packet I didn't send\n- ERR_NO_FREE_PACKET_BUFFER = 0x3e, // no free packet buffer (code location {0})\n- ERR_NO_FREE_TIMER_OR_QUEUE_ENTRY = 0x3f, // no free timer or queue entry (code location {0})\n- ERR_FREEING_UNUSED = 0x40, // freeing unused memory\n- ERR_FREEING_ERROR = 0x41, // freeing memory unsupported memory\n- ERR_UNSUPPORTED_COMMAND = 0x42, // unsupported command {0}\n- ERR_MSG_UNKNOWN_TYPE = 0x43, // unknown message type {0}\n- ERR_WRONG_ADDR_TYPE = 0x44, // wrong address type {0} (code location {1})\n- ERR_BRIDGE_MISMATCH = 0x45, // bridge mismatch (code location {0})\n- ERR_HEADER_TOO_LONG = 0x46, // header too long, length {1} (code location {0})\n- ERR_INPUTBUFFER_LENGTH = 0x47, // input length problem, length={0}\n- ERR_BOOTED = 0x48, // booted\n- ERR_INVALIDSERIALFRAME = 0x49, // invalid serial frame\n- ERR_INVALIDPACKETFROMRADIO = 0x4a, // invalid packet from radio, length {1} (code location {0})\n- ERR_BUSY_RECEIVING = 0x4b, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n- ERR_WRONG_CRC_INPUT = 0x4c, // wrong CRC in input Buffer\n- ERR_PACKET_SYNC = 0x4d, // synchronized when received a packet\n- ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4e, // the slot {0} to be added is already in schedule\n- ERR_UNSUPPORTED_FORMAT = 0x4f, // the received packet format is not supported (code location {0})\n- ERR_UNSUPPORTED_METADATA = 0x50, // the metadata type is not suppored\n- ERR_MAXRETRIES_REACHED = 0x51, // maxretries reached (counter: {0})\n- ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER = 0x52, // empty queue or trying to remove unknown timer id (code location {0})\n+ ERR_BUSY_SENDING = 0x3d, // busy sending\n+ ERR_UNEXPECTED_SENDDONE = 0x3e, // sendDone for packet I didn't send\n+ ERR_NO_FREE_PACKET_BUFFER = 0x3f, // no free packet buffer (code location {0})\n+ ERR_NO_FREE_TIMER_OR_QUEUE_ENTRY = 0x40, // no free timer or queue entry (code location {0})\n+ ERR_FREEING_UNUSED = 0x41, // freeing unused memory\n+ ERR_FREEING_ERROR = 0x42, // freeing memory unsupported memory\n+ ERR_UNSUPPORTED_COMMAND = 0x43, // unsupported command {0}\n+ ERR_MSG_UNKNOWN_TYPE = 0x44, // unknown message type {0}\n+ ERR_WRONG_ADDR_TYPE = 0x45, // wrong address type {0} (code location {1})\n+ ERR_BRIDGE_MISMATCH = 0x46, // bridge mismatch (code location {0})\n+ ERR_HEADER_TOO_LONG = 0x47, // header too long, length {1} (code location {0})\n+ ERR_INPUTBUFFER_LENGTH = 0x48, // input length problem, length={0}\n+ ERR_BOOTED = 0x49, // booted\n+ ERR_INVALIDSERIALFRAME = 0x4a, // invalid serial frame\n+ ERR_INVALIDPACKETFROMRADIO = 0x4b, // invalid packet from radio, length {1} (code location {0})\n+ ERR_BUSY_RECEIVING = 0x4c, // busy receiving when stop of serial activity, buffer input length {1} (code location {0})\n+ ERR_WRONG_CRC_INPUT = 0x4d, // wrong CRC in input Buffer\n+ ERR_PACKET_SYNC = 0x4e, // synchronized when received a packet\n+ ERR_SCHEDULE_ADDDUPLICATESLOT = 0x4f, // the slot {0} to be added is already in schedule\n+ ERR_UNSUPPORTED_FORMAT = 0x50, // the received packet format is not supported (code location {0})\n+ ERR_UNSUPPORTED_METADATA = 0x51, // the metadata type is not suppored\n+ ERR_MAXRETRIES_REACHED = 0x52, // maxretries reached (counter: {0})\n+ ERR_EMPTY_QUEUE_OR_UNKNOWN_TIMER = 0x53, // empty queue or trying to remove unknown timer id (code location {0})\n};\n//=========================== typedef =========================================\n"
},
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "@@ -103,6 +103,10 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\n// check if fragmentation is necessary\nif (!msg->l3_isFragment && msg->length > (MAX_FRAGMENT_SIZE + FRAGN_HEADER_SIZE)) {\n+ openserial_printInfo(COMPONENT_FRAG, ERR_FRAG_FRAGMENTING,\n+ (errorparameter_t) msg->length,\n+ (errorparameter_t) (msg->length / MAX_FRAGMENT_SIZE) + 1);\n+\n// update the global 6LoWPAN datagram tag\nfrag_vars.global_tag++;\nremaining_bytes = msg->length;\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Additional log for fragmentation
|
491,587 |
06.02.2020 18:44:33
| -3,600 |
28e2c41cb52aab3a07608ed5cd1c95a573bc3ca9
|
Cleanup fragments if buffer allocation fails
|
[
{
"change_type": "MODIFY",
"old_path": "openstack/03a-IPHC/frag.c",
"new_path": "openstack/03a-IPHC/frag.c",
"diff": "@@ -119,12 +119,10 @@ owerror_t frag_fragment6LoPacket(OpenQueueEntry_t *msg) {\nlowpan_fragment = openqueue_getFreePacketBuffer(COMPONENT_FRAG);\nif (lowpan_fragment == NULL) {\n// 6LoWPAN packet couldn't be entirely fragmented, thus clean up previously created fragments and exit.\n- openserial_printError(\n- COMPONENT_FRAG,\n- ERR_NO_FREE_PACKET_BUFFER,\n+ openserial_printError(COMPONENT_FRAG, ERR_NO_FREE_PACKET_BUFFER,\n(errorparameter_t) 0,\n- (errorparameter_t) 0\n- );\n+ (errorparameter_t) 0);\n+ cleanup_fragments(frag_vars.global_tag);\nreturn E_FAIL;\n}\n"
}
] |
C
|
BSD 3-Clause New or Revised License
|
openwsn-berkeley/openwsn-fw
|
FW-863. Cleanup fragments if buffer allocation fails
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.