[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/msp430/adc12 Msp430Adc12.h, 1.4, 1.5 Msp430Adc12ImplP.nc, 1.4, 1.5 Msp430Adc12P.nc, 1.4, 1.5 README.txt, 1.5, 1.6

Jan-Hinrich Hauer janhauer at users.sourceforge.net
Mon Jun 25 08:47:17 PDT 2007


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

Modified Files:
	Msp430Adc12.h Msp430Adc12ImplP.nc Msp430Adc12P.nc README.txt 
Log Message:
Added macros that can be used to reduce codesize (Msp430Adc12.h).
Updated README.


Index: Msp430Adc12.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/adc12/Msp430Adc12.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430Adc12.h	12 Dec 2006 18:23:07 -0000	1.4
--- Msp430Adc12.h	25 Jun 2007 15:47:14 -0000	1.5
***************
*** 38,47 ****
  #include "Msp430RefVoltGenerator.h"
  
! #define P6PIN_AUTO_CONFIGURE
  #define REF_VOLT_AUTO_CONFIGURE
! #define CHECK_ARGS
!  
  typedef struct { 
!   // see README.txt for a more detailed explanation
    unsigned int inch: 4;            // input channel 
    unsigned int sref: 3;            // reference voltage 
--- 38,51 ----
  #include "Msp430RefVoltGenerator.h"
  
! #define ADC12_TIMERA_ENABLED
! #define ADC12_P6PIN_AUTO_CONFIGURE
! #define ADC12_CHECK_ARGS
! //#define ADC12_ONLY_WITH_DMA
! 
! // for HIL clients 
  #define REF_VOLT_AUTO_CONFIGURE
! 
  typedef struct { 
!   // see README.txt
    unsigned int inch: 4;            // input channel 
    unsigned int sref: 3;            // reference voltage 
***************
*** 57,61 ****
  typedef struct 
  {
!   // see README.txt for a more detailed explanation
    volatile unsigned
    inch: 4,                                     // input channel
--- 61,65 ----
  typedef struct 
  {
!   // see README.txt
    volatile unsigned
    inch: 4,                                     // input channel

Index: Msp430Adc12ImplP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/adc12/Msp430Adc12ImplP.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430Adc12ImplP.nc	12 Dec 2006 18:23:07 -0000	1.4
--- Msp430Adc12ImplP.nc	25 Jun 2007 15:47:15 -0000	1.5
***************
*** 93,96 ****
--- 93,97 ----
    void prepareTimerA(uint16_t interval, uint16_t csSAMPCON, uint16_t cdSAMPCON)
    {
+ #ifdef ADC12_TIMERA_ENABLED
      msp430_compare_control_t ccResetSHI = {
        ccifg : 0, cov : 0, out : 0, cci : 0, ccie : 0,
***************
*** 105,112 ****
--- 106,115 ----
      call CompareA0.setEvent(interval-1);
      call CompareA1.setEvent((interval-1)/2);
+ #endif
    }
      
    void startTimerA()
    {
+ #ifdef ADC12_TIMERA_ENABLED
      msp430_compare_control_t ccSetSHI = {
        ccifg : 0, cov : 0, out : 1, cci : 0, ccie : 0,
***************
*** 124,132 ****
      call ControlA1.setControl(ccRSOutmod);
      call TimerA.setMode(MSP430TIMER_UP_MODE); // go!
    }   
    
    void configureAdcPin( uint8_t inch )
    {
! #ifdef P6PIN_AUTO_CONFIGURE
      switch (inch)
      {
--- 127,136 ----
      call ControlA1.setControl(ccRSOutmod);
      call TimerA.setMode(MSP430TIMER_UP_MODE); // go!
+ #endif
    }   
    
    void configureAdcPin( uint8_t inch )
    {
! #ifdef ADC12_P6PIN_AUTO_CONFIGURE
      switch (inch)
      {
***************
*** 145,149 ****
    void resetAdcPin( uint8_t inch )
    {
! #ifdef P6PIN_AUTO_CONFIGURE
      switch (inch)
      {
--- 149,153 ----
    void resetAdcPin( uint8_t inch )
    {
! #ifdef ADC12_P6PIN_AUTO_CONFIGURE
      switch (inch)
      {
***************
*** 164,168 ****
    {
      error_t result = ERESERVE;
! #ifdef CHECK_ARGS
      if (!config)
        return EINVAL;
--- 168,172 ----
    {
      error_t result = ERESERVE;
! #ifdef ADC12_CHECK_ARGS
      if (!config)
        return EINVAL;
***************
*** 208,212 ****
    {
      error_t result = ERESERVE;
! #ifdef CHECK_ARGS
      if (!config || jiffies == 1 || jiffies == 2)
        return EINVAL;
--- 212,216 ----
    {
      error_t result = ERESERVE;
! #ifdef ADC12_CHECK_ARGS
      if (!config || jiffies == 1 || jiffies == 2)
        return EINVAL;
***************
*** 256,260 ****
    {
      error_t result = ERESERVE;
! #ifdef CHECK_ARGS
      if (!config || !buf || !length || jiffies == 1 || jiffies == 2)
        return EINVAL;
--- 260,264 ----
    {
      error_t result = ERESERVE;
! #ifdef ADC12_CHECK_ARGS
      if (!config || !buf || !length || jiffies == 1 || jiffies == 2)
        return EINVAL;
***************
*** 312,316 ****
    {
      error_t result = ERESERVE;
! #ifdef CHECK_ARGS
      if (!config || !buf || !length || length > 16 || jiffies == 1 || jiffies == 2)
        return EINVAL;
--- 316,320 ----
    {
      error_t result = ERESERVE;
! #ifdef ADC12_CHECK_ARGS
      if (!config || !buf || !length || length > 16 || jiffies == 1 || jiffies == 2)
        return EINVAL;
***************
*** 390,394 ****
    {
      error_t result = ERESERVE;
! #ifdef CHECK_ARGS
      if (!config || !memctl || !numMemctl || numMemctl > 15 || !numSamples || 
          !buf || jiffies == 1 || jiffies == 2 || numSamples % (numMemctl+1) != 0)
--- 394,398 ----
    {
      error_t result = ERESERVE;
! #ifdef ADC12_CHECK_ARGS
      if (!config || !memctl || !numMemctl || numMemctl > 15 || !numSamples || 
          !buf || jiffies == 1 || jiffies == 2 || numSamples % (numMemctl+1) != 0)
***************
*** 472,477 ****
--- 476,483 ----
    {
      uint8_t i;
+ #ifdef ADC12_TIMERA_ENABLED
      if (state & USE_TIMERA)
        call TimerA.setMode(MSP430TIMER_STOP_MODE);
+ #endif
      resetAdcPin( (call HplAdc12.getMCtl(0)).inch );
      if (state & MULTI_CHANNEL){
***************
*** 520,524 ****
          signal Overflow.conversionTimeOverflow[clientID]();
      }
- #ifndef MSP430ADC12_ONLY_DMA
      switch (state & CONVERSION_MODE_MASK) 
      { 
--- 526,529 ----
***************
*** 536,539 ****
--- 541,545 ----
            break;
          }
+ #ifndef ADC12_ONLY_WITH_DMA
        case MULTI_CHANNEL:
          {
***************
*** 591,596 ****
            break;
          }
-       } // switch
  #endif
    }
  
--- 597,602 ----
            break;
          }
  #endif
+       } // switch
    }
  

Index: Msp430Adc12P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/adc12/Msp430Adc12P.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Msp430Adc12P.nc	12 Dec 2006 18:23:07 -0000	1.4
--- Msp430Adc12P.nc	25 Jun 2007 15:47:15 -0000	1.5
***************
*** 45,49 ****
    }
  } implementation { 
!   components Msp430Adc12ImplP, HplAdc12P, Msp430TimerC, MainC, HplMsp430GeneralIOC, 
               new SimpleRoundRobinArbiterC(MSP430ADC12_RESOURCE) as Arbiter;
  
--- 45,49 ----
    }
  } implementation { 
!   components Msp430Adc12ImplP, HplAdc12P, MainC, 
               new SimpleRoundRobinArbiterC(MSP430ADC12_RESOURCE) as Arbiter;
  
***************
*** 57,60 ****
--- 57,63 ----
    Msp430Adc12ImplP.ADCArbiterInfo -> Arbiter;
    Msp430Adc12ImplP.HplAdc12 -> HplAdc12P;
+ 
+ #ifdef ADC12_P6PIN_AUTO_CONFIGURE
+   components HplMsp430GeneralIOC;
    Msp430Adc12ImplP.Port60 -> HplMsp430GeneralIOC.Port60;
    Msp430Adc12ImplP.Port61 -> HplMsp430GeneralIOC.Port61;
***************
*** 65,69 ****
--- 68,75 ----
    Msp430Adc12ImplP.Port66 -> HplMsp430GeneralIOC.Port66;
    Msp430Adc12ImplP.Port67 -> HplMsp430GeneralIOC.Port67;
+ #endif
  
+ #ifdef ADC12_TIMERA_ENABLED
+   components Msp430TimerC;
    Msp430Adc12ImplP.TimerA -> Msp430TimerC.TimerA;
    Msp430Adc12ImplP.ControlA0 -> Msp430TimerC.ControlA0;
***************
*** 71,74 ****
--- 77,81 ----
    Msp430Adc12ImplP.CompareA0 -> Msp430TimerC.CompareA0;
    Msp430Adc12ImplP.CompareA1 -> Msp430TimerC.CompareA1;
+ #endif
  }
  

Index: README.txt
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/adc12/README.txt,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** README.txt	14 Mar 2007 18:14:06 -0000	1.5
--- README.txt	25 Jun 2007 15:47:15 -0000	1.6
***************
*** 33,39 ****
  
  An application that is written for an MSP430-based platform like 'eyesIFX' or
! 'telosb' can access the ADC12 in a more efficient way to, for example, do
! high-frequency sampling through the Msp430Adc12SingleChannel interface. On the
! MSP430 two additional hardware modules may become relevant when the ADC12 is
  used: the internal reference voltage generator and the DMA controller. 
  
--- 33,43 ----
  
  An application that is written for an MSP430-based platform like 'eyesIFX' or
! 'telosb' can access the ADC12 in a more efficient way via two interfaces: (1)
! the Msp430Adc12SingleChannel allows to perform one or more ADC conversions on a
! single channel with a specified sampling frequency and (2) the
! Msp430Adc12MultiChannel allows to sample a group of up to 16 different ADC
! channels "at once" (with minimum latency) and in addition define a sampling
! frequency for the whole group (useful for multi-channel accelerometers, etc.).
! On the MSP430 two additional hardware modules may play a role when the ADC12 is
  used: the internal reference voltage generator and the DMA controller. 
  
***************
*** 53,57 ****
  interface to the Msp430Adc12ClientAutoRVGC or Msp430Adc12ClientAutoDMA_RVGC
  component in addition to configuring the ADC through the
! Msp430Adc12SingleChannel interface (no nesC warning will be signalled).
    
  The DMA controller can be used to copy conversion data from the ADC registers
--- 57,61 ----
  interface to the Msp430Adc12ClientAutoRVGC or Msp430Adc12ClientAutoDMA_RVGC
  component in addition to configuring the ADC through the
! Msp430Adc12SingleChannel interface (a nesC warning will be signalled).
    
  The DMA controller can be used to copy conversion data from the ADC registers
***************
*** 68,71 ****
--- 72,76 ----
    * Msp430Adc12ClientAutoDMA_RVGC: DMA and automatic reference voltage
  
+ Currently Msp430Adc12MultiChannel is only provided by the first two components.
  
  I/O PINs
***************
*** 79,83 ****
  and input direction and immediately after the conversion has finished it is
  switched to I/O function mode. To disable this feature please comment out the
! "P6PIN_AUTO_CONFIGURE" macro in Msp430Adc12.h.
  
  
--- 84,88 ----
  and input direction and immediately after the conversion has finished it is
  switched to I/O function mode. To disable this feature please comment out the
! "ADC12_P6PIN_AUTO_CONFIGURE" macro in Msp430Adc12.h.
  
  
***************
*** 162,165 ****
--- 167,179 ----
    }
  
+ 
+ 3. Implementation
+ ====================================================================
+ 
+ The ADC12 stack is located at tinyos-2.x/tos/chips/msp430/adc12. Sensor
+ wrappers for the msp430 internal sensors are in
+ tinyos-2.x/tos/chips/msp430/sensors, an HAL test app can be found in
+ tinyos-2.x/apps/tests/msp430/Adc12.
+ 
  -----
  



More information about the Tinyos-2-commits mailing list