[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/swtest/TestSD SDApp.nc, 1.1, 1.2 SDAppM.nc, 1.1, 1.2

steve ayer ayer1 at users.sourceforge.net
Tue Jan 22 12:17:48 PST 2008


Update of /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/swtest/TestSD
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv29874

Modified Files:
	SDApp.nc SDAppM.nc 
Log Message:

updates reflecting changes to SD interface to handle new features
found on SHIMMER2.  note new events for available and unavailable,
which will indicate when a SHIMMER2 is docked (unavailable); to a SHIMMER, it's
always undocked. 



Index: SDApp.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/swtest/TestSD/SDApp.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SDApp.nc	3 Aug 2006 19:16:49 -0000	1.1
--- SDApp.nc	22 Jan 2008 20:17:45 -0000	1.2
***************
*** 47,51 ****
      SDC,
      ParamViewM,
!     NTPClientM,
      LedsC,
      TimerC;
--- 47,51 ----
      SDC,
      ParamViewM,
!     //    NTPClientM,
      LedsC,
      TimerC;
***************
*** 58,63 ****
    SDAppM.PVStdControl      -> ParamViewM;
    SDAppM.SDStdControl      -> SDC;
-   SDAppM.SDStdControl      -> SDC;
    //  SDAppM.Timer             -> TimerC.Timer[unique("Timer")];
    SDAppM.TCPServer         -> IPClientC.TCPServer[unique("TCPServer")];
  
--- 58,63 ----
    SDAppM.PVStdControl      -> ParamViewM;
    SDAppM.SDStdControl      -> SDC;
    //  SDAppM.Timer             -> TimerC.Timer[unique("Timer")];
+ 
    SDAppM.TCPServer         -> IPClientC.TCPServer[unique("TCPServer")];
  
***************
*** 68,80 ****
    SDAppM.TelnetRun         -> TelnetM.Telnet[unique("Telnet")];
  
!   SDAppM.NTPClient          -> NTPClientM;
    
    //  SD_M.Leds                -> SDC;
    //  SD_M.USARTControl        -> SDC;
! 
    NTPClientM.UDPClient       -> IPClientC.UDPClient[unique("UDPClient")];
    NTPClientM.Timer           -> TimerC.Timer[unique("Timer")];
    NTPClientM.Client          -> IPClientC;
! 
    ParamViewM.TelnetShow         -> TelnetM.Telnet[unique("Telnet")];
    ParamViewM.ParamView          -> SDAppM.ParamView;
--- 68,80 ----
    SDAppM.TelnetRun         -> TelnetM.Telnet[unique("Telnet")];
  
!   //  SDAppM.NTPClient          -> NTPClientM;
    
    //  SD_M.Leds                -> SDC;
    //  SD_M.USARTControl        -> SDC;
!   /*
    NTPClientM.UDPClient       -> IPClientC.UDPClient[unique("UDPClient")];
    NTPClientM.Timer           -> TimerC.Timer[unique("Timer")];
    NTPClientM.Client          -> IPClientC;
!   */
    ParamViewM.TelnetShow         -> TelnetM.Telnet[unique("Telnet")];
    ParamViewM.ParamView          -> SDAppM.ParamView;

Index: SDAppM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/swtest/TestSD/SDAppM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SDAppM.nc	3 Aug 2006 19:16:49 -0000	1.1
--- SDAppM.nc	22 Jan 2008 20:17:45 -0000	1.2
***************
*** 60,64 ****
  
      interface TCPServer;
!     interface NTPClient;
      //    interface Timer;
    }
--- 60,64 ----
  
      interface TCPServer;
!     //    interface NTPClient;
      //    interface Timer;
    }
***************
*** 101,108 ****
      memset(timebuf, ' ', MAX_SIZE);
  
      call Leds.init();
!     call Leds.redOff();
!     call Leds.greenOff();
!     call Leds.yellowOff();
  
      call PVStdControl.init();
--- 101,111 ----
      memset(timebuf, ' ', MAX_SIZE);
  
+     TOSH_CLR_UTXD0_PIN();  
+ 
      call Leds.init();
