annotate src/cs/drivers/drv_app/pwr/pwr_cust.h @ 146:fb95e3f83dc5

imported PWR source: s/ANALOG/ANLG_FAM/ for TCS211 environment
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 09 Oct 2016 06:06:04 +0000
parents 246f4a7dd92b
children c93a236e0d50
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*******************************************************************************
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 *
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * pwr_cust.h
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * Purpose: This file contains definitions for battery management.
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * These definitions can be modified by the customer.
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 * Author Candice Bazanegue (c-brille@ti.com)
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 *
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * (C) Texas Instruments 2001
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ******************************************************************************/
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #ifndef __PWR_CUST_H__
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define __PWR_CUST_H__
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "pwr_api.h"
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /* Constants relative to the battery type */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #define BAT_TYPE_LI_ION_MIN 0x400
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #define BAT_TYPE_LI_ION_MAX 0x450
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /* Constants relative to the charging process */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 #define CONSTANT_VOLTAGE_VALUE 4200 // (mV) /* for CV charge */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 #define CONSTANT_CURRENT_VALUE 500 // (mA) /* for CI charge */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 #define END_OF_CHARGE_I 150 // (mA) /* for CV charge */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 #define END_OF_CHARGE_V 4200 // (mV) /* for CI charge */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 #define CHARGE_START_AGAIN_CAPACITY 75 /* capacity threshold under which */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /* the charge is started again if */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 /* the charger has been left plugged. */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 /* the chosen value must be part of the */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /* a_pwr_thresholds array. */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 /* Constants relative to the battery temperature */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 #define BAT_TEMPERATURE_MAX_LI_ION (50) /* Celsius degrees */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 #define BAT_TEMPERATURE_MIN_LI_ION (0) /* Celsius degrees */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 #define BAT_TEMPERATURE_MAX BAT_TEMPERATURE_MAX_LI_ION
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 #define BAT_TEMPERATURE_MIN BAT_TEMPERATURE_MIN_LI_ION
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 #define THEN_10uA 0x0041 /* THSENS0 , THSENS1, THSENS2 = 0, 0, 0 MESBAT = 1 */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 #define THEN_30uA 0x0051 /* THSENS0 , THSENS1, THSENS2 = 0, 1, 0 MESBAT = 1 */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #define THEN_50uA 0x0061 /* THSENS0 , THSENS1, THSENS2 = 0, 0, 1 MESBAT = 1 */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 #define THEN_80uA 0x0079 /* THSENS0 , THSENS1, THSENS2 = 1, 1, 1 MESBAT = 1 */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 #define MESBAT 0x0001 /* Resistive divider connected to main battery */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* Constants relative to the timers duration */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 #define PWR_BAT_TEST_TIME_1 (10) /* 10 ms */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 #define PWR_BAT_TEST_TIME_2 (5000) /* 5s */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 #define PWR_CALIBRATION_TIME_1 (10) /* 10 ms */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 #define PWR_CALIBRATION_TIME_2 (5000) /* 5s */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 #define PWR_CI_CHECKING_TIME (4000) /* 4s */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 #define PWR_CV_CHECKING_TIME (4000) /* 4s */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 #define PWR_DISCHARGE_CHECKING_TIME_1 (60000) /* 1 minute */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 #define PWR_DISCHARGE_CHECKING_TIME_2 (10000) /* 10s */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 typedef struct {
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 UINT16 bat_voltage;
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 T_PWR_PERCENT remain_capa;
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 }T_PWR_THRESHOLDS;
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 typedef enum {
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 LI_ION,
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 UNKNOWN
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 } T_PWR_BATTERY_TYPE;
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 #define NB_THRESHOLDS (6) /* number of elements in the a_pwr_thresholds array */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 extern const T_PWR_THRESHOLDS a_pwr_thresholds[NB_THRESHOLDS];
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 /* Prototypes */
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 UINT16 pwr_adc_to_mvolt(UINT16 bat_voltage_madc);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 UINT16 pwr_adc_to_mA(UINT16 current_madc);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 UINT8 pwr_bat_temp_within_limits(INT16 battery_temperature);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 UINT8 pwr_madc_to_Celsius_conv(UINT8 bias_current, UINT16 madc_temp, INT16 *celsius_temp);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 void pwr_get_battery_type(void);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 void pwr_get_battery_temperature(void);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 T_PWR_PERCENT pwr_get_capacity_vs_voltage(UINT16 bat_voltage);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 void pwr_bat_50uA_temp_test_timer_process(void);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 void pwr_bat_10uA_temp_test_timer_process(void);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 void pwr_type_test_timer_process(void);
246f4a7dd92b src/cs/drivers/drv_app/pwr: import from MV100 source
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99
146
fb95e3f83dc5 imported PWR source: s/ANALOG/ANLG_FAM/ for TCS211 environment
Mychaela Falconia <falcon@freecalypso.org>
parents: 145
diff changeset
100 #endif /* __PWR_CUST_H__ */