[Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2 SSP1C.nc, 1.1, 1.2 SSP1M.nc, 1.1, 1.2

Robbie Adler radler at users.sourceforge.net
Thu Aug 18 15:32:24 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/beta/platform/imote2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204

Modified Files:
	SSP1C.nc SSP1M.nc 
Log Message:
updates required to enable DMA functionality

Index: SSP1C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/imote2/SSP1C.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SSP1C.nc	26 Jul 2005 01:36:07 -0000	1.1
--- SSP1C.nc	18 Aug 2005 22:32:21 -0000	1.2
***************
*** 11,14 ****
--- 11,15 ----
    components SSP1M,
      HPLSSP1M,
+     PXA27XDMAC,
      PXA27XInterruptM;
    
***************
*** 18,20 ****
--- 19,24 ----
    SSP1M.HPLSSP->HPLSSP1M;
    SSP1M.SSPInterrupt -> PXA27XInterruptM.PXA27XIrq[PPID_SSP1];
+   SSP1M.RxDMAChannel -> PXA27XDMAC.PXA27XDMAChannel[unique("DMAChannel")];
+   SSP1M.TxDMAChannel -> PXA27XDMAC.PXA27XDMAChannel[unique("DMAChannel")];
+   SSP1M.DMAControl -> PXA27XDMAC.StdControl;
  }

Index: SSP1M.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/imote2/SSP1M.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SSP1M.nc	26 Jul 2005 01:36:07 -0000	1.1
--- SSP1M.nc	18 Aug 2005 22:32:21 -0000	1.2
***************
*** 9,12 ****
--- 9,15 ----
    uses {
      interface HPLSSP;
+     interface PXA27XDMAChannel as RxDMAChannel;
+     interface PXA27XDMAChannel as TxDMAChannel;
+     interface StdControl as DMAControl;
      interface PXA27XInterrupt as SSPInterrupt;
    }
