[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/pxa27x/i2c HalPXA27xI2CMasterC.nc, 1.1.2.1, 1.1.2.2 HalPXA27xI2CMasterP.nc, 1.1.2.3, 1.1.2.4 HplPXA27xI2C.nc, 1.1.2.3, 1.1.2.4 HplPXA27xI2CC.nc, 1.1.2.3, 1.1.2.4 HplPXA27xI2CP.nc, 1.1.2.5, 1.1.2.6 HplPXA27xPI2CC.nc, 1.1.2.2, 1.1.2.3

Philip Buonadonna philipb at users.sourceforge.net
Wed Jul 5 12:01:50 PDT 2006


Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv6698

Modified Files:
      Tag: tinyos-2_0_devel-BRANCH
	HalPXA27xI2CMasterC.nc HalPXA27xI2CMasterP.nc HplPXA27xI2C.nc 
	HplPXA27xI2CC.nc HplPXA27xI2CP.nc HplPXA27xPI2CC.nc 
Log Message:
Updated I2C components for pxa27x

Index: HalPXA27xI2CMasterC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c/Attic/HalPXA27xI2CMasterC.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
*** HalPXA27xI2CMasterC.nc	28 Mar 2006 02:16:57 -0000	1.1.2.1
--- HalPXA27xI2CMasterC.nc	5 Jul 2006 19:01:46 -0000	1.1.2.2
***************
*** 1,5 ****
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arched Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arch Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
***************
*** 12,16 ****
   * documentation and/or other materials provided with the distribution.
   *  
!  *   Neither the name of the Arched 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.
--- 12,16 ----
   * 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.
***************
*** 36,44 ****
   */
  
! #include <I2CFlags.h>
  
  configuration HalPXA27xI2CMasterC
  {
!   provides interface I2CPacketAdv;
  }
  
--- 36,47 ----
   */
  
! #include <I2C.h>
  
  configuration HalPXA27xI2CMasterC
  {
!   provides interface I2CPacket<TI2CBasicAddr>;
! 
!   uses interface HplPXA27xGPIOPin as I2CSCL;
!   uses interface HplPXA27xGPIOPin as I2CSDA;
  }
  
***************
*** 49,56 ****
    components PlatformP;
  
!   I2CPacketAdv = HalPXA27xI2CMasterP;
  
!   HalPXA27xI2CMasterP.Init <- PlatformP.L2Init;
  
    HalPXA27xI2CMasterP.I2C -> HplPXA27xI2CC.I2C;
  }
--- 52,62 ----
    components PlatformP;
  
!   I2CPacket = HalPXA27xI2CMasterP;
  
!   HalPXA27xI2CMasterP.Init <- PlatformP.InitL2;
  
    HalPXA27xI2CMasterP.I2C -> HplPXA27xI2CC.I2C;
+ 
+   I2CSCL = HalPXA27xI2CMasterP.I2CSCL;
+   I2CSDA = HalPXA27xI2CMasterP.I2CSDA;
  }

Index: HalPXA27xI2CMasterP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c/Attic/HalPXA27xI2CMasterP.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
*** HalPXA27xI2CMasterP.nc	20 Jun 2006 19:43:58 -0000	1.1.2.3
--- HalPXA27xI2CMasterP.nc	5 Jul 2006 19:01:46 -0000	1.1.2.4
***************
*** 1,5 ****
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arched Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arch Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
***************
*** 12,16 ****
   * documentation and/or other materials provided with the distribution.
   *  
!  *   Neither the name of the Arched 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.
--- 12,16 ----
   * 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.
***************
*** 44,47 ****
--- 44,51 ----
  
    uses interface HplPXA27xI2C as I2C;
+ 
+   uses interface HplPXA27xGPIOPin as I2CSCL;
+   uses interface HplPXA27xGPIOPin as I2CSDA;
+ 
  }
  
***************
*** 69,77 ****
    static void readNextByte() {
      if (mCurBufIndex >= (mCurBufLen - 1)) {
!       mI2CState = I2C_STATE_READEND;
!       if (mI2CFlags & I2C_STOP) {
  	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_DRFIE | ICR_ACKNAK | ICR_TB | ICR_STOP));
        }
!       else if (mI2C_FLAGS & I2C_ACK_END) {
  	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_DRFIE | ICR_TB));
        }
