[Tinyos-beta-commits] CVS: tinyos-1.x/beta/platform/imote2 PMIC.nc, NONE, 1.1 PMICC.nc, NONE, 1.1 PMICM.nc, NONE, 1.1 pmic.h, 1.2, 1.3

Lama Nachman lnachman at users.sourceforge.net
Sun Sep 25 19:22:55 PDT 2005


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

Modified Files:
	pmic.h 
Added Files:
	PMIC.nc PMICC.nc PMICM.nc 
Log Message:
Added PMIC component


--- NEW FILE: PMIC.nc ---
/*									tab:4
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel 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 Intel 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 INTEL 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.
 * 
 */

/*
 *
 * Authors:	Lama Nachman, Robert Adler
 */

interface PMIC {
  /*
   * Set the voltage of the regulator controling the core
   *
   * @param core voltage specified in one of the supported trim values
   *
   * @return none
   */
  command result_t setCoreVoltage(uint8_t trimValue);
  
  command result_t getBatteryVoltage(uint8_t *val);
  command result_t enableAutoCharging(bool enable);
  command result_t enableManualCharging(bool enable);  
  command result_t chargingStatus(uint8_t *vBat, uint8_t *vChg, uint8_t *iChg);  
}

--- NEW FILE: PMICC.nc ---
/*									tab:4
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel 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 Intel 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 INTEL 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.
 * 
 * 
 */
/*
 *
 * Authors: Lama Nachman, Robert Adler
 */
configuration PMICC{

  provides{
    interface StdControl;
    interface PMIC;
  }
}
implementation{
  components PMICM, 
    PXA27XInterruptM, 
    PXA27XGPIOIntC, 
    BluSHC,
    ResetC,
    TimerC;

  StdControl = PMICM;
  PMIC = PMICM;
  PMICM.PI2CInterrupt -> PXA27XInterruptM.PXA27XIrq[PPID_PWR_I2C];
  PMICM.PMICInterrupt -> PXA27XGPIOIntC.PXA27XGPIOInt[1];
  PMICM.chargeMonitorTimer -> TimerC.Timer[unique("Timer")];
  PMICM.Reset -> ResetC;
    
  BluSHC.BluSH_AppI[unique("BluSH")] -> PMICM.BatteryVoltage;
  BluSHC.BluSH_AppI[unique("BluSH")] -> PMICM.ManualCharging;
  BluSHC.BluSH_AppI[unique("BluSH")] -> PMICM.AutoCharging;
  BluSHC.BluSH_AppI[unique("BluSH")] -> PMICM.ChargingStatus;
}

--- NEW FILE: PMICM.nc ---
/*									tab:4
 *  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.  By
 *  downloading, copying, installing or using the software you agree to
 *  this license.  If you do not agree to this license, do not download,
 *  install, copy or use the software.
 *
 *  Intel Open Source License 
 *
 *  Copyright (c) 2002 Intel 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 Intel 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 INTEL 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.
 * 
 * 
 */

/*
 *
 * Authors:  Lama Nachman, Robert Adler
 */

includes trace;

module PMICM{
  provides{
    interface StdControl;
    interface BluSH_AppI as BatteryVoltage; 
    interface BluSH_AppI as AutoCharging;
    interface BluSH_AppI as ManualCharging;
    interface BluSH_AppI as ChargingStatus;
    interface PMIC;
  }
  uses {
    interface PXA27XInterrupt as PI2CInterrupt;
    interface PXA27XGPIOInt as PMICInterrupt;
    interface Timer as chargeMonitorTimer;
    interface Reset;
  }
}