! 
!     //    call Leds.greenOn();
!     //call Leds.yellowOn();
!     //    call Leds.redOn();
  
      call PVStdControl.init();
***************
*** 129,134 ****
    }
  
-   event void NTPClient.timestampReceived( uint32_t *seconds, uint32_t *fraction ) {
      /*
      static uint8_t timebytes;
      static uint16_t curr_sector = 100;
--- 132,137 ----
    }
  
      /*
+   event void NTPClient.timestampReceived( uint32_t *seconds, uint32_t *fraction ) {
      static uint8_t timebytes;
      static uint16_t curr_sector = 100;
***************
*** 145,150 ****
        memset(timebuf, ' ', MAX_SIZE);
        //    }
-       */
    }
  
    char * do_init(char * in, char * out, char * outmax) { 
--- 148,153 ----
        memset(timebuf, ' ', MAX_SIZE);
        //    }
    }
+       */
  
    char * do_init(char * in, char * out, char * outmax) { 
***************
*** 160,163 ****
--- 163,167 ----
    char * do_write(char * in, char * out, char * outmax) { 
      uint8_t rval;
+     register uint8_t i;
      uint32_t sector;
  
***************
*** 165,170 ****
        sprintf(msgbuf, "NO SECTOR PROVIDED.");
        out += snprintf(out, outmax - out, "%s\r\n", "no sector provided");
!       sector = 10;
!     }
      else{
        sector = atol(in);
--- 169,174 ----
        sprintf(msgbuf, "NO SECTOR PROVIDED.");
        out += snprintf(out, outmax - out, "%s\r\n", "no sector provided");
!       sector = 10000;
!    }
      else{
        sector = atol(in);
***************
*** 172,179 ****
      }
  
!     //      if((rval = call SD.writeBlock(sector*512, MAX_SIZE, sbuf)))
!     if((rval = call SD.writeSector(sector, sbuf)))
!       sprintf(msgbuf, "bad write, error=%d", rval);
  
      return out;
    }
--- 176,185 ----
      }
  
!     //    for(i = 0; i < 10; i++){
!       rval = call SD.writeSector(sector, sbuf);
  
+       if(rval)
+ 	sprintf(msgbuf, "bad write, error=%d", rval);
+       //    }
      return out;
    }
***************
*** 181,185 ****
    char * do_read(char * in, char * out, char * outmax) { 
      uint32_t sector;
!     uint8_t rval;
  
      if(!strcmp(in, "")){
--- 187,191 ----
    char * do_read(char * in, char * out, char * outmax) { 
      uint32_t sector;
!     uint8_t rval, i;
  
      if(!strcmp(in, "")){
***************
*** 191,196 ****
        sprintf(msgbuf, "read from SECTOR %lu.", sector);
      }
!     //	if((rval = call SD.readBlock(sector*512, MAX_SIZE, cardbuf)))
!     if((rval = call SD.readSector(sector, cardbuf)))
        sprintf(msgbuf, "bad read, error=%d", rval);
  
--- 197,204 ----
        sprintf(msgbuf, "read from SECTOR %lu.", sector);
      }
! 
!     rval = call SD.readSector(sector++, cardbuf);
! 
!     if(rval)
        sprintf(msgbuf, "bad read, error=%d", rval);
  
***************
*** 199,202 ****
--- 207,215 ----
    }
  
+   async event void SD.available(){
+   }
+ 
+   async event void SD.unavailable(){
+   }
  
    /* this returns zero on sdio-only cards; unsupported there */
***************
*** 363,367 ****
  	  //this is a hack to prevent hanging telnet.process if nothing is returned from service function
  	  if(extrastuff)
! 	    out += snprintf(out, outmax - out, "%s\r\n", extrastuff);
  	  else
  	    out += snprintf(out, outmax - out, "%s\r\n", "dummy");
--- 376,380 ----
  	  //this is a hack to prevent hanging telnet.process if nothing is returned from service function
  	  if(extrastuff)
! 	    out += snprintf(out, outmax - out, "%s\r\n", msgbuf);
  	  else
  	    out += snprintf(out, outmax - out, "%s\r\n", "dummy");



More information about the Tinyos-contrib-commits mailing list