⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcc.h

📁 是一个手机功能的模拟程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************
 * Power Task (pwr)
 * Design and coding by Svend Kristian Lindholm, skl@ti.com
 *
 * PWR Types and globals
 *
 * $Id: lcc.h,v 1.1.1.1 2004/06/19 06:00:29 root Exp $
 *
 ******************************************************************************/

#ifndef _PWR_H_
#define _PWR_H_

#ifdef _RVF
#include "rvf_api.h"
#include "rv_general.h"
#include "lcc_api.h"
#include "lcc_cfg_i.h"
#endif

#define PWRVERSION 0x0201

/******************************************************************************
 * Types
 ******************************************************************************/

#ifndef BASIC_TYPES
#define BASIC_TYPES
typedef signed   char  int8;
typedef unsigned char  uint8;
typedef signed   short int16;
typedef unsigned short uint16;
typedef signed   int   int32;
typedef unsigned int   uint32;
#endif

typedef int8   epwr_t;      // error type



/******************************************************************************
 * RVF Types
 ******************************************************************************/

// Mail namings (REQ,IND,RSP) according to RIV010

// Request mail
struct pwr_req_s {
     T_RV_HDR header;
};

// Indication mail with ADC measurements
struct pwr_adc_ind_s {
     T_RV_HDR header;
     unsigned short data[9]; // ADC measurements + status of VRPCSTS register
};

// Response mail sent to ETM
struct pwr_tm_req_s {
     T_RV_HDR header;
};

typedef epwr_t                T_PWR_RET;
typedef struct pwr_req_s      T_PWR_REQ;

typedef struct
{
    uint16   alfa_num;     // Slope numerator
    uint16   alfa_denom;   // Slope denominator
    int16    beta;         // Offset
} T_PWR_I2V_CAL_BLOCK;

typedef struct
{
    uint16   alfa_num;     // Slope numerator
    uint16   alfa_denom;   // Slope denominator
    int16    beta;         // Offset
} T_PWR_VBAT_CAL_BLOCK;

// Corresponds to /pwr/i2v.cal and /pwr/vbat.cal
typedef struct
{
    T_PWR_I2V_CAL_BLOCK   i2v;
    T_PWR_VBAT_CAL_BLOCK vbat;
} T_PWR_CAL_BLOCK;

// Corresponds to /pwr/common.cfg
typedef struct
{
    uint32   sampling;     /* 4 */ // The sampling time [ms] used
    uint32   mod_cycle;    /* 4 */ // The modulation cycle time [ms] used when performing modulation (Lithium only)
    uint8    pins;         /* 1 */ // Number of battery pins 2 - 3 - 4
    uint8    chg_dedic;    /* 1 */ // Charging performed (TRUE) or not (FALSE) in dedicated mode
    uint8    alfa1;        /* 1 */ // The regulation parameter N (Exponentially Weighted Moving Average) for Vbat
    uint8    alfa2;        /* 1 */ // The regulation parameter N (Exponentially Weighted Moving Average) for Tbat
    uint8    alfa3;        /* 1 */ // The regulation parameter N (Exponentially Weighted Moving Average) for Trf
    uint8    rise_thr;     /* 1 */ // The battery rise temperature follows RF rise temperature threshold (Nickel only)
} T_PWR_COMMON_CFG_BLOCK;

// Corresponds to /pwr/bat/bat<N>.cfg
typedef struct
{
    uint16   type;          /* 2 */ // Battery type - Nickel or Lithium
    uint16   rf_temp;       /* 2 */ // Use rf temperature (TRUE) or not (FALSE) if no battery temperature is availlable
    uint32   id_low;        /* 4 */ // Low battery id limit - used for identification
    uint32   id_high;       /* 4 */ // High battery id limit - used for identification
    uint16   cbat;          /* 2 */ // Standard battery capacity [mAh]
    uint16   ratio;         /* 2 */ // Time ratio of charge current [C] (%) - ratio x cbat = max charger current
    uint32   T1;            /* 4 */ // The total time charging counter
    uint32   T2;            /* 4 */ // The CV charging complete timer (-Nickel)
    uint32   T3;            /* 4 */ // The re-charge attempt timer counter
    uint16   chg_start_thr; /* 2 */ // The CV charge begin battery voltage threshold value (-Nickel)
    uint16   chg_stop_thr;  /* 2 */ // The (CI and CV) charge end (stop) battery voltage threshold value
    uint16   chg_ctrl_thr;  /* 2 */ // The minimal charge control ('k_min') value threshold
    uint16   chg_again_thr; /* 2 */ // The charge again capacity threshold (t=20 degrees)
} T_PWR_BAT_CFG_BLOCK;

