view src/cs/drivers/drv_app/pwr/pwr_cust.h @ 636:57e67ca2e1cb

pcmdata.c: default +CGMI to "FreeCalypso" and +CGMM to model The present change has no effect whatsoever on Falconia-made and Openmoko-made devices on which /pcm/CGMI and /pcm/CGMM files have been programmed in FFS with sensible ID strings by the respective factories, but what should AT+CGMI and AT+CGMM queries return when the device is a Huawei GTM900 or Tango modem that has been converted to FreeCalypso with a firmware change? Before the present change they would return compiled-in defaults of "<manufacturer>" and "<model>", respectively; with the present change the firmware will self-identify as "FreeCalypso GTM900-FC" or "FreeCalypso Tango" on the two respective targets. This firmware identification will become important if someone incorporates an FC-converted GTM900 or Tango modem into a ZeroPhone-style smartphone where some high-level software like ofono will be talking to the modem and will need to properly identify this modem as FreeCalypso, as opposed to some other AT command modem flavor with different quirks. In technical terms, the compiled-in default for the AT+CGMI query (which will always be overridden by the /pcm/CGMI file in FFS if one is present) is now "FreeCalypso" in all configs on all targets; the compiled-in default for the AT+CGMM query (likewise always overridden by /pcm/CGMM if present) is "GTM900-FC" if CONFIG_TARGET_GTM900 or "Tango" if CONFIG_TARGET_TANGO or the original default of "<model>" otherwise.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 19 Jan 2020 20:14:58 +0000
parents c93a236e0d50
children
line wrap: on
line source

/*******************************************************************************
 *
 * pwr_cust.h
 *
 * Purpose: This file contains definitions for battery management.
 *          These definitions can be modified by the customer.
 *
 * Author   Candice Bazanegue (c-brille@ti.com)
 *
 *
 * (C) Texas Instruments 2001
 *
 ******************************************************************************/

#ifndef __PWR_CUST_H__
#define __PWR_CUST_H__

#include "pwr/pwr_api.h"


/* Constants relative to the battery type */

#define BAT_TYPE_LI_ION_MIN      0x400
#define BAT_TYPE_LI_ION_MAX      0x450


/* Constants relative to the charging process */

#define CONSTANT_VOLTAGE_VALUE   4200     // (mV)  /* for CV charge */
#define CONSTANT_CURRENT_VALUE   500      // (mA)  /* for CI charge */
#define END_OF_CHARGE_I          150      // (mA)  /* for CV charge */
#define END_OF_CHARGE_V          4200     // (mV)  /* for CI charge */

#define CHARGE_START_AGAIN_CAPACITY 75 /* capacity threshold under which */
                                       /* the charge is started again if */
                                       /* the charger has been left plugged. */
                                       /* the chosen value must be part of the */
                                       /* a_pwr_thresholds array. */


/* Constants relative to the battery temperature */

#define BAT_TEMPERATURE_MAX_LI_ION  (50) /* Celsius degrees */
#define BAT_TEMPERATURE_MIN_LI_ION  (0)  /* Celsius degrees */

#define BAT_TEMPERATURE_MAX         BAT_TEMPERATURE_MAX_LI_ION 
#define BAT_TEMPERATURE_MIN         BAT_TEMPERATURE_MIN_LI_ION


#define THEN_10uA 0x0041 /* THSENS0 , THSENS1, THSENS2 = 0, 0, 0  MESBAT = 1 */
#define THEN_30uA 0x0051 /* THSENS0 , THSENS1, THSENS2 = 0, 1, 0  MESBAT = 1 */
#define THEN_50uA 0x0061 /* THSENS0 , THSENS1, THSENS2 = 0, 0, 1  MESBAT = 1 */
#define THEN_80uA 0x0079 /* THSENS0 , THSENS1, THSENS2 = 1, 1, 1  MESBAT = 1 */
#define MESBAT    0x0001 /* Resistive divider connected to main battery */


/* Constants relative to the timers duration */
#define PWR_BAT_TEST_TIME_1            (10)   /* 10 ms */
#define PWR_BAT_TEST_TIME_2            (5000) /* 5s */
#define PWR_CALIBRATION_TIME_1         (10)   /* 10 ms */
#define PWR_CALIBRATION_TIME_2         (5000) /* 5s */
#define PWR_CI_CHECKING_TIME           (4000) /* 4s */
#define PWR_CV_CHECKING_TIME           (4000) /* 4s */
#define PWR_DISCHARGE_CHECKING_TIME_1  (60000) /* 1 minute */
#define PWR_DISCHARGE_CHECKING_TIME_2  (10000) /* 10s */


typedef struct { 
   UINT16 bat_voltage;
   T_PWR_PERCENT remain_capa;
}T_PWR_THRESHOLDS; 


typedef enum {
   LI_ION,
   UNKNOWN
} T_PWR_BATTERY_TYPE;


#define NB_THRESHOLDS   (6)      /* number of elements in the a_pwr_thresholds array */	
extern const T_PWR_THRESHOLDS a_pwr_thresholds[NB_THRESHOLDS];





/* Prototypes */

UINT16 pwr_adc_to_mvolt(UINT16 bat_voltage_madc);
UINT16 pwr_adc_to_mA(UINT16 current_madc);
UINT8 pwr_bat_temp_within_limits(INT16 battery_temperature);
UINT8 pwr_madc_to_Celsius_conv(UINT8 bias_current, UINT16 madc_temp, INT16 *celsius_temp);
void pwr_get_battery_type(void);
void pwr_get_battery_temperature(void);
T_PWR_PERCENT pwr_get_capacity_vs_voltage(UINT16 bat_voltage);
void pwr_bat_50uA_temp_test_timer_process(void);
void pwr_bat_10uA_temp_test_timer_process(void);
void pwr_type_test_timer_process(void);

#endif /* __PWR_CUST_H__ */