Changeset 181


Ignore:
Timestamp:
10/05/09 14:01:41 (4 years ago)
Author:
thomas
Message:

made TSCHAppC compile (some interfaces and components were changed when doing the video over WSN work). Compiles now, but don't know whether it actually works!
TODO:

  • replace printf's by SerialOutputC calls
Location:
apps/TSCH
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • apps/TSCH/Makefile

    r155 r181  
    1414CFLAGS += -I $(TOSROOT)/apps/TSCH/globaltime 
    1515CFLAGS += -I $(TOSROOT)/apps/TSCH/printpacket 
     16CFLAGS += -I $(TOSROOT)/apps/TSCH/serialoutput 
    1617CFLAGS += -I $(TOSDIR)/lib/printf 
    1718CFLAGS += -D"PRINTF_BUFFER_SIZE=3000" 
  • apps/TSCH/TODO.txt

    r122 r181  
    1 Thomas 
    21- CellUsageC: TXRES cells will always be reserved, regardless of the previous state. This can cause trouble. Enquire. 
    32- based on gathered statistics, trigger garbage collection of cells/neighbors 
  • apps/TSCH/TSCH.h

    r180 r181  
    105105} slotChannel_t; 
    106106 
    107 typedef struct stats_t { 
    108    uint16_t neighbor; 
    109    uint32_t first_received; 
    110    uint32_t last_received; 
    111    uint32_t num_received; 
    112 } stats_t; 
    113  
    114107typedef struct heightNeighbor_t { 
    115108   bool exists; 
  • apps/TSCH/TSCHAppC.nc

    r139 r181  
    1717   components GlobalTimeC; 
    1818   components ActiveMessageAddressC; 
     19   components SerialOutputC; 
    1920   //debug    
    2021   components PrintPacketC; 
     
    6970   NeighborsC.ReservationUpdate->ReservationC; 
    7071 
    71    CellUsageC.GlobalSynch->GlobalTimeC; 
     72   CellUsageC.GlobalSync->GlobalTimeC; 
    7273   CellUsageC.GlobalTime->GlobalTimeC; 
    7374 
     
    7980   TSCHQueueC.PrintPacket->PrintPacketC; 
    8081   TSCHQueueC.GlobalTime->GlobalTimeC; 
    81    TSCHQueueC.GlobalSynch->GlobalTimeC; 
     82   TSCHQueueC.GlobalSync->GlobalTimeC; 
    8283   TSCHQueueC.ActiveMessageAddress->ActiveMessageAddressC; 
    8384 
    8485   KeepAliveC.SimpleSend->TSCHQueueC.SendKA; 
    8586   KeepAliveC.NeighborGet->NeighborsC; 
    86    KeepAliveC.GlobalSynch->GlobalTimeC; 
     87   KeepAliveC.GlobalSync->GlobalTimeC; 
    8788   KeepAliveC.CellUsageGet->CellUsageC; 
    8889 
     
    9394   SlotEngineC.CellUsageGet->CellUsageC; 
    9495   SlotEngineC.GlobalTime->GlobalTimeC; 
    95    SlotEngineC.GlobalSynch->GlobalTimeC; 
     96   SlotEngineC.GlobalSync->GlobalTimeC; 
    9697   SlotEngineC.ActiveMessageAddress->ActiveMessageAddressC; 
    9798   SlotEngineC.CellStats->CellUsageC; 
     99   SlotEngineC.SerialOutput->SerialOutputC; 
    98100 
    99101   GlobalTimeC.SubReceive->SlotEngineC; 
  • apps/TSCH/TSCHP.nc

    r136 r181  
    3939   heightNeighbor_t nextHop; 
    4040   uint8_t printDebugCounter=0; 
    41    uint32_t datavaluecounter=0; 
     41   uint8_t datavaluecounter=0; 
    4242   uint8_t numreservations; 
    4343   bool blinkBool; 
    44    stats_t stats[7]; 
    4544 
    4645   /***************************** helper functions ***************************************/ 
     
    5049   task void sendDATAMessage(); 
    5150   task void addReservation(); 
    52    task void printStats(); 
    5351   task void removeReservation(); 
    5452   task void printDebug(); 
     
    9997            queuedPktUsed[i]=TRUE; 
    10098            ((cc2420_header_t*)queuedPkt[i].header)->dest=nextHop.neighbor; 
    101             //((data_format_t*)queuedPkt[i].data)->value=call GlobalTime.getTime32khz(); 
    102             ((data_format_t*)queuedPkt[i].data)->value=datavaluecounter; 
     99            ((data_format_t*)queuedPkt[i].data)->payload[0]=datavaluecounter; 
    103100            sendError = call Send.send(&queuedPkt[i],sizeof(data_format_t)); 
    104101            if (sendError==FAIL) { 
     
    111108      } 
    112109      //printf("\n==TSCHP ERROR no free queuedPkt cell");printfflush(); 
    113    } 
    114  
    115    task void printStats(){ 
    116       uint8_t i; 
    117       for (i=0;i<7;i++) { 
    118          printf("%i %lu %lu %lu\n",stats[i].neighbor,stats[i].first_received,stats[i].last_received,stats[i].num_received); 
    119       } 
    120110   } 
    121111 
     
    155145      call Notify.enable(); 
    156146      call Port34.makeOutput(); 
    157       stats[0].neighbor=2; 
    158       stats[1].neighbor=4; 
    159       stats[2].neighbor=5; 
    160       stats[3].neighbor=8; 
    161       stats[4].neighbor=9; 
    162       stats[5].neighbor=10; 
    163       stats[6].neighbor=11; 
    164       for (i=0;i<7;i++) { 
    165          stats[i].first_received=0; 
    166          stats[i].last_received=0; 
    167          stats[i].num_received=0; 
    168       } 
    169147      switch (call ActiveMessageAddress.amAddress()) { 
    170148         case 2: 
     
    210188      if (val==TRUE) { 
    211189         if (call ActiveMessageAddress.amAddress()==1) { 
    212             post printStats(); 
    213190            post printDebug(); 
    214191         } else { 
     
    235212   //Receive 
    236213   event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len){ 
    237       uint8_t i=0; 
    238       uint32_t senttime = (uint32_t)((data_format_t*)msg->data)->value; 
    239       uint32_t rxtime = ((cc2420_metadata_t*)msg->metadata)->timestamp; 
    240       printf("\n Delay: %lu",rxtime); 
    241  
    242214      //printf("\n==TSCHP Receive.received msg=%p rssi=%i",msg,((cc2420_metadata_t*)msg->metadata)->rssi); 
    243215      //call PrintPacket.print(msg);printfflush(); 
    244216      post blinkLeds(); 
    245       while (i<7) { 
    246          if (((cc2420_header_t*)msg->header)->src==stats[i].neighbor) { 
    247             if (stats[i].first_received==0) { 
    248                stats[i].first_received = ((data_format_t*)msg->data)->value; 
    249             } 
    250             stats[i].last_received = ((data_format_t*)msg->data)->value; 
    251             stats[i].num_received++; 
    252             return msg; 
    253          } 
    254          i++; 
    255       } 
    256       printf("\n==TSCHP received message from unknown neighbor %i\n",((cc2420_header_t*)msg->header)->src);printfflush(); 
    257217      return msg; 
    258218   } 
     
    267227   //ActiveMessageAddress 
    268228   async event void ActiveMessageAddress.changed(){ 
     229   } 
     230 
     231   //GlobalTime 
     232   async event void GlobalTime.newSlot(uint32_t newASN) { 
     233      //don't do anything. Should only be implemented by SlotEngineC 
    269234   } 
    270235 
  • apps/TSCH/cellusage/CellUsageC.nc

    r118 r181  
    88   provides interface DebugPrint; 
    99   provides interface CellStats; 
    10    uses interface GlobalSynch; 
     10   uses interface GlobalSync; 
    1111   uses interface GlobalTime; 
    1212} 
     
    1818   DebugPrint = CellUsageP.DebugPrint; 
    1919   CellStats = CellUsageP.CellStats; 
    20    GlobalSynch = CellUsageP.GlobalSynch; 
     20   GlobalSync = CellUsageP.GlobalSync; 
    2121   GlobalTime = CellUsageP.GlobalTime; 
    2222 
  • apps/TSCH/cellusage/CellUsageP.nc

    r122 r181  
    88   provides interface DebugPrint; 
    99   provides interface CellStats; 
    10    uses interface GlobalSynch; 
     10   uses interface GlobalSync; 
    1111   uses interface GlobalTime; 
    1212   uses interface Random; 
     
    6464      slotChannel_t return_value; 
    6565      return_value.exists=FALSE; 
    66       if (call GlobalSynch.isSynch()==FALSE){ 
     66      if (call GlobalSync.isSync()==FALSE){ 
    6767         return return_value; 
    6868      } 
     
    147147   } 
    148148 
    149    command cellType_t CellUsageGet.GetType(slotOffset_t slotOffset) { 
     149   command cellType_t CellUsageGet.getType(slotOffset_t slotOffset) { 
    150150      return getCellType(slotOffset); 
    151151   } 
    152    command uint16_t CellUsageGet.GetNeighbor(slotOffset_t slotOffset) { 
     152   command uint16_t CellUsageGet.getNeighbor(slotOffset_t slotOffset) { 
    153153      return getCellNeighbor(slotOffset); 
    154154   } 
    155    command channelOffset_t CellUsageGet.GetChannel(slotOffset_t slotOffset) { 
     155   command channelOffset_t CellUsageGet.getChannel(slotOffset_t slotOffset) { 
    156156      return getCellChannelOffset(slotOffset); 
    157157   } 
     
    160160   command error_t CellUsageSet.setUsage(slotOffset_t slotOffset, cellType_t type, uint16_t neighbor, channelOffset_t channelOffset) { 
    161161      error_t return_error; 
    162       if (call GlobalSynch.isSynch()==FALSE){ 
     162      if (call GlobalSync.isSync()==FALSE){ 
    163163         return FAIL; 
    164164      } 
     
    212212   } 
    213213   command error_t CellUsageSet.setUsageForce(slotOffset_t slotOffset, cellType_t type, uint16_t neighbor, channelOffset_t channelOffset) { 
    214       if (call GlobalSynch.isSynch()==FALSE){ 
     214      if (call GlobalSync.isSync()==FALSE){ 
    215215         return FAIL; 
    216216      } 
     
    236236   } 
    237237 
    238    //GlobalSynch 
    239    event void GlobalSynch.loosingSynch(){ 
    240    } 
    241    event void GlobalSynch.lostSynch(){ 
     238   //GlobalSync 
     239   event void GlobalSync.loosingSync(){ 
     240   } 
     241   event void GlobalSync.lostSync(){ 
    242242   } 
    243243 
     
    249249   //CellStats 
    250250   command void CellStats.update(slotOffset_t slotOffset, bool ack){ 
    251       if (call GlobalSynch.isSynch()==FALSE){ 
     251      if (call GlobalSync.isSync()==FALSE){ 
    252252         return; 
    253253      } 
     
    256256      cellStatsACK = ack; 
    257257      post cellStatsUpdate(); 
     258   } 
     259 
     260   //GlobalTime 
     261   async event void GlobalTime.newSlot(uint32_t newASN) { 
     262      //don't do anything. Should only be implemented by SlotEngineC 
    258263   } 
    259264 
     
    326331 
    327332   cellType_t getCellType(slotOffset_t slotOffset) { 
    328       if (call GlobalSynch.isSynch()==FALSE){ 
     333      if (call GlobalSync.isSync()==FALSE){ 
    329334         return CELLTYPE_ADV; 
    330335      } 
     
    333338 
    334339   uint16_t getCellNeighbor(slotOffset_t slotOffset) { 
    335       if (call GlobalSynch.isSynch()==FALSE){ 
     340      if (call GlobalSync.isSync()==FALSE){ 
    336341         return 0; 
    337342      } 
     
    340345 
    341346   channelOffset_t getCellChannelOffset(slotOffset_t slotOffset) { 
    342       if (call GlobalSynch.isSynch()==FALSE){ 
     347      if (call GlobalSync.isSync()==FALSE){ 
    343348         return 0; 
    344349      } 
  • apps/TSCH/deploy.sh

    r128 r181  
    11#!/bin/bash 
    2 make telosb install.1 bsl,0 
    3 make telosb install.2 bsl,1 
     2make telosb install.1  bsl,20 
     3make telosb install.2  bsl,21 
     4make telosb install.3  bsl,22 
     5 
     6#make telosb install.4  bsl,23 
     7#make telosb install.5  bsl,24 
     8#make telosb install.6  bsl,25 
     9 
     10#make telosb install.7  bsl,26 
     11#make telosb install.8  bsl,27 
     12#make telosb install.9  bsl,28 
     13 
     14#make telosb install.10 bsl,29 
     15#make telosb install,11 bsl,30 
     16#make telosb install.12 bsl,31 
     17 
     18#make telosb install.13 bsl,32 
     19#make telosb install,14 bsl,33 
     20#make telosb install.15 bsl,34 
  • apps/TSCH/interfaces/CellUsageGet.nc

    r177 r181  
    22 
    33interface CellUsageGet { 
    4    command uint8_t numCells(cellType_t type, uint16_t neighbor); 
    5    command slotChannel_t getCell(cellType_t type, uint16_t neighbor); 
    6    command cellType_t getType(slotOffset_t slotoffset); 
    7    command uint16_t getNeighbor(slotOffset_t slotoffset); 
     4   command uint8_t         numCells(cellType_t type, uint16_t neighbor); 
     5   command slotChannel_t   getCell(cellType_t type, uint16_t neighbor); 
     6   command cellType_t      getType(slotOffset_t slotoffset); 
     7   command uint16_t        getNeighbor(slotOffset_t slotoffset); 
    88   command channelOffset_t getChannel(slotOffset_t slotoffset); 
    99} 
  • apps/TSCH/keepalive/KeepAliveC.nc

    r115 r181  
    33module KeepAliveC { 
    44   provides interface Init as SoftwareInit; 
    5    uses interface GlobalSynch; 
     5   uses interface GlobalSync; 
    66   uses interface CellUsageGet; 
    77   uses interface SimpleSend; 
     
    3535   } 
    3636 
    37    //GlobalSynch 
    38    event void GlobalSynch.lostSynch() { 
     37   //GlobalSync 
     38   event void GlobalSync.lostSync() { 
    3939   } 
    40    event void GlobalSynch.loosingSynch() { 
     40   event void GlobalSync.loosingSync() { 
    4141      post sendKeepAlive(); 
    4242   } 
  • apps/TSCH/printpacket/PrintPacketC.nc

    r122 r181  
    4343         case AM_TSCH_DATA: 
    4444            printf(" type=DATA"); 
    45             printf(" value=%lu",((data_format_t*)msg->data)->value); 
     45            printf(" payload=%lu",((data_format_t*)msg->data)->payload); 
    4646            break; 
    4747         case AM_TSCH_ACK: 
  • apps/TSCH/reservation/ReservationP.nc

    r123 r181  
    335335   } 
    336336 
     337   //GlobalTime 
     338   async event void GlobalTime.newSlot(uint32_t newASN) { 
     339      //don't do anything. Should only be implemented by SlotEngineC 
     340   } 
     341 
    337342   //DebugPrint 
    338343   command void DebugPrint.print() { 
  • apps/TSCH/tschqueue/TSCHQueueC.nc

    r99 r181  
    1010   provides interface DebugPrint; 
    1111   uses interface GlobalTime; 
    12    uses interface GlobalSynch; 
     12   uses interface GlobalSync; 
    1313   uses interface PrintPacket; 
    1414   uses interface ActiveMessageAddress; 
     
    2323   DebugPrint = TSCHQueueP.DebugPrint; 
    2424   GlobalTime = TSCHQueueP.GlobalTime; 
    25    GlobalSynch = TSCHQueueP.GlobalSynch; 
     25   GlobalSync = TSCHQueueP.GlobalSync; 
    2626   PrintPacket = TSCHQueueP.PrintPacket; 
    2727   ActiveMessageAddress = TSCHQueueP.ActiveMessageAddress; 
  • apps/TSCH/tschqueue/TSCHQueueP.nc

    r122 r181  
    1111   provides interface DebugPrint; 
    1212   uses interface GlobalTime; 
    13    uses interface GlobalSynch; 
     13   uses interface GlobalSync; 
    1414   uses interface PrintPacket; 
    1515   uses interface ActiveMessageAddress; 
     
    259259   } 
    260260 
    261    //GlobalSynch 
    262    event void GlobalSynch.loosingSynch() { 
    263    } 
    264    event void GlobalSynch.lostSynch() { 
     261   //GlobalSync 
     262   event void GlobalSync.loosingSync() { 
     263   } 
     264   event void GlobalSync.lostSync() { 
    265265   } 
    266266 
     
    320320   async event void ActiveMessageAddress.changed(){ 
    321321   } 
     322 
     323   //GlobalTime 
     324   async event void GlobalTime.newSlot(uint32_t newASN) { 
     325      //don't do anything. Should only be implemented by SlotEngineC 
     326   } 
    322327} 
Note: See TracChangeset for help on using the changeset viewer.