@@ -115,6 +115,7 @@ void ieee154e_init() {
115
115
ieee154e_vars .singleChannel = SYNCHRONIZING_CHANNEL ;
116
116
ieee154e_vars .isAckEnabled = TRUE;
117
117
ieee154e_vars .isSecurityEnabled = FALSE;
118
+ ieee154e_vars .slotDuration = TsSlotDuration ;
118
119
// default hopping template
119
120
memcpy (
120
121
& (ieee154e_vars .chTemplate [0 ]),
@@ -140,7 +141,7 @@ void ieee154e_init() {
140
141
radio_setStartFrameCb (ieee154e_startOfFrame );
141
142
radio_setEndFrameCb (ieee154e_endOfFrame );
142
143
// have the radio start its timer
143
- radio_startTimer (TsSlotDuration );
144
+ radio_startTimer (ieee154e_vars . slotDuration );
144
145
}
145
146
146
147
//=========================== public ==========================================
@@ -184,7 +185,7 @@ PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN) {
184
185
This function executes in ISR mode, when the new slot timer fires.
185
186
*/
186
187
void isr_ieee154e_newSlot () {
187
- radio_setTimerPeriod (TsSlotDuration );
188
+ radio_setTimerPeriod (ieee154e_vars . slotDuration );
188
189
if (ieee154e_vars .isSync == FALSE) {
189
190
if (idmanager_getIsDAGroot ()== TRUE) {
190
191
changeIsSync (TRUE);
@@ -761,6 +762,12 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) {
761
762
// timelsot template ID
762
763
timeslotTemplateIDStoreFromEB (* ((uint8_t * )(pkt -> payload )+ ptr ));
763
764
ptr = ptr + 1 ;
765
+ if (ieee154e_vars .tsTemplateId != TIMESLOT_TEMPLATE_ID ){
766
+ ieee154e_vars .slotDuration = * ((uint8_t * )(pkt -> payload )+ ptr );
767
+ ptr = ptr + 1 ;
768
+ ieee154e_vars .slotDuration |= ((* ((uint8_t * )(pkt -> payload )+ ptr ))<<8 ) & 0xff00 ;
769
+ ptr = ptr + 1 ;
770
+ }
764
771
}
765
772
break ;
766
773
@@ -948,7 +955,7 @@ port_INLINE void activity_ti1ORri1() {
948
955
openserial_startInput ();
949
956
//this is to emulate a set of serial input slots without having the slotted structure.
950
957
951
- radio_setTimerPeriod (TsSlotDuration * (NUMSERIALRX ));
958
+ radio_setTimerPeriod (ieee154e_vars . slotDuration * (NUMSERIALRX ));
952
959
953
960
//increase ASN by NUMSERIALRX-1 slots as at this slot is already incremented by 1
954
961
for (i = 0 ;i < NUMSERIALRX - 1 ;i ++ ){
@@ -1912,6 +1919,14 @@ void ieee154e_setIsSecurityEnabled(bool isEnabled){
1912
1919
ieee154e_vars .isSecurityEnabled = isEnabled ;
1913
1920
}
1914
1921
1922
+ void ieee154e_setSlotDuration (uint16_t duration ){
1923
+ ieee154e_vars .slotDuration = duration ;
1924
+ }
1925
+
1926
+ uint16_t ieee154e_getSlotDuration (){
1927
+ return ieee154e_vars .slotDuration ;
1928
+ }
1929
+
1915
1930
// timeslot template handling
1916
1931
port_INLINE void timeslotTemplateIDStoreFromEB (uint8_t id ){
1917
1932
ieee154e_vars .tsTemplateId = id ;
@@ -1936,12 +1951,12 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {
1936
1951
// calculate new period
1937
1952
timeCorrection = (PORT_SIGNED_INT_WIDTH )((PORT_SIGNED_INT_WIDTH )timeReceived - (PORT_SIGNED_INT_WIDTH )TsTxOffset );
1938
1953
1939
- newPeriod = TsSlotDuration ;
1954
+ newPeriod = ieee154e_vars . slotDuration ;
1940
1955
1941
1956
// detect whether I'm too close to the edge of the slot, in that case,
1942
1957
// skip a slot and increase the temporary slot length to be 2 slots long
1943
1958
if (currentValue < timeReceived || currentPeriod - currentValue < RESYNCHRONIZATIONGUARD ) {
1944
- newPeriod += TsSlotDuration ;
1959
+ newPeriod += ieee154e_vars . slotDuration ;
1945
1960
incrementAsnOffset ();
1946
1961
}
1947
1962
newPeriod = (PORT_RADIOTIMER_WIDTH )((PORT_SIGNED_INT_WIDTH )newPeriod + timeCorrection );
@@ -2055,9 +2070,9 @@ void notif_receive(OpenQueueEntry_t* packetReceived) {
2055
2070
// COMPONENT_IEEE802154E_TO_SIXTOP so sixtop can knows it's for it
2056
2071
packetReceived -> owner = COMPONENT_IEEE802154E_TO_SIXTOP ;
2057
2072
#ifdef GOLDEN_IMAGE_ROOT
2058
- openserial_printInfo (COMPONENT_IEEE802154E ,ERR_PACKET_SYNC ,
2059
- (errorparameter_t )packetReceived -> l2_asn .bytes0and1 ,
2060
- (errorparameter_t )packetReceived -> l2_timeCorrection );
2073
+ // openserial_printInfo(COMPONENT_IEEE802154E,ERR_PACKET_SYNC,
2074
+ // (errorparameter_t)packetReceived->l2_asn.bytes0and1,
2075
+ // (errorparameter_t)packetReceived->l2_timeCorrection);
2061
2076
#endif
2062
2077
// post RES's Receive task
2063
2078
scheduler_push_task (task_sixtopNotifReceive ,TASKPRIO_SIXTOP_NOTIF_RX );
0 commit comments