implementation {
#include "pmic.h"
  
  bool gotReset;
  
  command result_t StdControl.init(){
    CKEN |= CKEN15_PMI2C;
    PCFR |= PCFR_PI2C_EN;
    PICR = ICR_IUE | ICR_SCLEA;
    atomic{
      gotReset=FALSE;
    }    
    return call PI2CInterrupt.allocate();
  }
  
  result_t readPMIC(uint8_t address, uint8_t *value, uint8_t numBytes){
    //send the PMIC the address that we want to read
    if(numBytes > 0){
      PIDBR = PMIC_SLAVE_ADDR<<1; 
      PICR |= ICR_START;
      PICR |= ICR_TB;
      while(PICR & ICR_TB);
      
      //actually send the address terminated with a STOP
      PIDBR = address;
      PICR &= ~ICR_START;
      PICR |= ICR_STOP;
      PICR |= ICR_TB;
      while(PICR & ICR_TB);
      PICR &= ~ICR_STOP;
      
      
      //actually request the read of the data
      PIDBR = PMIC_SLAVE_ADDR<<1 | 1; 
      PICR |= ICR_START;
      PICR |= ICR_TB;
      while(PICR & ICR_TB);
      PICR &= ~ICR_START;
      
      //using Page Read Mode
      while (numBytes > 1){
	PICR |= ICR_TB;
	while(PICR & ICR_TB);
	*value = PIDBR;
	value++;
	numBytes--;
      }
      
      PICR |= ICR_STOP;
      PICR |= ICR_ACKNAK;
      PICR |= ICR_TB;
      while(PICR & ICR_TB);
      *value = PIDBR;
      PICR &= ~ICR_STOP;
      PICR &= ~ICR_ACKNAK;
      
      return SUCCESS;
    }
    else{
      return FAIL;
    }
  }

  result_t writePMIC(uint8_t address, uint8_t value){
    PIDBR = PMIC_SLAVE_ADDR<<1;
    PICR |= ICR_START;
    PICR |= ICR_TB;
    while(PICR & ICR_TB);
    
    PIDBR = address;
    PICR &= ~ICR_START;
    PICR |= ICR_TB;
    while(PICR & ICR_TB);

    PIDBR = value;
    PICR |= ICR_STOP;
    PICR |= ICR_TB;
    while(PICR & ICR_TB);
    PICR &= ~ICR_STOP;

    return SUCCESS;
  }
  
  command result_t StdControl.start(){
    //init unit
    uint8_t val[3];
    call PI2CInterrupt.enable();
    //irq is apparently active low...however trigger on both for now
    call PMICInterrupt.enable(TOSH_FALLING_EDGE);
        
    /*
     * Reset the watchdog, switch it to an interrupt, so we can disable it
     * Ignore SLEEP_N pin, enable H/W reset via button 
     */
    writePMIC(PMIC_SYS_CONTROL_A, 
              SCA_RESET_WDOG | SCA_WDOG_ACTION | SCA_HWRES_EN);

    // Disable all interrupts from PMIC except for ONKEY button
    writePMIC(PMIC_IRQ_MASK_A, ~IMA_ONKEY_N);
    writePMIC(PMIC_IRQ_MASK_B, 0xFF);
    writePMIC(PMIC_IRQ_MASK_C, 0xFF);
    
    //read out the EVENT registers so that we can receive interrupts
    readPMIC(PMIC_EVENTS, val, 3);

    // Set default core voltage to 0.85 V
    call PMIC.setCoreVoltage(B2R1_TRIM_P85_V);
    return SUCCESS;
  }
  
  command result_t StdControl.stop(){
    call PI2CInterrupt.disable();
    call PMICInterrupt.disable();
    CKEN &= ~CKEN15_PMI2C;
    PICR = 0;
    
    return SUCCESS;
  }
  
  async event void PI2CInterrupt.fired(){
    uint32_t status, update=0;
    status = PISR;
    if(status & ISR_ITE){
      update |= ISR_ITE;
      trace("sent data");
    }

    if(status & ISR_BED){
      update |= ISR_BED;
      trace("bus error");
    }
    PISR = update;
  }
  
  async event void PMICInterrupt.fired(){
    uint8_t events[3];
    bool localGotReset;
   
    call PMICInterrupt.clear();
   
    readPMIC(PMIC_EVENTS, events, 3);
   
    if(events[EVENTS_A_OFFSET] & EA_ONKEY_N){
      atomic{
        localGotReset = gotReset;
      }
      if(localGotReset==TRUE){
        call Reset.reset();
      }
      else{
        atomic{
	  gotReset=TRUE;
        }
      }
    }
    else{
      trace("PMIC EVENTs =%#x %#x %#x\r\n",events[0], events[1], events[2]);
    }
  }

  /*
   * The Buck2 controls the core voltage, set to appropriate trim value
   */
  command result_t PMIC.setCoreVoltage(uint8_t trimValue) {
    writePMIC(PMIC_BUCK2_REG1, (trimValue & B2R1_TRIM_MASK) | B2R1_GO);
    return SUCCESS;
  }
  

  result_t getPMICADCVal(uint8_t channel, uint8_t *val){
    uint8_t oldval;
    result_t rval;
    
    //read out the old value so that we can reset at the end
    rval= readPMIC(PMIC_ADC_MAN_CONTROL, &oldval,1);
    rcombine(rval,writePMIC(PMIC_ADC_MAN_CONTROL, PMIC_AMC_ADCMUX(channel) | 
                  PMIC_AMC_MAN_CONV | PMIC_AMC_LDO_INT_Enable));
    rcombine(rval, readPMIC(PMIC_MAN_RES,val,1));
    //reset to old state
    rcombine(rval,writePMIC(PMIC_ADC_MAN_CONTROL, oldval));
    return rval;
  }

  command result_t PMIC.getBatteryVoltage(uint8_t *val){
    //for now, let's use the manual conversion mode
    return getPMICADCVal(0, val);
  }
  
  command result_t PMIC.chargingStatus(uint8_t *vBat, uint8_t *vChg, 
                                       uint8_t *iChg){
    getPMICADCVal(0, vBat);
    getPMICADCVal(2, vChg);
    getPMICADCVal(1, iChg);
    return SUCCESS;
  }  
  
  command result_t PMIC.enableAutoCharging(bool enable){
    return SUCCESS;
  }
  
  command result_t PMIC.enableManualCharging(bool enable){
    //just turn on or off the LED for now!!
    uint8_t val;
    
    if(enable){
      //want to turn on the charger
      getPMICADCVal(2, &val);
      //if charger is present due some stuff...75 should be 4.65V or so 
      if(val > 75 ) {
	trace("Charger Voltage is %.3fV...enabling charger...\r\n", ((val*6) * .01035));
	//write the total timeout to be 8 hours
	writePMIC(PMIC_TCTR_CONTROL,8);
	//enable the charger at 100mA and 4.35V
	writePMIC(PMIC_CHARGE_CONTROL,PMIC_CC_CHARGE_ENABLE | PMIC_CC_ISET(1) | PMIC_CC_VSET(7));
	//turn on the LED
	writePMIC(PMIC_LED1_CONTROL,0x80);
	//start a timer to monitor our progress every 5 minutes!
	call chargeMonitorTimer.start(TIMER_REPEAT,300000);
      }
      else{
	trace("Charger Voltage is %.3fV...charger not enabled\r\n", ((val*6) * .01035));
      }
    }
    else{
      //turn off the charger and the LED
      call PMIC.getBatteryVoltage(&val);
      trace("Disabling Charger...Battery Voltage is %.3fV\r\n", (val * .01035) + 2.65);
      //disable everything that we enabled
      writePMIC(PMIC_TCTR_CONTROL,0);
      writePMIC(PMIC_CHARGE_CONTROL,0);
      writePMIC(PMIC_LED1_CONTROL,0x00);
    }
    return SUCCESS; 
  }  
  
  event result_t chargeMonitorTimer.fired(){
    uint8_t val;
    call PMIC.getBatteryVoltage(&val);
    //stop when vBat>4V
    if(val>130){
      call PMIC.enableManualCharging(FALSE);
      call chargeMonitorTimer.stop();
    }
    return SUCCESS;
  }
  
  command BluSH_result_t BatteryVoltage.getName(char *buff, uint8_t len){
    
    const char name[] = "BatteryVoltage";
    strcpy(buff,name);
    return BLUSH_SUCCESS_DONE;
  }
  
  command BluSH_result_t BatteryVoltage.callApp(char *cmdBuff, uint8_t cmdLen,
					      char *resBuff, uint8_t resLen){
    uint8_t val;
    if(call PMIC.getBatteryVoltage(&val)){
      trace("Battery Voltage is %.3fV\r\n", (val * .01035) + 2.65);
    }
    else{
      trace("Error:  getBatteryVoltage failed\r\n");
    }
    return BLUSH_SUCCESS_DONE;
  }

  command BluSH_result_t ChargingStatus.getName(char *buff, uint8_t len){
    
    const char name[] = "ChargingStatus";
    strcpy(buff,name);
    return BLUSH_SUCCESS_DONE;
  }
  
  command BluSH_result_t ChargingStatus.callApp(char *cmdBuff, uint8_t cmdLen,
					      char *resBuff, uint8_t resLen){
    uint8_t vBat, vChg, iChg;
    call PMIC.chargingStatus(&vBat, &vChg, &iChg);
    trace("vBat = %.3fV %vChg = %.3fV iChg = %.3fA\r\n", (vBat * .01035) + 2.65,((vChg*6) * .01035), ((iChg * .01035)/1.656));
    return BLUSH_SUCCESS_DONE;
  }

  command BluSH_result_t ManualCharging.getName(char *buff, uint8_t len){
    
    const char name[] = "ManualCharging";
    strcpy(buff,name);
    return BLUSH_SUCCESS_DONE;
  }
  
  command BluSH_result_t ManualCharging.callApp(char *cmdBuff, uint8_t cmdLen,
					      char *resBuff, uint8_t resLen){
    uint8_t val;
    //get charger's state
    readPMIC(PMIC_CHARGE_CONTROL,&val, 1);
    if(val > 0){
      //charge is already enabled...disable it
      call PMIC.enableManualCharging(FALSE);
    }
    else{
       call PMIC.enableManualCharging(TRUE);
    }
    return BLUSH_SUCCESS_DONE;
  }

  command BluSH_result_t AutoCharging.getName(char *buff, uint8_t len){
    
    const char name[] = "AutoCharging";
    strcpy(buff,name);
    return BLUSH_SUCCESS_DONE;
  }
  
  command BluSH_result_t AutoCharging.callApp(char *cmdBuff, uint8_t cmdLen,
					      char *resBuff, uint8_t resLen){
    
    return BLUSH_SUCCESS_DONE;
  }
}

