Changeset 201
- Timestamp:
- 10/08/09 10:35:08 (4 years ago)
- Location:
- apps/TSCH
- Files:
-
- 11 edited
-
TODO.txt (modified) (1 diff)
-
TSCH.h (modified) (3 diffs)
-
TSCHAppC.nc (modified) (2 diffs)
-
TSCHP.nc (modified) (3 diffs)
-
advertise/AdvertiseP.nc (modified) (1 diff)
-
cellusage/CellUsageP.nc (modified) (1 diff)
-
debugwsn.py (modified) (5 diffs)
-
globaltime/GlobalTimeP.nc (modified) (1 diff)
-
serialio/SerialIOP.nc (modified) (2 diffs)
-
slotengine/SlotEngineP.nc (modified) (6 diffs)
-
testlowertsch/TestLowerTSCHC.nc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apps/TSCH/TODO.txt
r181 r201 1 1 - CellUsageC: TXRES cells will always be reserved, regardless of the previous state. This can cause trouble. Enquire. 2 2 - based on gathered statistics, trigger garbage collection of cells/neighbors 3 4 5 TSCHP: 6 message_t queuedPkt[QUEUELENGTH]; 7 bool queuedPktUsed[QUEUELENGTH]; 8 9 ------------------------------------------- 10 11 AdvertiseP: 12 uint8_t myHeight; 13 14 Total: 1B 15 16 ------------------------------------------- 17 18 CellUsageP: 19 cellUsageInformation cellTable[LENGTHCELLFRAME]; 20 21 Total: 9*11=99B 22 23 ------------------------------------------- 24 25 NeighborsP: 26 neighborEntry_t neighbors[MAXNUMNEIGHBORS]; 27 28 Total: 18*10=180B 29 30 ------------------------------------------- 31 32 ReservationP: 33 ongoingRes_t ongoingRes[NUMONGOINGRES]; 34 35 Total: (16+110?)*3=48B/358B 36 37 ------------------------------------------- 38 39 SerialIOP: 40 uint16_t output_buffer_index_write; 41 uint16_t output_buffer_index_read; 42 43 Total: 4B 44 45 ------------------------------------------- 46 47 TSCHQueueP: 48 TSCHQueueEntry_t queue[QUEUELENGTH]; 49 50 Total: 110*5=550B 51 52 =========================================== 53 54 Total: 924B 55 -
apps/TSCH/TSCH.h
r197 r201 5 5 enum { 6 6 LOOSING_SYNC_DELAY = 15, //in seconds 7 LOST_SYNC_DELAY = 30, //in seconds7 LOST_SYNC_DELAY = 30, //in seconds 8 8 LENGTHCELLFRAME = 5, //prime number better 9 9 QUEUELENGTH = 5, … … 15 15 ADVRESCHANNELOFFSET=0, 16 16 DELAY_REMOVE_FROZEN_RESERVATIONS=30000,//in ms 17 SERIAL_BUFFER_SIZE=200 17 SERIAL_OUTPUT_BUFFER_SIZE=200, 18 SERIAL_INPUT_BUFFER_SIZE=200 18 19 }; 19 20 … … 157 158 ERR_NOT_IN_SLEEP_STATE =29, //was not in S_SLEEP state at beginning of slot [SlotEngineP] arg1=state 158 159 ERR_TURN_OFF_RADIO_FAILED =30, //could not turn off radio [SlotEngineP] 159 ERR_ NOT_IN_SLEEP_SYNCHRONIZING_AT_NEWSLOT =31, //wrong state (not SLEEP/SYNCHRONIZING) in newSlot[SlotEngineP] arg1=state160 ERR_WRONG_STATE_IN_NEWSLOT =31, //wrong state in newSlot [SlotEngineP] arg1=state 160 161 ERR_NO_TIME_TO_SET_CHANNEL =32, //no time to set channel and start radio [SlotEngineP] 161 162 ERR_NO_TIME_TO_SEND_DATA =33, //no time to send DATA [SlotEngineP] 162 163 ERR_NO_TIME_TO_SEND_ACK =34, //no time to send ACK [SlotEngineP] 163 ERR_WRONG_STATE_IN_FASTTIMER_FIRED =35, //wrong state in FastTimer.fired [SlotEngineP] arg1=state 164 ERR_WRONG_STATE_IN_SUBCONTROL_STARTDONE =36, //wrong state in SubControl.startDone [SlotEngineP] arg1=state 165 ERR_WRONG_STATE_IN_SUBCONTROL_STOPDONE =37, //wrong state in SubControl.stopDone [SlotEngineP] arg1=state 164 ERR_WRONG_STATE_IN_FASTTIMER_FIRED =35, //wrong state in FastTimer.fired [SlotEngineP] arg1=state arg2=slotOffset 165 ERR_WRONG_STATE_IN_SUBCONTROL_STARTDONE =36, //wrong state in SubControl.startDone [SlotEngineP] arg1=state arg2=slotOffset 166 ERR_WRONG_STATE_IN_SUBCONTROL_STOPDONE =37, //wrong state in SubControl.stopDone [SlotEngineP] arg1=state arg2=slotOffset 166 167 ERR_START_RADIO_FOR_SYNCHRONIZER_FAILED =38, //could not start radio for synchronizer [SlotEngineP] 167 168 ERR_START_RADIO_AT_START_SLOT_FAILED =39, //could not start radio at beginning of slot [SlotEngineP] 168 ERR_WRONG_STATE_IN_CC2420CONFIG_SYNCDONE =40, //wrong state in CC2420Config.syncDone [SlotEngineP] arg1=state 169 ERR_WRONG_STATE_IN_SUBSEND_SENDDONE =41, //wrong state in SubSend.sendDone [SlotEngineP] arg1=state 169 ERR_WRONG_STATE_IN_CC2420CONFIG_SYNCDONE =40, //wrong state in CC2420Config.syncDone [SlotEngineP] arg1=state arg2=slotOffset 170 ERR_WRONG_STATE_IN_SUBSEND_SENDDONE =41, //wrong state in SubSend.sendDone [SlotEngineP] arg1=state arg2=slotOffset 170 171 ERR_UNDEFINED_TYPE =42, //undefined type [TSCHQueueC] arg1=type 171 172 ERR_NOT_DATA_MSG_THROUGH_SENDDATA =43, //should receive only DATA through SendDATA [TSCHQueueC] arg1=message_type -
apps/TSCH/TSCHAppC.nc
r197 r201 2 2 } 3 3 implementation { 4 //general5 4 components MainC; 6 //stack7 5 components TSCHC; 8 6 components ForwardingC; … … 24 22 25 23 TSCHC.Boot->MainC; 26 //stack27 24 TSCHC.IDManager->IDManagerC; 28 25 TSCHC.Advertise->AdvertiseC; -
apps/TSCH/TSCHP.nc
r200 r201 31 31 } 32 32 implementation { 33 /*-------------------------------- variables -----------------------------------------*/ 34 33 35 message_t queuedPkt[QUEUELENGTH]; 34 36 bool queuedPktUsed[QUEUELENGTH]; 37 35 38 heightNeighbor_t nextHop; 36 39 uint8_t datavaluecounter=0; 37 40 uint8_t numreservations; 38 41 39 /* **************************** helper functions ***************************************/42 /*-------------------------------- prototypes ----------------------------------------*/ 40 43 41 44 task void getNextHop(); 42 45 task void checkReservedCells(); 43 task void sendDATAMessage();44 46 task void addReservation(); 45 47 task void removeReservation(); 48 task void sendDATAMessage(); 46 49 task void printDebug(); 50 51 /*-------------------------------- helper functions ----------------------------------*/ 47 52 48 53 task void getNextHop() { … … 109 114 } 110 115 111 /***************************** interfaces ***************************************/ 112 116 /*-------------------------------- interfaces ----------------------------------------*/ 117 118 //SoftwareInit 119 command error_t SoftwareInit.init() { 120 uint8_t i; 121 for (i=0;i<QUEUELENGTH;i++){ 122 queuedPktUsed[i]=FALSE; 123 } 124 return SUCCESS; 125 } 126 113 127 //Boot 114 128 event void Boot.booted() { … … 118 132 } 119 133 120 //SoftwareInit121 command error_t SoftwareInit.init() {122 uint8_t i;123 for (i=0;i<QUEUELENGTH;i++){124 queuedPktUsed[i]=FALSE;125 }126 return SUCCESS;127 }128 129 134 //SplitControl 130 135 event void SplitControl.startDone(error_t error) { 131 136 switch (call IDManager.getMyID()) { 132 137 case 2: 138 case 3: 133 139 numreservations = 1; 134 break;135 case 4:136 numreservations = 6;137 break;138 case 5:139 numreservations = 9;140 140 break; 141 141 default: -
apps/TSCH/advertise/AdvertiseP.nc
r200 r201 16 16 /*-------------------------------- variables -----------------------------------------*/ 17 17 18 uint8_t myHeight; 19 18 20 message_t pkt; 19 21 bool busy; 20 uint8_t myHeight;21 22 uint32_t advPeriod = 1000; 22 23 -
apps/TSCH/cellusage/CellUsageP.nc
r200 r201 17 17 18 18 cellUsageInformation cellTable[LENGTHCELLFRAME]; 19 19 20 bool cellStatsBusy; 20 21 slotOffset_t cellStatsSlotOffset; -
apps/TSCH/debugwsn.py
r199 r201 15 15 sys.exit() 16 16 17 def getSlotState(slotStateNumber): 18 if (slotStateNumber==0): return "S_SETTING_CHAN" 19 elif (slotStateNumber==1): return "S_STARTING" 20 elif (slotStateNumber==2): return "S_STARTED" 21 elif (slotStateNumber==3): return "S_SYNCHRONIZING" 22 elif (slotStateNumber==4): return "S_TXDATA" 23 elif (slotStateNumber==5): return "S_WAIT_RXACK" 24 elif (slotStateNumber==6): return "S_ACK" 25 elif (slotStateNumber==7): return "S_RXDATA" 26 elif (slotStateNumber==8): return "S_WAIT_TXACK" 27 elif (slotStateNumber==9): return "S_TXACK" 28 elif (slotStateNumber==10): return "S_STOPPING" 29 elif (slotStateNumber==11): return "S_SLEEP" 30 else: return "!!unknow state ("+str(slotStateNumber)+")!!" 31 32 def getComponentName(componentNameNumber): 33 if (componentNameNumber==0): return "[TSCHP]" 34 elif (componentNameNumber==1): return "[ForwardingP]" 35 elif (componentNameNumber==2): return "[ReservationP]" 36 elif (componentNameNumber==3): return "[NeighborsP]" 37 elif (componentNameNumber==4): return "[CellUsageP]" 38 elif (componentNameNumber==5): return "[AdvertiseP]" 39 elif (componentNameNumber==6): return "[TSCHQueueP]" 40 elif (componentNameNumber==7): return "[KeepAliveP]" 41 elif (componentNameNumber==8): return "[MultiplexP]" 42 elif (componentNameNumber==9): return "[SlotEngineP]" 43 elif (componentNameNumber==10): return "[GlobalTimeP]" 44 elif (componentNameNumber==11): return "[SerialIOP]" 45 elif (componentNameNumber==12): return "[TestLowerTSCHP]" 46 else : displayline = displayline + "[!!unknow component("+str(ord(command[3]))+")!!] " 47 17 48 def parseAndDisplay(text_tag,command): 18 49 displayline="" … … 23 54 displayline = displayline + "node "+str(moteID)+": " 24 55 #byte 3 is the calling component 25 if (ord(command[3])==0): displayline = displayline + "[TSCHP] " 26 elif (ord(command[3])==1): displayline = displayline + "[ForwardingP] " 27 elif (ord(command[3])==2): displayline = displayline + "[ReservationP] " 28 elif (ord(command[3])==3): displayline = displayline + "[NeighborsP] " 29 elif (ord(command[3])==4): displayline = displayline + "[CellUsageP] " 30 elif (ord(command[3])==5): displayline = displayline + "[AdvertiseP] " 31 elif (ord(command[3])==6): displayline = displayline + "[TSCHQueueP] " 32 elif (ord(command[3])==7): displayline = displayline + "[KeepAliveP] " 33 elif (ord(command[3])==8): displayline = displayline + "[MultiplexP] " 34 elif (ord(command[3])==9): displayline = displayline + "[SlotEngineP] " 35 elif (ord(command[3])==10): displayline = displayline + "[GlobalTimeP] " 36 elif (ord(command[3])==11): displayline = displayline + "[SerialIOP] " 56 displayline = displayline + getComponentName(ord(command[3])) + " " 37 57 #byte 4 is the command 38 58 #bytes 5 and 6 are arg1 39 59 #bytes 7 and 8 are arg2 40 if (ord(command[4])==0): displayline = displayline + "main program booted" 41 elif (ord(command[4])==0): displayline = displayline + "main program booted" 60 if (ord(command[4])==0): displayline = displayline + "main program booted" 42 61 elif (ord(command[4])==1): displayline = displayline + "reservation is ready" 43 62 elif (ord(command[4])==2): displayline = displayline + "send.sendDone for packet I did not send" … … 51 70 elif (ord(command[4])==10): displayline = displayline + "CellUsageSet.setUsage does not set RXRES and ADV slots (slotOffset="+str(ord(command[5])*256+ord(command[6]))+", channelOffset="+str(ord(command[7])*256+ord(command[8]))+")" 52 71 elif (ord(command[4])==11): displayline = displayline + "ForwardingP is busy" 53 elif (ord(command[4])==12): displayline = displayline + " lost synchronization"72 elif (ord(command[4])==12): displayline = displayline + "Lost Synchronization" 54 73 elif (ord(command[4])==13): displayline = displayline + "SimpleSend.sendDone while busy==FALSE" 55 74 elif (ord(command[4])==14): displayline = displayline + "received message of unknown type="+str(ord(command[5])*256+ord(command[6])) … … 68 87 elif (ord(command[4])==27): displayline = displayline + "SimpleSend.sendDone with todo!=WAIT_FOR_SENT" 69 88 elif (ord(command[4])==28): displayline = displayline + "unsupported ACK response" 70 elif (ord(command[4])==29): displayline = displayline + "was in state="+ str(ord(command[5])*256+ord(command[6]))+" at beginning of slot, not in S_SLEEP"89 elif (ord(command[4])==29): displayline = displayline + "was in state="+getSlotState(str(ord(command[5])*256+ord(command[6])))+" at beginning of slot, not in S_SLEEP" 71 90 elif (ord(command[4])==30): displayline = displayline + "could not turn off radio" 72 elif (ord(command[4])==31): displayline = displayline + "wrong state="+ str(ord(command[5])*256+ord(command[6]))+" (not SLEEP/SYNCHRONIZING) in newSlot"91 elif (ord(command[4])==31): displayline = displayline + "wrong state="+getSlotState(ord(command[5])*256+ord(command[6]))+" in newSlot, should be S_SLEEP or S_SYNCHRONIZING (slotOffset="+str(ord(command[7])*256+ord(command[8]))+")" 73 92 elif (ord(command[4])==32): displayline = displayline + "no time to set channel and start radio" 74 93 elif (ord(command[4])==33): displayline = displayline + "no time to send DATA" 75 94 elif (ord(command[4])==34): displayline = displayline + "no time to send ACK" 76 elif (ord(command[4])==35): displayline = displayline + "wrong state="+ str(ord(command[5])*256+ord(command[6]))+" in FastTimer.fired"77 elif (ord(command[4])==36): displayline = displayline + "wrong state="+ str(ord(command[5])*256+ord(command[6]))+" in SubControl.startDone"78 elif (ord(command[4])==37): displayline = displayline + "wrong state="+ str(ord(command[5])*256+ord(command[6]))+" in SubControl.stopDone"95 elif (ord(command[4])==35): displayline = displayline + "wrong state="+getSlotState(ord(command[5])*256+ord(command[6]))+" in FastTimer.fired (slotOffset="+str(ord(command[7])*256+ord(command[8]))+")" 96 elif (ord(command[4])==36): displayline = displayline + "wrong state="+getSlotState(ord(command[5])*256+ord(command[6]))+" in SubControl.startDone (slotOffset="+str(ord(command[7])*256+ord(command[8]))+")" 97 elif (ord(command[4])==37): displayline = displayline + "wrong state="+getSlotState(ord(command[5])*256+ord(command[6]))+" in SubControl.stopDone (slotOffset="+str(ord(command[7])*256+ord(command[8]))+")" 79 98 elif (ord(command[4])==38): displayline = displayline + "could not start radio for synchronizer" 80 99 elif (ord(command[4])==39): displayline = displayline + "could not start radio at beginning of slot" 81 elif (ord(command[4])==40): displayline = displayline + "wrong state="+ str(ord(command[5])*256+ord(command[6]))+" in CC2420Config.syncDone"82 elif (ord(command[4])==41): displayline = displayline + "wrong state="+ str(ord(command[5])*256+ord(command[6]))+" in SubSend.sendDone"100 elif (ord(command[4])==40): displayline = displayline + "wrong state="+getSlotState(ord(command[5])*256+ord(command[6]))+" in CC2420Config.syncDone (slotOffset="+str(ord(command[7])*256+ord(command[8]))+")" 101 elif (ord(command[4])==41): displayline = displayline + "wrong state="+getSlotState(ord(command[5])*256+ord(command[6]))+" in SubSend.sendDone (slotOffset="+str(ord(command[7])*256+ord(command[8]))+")" 83 102 elif (ord(command[4])==42): displayline = displayline + "undefined type="+str(ord(command[5])*256+ord(command[6])) 84 103 elif (ord(command[4])==43): displayline = displayline + "should receive only DATA through SendDATA (now type="+str(ord(command[5])*256+ord(command[6]))+")" … … 89 108 elif (ord(command[4])==48): displayline = displayline + "Dequeue.done while busy==TRUE" 90 109 elif (ord(command[4])==49): displayline = displayline + "DeQueue.done for packet I didn't send" 91 elif (ord(command[4])==50): displayline = displayline + "Acquired Sync "92 elif (ord(command[4])==51): displayline = displayline + "Loosing Sync "110 elif (ord(command[4])==50): displayline = displayline + "Acquired Synchronization" 111 elif (ord(command[4])==51): displayline = displayline + "Loosing Synchronization" 93 112 else: displayline = displayline + "unknown command code" 94 113 displayline = displayline + "\n" -
apps/TSCH/globaltime/GlobalTimeP.nc
r200 r201 25 25 /*-------------------------------- variables -----------------------------------------*/ 26 26 27 bool sync; 27 28 uint32_t asn; 28 bool sync;29 29 uint32_t myReceptionLocalTime; 30 30 uint32_t hisTranmissionGlobalSlotOffset; -
apps/TSCH/serialio/SerialIOP.nc
r199 r201 18 18 /*------------------- variables ----------------------------------*/ 19 19 20 msp430_uart_union_config_t msp430_uart_telos_config = {{ubr: UBR_1MHZ_115200, umctl: UMCTL_1MHZ_115200, ssel: 0x02, pena: 0, pev: 0, spb: 0, clen: 1, listen: 0, mm: 0, ckpl: 0, urxse: 0, urxeie: 1, urxwie: 0, utxe : 1, urxe : 1}};21 uint8_t output_buffer[SERIAL_BUFFER_SIZE];22 20 uint16_t output_buffer_index_write; 23 21 uint16_t output_buffer_index_read; 22 23 msp430_uart_union_config_t msp430_uart_telos_config = {{ubr: UBR_1MHZ_115200, umctl: UMCTL_1MHZ_115200, ssel: 0x02, pena: 0, pev: 0, spb: 0, clen: 1, listen: 0, mm: 0, ckpl: 0, urxse: 0, urxeie: 1, urxwie: 0, utxe : 1, urxe : 1}}; 24 uint8_t output_buffer[SERIAL_OUTPUT_BUFFER_SIZE]; 24 25 bool somethingInOutputBuffer; 25 uint8_t input_buffer[SERIAL_ BUFFER_SIZE];26 uint8_t input_buffer[SERIAL_INPUT_BUFFER_SIZE]; 26 27 uint16_t input_buffer_index_write; 27 28 bool allowedToUse; … … 36 37 37 38 uint16_t output_buffer_index_write_increment() { 38 atomic output_buffer_index_write=(output_buffer_index_write+1)%SERIAL_ BUFFER_SIZE;39 atomic output_buffer_index_write=(output_buffer_index_write+1)%SERIAL_OUTPUT_BUFFER_SIZE; 39 40 return output_buffer_index_write; 40 41 } 41 42 42 43 uint16_t output_buffer_index_read_increment() { 43 atomic output_buffer_index_read=(output_buffer_index_read+1)%SERIAL_ BUFFER_SIZE;44 atomic output_buffer_index_read=(output_buffer_index_read+1)%SERIAL_INPUT_BUFFER_SIZE; 44 45 atomic return output_buffer_index_read; 45 46 } -
apps/TSCH/slotengine/SlotEngineP.nc
r200 r201 211 211 default: 212 212 post endSlotTask(); 213 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_ NOT_IN_SLEEP_SYNCHRONIZING_AT_NEWSLOT,(uint16_t)state,0);213 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_NEWSLOT,(uint16_t)state,(uint16_t)newASN%LENGTHCELLFRAME); 214 214 break; 215 215 } … … 286 286 default: 287 287 post endSlotTask(); 288 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_FASTTIMER_FIRED,(uint16_t)state, 0);288 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_FASTTIMER_FIRED,(uint16_t)state,(uint16_t)slotOffset); 289 289 break; 290 290 } … … 397 397 default: 398 398 post endSlotTask(); 399 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_SUBCONTROL_STARTDONE,(uint16_t)state, 0);399 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_SUBCONTROL_STARTDONE,(uint16_t)state,(uint16_t)slotOffset); 400 400 break; 401 401 } … … 409 409 default: 410 410 post endSlotTask(); 411 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_SUBCONTROL_STOPDONE,(uint16_t)state, 0);411 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_SUBCONTROL_STOPDONE,(uint16_t)state,(uint16_t)slotOffset); 412 412 break; 413 413 } … … 436 436 default: 437 437 post endSlotTask(); 438 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_CC2420CONFIG_SYNCDONE,(uint16_t)state, 0);438 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_CC2420CONFIG_SYNCDONE,(uint16_t)state,(uint16_t)slotOffset); 439 439 break; 440 440 } … … 455 455 default: 456 456 post endSlotTask(); 457 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_SUBSEND_SENDDONE,(uint16_t)state, 0);457 call SerialIO.printError(COMPONENT_SLOTENGINE,ERR_WRONG_STATE_IN_SUBSEND_SENDDONE,(uint16_t)state,(uint16_t)slotOffset); 458 458 break; 459 459 } -
apps/TSCH/testlowertsch/TestLowerTSCHC.nc
r199 r201 63 63 if (slotoffset==0) { //adv 64 64 return CELLTYPE_ADV; 65 } else if (slotoffset==1 || slotoffset==2) { //off (for serial communication) 66 return CELLTYPE_OFF; 65 67 } else { 66 68 if (TOS_NODE_ID%2==0) { … … 221 223 async event void GlobalTime.newSlot(uint32_t newASN) { 222 224 } 223 224 //DebugPrintSlotEngine225 event void DebugPrintSlotEngine.done() {226 }227 228 //DebugPrintGlobalTime229 event void DebugPrintGlobalTime.done() {230 }231 225 }
Note: See TracChangeset
for help on using the changeset viewer.
