comparison src/cs/drivers/drv_app/pwr/pwr_messages.h @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /*******************************************************************************
2 *
3 * pwr_messages.h
4 *
5 * Purpose: Contains definitions used by PWR SWE to send events
6 * to the upper layer (MMI)
7 *
8 * Author Candice Bazanegue (c-brille@ti.com)
9 *
10 * (C) Texas Instruments 2001
11 *
12 ******************************************************************************/
13
14 #ifndef __PWR_MESSAGES_H__
15 #define __PWR_MESSAGES_H__
16
17 #include "rv/rv_general.h"
18 #include "pwr/pwr_api.h"
19 #include "pwr/pwr_env.h"
20 #include "spi/spi_api.h"
21
22 typedef struct
23 {
24 UINT16 battery_voltage;
25 INT16 battery_temperature;
26 UINT16 battery_charger_current;
27 BOOLEAN charger_plugged;
28 T_PWR_CHARGING_STATE charge_started;
29 T_PWR_PERCENT remaining_capacity;
30 } T_PWR_BAT_INFO;
31
32
33 #define PWR_SEND_MESSAGE(mmi_return_path, \
34 message_p) \
35 { \
36 if ((mmi_return_path).callback_func != NULL) \
37 { \
38 ((mmi_return_path).callback_func) (message_p); \
39 } \
40 else \
41 { \
42 if ((mmi_return_path).addr_id != RVF_INVALID_ADDR_ID) \
43 { \
44 (void) rvf_send_msg ((mmi_return_path).addr_id, \
45 (message_p)); \
46 } \
47 else \
48 { \
49 rvf_free_buf((T_RVF_BUFFER *) message_p); \
50 } \
51 } \
52 }
53
54
55 /* Events that can be sent by the power SWE API to the MMI */
56
57 #define POWER_CHARGER_PLUG_IND 1
58 #define POWER_CHARGER_UNPLUG_IND 2
59 #define POWER_BAT_CI_CHARGE_START_IND 3
60 #define POWER_BAT_CV_CHARGE_START_IND 4
61 #define POWER_BAT_CHARGE_STOP_IND 5
62 #define POWER_BAT_CHARGE_NOT_POSSIBLE_IND 6
63 #define POWER_BAT_DISCHARGE_LEVEL_IND 7
64 #define POWER_LOW_BAT_ALERT_IND 8
65 #define POWER_BAT_INFO_STATUS 9
66
67
68
69 /* Structures of messages */
70
71 typedef struct
72 { T_RV_HDR hdr;
73 INT8 status;
74 } T_PWR_BAT_CHARGE_STOP;
75
76 typedef struct
77 { T_RV_HDR hdr;
78 T_BAT_PROBLEM problem;
79 } T_PWR_BAT_CHARGE_NOT_POSSIBLE;
80
81 typedef struct
82 { T_RV_HDR hdr;
83 T_PWR_PERCENT remaining_capacity;
84 } T_PWR_BAT_DISCHARGE_LEVEL;
85
86 typedef struct
87 { T_RV_HDR hdr;
88 T_PWR_PERCENT remaining_capacity;
89 } T_PWR_LOW_BAT_ALERT;
90
91
92 typedef struct
93 { T_RV_HDR hdr;
94 T_PWR_BAT_INFO bat_info;
95 } T_PWR_BAT_INFO_STATUS;
96
97
98 typedef struct
99 { T_RV_HDR hdr;
100 BOOLEAN info_enable;
101 T_RV_RETURN return_path;
102 } T_PWR_SPI_INFO_REG;
103
104
105 typedef struct
106 { T_RV_HDR hdr;
107 T_PWR_PERCENT remain_capa_threshold;
108 T_RV_RETURN return_path;
109 } T_PWR_SPI_ALERT_REG;
110
111
112 typedef struct
113 { T_RV_HDR hdr;
114 T_RV_RETURN return_path;
115 } T_PWR_SPI_EMERGENCY_REG;
116
117
118
119
120
121 /* Prototypes */
122
123 /* Functions used to send messages to the upper layer */
124 T_RV_RET pwr_send_charger_plug_event(void);
125 T_RV_RET pwr_send_charger_unplug_event(void);
126 T_RV_RET pwr_send_CI_charge_start_event(void);
127 T_RV_RET pwr_send_CV_charge_start_event(void);
128 T_RV_RET pwr_send_charge_stop_event(void);
129 T_RV_RET pwr_send_charge_not_possible_event(T_BAT_PROBLEM charge_problem);
130 T_RV_RET pwr_send_bat_discharge_event(T_PWR_PERCENT remaining_capacity);
131 T_RV_RET pwr_send_low_bat_event(T_PWR_PERCENT remaining_capacity);
132 T_RV_RET pwr_send_battery_info(UINT16 battery_voltage, UINT16 battery_temperature,
133 UINT16 battery_charger_current,
134 BOOLEAN is_charger_plugged,
135 T_PWR_CHARGING_STATE is_charge_started,
136 T_PWR_PERCENT remaining_capacity);
137
138 #endif /* __PWR_MESSAGES_H__ */