Index: pmic.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/beta/platform/imote2/pmic.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pmic.h	19 Sep 2005 21:06:26 -0000	1.2
--- pmic.h	26 Sep 2005 02:22:52 -0000	1.3
***************
*** 76,108 ****
  // Register BUCK2 with DVC1
  #define PMIC_BUCK2_REG1 0x15
- #define PMIC_TRIM_P85_V 0x80
- #define PMIC_TRIM_P875_V 0x81
- #define PMIC_TRIM_P9_V 0x82
- #define PMIC_TRIM_P925_V 0x83
- #define PMIC_TRIM_P95_V 0x84
- #define PMIC_TRIM_P975_V 0x85
- #define PMIC_TRIM_1_V 0x86
- #define PMIC_TRIM_1_25_V 0x90
  
  // Register BUCK2 with DVC2
  #define PMIC_BUCK2_REG2 0x16
  
! // LDO on/off control
! #define PMIC_B_REG_CONTROL_1 0x17
! #define PMIC_BRC1_BUCK2_EN 0x1	// on
! #define PMIC_BRC1_LDO10_EN 0x2	// off
! #define PMIC_BRC1_LDO11_EN 0x4	// off
! #define PMIC_BRC1_LDO13_EN 0x8	// off
! #define PMIC_BRC1_LDO14_EN 0x10	// off
! #define PMIC_BRC1_LDO15_EN 0x20	// on
! #define PMIC_BRC1_LDO16_EN 0x40	// on
! #define PMIC_BRC1_LDO17_EN 0x80	// off
! 
! #define PMIC_B_REG_CONTROL_2 0x18
! #define PMIC_BRC2_LDO18_EN 0x1	// on
! #define PMIC_BRC2_LDO19_EN 0x2	// on
! #define PMIC_BRC2_SIMCP_EN 0x40	// off
  
