annotate src/cs/drivers/drv_app/fchg/fchg_api.c @ 685:3fb7384e820d

tpudrv12.h: FCDEV3B goes back to being itself A while back we had the idea of a FreeCalypso modem family whereby our current fcdev3b target would some day morph into fcmodem, with multiple FC modem family products, potentially either triband or quadband, being firmware-compatible with each other and with our original FCDEV3B. But in light of the discovery of Tango modules that earlier idea is now being withdrawn: instead the already existing Tango hw is being adopted into our FreeCalypso family. Tango cannot be firmware-compatible with triband OM/FCDEV3B targets because the original quadband RFFE on Tango modules is wired in TI's original Leonardo arrangement. Because this Leonardo/Tango way is now becoming the official FreeCalypso way of driving quadband RFFEs thanks to the adoption of Tango into our FC family, our earlier idea of extending FIC's triband RFFE control signals with TSPACT5 no longer makes much sense - we will probably never produce any new hardware with that once-proposed arrangement. Therefore, that triband-or-quadband FCFAM provision is being removed from the code base, and FCDEV3B goes back to being treated the same way as CONFIG_TARGET_GTAMODEM for RFFE control purposes.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Sep 2020 21:03:08 +0000
parents 3a7810ca74e2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
336
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * The implementation of our external API functions lives here.
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 */
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 #include "fchg/fchg_api.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include "fchg/fchg_env.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "fchg/fchg_messages.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "rv/rv_general.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "rvf/rvf_api.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "rvm/rvm_use_id_list.h"
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 T_RV_RET fchg_get_current_state(struct fchg_user_state *rstruct)
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 {
345
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
14 if (!pwr_ctrl)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
15 return RV_NOT_READY;
336
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 rstruct->chg_state = pwr_ctrl->state;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 rstruct->batt_mv = pwr_ctrl->batt_mv;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 rstruct->batt_percent =
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 pwr_ctrl->batt_thresholds[pwr_ctrl->curr_disch_thresh].remain_capa;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 return RV_OK;
be011556e71f FCHG: API implementation started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 }
345
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
22
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
23 T_RV_RET fchg_user_charge_control(enum fchg_user_charge_ctrl arg)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
24 {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
25 enum pwr_msg_id msg_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
26 struct pwr_req_s *msg;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
27
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
28 if (!pwr_ctrl)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
29 return RV_NOT_READY;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
30 switch (arg) {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
31 case FCHG_CHARGE_START:
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
32 if (!pwr_ctrl->config_present)
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
33 return RV_NOT_READY;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
34 msg_id = USER_START_CHARGE_REQ;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
35 break;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
36 case FCHG_CHARGE_STOP:
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
37 msg_id = USER_STOP_CHARGE_REQ;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
38 break;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
39 default:
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
40 return RV_INVALID_PARAMETER;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
41 }
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
42 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s),
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
43 (T_RVF_BUFFER **)&msg) == RVF_RED) {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
44 rvf_send_trace(
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
45 "rvf_get_buf() failed in fchg_user_charge_control()",
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
46 50, NULL_PARAM, RV_TRACE_LEVEL_ERROR, FCHG_USE_ID);
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
47 return RV_MEMORY_ERR;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
48 }
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
49 msg->header.msg_id = msg_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
50 msg->header.src_addr_id = pwr_ctrl->addr_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
51 msg->header.dest_addr_id = pwr_ctrl->addr_id;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
52 msg->header.callback_func = NULL;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
53 if (rvf_send_msg(pwr_ctrl->addr_id, msg) != RV_OK) {
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
54 rvf_send_trace("fchg_user_charge_control(): Send failed!", 40,
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
55 NULL_PARAM, RV_TRACE_LEVEL_ERROR, FCHG_USE_ID);
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
56 rvf_free_buf(msg);
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
57 return RV_INTERNAL_ERR;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
58 }
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
59 return RV_OK;
3a7810ca74e2 fchg_user_charge_control() API implemented
Mychaela Falconia <falcon@freecalypso.org>
parents: 336
diff changeset
60 }