***************
*** 15,18 ****
--- 18,25 ----
  implementation {
  
+   //change this value to change the default priority requst for the DMA channel
+ #define  DEFAULTDMARXPRIORITY (DMA_Priority1|DMA_Priority2|DMA_Priority3|DMA_Priority4)
+ #define  DEFAULTDMATXPRIORITY (DMA_Priority1|DMA_Priority2|DMA_Priority3|DMA_Priority4)
+ 
    SSPFrameFormat_t gFrameFormat;
    SSPDataWidth_t gDataWidth;
***************
*** 35,39 ****
    norace uint16_t gNumRxFifoOverruns;
    
!   norace uint8_t *gRxBuffer;
    norace uint16_t gRxNumBytes, gRxBufferPos;
    
--- 42,48 ----
    norace uint16_t gNumRxFifoOverruns;
    
!   //hack!!!
!   norace uint16_t *gRxBuffer;
!   
    norace uint16_t gRxNumBytes, gRxBufferPos;
    
***************
*** 50,61 ****
      gTxFifoLevel = SSP_8Samples;  //note, this setting will only be used for DMA.. non-DMA will use a value of 1 for simplicity
      gMicrowireSize = SSP_8bitCommands;
!     gClkdivider = 0;
      gClkMode = SSP_normalmode;
      gSlaveClockFreeRunning = FALSE;
-     gMasterSCLK = TRUE;
-     gMasterSFRM = FALSE;
      gReceiveWithoutTransmit = TRUE;
      gRxFifoOverrun = TRUE;
!     gAudioClockSelect = TRUE;
      
      atomic{
--- 59,68 ----
      gTxFifoLevel = SSP_8Samples;  //note, this setting will only be used for DMA.. non-DMA will use a value of 1 for simplicity
      gMicrowireSize = SSP_8bitCommands;
!     gClkdivider = 1;
      gClkMode = SSP_normalmode;
      gSlaveClockFreeRunning = FALSE;
      gReceiveWithoutTransmit = TRUE;
      gRxFifoOverrun = TRUE;
!     gAudioClockSelect = FALSE;
      
      atomic{
***************
*** 72,76 ****
      call HPLSSP.setSSCR0(SSCR0);
      
!     //hack for now to enable testing of this functionality
      if(gAudioClockSelect == TRUE){
        SSACD_1 = SSACD_ACPS(5) | SSACD_SCDB | SSACD_ACDS(1);
--- 79,83 ----
      call HPLSSP.setSSCR0(SSCR0);
      
!     //hack for now to enable testing of this fuunctionality
      if(gAudioClockSelect == TRUE){
        SSACD_1 = SSACD_ACPS(5) | SSACD_SCDB | SSACD_ACDS(1);
***************
*** 78,82 ****
      call SSPInterrupt.allocate();
      call SSPInterrupt.enable();
!     
      //need to configure SSP pin for correct functionality
      _PXA_setaltfn(SSP1_RXD, SSP1_RXD_ALTFN, GPIO_IN);
--- 85,90 ----
      call SSPInterrupt.allocate();
      call SSPInterrupt.enable();
!     call DMAControl.init();
!     call DMAControl.start();
      //need to configure SSP pin for correct functionality
      _PXA_setaltfn(SSP1_RXD, SSP1_RXD_ALTFN, GPIO_IN);
***************
*** 287,317 ****
     gRxNumBytes = NumBytes;
     gRxBufferPos = 0;
!    //hack for now until we get DMA fixed up...
!    call SingleTxRx.startReceive();
!    return SUCCESS;
! #if 0
!     uint32_t temp;
!     if(!gRxInProgress){
        if(!gTxInProgress){
  	//if we're neither transmitting nor receiving, setup the port how we want it be setup 
! 	uint32_t SSCR0 = createSSCR0() | SSCR0_SSE;
! 	call HPLSSP.setSSCR1(createSSCR1());
  	
!        
! 	call HPLSSP.setSSCR0(SSCR0);
  	//go
  	gRxInProgress = TRUE;
!       return SUCCESS;
        }
      }
      else{
        //transaction is in progress...return FAIL...(equivalent to the port being already opened)
-       return FAIL;
      }
! #endif
!   }
    
    command result_t BulkTxRx.BulkTransmit(uint8_t *TxBuffer, uint16_t NumBytes){
! 
    }
  
--- 295,335 ----
     gRxNumBytes = NumBytes;
     gRxBufferPos = 0;
!    gNumRxFifoOverruns=0;
!    call SSPInterrupt.disable();
!    
!    if(!gRxInProgress){
        if(!gTxInProgress){
  	//if we're neither transmitting nor receiving, setup the port how we want it be setup 
! 	CKEN |= (CKEN23_SSP1);
! 	call HPLSSP.setSSCR1(createSSCR1() | SSCR1_TRAIL | SSCR1_RSRE);
! 	call HPLSSP.setSSTO(512);
  	
! 	call RxDMAChannel.setSourceAddr(0x41000010);
! 	call RxDMAChannel.setTargetAddr(RxBuffer);
! 	call RxDMAChannel.enableSourceAddrIncrement(FALSE);
! 	call RxDMAChannel.enableTargetAddrIncrement(TRUE);
! 	call RxDMAChannel.enableSourceFlowControl(TRUE);
! 	call RxDMAChannel.enableTargetFlowControl(FALSE);
! 	call RxDMAChannel.setTransferLength(NumBytes);
! 	//need to fix to guarantee that this is generic
! 	call RxDMAChannel.setMaxBurstSize( ((gRxFifoLevel+1) * (gDataWidth + 1)>>3)>>4);
! 	call RxDMAChannel.setTransferWidth((gDataWidth+1)>>3);
! 	
! 	//request a non-permanent channel
! 	call RxDMAChannel.requestChannel(DMAID_SSP1_RX,DEFAULTDMARXPRIORITY, FALSE); 
! 
  	//go
  	gRxInProgress = TRUE;
! 	return SUCCESS;
        }
      }
      else{
        //transaction is in progress...return FAIL...(equivalent to the port being already opened)
      }
!    return FAIL;
!  }
    
    command result_t BulkTxRx.BulkTransmit(uint8_t *TxBuffer, uint16_t NumBytes){
!     
    }
  
***************
*** 328,331 ****
--- 346,350 ----
  	 //if we're neither transmitting nor receiving, setup the port how we want it be setup 
  	 
+ 	 TOSH_SET_YELLOW_LED_PIN();
  	 gNumRxFifoOverruns=0;
  	 SSCR0 = createSSCR0() | SSCR0_SSE;
***************
*** 440,453 ****
        //while(1);
        gNumRxFifoOverruns++;
!       gRxBufferPos=0;
        call HPLSSP.setSSSR(SSSR_ROR);
      }
      
      if(temp & SSSR_RFS){
!       atomic{
  	while(SSSR_1 & SSSR_RNE){
  	  //while fifo not empty
! 	  uint32_t data = call HPLSSP.getSSDR();
! 	  ((uint16_t *)gRxBuffer)[gRxBufferPos] =(uint16_t)~data;
  	  gRxBufferPos++;
  	  //gRxBuffer[gRxBufferPos++] = (call HPLSSP.getSSDR());
--- 459,476 ----
        //while(1);
        gNumRxFifoOverruns++;
!       //gRxBufferPos=0;
        call HPLSSP.setSSSR(SSSR_ROR);
      }
      
      if(temp & SSSR_RFS){
!       //atomic
!       //uint16_t data;
! 	{
  	while(SSSR_1 & SSSR_RNE){
  	  //while fifo not empty
! 	  //uint32_t data = call HPLSSP.getSSDR();
! 	  //data = SSDR_1;
! 	  //*gRxBuffer++ =(uint16_t)~data;
! 	  *gRxBuffer++ = SSDR_1;
  	  gRxBufferPos++;
  	  //gRxBuffer[gRxBufferPos++] = (call HPLSSP.getSSDR());
***************
*** 455,459 ****
  	    //got all the data that we want....turn things off for now
  	    call SingleTxRx.stopReceive();
! 	    post signalBulkTxRxReceiveDone();
  	  }
  	}
--- 478,482 ----
  	    //got all the data that we want....turn things off for now
  	    call SingleTxRx.stopReceive();
! 	    //post signalBulkTxRxReceiveDone();
  	  }
  	}
***************
*** 465,469 ****
        //stupid thing wants data to send out...i.e the last set of sends are done!
      }
!        
    }
  }
--- 488,522 ----
        //stupid thing wants data to send out...i.e the last set of sends are done!
      }
!   }
!  
!   event result_t RxDMAChannel.requestChannelDone(){
!     //so we've successfully been cleared to start doing something with our port...go!!
!     uint32_t SSCR0;
! 
!     call RxDMAChannel.run();  
!     SSCR0 = createSSCR0() | SSCR0_SSE;
!     call HPLSSP.setSSCR0(SSCR0);
! 	
!     return SUCCESS;
!   }
!   
!   async event void RxDMAChannel.Interrupt(){
!     //turn off things and post a task to signal that we're done
!     uint32_t SSCR0;
!     
!     gRxInProgress = FALSE;
!     SSCR0 = call HPLSSP.getSSCR0();
!     SSCR0 &= ~SSCR0_SSE; 
!     call HPLSSP.setSSCR0(SSCR0);
!     post signalBulkTxRxReceiveDone();
!     return;
!   }
!   
!   event result_t TxDMAChannel.requestChannelDone(){
!     return SUCCESS;
!   }
!   
!   async event void TxDMAChannel.Interrupt(){
!     return;
    }
  }



More information about the Tinyos-beta-commits mailing list