summaryrefslogtreecommitdiff
path: root/board/wmt/wmt_battery/gauge/upi/ug31xx_boot.h
blob: 730a4bfcf619a38edad4cc33fd6c5eb68e14b6a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
 * @filename	ug31xx_boot.h
 *
 *	uG31xx API for bootloader
 *
 * @author	AllenTeng <allen_teng@upi-semi.com>
 */

#ifndef	_UG31XX_BOOT_H_
#define	_UG31XX_BOOT_H_

enum UPI_BOOT_RTN {
	UPI_BOOT_RTN_PASS = 0,
	UPI_BOOT_RTN_UG31XX_NOT_ACTIVE,
	UPI_BOOT_RTN_INVALID_CAPACITY,
	UPI_BOOT_RTN_INVALID_PRODUCT_TYPE,
};

typedef struct UG31xxDataST {
	//struct qup_i2c_dev *ug31xx_i2c_dev;
	
	int	version;

	int	rm;		///< [AT-PM] : in unit mAh ; 02/01/2013
	int	fcc;		///< [AT-PM] : in unit mAh ; 02/01/2013
	int	rsoc;		///< [AT-PM] : in unit % ; 02/01/2013

	int	volt;		///< [AT-PM] : in unit mV ; 02/01/2013
	int	curr;		///< [AT-PM] : in unit mA ; 02/01/2013
	int	intTemp;	///< [AT-PM] : in unit 0.1oC ; 02/01/2013
	int	extTemp;	///< [AT-PM] : in unit 0.1oC ; 02/01/2013

	char	*buf;
} UG31xxDataType;

/**
 * @brief	UpiBootInitial
 *
 *	Initialize uG31xx
 *
 * @para	data	address of UG31xxDataType
 * @return	UPI_BOOT_RTN_PASS
 */
extern int UpiBootInitial(UG31xxDataType *data);

/**
 * @brief	UpiBootMain
 *
 *	Main function of uG31xx
 *
 * @para	data	address of UG31xxDataType
 * @return	UPI_BOOT_RTN_PASS
 */
extern int UpiBootMain(UG31xxDataType *data);

/**
 * @brief	UpiBootUnInitial
 *
 *	Un-initialize uG31xx
 *
 * @para	data	address of UG31xxDataType
 * @return	UPI_BOOT_RTN_PASS
 */
extern int UpiBootUnInitial(UG31xxDataType *data);

extern int upi_read_percentage(void);

extern int upi_boot_init(void);

#endif	///< end of _UG31XX_BOOT_H_