--- 73,81 ----
    static void readNextByte() {
      if (mCurBufIndex >= (mCurBufLen - 1)) {
!       atomic { mI2CState = I2C_STATE_READEND; }
!       if (mCurFlags & I2C_STOP) {
  	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_DRFIE | ICR_ACKNAK | ICR_TB | ICR_STOP));
        }
!       else if (mCurFlags & I2C_ACK_END) {
  	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_DRFIE | ICR_TB));
        }
***************
*** 81,84 ****
--- 85,89 ----
      }
      else {
+       atomic { mI2CState = I2C_STATE_READ; }
        call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_DRFIE | ICR_TB));
      }
***************
*** 88,101 ****
    static void writeNextByte() {
      if (mCurBufIndex >= mCurBufLen) {
!       mI2CState = I2C_STATE_WRITEEND;
!       if (mI2CFlags & I2C_STOP) {
! 	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_TB | ICR_STOP));
        }
        else {
! 	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_TB));
        }
      }
      else {
!       call I2C.setICR((mBaseICRfFlags) | (ICR_ALDIE | ICR_TB));
      }
      return;
--- 93,109 ----
    static void writeNextByte() {
      if (mCurBufIndex >= mCurBufLen) {
!       atomic { mI2CState = I2C_STATE_WRITEEND; }
!       
!       if (mCurFlags & I2C_STOP) {
! 	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_TB | ICR_ITEIE | ICR_STOP));
        }
+       
        else {
! 	call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_ITEIE | ICR_TB));
        }
+       
      }
      else {
!       call I2C.setICR((mBaseICRFlags) | (ICR_ALDIE | ICR_ITEIE |ICR_TB));
      }
      return;
