[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/msp430/usart HplMsp430I2CInterrupts.nc, NONE, 1.1.2.1 Msp430I2C0P.nc, NONE, 1.1.2.1 Msp430I2CC.nc, NONE, 1.1.2.1 Msp430I2CP.nc, NONE, 1.1.2.1 HplMsp430Usart0C.nc, 1.1.2.7, 1.1.2.8 HplMsp430Usart0P.nc, 1.1.2.7, 1.1.2.8 HplMsp430UsartInterrupts.nc, 1.1.2.1, 1.1.2.2 Msp430Usart0C.nc, 1.1.2.4, 1.1.2.5 Msp430UsartShare0P.nc, 1.1.2.4, 1.1.2.5 Msp430UsartShareP.nc, 1.1.2.3, 1.1.2.4

Jonathan Hui jwhui at users.sourceforge.net
Tue Aug 1 09:36:29 PDT 2006


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

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	HplMsp430Usart0C.nc HplMsp430Usart0P.nc 
	HplMsp430UsartInterrupts.nc Msp430Usart0C.nc 
	Msp430UsartShare0P.nc Msp430UsartShareP.nc 
Added Files:
      Tag: tinyos-2_0_devel-BRANCH
	HplMsp430I2CInterrupts.nc Msp430I2C0P.nc Msp430I2CC.nc 
	Msp430I2CP.nc 
Log Message:

msp430 implementation of the tinyos-2.x I2C interface.



--- NEW FILE: HplMsp430I2CInterrupts.nc ---
/*
 * Copyright (c) 2005-2006 Arch Rock Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Arch Rock Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */

/**
 * @author Jonathan Hui <jhui at archrock.com>
 * @version $Revision: 1.1.2.1 $ $Date: 2006/08/01 16:36:24 $
 */

interface HplMsp430I2CInterrupts {
  
  async event void fired();
  
}

--- NEW FILE: Msp430I2C0P.nc ---
/*
 * Copyright (c) 2005-2006 Arch Rock Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Arch Rock Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */

/**
 * @author Jonathan Hui <jhui at archrock.com>
 * @version $Revision: 1.1.2.1 $ $Date: 2006/08/01 16:36:24 $
 */

configuration Msp430I2C0P {
  
  provides interface Resource[ uint8_t id ];
  provides interface I2CPacket<TI2CBasicAddr> as I2CBasicAddr;
  
  uses interface Resource as UsartResource[ uint8_t id ];
  uses interface HplMsp430I2CInterrupts as I2CInterrupts;
  
}

implementation {
  
  components Msp430I2CP as I2CP;
  Resource = I2CP.Resource;
  I2CBasicAddr = I2CP.I2CBasicAddr;
  UsartResource = I2CP.UsartResource;
  I2CInterrupts = I2CP.I2CInterrupts;
  
  components HplMsp430Usart0C as UsartC;
  I2CP.Usart -> UsartC;
  
  components LedsC as Leds;
  I2CP.Leds -> Leds;
  
}

--- NEW FILE: Msp430I2CC.nc ---
/*
 * Copyright (c) 2005-2006 Arch Rock Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Arch Rock Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */

/**
 * @author Jonathan Hui <jhui at archrock.com>
 * @version $Revision: 1.1.2.1 $ $Date: 2006/08/01 16:36:24 $
 */

#include <I2C.h>
#include "msp430UsartResource.h"

generic configuration Msp430I2CC() {
  
  provides interface Resource;
  provides interface I2CPacket<TI2CBasicAddr> as I2CBasicAddr;
  
}

implementation {
  
  enum {
    CLIENT_ID = unique( MSP430_SPIO_BUS ),
  };
  
  components Msp430I2C0P as I2CP;
  Resource = I2CP.Resource[ CLIENT_ID ];
  I2CBasicAddr = I2CP.I2CBasicAddr;
  
  components new Msp430Usart0C() as UsartC;
  I2CP.UsartResource[ CLIENT_ID ] -> UsartC.Resource;
  I2CP.I2CInterrupts -> UsartC.HplMsp430I2CInterrupts;
  
}

--- NEW FILE: Msp430I2CP.nc ---
/*
 * Copyright (c) 2005-2006 Arch Rock Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * - Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in the
 *   documentation and/or other materials provided with the
 *   distribution.
 * - Neither the name of the Arch Rock Corporation nor the names of
 *   its contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 * ARCHED ROCK OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE
 */

/**
 * @author Jonathan Hui <jhui at archrock.com>
 * @version $Revision: 1.1.2.1 $ $Date: 2006/08/01 16:36:24 $
 */

#include <I2C.h>

module Msp430I2CP {
  
  provides interface Resource[ uint8_t id ];
  provides interface I2CPacket<TI2CBasicAddr> as I2CBasicAddr;
  
  uses interface Resource as UsartResource[ uint8_t id ];
  uses interface HplMsp430Usart as Usart;
  uses interface HplMsp430I2CInterrupts as I2CInterrupts;
  uses interface Leds;
  
}

implementation {
  
  enum {
    TIMEOUT = 64,
  };
  
  MSP430REG_NORACE(I2CTCTL);
  MSP430REG_NORACE(I2CIE);
  MSP430REG_NORACE(I2CIFG);
  MSP430REG_NORACE(I2CDR);
  MSP430REG_NORACE(I2CSA);
  MSP430REG_NORACE(U0CTL);
  
  norace uint8_t* m_buf;
  norace uint8_t m_len;
  norace uint8_t m_pos;
  norace i2c_flags_t m_flags;
  
  void nextRead();
  void nextWrite();
  void signalDone( error_t error );
  
  async command error_t Resource.immediateRequest[ uint8_t id ]() {
    error_t error = call UsartResource.immediateRequest[ id ]();
    if ( error == SUCCESS )
      call Usart.setModeI2C();
    return error;
  }
  
  async command error_t Resource.request[ uint8_t id ]() {
    return call UsartResource.request[ id ]();
  }

  async command uint8_t Resource.isOwner[ uint8_t id ]() {
    return call UsartResource.isOwner[ id ]();
  }
  
  async command void Resource.release[ uint8_t id ]() {
    call UsartResource.release[ id ]();
  }
  
  event void UsartResource.granted[ uint8_t id ]() {
    call Usart.setModeI2C();
    signal Resource.granted[ id ]();
  }
  
  default async command error_t UsartResource.request[ uint8_t id ]() { return FAIL; }
  default async command error_t UsartResource.immediateRequest[ uint8_t id ]() { return FAIL; }
  default async command void UsartResource.release[ uint8_t id ]() {}
  default event void Resource.granted[ uint8_t id ]() {}
  
  async command error_t I2CBasicAddr.read( i2c_flags_t flags,
					   uint16_t addr, uint8_t len, 
					   uint8_t* buf ) {
    
    m_buf = buf;
    m_len = len;
    m_flags = flags;
    m_pos = 0;
    
    U0CTL |= MST;
    I2CTCTL &= ~I2CTRX;
    
    I2CSA = addr;
    I2CIE = RXRDYIE | ARDYIE | NACKIE;
    if ( flags & I2C_START )
      I2CTCTL |= I2CSTT;
    else
      nextRead();
    
    return SUCCESS;
    
  }
  
  async command error_t I2CBasicAddr.write( i2c_flags_t flags,
					    uint16_t addr, uint8_t len,
					    uint8_t* buf ) {
    
    m_buf = buf;
    m_len = len;
    m_flags = flags;
    m_pos = 0;
    
    U0CTL |= MST;
    I2CTCTL |= I2CTRX;
    
    I2CSA = addr;
    I2CIE = TXRDYIE | ARDYIE | NACKIE;
    if ( flags & I2C_START )
      I2CTCTL |= I2CSTT;
    else
      nextWrite();
    
    return SUCCESS;
    
  }
  
  async event void I2CInterrupts.fired() {
    
    int i = 0;
    
    switch( I2CIV ) {
      
    case 0x04:
      if ( I2CDCTL & I2CBB )
	I2CTCTL |= I2CSTP;
      while( I2CDCTL & I2CBUSY );
      signalDone( FAIL );
      break;
      
    case 0x08:
      while( (I2CDCTL & I2CBUSY) ) {
	if ( i++ >= TIMEOUT ) {
	  signalDone( FAIL );
	  return;
	}
      }
      signalDone( SUCCESS );
      break;
      
    case 0x0A:
      nextRead();
      break;
      
    case 0x0C:
      nextWrite();
      break;
      
    default:
      break;

    }
    
  }
  
  void nextRead() {
    m_buf[ m_pos++ ] = I2CDR;
    if ( m_pos == m_len ) {
      if ( m_flags & I2C_STOP )
	I2CTCTL |= I2CSTP;
      else
	signalDone( SUCCESS );
    }
  }
  
  void nextWrite() {
    if ( ( m_pos == m_len - 1 ) && ( m_flags & I2C_STOP ) ) {
      I2CTCTL |= I2CSTP;
    }
    else if ( m_pos == m_len ) {
      signalDone( SUCCESS );
      return;
    }
    I2CDR = m_buf[ m_pos++ ];
  }
  
  void signalDone( error_t error ) {
    I2CIE = 0;
    if ( I2CTCTL & I2CTRX )
      signal I2CBasicAddr.writeDone( error, I2CSA, m_len, m_buf );
    else
      signal I2CBasicAddr.readDone( error, I2CSA, m_len, m_buf );
  }
  
}

Index: HplMsp430Usart0C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/HplMsp430Usart0C.nc,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** HplMsp430Usart0C.nc	20 Jun 2006 18:56:05 -0000	1.1.2.7
--- HplMsp430Usart0C.nc	1 Aug 2006 16:36:24 -0000	1.1.2.8
***************
*** 69,72 ****
--- 69,73 ----
    provides interface HplMsp430Usart;
    provides interface HplMsp430UsartInterrupts;
+   provides interface HplMsp430I2CInterrupts;
  
  }
