comparison src/cs/drivers/drv_app/abb/board/abb_inth.c @ 341:651778900ec1

.../drv_app/abb/board/abb_inth.c: FCHG hooked in
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 Dec 2017 18:58:12 +0000
parents 945cf7f506b2
children bed6d393f3e0
comparison
equal deleted inserted replaced
340:2f41f7883261 341:651778900ec1
66 #include "spi/spi_env.h" 66 #include "spi/spi_env.h"
67 #include "spi/spi_process.h" // for ABB_EXT_IRQ_EVT 67 #include "spi/spi_process.h" // for ABB_EXT_IRQ_EVT
68 #include "kpd/kpd_power_api.h" // for kpd_power_key_pressed() 68 #include "kpd/kpd_power_api.h" // for kpd_power_key_pressed()
69 #include "power/power.h" 69 #include "power/power.h"
70 70
71
72 #ifdef RVM_LCC_SWE 71 #ifdef RVM_LCC_SWE
73 #include "lcc/lcc_api.h" 72 #include "lcc/lcc_api.h"
74 #include "lcc/lcc_cfg_i.h" 73 #include "lcc/lcc_cfg_i.h"
75 #include "lcc/lcc.h" 74 #include "lcc/lcc.h"
76 #include "lcc/lcc_env.h" 75 #include "lcc/lcc_env.h"
77 #endif 76 #endif
77
78 #ifdef RVM_FCHG_SWE
79 #include "fchg/fchg_struct.h"
80 #include "fchg/fchg_messages.h"
81 #endif
82
78 /********************************************************************************/ 83 /********************************************************************************/
79 /* */ 84 /* */
80 /* Function Name: spi_abb_read_int_reg_callback */ 85 /* Function Name: spi_abb_read_int_reg_callback */
81 /* */ 86 /* */
82 /* Purpose: Callback function */ 87 /* Purpose: Callback function */
89 SYS_UWORD16 loop_count; 94 SYS_UWORD16 loop_count;
90 SYS_UWORD16 status_value; 95 SYS_UWORD16 status_value;
91 xSignalHeaderRec *adc_msg; 96 xSignalHeaderRec *adc_msg;
92 volatile SYS_UWORD8 i; 97 volatile SYS_UWORD8 i;
93 98
94 #ifdef RVM_LCC_SWE 99 #if (defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE))
95 struct pwr_adc_ind_s *addr; 100 struct pwr_adc_ind_s *addr;
96 extern T_PWR_CTRL_BLOCK *pwr_ctrl; 101 extern T_PWR_CTRL_BLOCK *pwr_ctrl;
97 #endif 102 #endif
98 103
99
100 // check all the possible causes of the ABB IT 104 // check all the possible causes of the ABB IT
101 if (*read_value & PUSHOFF_IT_STS) 105 if (*read_value & PUSHOFF_IT_STS)
102 { 106 {
103 /* Push Button from ON to OFF */ 107 /* Push Button from ON to OFF */
104 if (SPI_GBL_INFO_PTR->is_gsm_on == TRUE) 108 if (SPI_GBL_INFO_PTR->is_gsm_on == TRUE)
179 for(i=0;i<MADC_NUMBER_OF_MEAS;i++) 183 for(i=0;i<MADC_NUMBER_OF_MEAS;i++)
180 { 184 {
181 ((T_CST_ADC_RESULT *)(adc_msg->SigP))->adc_result[i] = SPI_GBL_INFO_PTR->adc_result[i]; 185 ((T_CST_ADC_RESULT *)(adc_msg->SigP))->adc_result[i] = SPI_GBL_INFO_PTR->adc_result[i];
182 } 186 }
183 os_send_sig(adc_msg, RRM1_QUEUE); 187 os_send_sig(adc_msg, RRM1_QUEUE);
184 #ifdef RVM_LCC_SWE 188 #if (defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE))
185 // Send ADC measurement to PWR (LCC) task 189 // Send ADC measurement to PWR (LCC) task
186 // NOTE that memory is allocated externally in the PWR task 190 // NOTE that memory is allocated externally in the PWR task
187 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_adc_ind_s), (void *)&addr) == RVF_RED) { 191 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_adc_ind_s), (void *)&addr) == RVF_RED) {
188 rvf_send_trace("rvf_get_buf failed",18, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); 192 rvf_send_trace("rvf_get_buf failed",18, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
189 /* Unmask External interrupt */ 193 /* Unmask External interrupt */
203 } 207 }
204 #endif 208 #endif
205 } 209 }
206 } 210 }
207 211
208 #if (defined(RVM_PWR_SWE) || defined(RVM_LCC_SWE)) 212 #if (defined(RVM_PWR_SWE) || defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE))
209 else if (*read_value & CHARGER_IT_STS) 213 else if (*read_value & CHARGER_IT_STS)
210 { 214 {
211 /* Charger plug IN or OUT */ 215 /* Charger plug IN or OUT */
212 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2)) 216 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
213 status_value = ABB_Read_Status(); 217 status_value = ABB_Read_Status();
218 { 222 {
219 rvf_send_trace("IQ EXT: Charger Plug",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID); 223 rvf_send_trace("IQ EXT: Charger Plug",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID);
220 #ifdef RVM_PWR_SWE 224 #ifdef RVM_PWR_SWE
221 PWR_Charger_Plug(); /* charger plugged IN */ 225 PWR_Charger_Plug(); /* charger plugged IN */
222 #endif 226 #endif
223 #ifdef RVM_LCC_SWE 227 #if (defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE))
224 // Forward charger plug indication to PWR (LCC) task 228 // Forward charger plug indication to PWR (LCC) task
225 // NOTE that memory is allocated externally in the PWR task 229 // NOTE that memory is allocated externally in the PWR task
226 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s), (void *)&addr) == RVF_RED) { 230 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s), (void *)&addr) == RVF_RED) {
227 rvf_send_trace("rvf_get_buf failed#1",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); 231 rvf_send_trace("rvf_get_buf failed#1",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
228 rvf_dump_mem(); 232 rvf_dump_mem();
241 rvf_send_trace("IQ EXT: Charger Unplug",22, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID); 245 rvf_send_trace("IQ EXT: Charger Unplug",22, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID);
242 246
243 #ifdef RVM_PWR_SWE 247 #ifdef RVM_PWR_SWE
244 PWR_Charger_Unplug(); /* charger plugged OUT */ 248 PWR_Charger_Unplug(); /* charger plugged OUT */
245 #endif 249 #endif
246 #ifdef RVM_LCC_SWE 250 #if (defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE))
247 // Forward charger unplug indication to PWR (LCC) task 251 // Forward charger unplug indication to PWR (LCC) task
248 // NOTE that memory is allocated externally in the PWR task 252 // NOTE that memory is allocated externally in the PWR task
249 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s), (void *)&addr) == RVF_RED) { 253 if (rvf_get_buf(pwr_ctrl->prim_id, sizeof(struct pwr_req_s), (void *)&addr) == RVF_RED) {
250 rvf_send_trace("rvf_get_buf failed#2",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID); 254 rvf_send_trace("rvf_get_buf failed#2",20, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, LCC_USE_ID);
251 rvf_dump_mem(); 255 rvf_dump_mem();