[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/msp430/usart Msp430SpiNoDmaP.nc, 1.5, 1.6

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Mon Jun 16 00:31:23 PDT 2008


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv15822

Modified Files:
	Msp430SpiNoDmaP.nc 
Log Message:
bugfix: previously two bytes were written to the U0TXBUF register before one was read from the U0RXBUF, which at bus speed >500KHz could lead to a race condition. This has been fixed.


Index: Msp430SpiNoDmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430SpiNoDmaP.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Msp430SpiNoDmaP.nc	4 Jun 2008 05:31:15 -0000	1.5
--- Msp430SpiNoDmaP.nc	16 Jun 2008 07:31:21 -0000	1.6
***************
*** 32,35 ****
--- 32,36 ----
  /**
   * @author Jonathan Hui <jhui at archedrock.com>
+  * @author Jan Hauer <hauer at tkn.tu-berlin.de> (bugfix in continueOp())
   * @version $Revision$ $Date$
   */
***************
*** 120,144 ****
    void continueOp() {
  
!     uint8_t end;
!     uint8_t tmp;
  
!     atomic {
!       call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
  
!       end = m_pos + SPI_ATOMIC_SIZE;
!       if ( end > m_len )
!         end = m_len;
  
!       while ( ++m_pos < end ) {
!         while( !call Usart.isTxIntrPending() );
!         call Usart.clrTxIntr();
!         call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
!         while( !call Usart.isRxIntrPending() );
!         call Usart.clrRxIntr();
!         tmp = call Usart.rx();
!         if ( m_rx_buf )
!           m_rx_buf[ m_pos - 1 ] = tmp;
!       }
!     }
  
    }
--- 121,142 ----
    void continueOp() {
  
!    uint8_t end;
!    uint8_t tmp;
  
!    atomic {
!      call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
  
!      end = m_pos + SPI_ATOMIC_SIZE;
!      if ( end > m_len )
!        end = m_len;
  
!      while ( ++m_pos < end ) {
!        while( !call Usart.isRxIntrPending() );
!        tmp = call Usart.rx();
!        if ( m_rx_buf )
!          m_rx_buf[ m_pos - 1 ] = tmp;
!        call Usart.tx( m_tx_buf ? m_tx_buf[ m_pos ] : 0 );
!      }
!    }
  
    }



More information about the Tinyos-2-commits mailing list