// Corresponds to /pwr/bat/temp<N>.cfg
typedef struct
{
    int16      tbat_min;  /* 2 */  // Minimum battery temperature allowed
    int16      tbat_max;  /* 2*/  // Maximum battery temperature allowed

    uint16    a0;         /* 2 */  // Capacity temperature compensation a0 (a2*t*t + a1*t +a0)
    uint16    a1;         /* 2 */  // Capacity temperature compensation a1 (a2*t*t + a1*t +a0)
    uint16    a2;         /* 2 */  // Capacity temperature compensation a2 (a2*t*t + a1*t +a0)
                          // Capacity compensation function relative to t=20 degrees
                          // C(t=0) = C(t=20) + capacity compensation function(t=-20)

    uint16   cap[9+1];      /* 20 */ // Capacity as a function of voltage measured at t=20 degrees - C(t=20)
                          // Capacity vector : 100%, 90%, 80%, 70% ,60% ,50%, 40%, 30%, 20%, 10%

    uint16     i_meas1;   /* 2 */  // The choosen measurement current, i_measure (typically 10uA and 50uA)
    uint16     i_meas2;   /* 2 */  // The choosen measurement current, i_measure (typically 10uA and 50uA)
    uint16     v2t_1[8+1];  /* 18 */ // The voltage to temperature mapper for i_measure
    uint16     v2t_2[8+1];  /* 18 */ // The voltage to temperature mapper for i_measure
                          // Temperature vector : -20, -10, 0, 10 ,20 ,30, 40, 50, 60
                          // Interpolation is applied when mapping


} T_PWR_BAT_TEMP_CFG_BLOCK;

// Corresponds to /pwr/chg/chg<N>.cfg
typedef struct
{
    uint16   type;       /* 2 */ // Charger type - Regulated (CI or CV) or unregulated (UNREGULATED)
    uint16   ichg_max;   /* 2 */ // Maximum charger current [mA] - normally decides the fast charging current
    uint16   vchg_low;   /* 2 */ // Low charger voltage limit  (Open circuit - used for identification )
    uint16   vchg_high;  /* 2 */ // High charger voltage limit (Open circuit- used for identification)
} T_PWR_CHG_CFG_BLOCK;

/* zhq, 2004/06/16, add for brute use bat1.cfg and chg1.cfg, temp1.cfg. 
becasue we do not have battery and bat ID detection circuit, it is unnecessary for us to do that.*/
/* corresponds to /pwr/chg/force */
typedef struct
{
   char cforce; // Force usage of charger configuration
} T_PWR_FORCE_CHG_CFG_BlOCK;

/* corresponds to /pwr/bat/force */
typedef struct
{
   char bforce; // Force usage of charger configuration
} T_PWR_FORCE_BAT_CFG_BlOCK;


// The power data block - dynamical data collected
typedef struct
{
    uint16       bat_id;             // Measured battery ID
    uint16       chg_id;             // Measured charger ID

    uint16       Vbat;               // Latest measured battery voltage
    uint16       Vbat_avg;           // Latest _average_ battery voltage
    uint16       Vbat_avg_mV;        // Latest _average_ battery voltage

    uint16       Tbat;               // Latest measured battery temperature
    uint16       Tbat_avg;           // Latest _average_ battery temperature

    uint16       T_rf;               // Latest measured RF temperature
    uint16       T_rf_avg;           // Latest _average_ RF temperature

    uint16       Vchg;               // Latest measured charger voltage
    uint16       Ichg;               // Latest measured charger current

    uint16       Cbat;               // Battery capacity in %

    char         cfg_id;             // Configuration ID (bat<n>.cfg)
    char         chg_cfg_id;         // Charger Configuration ID (chg<n>.cfg)
    char         bforce;             // Force usage of battery configuration
    char         cforce;             // Force usage of charger configuration
    uint16       k;                  // Modulation value
    uint32       T4;                 // The modulation ON T4 timer counter (variable!!)
} T_PWR_DATA_BLOCK;

// The PWR control block - state and debug info
typedef struct
{
    int      state;                  // The battery & charging state of the PWR task

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -