blob: 35d1e922cefeb8a8118db6ae9d160a540ad80457 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001
2/**************************************************************************
3 *
4 *Copyright (c) 2013 ZTE Corporation.
5 *
6 * Ä£ ¿é Ãû :
7 * ÎÄ ¼þ Ãû : drvs_he43106.h
8 * Ïà¹ØÎļþ :
9 * ʵÏÖ¹¦ÄÜ : HE43106оƬÏà¹ØÐÅÏ¢
10 * ×÷ Õß : qihongfang
11 * °æ ±¾ : V1.0
12 * Íê³ÉÈÕÆÚ : 2014-12-23
13 *
14 * ÆäËü˵Ã÷ :
15 *
16 * Ð޸ļǼºÅ ÈÕÆÚ ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
17* ---------------------------------------------------------------------
18* 1 2014.12.23 Æëºì·¼ н¨
19 **************************************************************************/
20
21#ifndef _DRVS_HE43106_H
22#define _DRVS_HE43106_H
23
24#include "drvs_general.h"
25
26#define HE43106_I2C_SLAVE_ADDR0 0x3A
27#define I2C_BUS_FREQ (2*1000*1000)
28#define HE43106_ALL_BITS 0xFF
29
30
31#define HE43106_BITFVAL(var, lsh) ( (var) << (lsh) )
32#define HE43106_BITFMASK(wid, lsh) ( ((1U << (wid)) - 1) << (lsh) )
33
34//#define BIT(n) (UINT8)(1<<(n))
35//#define CHARGER "zte_charger"
36#define GPIOFUNC_FUNC 1
37
38#define BOOST_REG 0x00
39#define BLED_REG 0x01
40#define FLASHLIGHT_REG 0x02
41#define INTERRRUPT_MASK_REG 0x03
42#define INTERRRUPT_REG 0x04
43#define CHARGE_REG 0x05
44#define CP_REG 0x06
45#define TTC_TIMEOUT_REG 0x07
46#define MCU_OPTION_0_REG 0x10
47#define MCU_OPTION_1_REG 0x11
48
49
50/*define for 0x00 BOOST_REG*/
51#define OV_TEMP (1<<7)
52#define BOOST_OVERLOAD_LATCH (1<<6)
53#define LOWBAT_DETECT (1<<5)
54#define NOLOAD_DETECT (1<<4)
55#define BOOST_EN (1<<3)
56#define DISCHARGE_ON 2
57#define MCU_DISCHARGE_ON 1
58#define MCU_DISCHARGE_EN 0
59
60/*define for 0x01 BLED_REG*/
61#define MCU_BLED_EN 4
62#define MCU_BLED4_ON 3
63#define MCU_BLED3_ON 2
64#define MCU_BLED2_ON 1
65#define MCU_BLED1_ON 0
66
67
68/*define for 0x03 INTERRRUPT_MASK_REG*/
69#define MCU_INT_PIN_EN 7
70#define MASK_ABNORMAL_INT 4
71#define MASK_CP_INT 3
72#define MASK_CHARGE_INT 2
73#define MASK_NOLOAD_DET_INT 1
74#define MASK_LOWBAT_INT 0
75#define MASK_ALL_INT 0x9f
76
77/*define for 0x04 INTERRRUPT_REG*/
78#define ABNORMAL_INT (1<<4)
79#define CP_INT (1<<3)
80#define CHARGE_INT (1<<2)
81#define NOLOAD_DET_INT (1<<1)
82#define LOWBAT_INT (1<<0)
83#define CHG_INT_ALL 0x1f
84
85/*define for 0x05 CHARGE_REG*/
86#define CHARGE_DISABLE 6//(1<<6)
87#define CHARGE_TIMEOUT (1<<3)
88#define CHARGE_DONE (1<<2)
89#define CHARGE_IN_PROGRESS (1<<1)
90#define CHARGE_VIN_GOOD (1<<0)
91
92/*define for 0x06 CP_REG*/
93#define FORCE_CP_ENABLE 6
94#define CP3_HIGH 3
95#define CP2_HIGH 2
96#define CP1_HIGH 1
97#define CP0_HIGH 0
98
99/*define for 0x07 TTC_TIMEOUT_REG*/
100#define SW_RESET_CTRL1 7
101#define CHARGE_TIMOUT_SEL 0/*bit 0~2*/
102
103/*define for 0x10 MCU_OPTION_0_REG*/
104#define MCU_OL_LED_BLANK_DIS 7
105#define CP_OPTION 5
106#define MCU_CABLE_CPS_EN 4
107#define MCU_BES_OUT_SEL 3
108#define MCU_VBAT_REGULATION 0
109
110/*define for 0x11 MCU_OPTION_0_REG*/
111#define SW_RESET_CTRL2 7
112#define CHARGE_1A 5
113#define MCU_SEL_0P1S 4
114#define MCU_CHARGE_TIMEOUT_EN 3
115#define CP_PROCESS_BYPASS 2
116#define MCU_MODE 0
117
118SINT32 led_Reset(VOID);
119SINT32 chg_ChargerReset(VOID);
120
121#endif/*END of _DRVS_HE43106_H*/
122