***************
*** 129,132 ****
--- 137,141 ----
  
      if (flags & I2C_START) {
+ 
        tmpAddr = (bRnW) ? 0x1 : 0x0;
        tmpAddr |= ((addr << 1) & 0xFE);
***************
*** 149,153 ****
  
    task void handleReadError() {
!     call I2C.setISR(0x7F0);
      call I2C.setICR(mBaseICRFlags | ICR_MA);
      call I2C.setICR(ICR_UR);
--- 158,162 ----
  
    task void handleReadError() {
!     call I2C.setISAR(0x7F0);
      call I2C.setICR(mBaseICRFlags | ICR_MA);
      call I2C.setICR(ICR_UR);
***************
*** 161,165 ****
      
    task void handleWriteError() {
!     call I2C.setISR(0x7F0);
      call I2C.setICR(mBaseICRFlags | ICR_MA);
      call I2C.setICR(ICR_UR);
--- 170,174 ----
      
    task void handleWriteError() {
!     call I2C.setISAR(0x7F0);
      call I2C.setICR(mBaseICRFlags | ICR_MA);
      call I2C.setICR(ICR_UR);
***************
*** 174,179 ****
--- 183,196 ----
    command error_t Init.init() {
      atomic {
+       call I2CSCL.setGAFRpin(I2C_SCL_ALTFN);
+       call I2CSCL.setGPDRbit(TRUE);
+       call I2CSDA.setGAFRpin(I2C_SDA_ALTFN);
+       call I2CSDA.setGPDRbit(TRUE);
+ 
        mI2CState = I2C_STATE_IDLE;
+       call I2C.setISAR(0);
+       call I2C.setICR(mBaseICRFlags | ICR_ITEIE | ICR_DRFIE);
      }    
+     return SUCCESS;
    }
  
***************
*** 182,186 ****
      uint8_t tmpAddr;
  
!     if ((flags & I2C_ACKEND) && (flags & I2C_STOP)) {
        error = EINVAL;
        return error;
--- 199,203 ----
      uint8_t tmpAddr;
  
!     if ((flags & I2C_ACK_END) && (flags & I2C_STOP)) {
        error = EINVAL;
        return error;
***************
*** 193,196 ****
--- 210,214 ----
        error = startI2CTransact(I2C_STATE_READ,addr,length,data,flags,TRUE);
      }
+     
      return error;
    }
***************
*** 208,212 ****
--- 226,236 ----
      uint32_t valISR;
  
+     // PXA27x Devel Guide is wrong.  You have to write to the ISR to clear the bits.
      valISR = call I2C.getISR();
+     call I2C.setISR(ISR_ITE | ISR_IRF);
+ 
+     // turn off DRFIE and ITEIE
+     //call I2C.setICR((call I2C.getICR()) & ~(ICR_DRFIE | ICR_ITEIE));
+     //call I2C.setICR(mBaseICRFlags);
  
      switch (mI2CState) {
***************
*** 254,257 ****
--- 278,282 ----
        call I2C.setIDBR(mCurBuf[mCurBufIndex]);
        mCurBufIndex++;
+       writeNextByte();
  
        break;
***************
*** 264,267 ****
--- 289,294 ----
        }
        mI2CState= I2C_STATE_IDLE;
+       //call I2C.setICR(call I2C.getICR() & ~I2C_STOP);
+       call I2C.setICR(mBaseICRFlags);
        signal I2CPacket.writeDone(SUCCESS,mCurTargetAddr,mCurBufLen,mCurBuf);
        break;
***************
*** 275,286 ****
    }
  
!   default async event void I2CPacket.readone(error_t error, uint16_t addr, 
  					     uint8_t length, uint8_t* data) {
      return;
    }
  
!   default async event void I2CPacket.writePacketDone(error_t error, uint16_t addr, 
  						     uint8_t length, uint8_t* data) { 
      return;
    }
  }
--- 302,316 ----
    }
  
!   default async event void I2CPacket.readDone(error_t error, uint16_t addr, 
  					     uint8_t length, uint8_t* data) {
      return;
    }
  
!   default async event void I2CPacket.writeDone(error_t error, uint16_t addr, 
  						     uint8_t length, uint8_t* data) { 
      return;
    }
+ 
+   async event void I2CSDA.interruptGPIOPin() {}
+   async event void I2CSCL.interruptGPIOPin() {}
  }

Index: HplPXA27xI2C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c/Attic/HplPXA27xI2C.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
*** HplPXA27xI2C.nc	23 Jun 2006 22:32:43 -0000	1.1.2.3
--- HplPXA27xI2C.nc	5 Jul 2006 19:01:46 -0000	1.1.2.4
***************
*** 1,5 ****
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arched Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arch Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
***************
*** 12,16 ****
   * documentation and/or other materials provided with the distribution.
   *  
!  *   Neither the name of the Arched 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.
--- 12,16 ----
   * 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.

Index: HplPXA27xI2CC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c/Attic/HplPXA27xI2CC.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
*** HplPXA27xI2CC.nc	20 Jun 2006 19:59:43 -0000	1.1.2.3
--- HplPXA27xI2CC.nc	5 Jul 2006 19:01:47 -0000	1.1.2.4
***************
*** 1,5 ****
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arched Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arch Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
***************
*** 12,16 ****
   * documentation and/or other materials provided with the distribution.
   *  
!  *   Neither the name of the Arched 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.
--- 12,16 ----
   * 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.
***************
*** 47,50 ****
--- 47,51 ----
    I2C = HplPXA27xI2CP;
  
+   HplPXA27xI2CP.Init <- PlatformP.InitL1;
    HplPXA27xI2CP.I2CIrq -> HplPXA27xInterruptM.PXA27xIrq[PPID_I2C];
  }

Index: HplPXA27xI2CP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c/Attic/HplPXA27xI2CP.nc,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** HplPXA27xI2CP.nc	23 Jun 2006 23:22:07 -0000	1.1.2.5
--- HplPXA27xI2CP.nc	5 Jul 2006 19:01:47 -0000	1.1.2.6
***************
*** 1,5 ****
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arched Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arch Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
***************
*** 12,16 ****
   * documentation and/or other materials provided with the distribution.
   *  
!  *   Neither the name of the Arched 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.
--- 12,16 ----
   * 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.

Index: HplPXA27xPI2CC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/pxa27x/i2c/Attic/HplPXA27xPI2CC.nc,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** HplPXA27xPI2CC.nc	28 Mar 2006 02:16:02 -0000	1.1.2.2
--- HplPXA27xPI2CC.nc	5 Jul 2006 19:01:47 -0000	1.1.2.3
***************
*** 1,5 ****
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arched Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
--- 1,5 ----
  /* $Id$ */
  /*
!  * Copyright (c) 2005 Arch Rock Corporation 
   * All rights reserved. 
   * Redistribution and use in source and binary forms, with or without
***************
*** 12,16 ****
   * documentation and/or other materials provided with the distribution.
   *  
!  *   Neither the name of the Arched 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.
--- 12,16 ----
   * 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.



More information about the Tinyos-2-commits mailing list