[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/msp430/usart Msp430Spi0C.nc, 1.4, 1.5 Msp430Spi1C.nc, 1.4, 1.5 Msp430SpiDma0P.nc, 1.4, 1.5 Msp430SpiDma1P.nc, 1.4, 1.5 Msp430SpiDmaP.nc, 1.4, 1.5

dmm rincon at users.sourceforge.net
Thu Nov 8 13:34:45 PST 2007


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

Modified Files:
	Msp430Spi0C.nc Msp430Spi1C.nc Msp430SpiDma0P.nc 
	Msp430SpiDma1P.nc Msp430SpiDmaP.nc 
Log Message:
Mark Hays repair the SPI code, unit testing demonstrates SPI0 w/ and w/out DMA works properly, and we have a chance at SPI1 working properly now as well - although it still hasn't been tested completely.

Index: Msp430Spi0C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430Spi0C.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430Spi0C.nc	12 Dec 2006 18:23:11 -0000	1.4
--- Msp430Spi0C.nc	8 Nov 2007 21:34:42 -0000	1.5
***************
*** 37,40 ****
--- 37,41 ----
   *
   * @author Jonathan Hui <jhui at archedrock.com>
+  * @author Mark Hays
   * @version $Revision$ $Date$
   */
***************
*** 57,61 ****
--- 58,68 ----
    };
  
+ #ifdef ENABLE_SPI0_DMA
+ #warning "Enabling SPI DMA on USART0"
+   components Msp430SpiDma0P as SpiP;
+ #else
    components Msp430SpiNoDma0P as SpiP;
+ #endif
+ 
    Resource = SpiP.Resource[ CLIENT_ID ];
    SpiByte = SpiP.SpiByte;

Index: Msp430Spi1C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430Spi1C.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430Spi1C.nc	12 Dec 2006 18:23:11 -0000	1.4
--- Msp430Spi1C.nc	8 Nov 2007 21:34:42 -0000	1.5
***************
*** 37,40 ****
--- 37,41 ----
   *
   * @author Jonathan Hui <jhui at archedrock.com>
+  * @author Mark Hays
   * @version $Revision$ $Date$
   */
***************
*** 57,61 ****
--- 58,68 ----
    };
  
+ #ifdef ENABLE_SPI1_DMA
+ #warning "Enabling SPI DMA on USART1"
+   components Msp430SpiDma1P as SpiP;
+ #else
    components Msp430SpiNoDma1P as SpiP;
+ #endif
+ 
    Resource = SpiP.Resource[ CLIENT_ID ];
    SpiByte = SpiP.SpiByte;

Index: Msp430SpiDma0P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430SpiDma0P.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430SpiDma0P.nc	12 Dec 2006 18:23:11 -0000	1.4
--- Msp430SpiDma0P.nc	8 Nov 2007 21:34:42 -0000	1.5
***************
*** 32,35 ****
--- 32,36 ----
  /**
   * @author Jonathan Hui <jhui at archedrock.com>
+  * @author Mark Hays
   * @version $Revision$ $Date$
   */
