comparison src/cs/drivers/drv_app/abb/board/abb_inth.c @ 268:f2e52cab0a73

abb_inth.c: check all interrupt causes, not just one The original code used if - else if - else if etc constructs, thus the first detected interrupt was the only one handled. However, Iota ITSTATREG is a clear-on-read register, thus if we only handle the first detected interrupt and skip checking the others, then the other interrupts will be lost, if more than one interrupt happened to occur in one ABB interrupt handling cycle - a form of rare race condition. Change the code to check all interrupts that were read in this cycle.
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 13 Jun 2021 18:17:53 +0000
parents 7420959e02ec
children
comparison
equal deleted inserted replaced
267:10b3a6876273 268:f2e52cab0a73
157 } 157 }
158 #endif //WCP 158 #endif //WCP
159 } 159 }
160 } 160 }
161 161
162 else if (*read_value & REMOT_IT_STS) 162 if (*read_value & REMOT_IT_STS)
163 { 163 {
164 rvf_send_trace("IQ EXT: Power Off remote request",32, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID); 164 rvf_send_trace("IQ EXT: Power Off remote request",32, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID);
165 165
166 /* 'Remote Power' from ON to OFF */ 166 /* 'Remote Power' from ON to OFF */
167 Power_OFF_Remote(); 167 Power_OFF_Remote();
168 } 168 }
169 169
170 else if (*read_value & ADCEND_IT_STS) 170 if (*read_value & ADCEND_IT_STS)
171 { 171 {
172 rvf_send_trace("IQ EXT: ADC End",15, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID); 172 rvf_send_trace("IQ EXT: ADC End",15, NULL_PARAM, RV_TRACE_LEVEL_DEBUG_LOW, SPI_USE_ID);
173 173
174 /* ADC end of conversion */ 174 /* ADC end of conversion */
175 ABB_Read_ADC(&SPI_GBL_INFO_PTR->adc_result[0]); 175 ABB_Read_ADC(&SPI_GBL_INFO_PTR->adc_result[0]);
206 #endif 206 #endif
207 } 207 }
208 } 208 }
209 209
210 #if (defined(RVM_PWR_SWE) || defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE)) 210 #if (defined(RVM_PWR_SWE) || defined(RVM_LCC_SWE) || defined(RVM_FCHG_SWE))
211 else if (*read_value & CHARGER_IT_STS) 211 if (*read_value & CHARGER_IT_STS)
212 { 212 {
213 /* Charger plug IN or OUT */ 213 /* Charger plug IN or OUT */
214 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2)) 214 #if ((ANLG_FAM == 1) || (ANLG_FAM == 2))
215 status_value = ABB_Read_Status(); 215 status_value = ABB_Read_Status();
216 #elif (ANLG_FAM == 3) 216 #elif (ANLG_FAM == 3)