[Tinyos-commits] CVS: tinyos-1.x/tos/platform/telosb HPLSTM25PC.nc, 1.3, 1.4 HPLSTM25PM.nc, 1.4, 1.5

Jonathan Hui jwhui at users.sourceforge.net
Wed Jul 13 23:00:51 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tos/platform/telosb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17702

Modified Files:
	HPLSTM25PC.nc HPLSTM25PM.nc 
Log Message:
- Make a better use of the USART module's double buffering capability
on the receive side. Ups the read data rate of the external flash chip
from abou 24KB/sec to 35KB/sec. The data rate could be pushed higher
if we fully saturated the bus, but this is dangerous if interrupts are
not disabled during the transaction since the processor may not be
able to handle the incoming data fast enough. Thus, we play safe and
ensure that a character is pulled off before requesting another.



Index: HPLSTM25PC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telosb/HPLSTM25PC.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** HPLSTM25PC.nc	17 May 2005 20:45:34 -0000	1.3
--- HPLSTM25PC.nc	14 Jul 2005 06:00:47 -0000	1.4
***************
*** 40,43 ****
--- 40,44 ----
      BusArbitrationC, 
      HPLUSART0M,
+     LedsC,
      Main;
  
***************
*** 48,51 ****
--- 49,53 ----
  
    HPLSTM25PM.BusArbitration -> BusArbitrationC.BusArbitration[unique("BusArbitration")];
+   HPLSTM25PM.Leds -> LedsC;
    HPLSTM25PM.USARTControl -> HPLUSART0M;
  }

Index: HPLSTM25PM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telosb/HPLSTM25PM.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HPLSTM25PM.nc	17 May 2005 20:45:34 -0000	1.4
--- HPLSTM25PM.nc	14 Jul 2005 06:00:48 -0000	1.5
***************
*** 34,37 ****
--- 34,38 ----
      interface BusArbitration;
      interface HPLUSARTControl as USARTControl;    
+     interface Leds;
    }
  }
***************
*** 63,122 ****
    }
  
!   async command result_t HPLSTM25P.beginCmd() {
      TOSH_CLR_FLASH_CS_PIN();
      call HPLSTM25P.unhold();
-     return SUCCESS;
    }
  
!   async command result_t HPLSTM25P.endCmd() {
      while(!(call USARTControl.isTxEmpty()));
      TOSH_SET_FLASH_CS_PIN();
-     return SUCCESS;
    }
  
!   async command result_t HPLSTM25P.hold() {
      TOSH_CLR_FLASH_HOLD_PIN();
-     return SUCCESS;
    }
  
!   async command result_t HPLSTM25P.unhold() {
      TOSH_SET_FLASH_HOLD_PIN();
-     return SUCCESS;
    }
! 
!   async command result_t HPLSTM25P.txBuf(void* buf, stm25p_addr_t len) {
! 
      uint8_t* tmpBuf = buf;
! 
      call USARTControl.isTxIntrPending();
!     for ( ; len > 0; len--, tmpBuf++ ) {
!       call USARTControl.tx(*tmpBuf);
        while(!(call USARTControl.isTxIntrPending()));
      }
  
-     return SUCCESS;
- 
    }
  
!   async command result_t HPLSTM25P.rxBuf(void* buf, stm25p_addr_t len, uint16_t* crcResult) {
  
-     uint16_t crc = *crcResult;
      uint8_t* tmpBuf = buf;
      uint8_t tmp;
  
      call USARTControl.rx(); // clear receive interrupt
      for ( ; len > 0; len-- ) {
!       call USARTControl.tx(0);
!       while(!call USARTControl.isRxIntrPending());
!       tmp = call USARTControl.rx();
!       crc = crcByte(crc, tmp);
        if (buf != NULL)
  	*tmpBuf++ = tmp;
      }
  
!     *crcResult = crc;
  
-     return SUCCESS;
-     
    }
  
--- 64,119 ----
    }
  
!   async command void HPLSTM25P.beginCmd() {
      TOSH_CLR_FLASH_CS_PIN();
      call HPLSTM25P.unhold();
    }
  
!   async command void HPLSTM25P.endCmd() {
      while(!(call USARTControl.isTxEmpty()));
      TOSH_SET_FLASH_CS_PIN();
    }
  
!   async command void HPLSTM25P.hold() {
      TOSH_CLR_FLASH_HOLD_PIN();
    }
  
!   async command void HPLSTM25P.unhold() {
      TOSH_SET_FLASH_HOLD_PIN();
    }
!   
!   async command void HPLSTM25P.txBuf(void* buf, stm25p_addr_t len) {
!     
      uint8_t* tmpBuf = buf;
!     
      call USARTControl.isTxIntrPending();
!     for ( ; len; len-- ) {
!       call USARTControl.tx(*tmpBuf++);
        while(!(call USARTControl.isTxIntrPending()));
      }
  
    }
  
!   async command uint16_t HPLSTM25P.rxBuf(void* buf, stm25p_addr_t len, uint16_t crc) {
  
      uint8_t* tmpBuf = buf;
      uint8_t tmp;
  
      call USARTControl.rx(); // clear receive interrupt
+     call USARTControl.tx(0);
      for ( ; len > 0; len-- ) {
!       atomic {
! 	while(!call USARTControl.isTxIntrPending());
! 	call USARTControl.tx(0);
! 	while(!call USARTControl.isRxIntrPending());
! 	tmp = call USARTControl.rx();
!       }
        if (buf != NULL)
  	*tmpBuf++ = tmp;
+       else
+ 	crc = crcByte(crc, tmp);
      }
  
!     return crc;
  
    }
  



More information about the Tinyos-commits mailing list