***************
*** 80,83 ****
--- 81,85 ----
    HplMsp430Usart = HplUsartP;
    HplMsp430UsartInterrupts = HplUsartP;
+   HplMsp430I2CInterrupts = HplUsartP;
    
    HplUsartP.SIMO -> GIO.SIMO0;

Index: HplMsp430Usart0P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/HplMsp430Usart0P.nc,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -C2 -d -r1.1.2.7 -r1.1.2.8
*** HplMsp430Usart0P.nc	20 Jun 2006 18:56:05 -0000	1.1.2.7
--- HplMsp430Usart0P.nc	1 Aug 2006 16:36:24 -0000	1.1.2.8
***************
*** 73,76 ****
--- 73,77 ----
    provides interface HplMsp430Usart as Usart;
    provides interface HplMsp430UsartInterrupts as Interrupts;
+   provides interface HplMsp430I2CInterrupts as I2CInterrupts;
  
    uses interface HplMsp430GeneralIO as SIMO;
***************
*** 98,102 ****
    
    TOSH_SIGNAL(UART0TX_VECTOR) {
!     signal Interrupts.txDone();
    }
    
--- 99,106 ----
    
    TOSH_SIGNAL(UART0TX_VECTOR) {
!     if ( call Usart.isI2C() )
!       signal I2CInterrupts.fired();
!     else
!       signal Interrupts.txDone();
    }
    