! #define PMIC_CID                    (0x00)
  #define PMIC_EVENTA                 (0x01)
  #define PMIC_EVENTB                 (0x02)
--- 76,88 ----
  // Register BUCK2 with DVC1
  #define PMIC_BUCK2_REG1 0x15
  
  // Register BUCK2 with DVC2
  #define PMIC_BUCK2_REG2 0x16
  
! // LDO on/off control in App Reg space
! #define PMIC_A_REG_CONTROL_1 0x17
! #define PMIC_A_REG_CONTROL_2 0x18
  
! #define PMIC_EVENTS                 (0x01)	// 3 byte array
  #define PMIC_EVENTA                 (0x01)
  #define PMIC_EVENTB                 (0x02)
***************
*** 130,152 ****
  #define PMIC_LED1_CONTROL           (0x20)
  
! #define PMIC_H_REG_CONTROL_1 0x97
! #define PMIC_HRC1_BUCK_EN 0x1	// off
! #define PMIC_HRC1_LDO1_EN 0x2	// off
! #define PMIC_HRC1_LDO2_EN 0x4	// off
! #define PMIC_HRC1_LDO3_EN 0x8	// BB
! #define PMIC_HRC1_LDO4_EN 0x10	// off
! #define PMIC_HRC1_LDO5_EN 0x20	// radio
! #define PMIC_HRC1_LDO6_EN 0x40	// off
! #define PMIC_HRC1_LDO7_EN 0x80	// off
  
! #define PMIC_H_REG_CONTROL_2 0x98
! #define PMIC_HRC2_LDO8_EN 0x1	// off
! #define PMIC_HRC2_LDO9_EN 0x2	// off
! #define PMIC_HRC2_LDO10_EN 0x4	// sensor board
! #define PMIC_HRC2_LDO11_EN 0x8	// sensor board
! #define PMIC_HRC2_LDO12_EN 0x10	// BB_IO
! #define PMIC_HRC2_LDO14_EN 0x20	// off
! #define PMIC_HRC2_SIMCP_EN 0x40	// off
! #define PMIC_HRC2_SLEEP 0x80	// off
  
  #endif //PMIC_H