***************
*** 50,54 ****
  implementation {
  
!   components new Msp430SpiDmaP() as SpiP;
    Resource = SpiP.Resource;
    ResourceConfigure = SpiP.ResourceConfigure;
--- 51,63 ----
  implementation {
  
! #include "Msp430Dma.h"
! 
!   components new Msp430SpiDmaP(IFG1_,
! 			       U0TXBUF_,
! 			       UTXIFG0,
! 			       (uint16_t) DMA_TRIGGER_UTXIFG0,
! 			       U0RXBUF_,
! 			       URXIFG0,
! 			       (uint16_t) DMA_TRIGGER_URXIFG0) as SpiP;
    Resource = SpiP.Resource;
    ResourceConfigure = SpiP.ResourceConfigure;

Index: Msp430SpiDma1P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430SpiDma1P.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430SpiDma1P.nc	12 Dec 2006 18:23:11 -0000	1.4
--- Msp430SpiDma1P.nc	8 Nov 2007 21:34:42 -0000	1.5
***************
*** 32,35 ****
--- 32,36 ----
  /**
   * @author Jonathan Hui <jhui at archedrock.com>
+  * @author Mark Hays
   * @version $Revision$ $Date$
   */
***************
*** 38,42 ****
  
    provides interface Resource[ uint8_t id ];
!   provides interface ResourceControl [uint8_t id];
    provides interface SpiByte;
    provides interface SpiPacket[ uint8_t id ];
--- 39,43 ----
  
    provides interface Resource[ uint8_t id ];
!   provides interface ResourceConfigure[uint8_t id];
    provides interface SpiByte;
    provides interface SpiPacket[ uint8_t id ];
***************
*** 50,56 ****
  implementation {
  
!   components new Msp430SpiDmaP() as SpiP;
    Resource = SpiP.Resource;
!   ResourceControl = SpiP.ResourceControl;
    Msp430SpiConfigure = SpiP.Msp430SpiConfigure;
    SpiByte = SpiP.SpiByte;
--- 51,65 ----
  implementation {
  
! #include "Msp430Dma.h"
! 
!   components new Msp430SpiDmaP(IFG2_,
! 			       U1TXBUF_,
! 			       UTXIFG1,
! 			       (uint16_t) DMA_TRIGGER_UTXIFG1,
! 			       U1RXBUF_,
! 			       URXIFG1,
! 			       (uint16_t) DMA_TRIGGER_URXIFG1) as SpiP;
    Resource = SpiP.Resource;
!   ResourceConfigure = SpiP.ResourceConfigure;
    Msp430SpiConfigure = SpiP.Msp430SpiConfigure;
    SpiByte = SpiP.SpiByte;

Index: Msp430SpiDmaP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430SpiDmaP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430SpiDmaP.nc	12 Dec 2006 18:23:11 -0000	1.4
--- Msp430SpiDmaP.nc	8 Nov 2007 21:34:42 -0000	1.5
***************
*** 32,40 ****
  /**
   * @author Jonathan Hui <jhui at archedrock.com>
   * @version $Revision$ $Date$
   */
  
  
! generic module Msp430SpiDmaP() {
  
    provides interface Resource[ uint8_t id ];
--- 32,47 ----
  /**
   * @author Jonathan Hui <jhui at archedrock.com>
+  * @author Mark Hays
   * @version $Revision$ $Date$
   */
  
  
! generic module Msp430SpiDmaP( uint16_t IFG_addr,
! 			      uint16_t TXBUF_addr,
! 			      uint8_t  TXIFG,
! 			      uint16_t TXTRIG,
! 			      uint16_t RXBUF_addr,
! 			      uint8_t  RXIFG,
! 			      uint16_t RXTRIG ) {
  
    provides interface Resource[ uint8_t id ];
***************
*** 55,59 ****
  implementation {
  
!   MSP430REG_NORACE( IFG1 );
  
    uint8_t* m_tx_buf;
--- 62,66 ----
  implementation {
  
! #define IFG (*(volatile uint8_t*)IFG_addr)
  
    uint8_t* m_tx_buf;
***************
*** 116,121 ****
  						      uint16_t len ) {
  
-     uint16_t ctrl;
- 
      atomic {
        m_client = id;
--- 123,126 ----
***************
*** 125,145 ****
      }
  
-     if ( rx_buf ) {
-       ctrl = 0xcd4;
-     }
-     else {
-       ctrl = 0x0d4;
-       rx_buf = &m_dump;
-     }
- 
      if ( len ) {
!       IFG1 &= ~( UTXIFG0 | URXIFG0 );
!       call DmaChannel1.setupTransferRaw( ctrl, DMA_TRIGGER_USARTRX,
! 					 (uint16_t*)U0RXBUF_, rx_buf, len );
!       call DmaChannel2.setupTransferRaw( 0x3d4, DMA_TRIGGER_USARTTX,
! 					 tx_buf, (uint16_t*)U0TXBUF_, len );
!       IFG1 |= UTXIFG0;
!     }
!     else {
        post signalDone_task();
      }
--- 130,170 ----
      }
  
      if ( len ) {
!       // clear the interrupt flags
!       IFG &= ~( TXIFG | RXIFG );
! 
!       // set up the RX xfer
!       call DmaChannel1.setupTransfer(DMA_SINGLE_TRANSFER,
! 				     RXTRIG,
! 				     DMA_EDGE_SENSITIVE,
! 				     (void *) RXBUF_addr,
! 				     rx_buf ? rx_buf : &m_dump,
! 				     len,
! 				     DMA_BYTE,
! 				     DMA_BYTE,
! 				     DMA_ADDRESS_UNCHANGED,
! 				     rx_buf ?
! 				       DMA_ADDRESS_INCREMENTED :
! 				       DMA_ADDRESS_UNCHANGED);
!       // this doesn't start a transfer; it simply enables the channel
!       call DmaChannel1.startTransfer();
! 
!       // set up the TX xfer
!       call DmaChannel2.setupTransfer(DMA_SINGLE_TRANSFER,
! 				     TXTRIG,
! 				     DMA_EDGE_SENSITIVE,
! 				     tx_buf,
! 				     (void *) TXBUF_addr,
! 				     len,
! 				     DMA_BYTE,
! 				     DMA_BYTE,
! 				     DMA_ADDRESS_INCREMENTED,
! 				     DMA_ADDRESS_UNCHANGED);
!       // this doesn't start a transfer; it simply enables the channel
!       call DmaChannel2.startTransfer();
! 
!       // pong the tx flag to get things rolling
!       IFG |= TXIFG;
!     } else {
        post signalDone_task();
      }



More information about the Tinyos-2-commits mailing list