***************
*** 389,423 ****
    // i2c enable bit is not set by default
    async command void Usart.setModeI2C() {
      // check if we are already in I2C mode
      if (call Usart.getMode() == USART_I2C)
        return;
! 
!     call Usart.disableUART();
!     call Usart.disableSPI();
! 
      atomic {
        call SIMO.makeInput();
-       call UCLK.makeInput();
        call SIMO.selectModuleFunc();
        call UCLK.selectModuleFunc();
! 
!       IE1 &= ~(UTXIE0 | URXIE0);  // interrupt disable
! 
!       U0CTL = SWRST;
!       U0CTL |= SYNC | I2C;  // 7-bit addr, I2C-mode, USART as master
!       U0CTL &= ~I2CEN;
! 
        U0CTL |= MST;
! 
!       I2CTCTL = I2CSSEL_2;        // use 1MHz SMCLK as the I2C reference
! 
!       I2CPSC = 0x00;              // I2C CLK runs at 1MHz/10 = 100kHz
        I2CSCLH = 0x03;
        I2CSCLL = 0x03;
  
!       I2CIE = 0;                 // clear all I2C interrupt enables
!       I2CIFG = 0;                // clear all I2C interrupt flags
      }
!     return;
    }
  
--- 393,423 ----
    // i2c enable bit is not set by default
    async command void Usart.setModeI2C() {
+     
      // check if we are already in I2C mode
      if (call Usart.getMode() == USART_I2C)
        return;
!     
      atomic {
+       U0CTL &= ~(I2C | I2CEN | SYNC);
+       U0CTL = SWRST;
+       U0CTL |= SYNC | I2C;
+       U0CTL &= ~I2CEN;
+       
+       call Usart.disableUART();
+       call Usart.disableSPI();
        call SIMO.makeInput();
        call SIMO.selectModuleFunc();
+       call UCLK.makeInput();
        call UCLK.selectModuleFunc();
!       
        U0CTL |= MST;
!       I2CTCTL = I2CRM | I2CSSEL_2;
!       I2CPSC = 0x00;
        I2CSCLH = 0x03;
        I2CSCLL = 0x03;
  
!       U0CTL |= I2CEN;
      }
!     
    }
  

Index: HplMsp430UsartInterrupts.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/HplMsp430UsartInterrupts.nc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** HplMsp430UsartInterrupts.nc	15 Mar 2006 16:40:29 -0000	1.1.2.1
--- HplMsp430UsartInterrupts.nc	1 Aug 2006 16:36:24 -0000	1.1.2.2
***************
*** 53,57 ****
     */
    async event void rxDone(uint8_t data);