--- 110,207 ----
  #define PMIC_LED1_CONTROL           (0x20)
  
! // LDO on/off control in Baseband Reg space
! #define PMIC_B_REG_CONTROL_1 0x97
! #define PMIC_B_REG_CONTROL_2 0x98
  
! // IRQ_MASK_A
! #define IMA_ONKEY_N 0x1
! #define IMA_PWREN1 0x2
! #define IMA_EXTON 0x4
! #define IMA_CHDET 0x8
! #define IMA_TBAT 0x10
! #define IMA_VBATMON_1 0x20
! #define IMA_VBATMON_2 0x40
! #define IMA_CHIOVER 0x80
!  
! //IRQ_MASK_B
! #define IMB_TCTO 0x1
! #define IMB_CCTO 0x2
! #define IMB_ADC_READY 0x4
! #define IMB_VBUS_VALID_4_4 0x8
! #define IMB_VBUS_VALID_4_0 0x10
! #define IMB_SESSION_VALID 0x20
! #define IMB_SRP_DETECT 0x40
! #define IMB_WDOG 0x80
! 
! // SYS_CONTROL_A
! #define SCA_SLEEP_N_EN 0x1
! #define SCA_SHUTDOWN 0x2
! #define SCA_HWRES_EN 0x4
! #define SCA_WDOG_ACTION 0x8
! #define SCA_TWDSCALE(_x) (((_x) & 7) << 4)
! #define SCA_RESET_WDOG 0x80
! 
! // Events registers A, B, C
! #define EVENTS_A_OFFSET 0
! #define EA_ONKEY_N 0x1
! #define EA_PWREN1 0x2
! #define EA_EXTON 0x4
! #define EA_CHDET 0x8
! #define EA_TBAT 0x10
! #define EA_VBATMON 0x20
! #define EA_VBATMON_TXON 0x40
! #define EA_CHIOVER 0x80
! 
! #define EVENTS_B_OFFSET 1
! #define EVENTS_C_OFFSET 2
! 
! // BUCK2 Reg 1
! #define B2R1_TRIM_MASK 0x1f
! #define B2R1_TRIM_P85_V 0x0
! #define B2R1_TRIM_P875_V 0x1
! #define B2R1_TRIM_P9_V 0x2
! #define B2R1_TRIM_P925_V 0x3
! #define B2R1_TRIM_P95_V 0x4
! #define B2R1_TRIM_P975_V 0x5
! #define B2R1_TRIM_1_V 0x6
! #define B2R1_TRIM_1_125_V 0xB
! #define B2R1_TRIM_1_25_V 0x10
! #define B2R1_SLEEP 0x40
! #define B2R1_GO 0x80
! 
! // Reg Control 1 for App processor reg space: Enable/Disable LDOs
! #define ARC1_BUCK2_EN 0x1	// on
! #define ARC1_LDO10_EN 0x2	// off
! #define ARC1_LDO11_EN 0x4	// off
! #define ARC1_LDO13_EN 0x8	// off
! #define ARC1_LDO14_EN 0x10	// off
! #define ARC1_LDO15_EN 0x20	// on
! #define ARC1_LDO16_EN 0x40	// on
! #define ARC1_LDO17_EN 0x80	// off
! 
! // Reg Control 2 for App processor reg space : Enable/Disable LDOs
! #define ARC2_LDO18_EN 0x1	// on
! #define ARC2_LDO19_EN 0x2	// on
! #define ARC2_SIMCP_EN 0x40	// off
! 
! // Reg Control 1 for Baseband reg space
! #define BRC1_BUCK_EN 0x1	// off
! #define BRC1_LDO1_EN 0x2	// off
! #define BRC1_LDO2_EN 0x4	// off
! #define BRC1_LDO3_EN 0x8	// BB
! #define BRC1_LDO4_EN 0x10	// off
! #define BRC1_LDO5_EN 0x20	// radio
! #define BRC1_LDO6_EN 0x40	// off
! #define BRC1_LDO7_EN 0x80	// off
! 
! // Reg Control 2 for Baseband reg space
! #define BRC2_LDO8_EN 0x1	// off
! #define BRC2_LDO9_EN 0x2	// off
! #define BRC2_LDO10_EN 0x4	// sensor board
! #define BRC2_LDO11_EN 0x8	// sensor board
! #define BRC2_LDO12_EN 0x10	// BB_IO
! #define BRC2_LDO14_EN 0x20	// off
! #define BRC2_SIMCP_EN 0x40	// off
! #define BRC2_SLEEP 0x80	 	// off
  
  #endif //PMIC_H



More information about the Tinyos-beta-commits mailing list