! 
  }
- 
--- 53,56 ----
     */
    async event void rxDone(uint8_t data);
!   
  }

Index: Msp430Usart0C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430Usart0C.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** Msp430Usart0C.nc	20 Jun 2006 18:56:05 -0000	1.1.2.4
--- Msp430Usart0C.nc	1 Aug 2006 16:36:25 -0000	1.1.2.5
***************
*** 43,46 ****
--- 43,47 ----
    provides interface HplMsp430Usart;
    provides interface HplMsp430UsartInterrupts;
+   provides interface HplMsp430I2CInterrupts;
    
  }
***************
*** 57,61 ****
    ArbiterInfo = UsartShareP.ArbiterInfo;
    HplMsp430UsartInterrupts = UsartShareP.Interrupts[ CLIENT_ID ];
! 
    components HplMsp430Usart0C as UsartC;
    HplMsp430Usart = UsartC;
--- 58,63 ----
    ArbiterInfo = UsartShareP.ArbiterInfo;
    HplMsp430UsartInterrupts = UsartShareP.Interrupts[ CLIENT_ID ];
!   HplMsp430I2CInterrupts = UsartShareP.I2CInterrupts[ CLIENT_ID ];
!   
    components HplMsp430Usart0C as UsartC;
    HplMsp430Usart = UsartC;

Index: Msp430UsartShare0P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430UsartShare0P.nc,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** Msp430UsartShare0P.nc	20 Jun 2006 18:56:05 -0000	1.1.2.4
--- Msp430UsartShare0P.nc	1 Aug 2006 16:36:25 -0000	1.1.2.5
***************
*** 38,41 ****
--- 38,42 ----
    
    provides interface HplMsp430UsartInterrupts as Interrupts[ uint8_t id ];
+   provides interface HplMsp430I2CInterrupts as I2CInterrupts[ uint8_t id ];
    provides interface Resource[ uint8_t id ];
    provides interface ArbiterInfo;
***************
*** 47,52 ****
    components new Msp430UsartShareP() as UsartShareP;
    Interrupts = UsartShareP;
    UsartShareP.RawInterrupts -> UsartC;
!   
    components new FcfsArbiterC( MSP430_HPLUSART0_RESOURCE ) as ArbiterC;
    Resource = ArbiterC;
--- 48,55 ----
    components new Msp430UsartShareP() as UsartShareP;
    Interrupts = UsartShareP;
+   I2CInterrupts = UsartShareP;
    UsartShareP.RawInterrupts -> UsartC;
!   UsartShareP.RawI2CInterrupts -> UsartC;
! 
    components new FcfsArbiterC( MSP430_HPLUSART0_RESOURCE ) as ArbiterC;
    Resource = ArbiterC;

Index: Msp430UsartShareP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/msp430/usart/Msp430UsartShareP.nc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** Msp430UsartShareP.nc	20 Jun 2006 18:56:05 -0000	1.1.2.3
--- Msp430UsartShareP.nc	1 Aug 2006 16:36:25 -0000	1.1.2.4
***************
*** 38,42 ****
--- 38,44 ----
    
    provides interface HplMsp430UsartInterrupts as Interrupts[ uint8_t id ];
+   provides interface HplMsp430I2CInterrupts as I2CInterrupts[ uint8_t id ];
    uses interface HplMsp430UsartInterrupts as RawInterrupts;
+   uses interface HplMsp430I2CInterrupts as RawI2CInterrupts;
    uses interface ArbiterInfo;
    
***************
*** 54,60 ****
        signal Interrupts.rxDone[ call ArbiterInfo.userId() ]( data );
    }
! 
    default async event void Interrupts.txDone[ uint8_t id ]() {}
    default async event void Interrupts.rxDone[ uint8_t id ]( uint8_t data ) {}
!   
  }
--- 56,68 ----
        signal Interrupts.rxDone[ call ArbiterInfo.userId() ]( data );
    }
!   
!   async event void RawI2CInterrupts.fired() {
!     if ( call ArbiterInfo.inUse() )
!       signal I2CInterrupts.fired[ call ArbiterInfo.userId() ]();
!   }
!   
    default async event void Interrupts.txDone[ uint8_t id ]() {}
    default async event void Interrupts.rxDone[ uint8_t id ]( uint8_t data ) {}
!   default async event void I2CInterrupts.fired[ uint8_t id ]() {}
! 
  }



More information about the Tinyos-2-commits mailing list