@@ -131,7 +131,7 @@ static void i2c_mspm0g3xxx_target_stop_watchdog(struct i2c_mspm0g3xxx_data *data
131131 }
132132}
133133
134- static void i2c_mspm0g3xxx_target_reset (const struct device * dev , uint8_t channel , uint32_t ticks ,
134+ static void i2c_mspm0g3xxx_panic (const struct device * dev , uint8_t channel , uint32_t ticks ,
135135 void * user_data )
136136{
137137 struct i2c_mspm0g3xxx_data * data = user_data ;
@@ -197,25 +197,22 @@ void i2c_mspm0g3xxx_target_thread_work(void)
197197 if (data -> state == I2C_mspm0g3xxx_TARGET_STARTED ) {
198198 data -> state = I2C_mspm0g3xxx_TARGET_RX_INPROGRESS ;
199199 if (tconfig -> callbacks -> write_requested != NULL ) {
200- i2c_mspm0g3xxx_target_start_watchdog (data );
201200 data -> target_rx_valid =
202201 tconfig -> callbacks -> write_requested (tconfig );
203- i2c_mspm0g3xxx_target_stop_watchdog (data );
204202 }
205203 }
206204 /* Store received data in buffer */
207205 if (tconfig -> callbacks -> write_received != NULL ) {
208206 uint8_t nextByte ;
209207 while (DL_I2C_isTargetRXFIFOEmpty ((I2C_Regs * )config -> base ) !=
210208 true) {
209+ i2c_mspm0g3xxx_target_start_watchdog (data );
211210 if (data -> target_rx_valid == 0 ) {
212211 nextByte = DL_I2C_receiveTargetData (
213212 (I2C_Regs * )config -> base );
214- i2c_mspm0g3xxx_target_start_watchdog (data );
215213 data -> target_rx_valid =
216214 tconfig -> callbacks -> write_received (
217215 tconfig , nextByte );
218- i2c_mspm0g3xxx_target_stop_watchdog (data );
219216
220217 if (data -> target_rx_valid == 0 ) {
221218 DL_I2C_setTargetACKOverrideValue (
@@ -233,6 +230,7 @@ void i2c_mspm0g3xxx_target_thread_work(void)
233230 (I2C_Regs * )config -> base ,
234231 DL_I2C_TARGET_RESPONSE_OVERRIDE_VALUE_NACK );
235232 }
233+ i2c_mspm0g3xxx_target_stop_watchdog (data );
236234 }
237235 }
238236
@@ -242,10 +240,8 @@ void i2c_mspm0g3xxx_target_thread_work(void)
242240 /* Fill TX FIFO if there are more bytes to send */
243241 if (tconfig -> callbacks -> read_requested != NULL ) {
244242 uint8_t nextByte ;
245- i2c_mspm0g3xxx_target_start_watchdog (data );
246243 data -> target_tx_valid =
247244 tconfig -> callbacks -> read_requested (tconfig , & nextByte );
248- i2c_mspm0g3xxx_target_stop_watchdog (data );
249245 if (data -> target_tx_valid == 0 ) {
250246 DL_I2C_transmitTargetData ((I2C_Regs * )config -> base ,
251247 nextByte );
@@ -264,10 +260,8 @@ void i2c_mspm0g3xxx_target_thread_work(void)
264260 * will be filled in */
265261 uint8_t nextByte ;
266262 if (data -> target_tx_valid == 0 ) {
267- i2c_mspm0g3xxx_target_start_watchdog (data );
268263 data -> target_tx_valid = tconfig -> callbacks -> read_processed (
269264 tconfig , & nextByte );
270- i2c_mspm0g3xxx_target_stop_watchdog (data );
271265 }
272266
273267 if (data -> target_tx_valid == 0 ) {
@@ -284,9 +278,7 @@ void i2c_mspm0g3xxx_target_thread_work(void)
284278 data -> state = I2C_mspm0g3xxx_IDLE ;
285279 k_sem_give (& data -> i2c_busy_sem );
286280 if (tconfig -> callbacks -> stop ) {
287- i2c_mspm0g3xxx_target_start_watchdog (data );
288281 tconfig -> callbacks -> stop (tconfig );
289- i2c_mspm0g3xxx_target_stop_watchdog (data );
290282 }
291283 break ;
292284 default :
@@ -847,7 +839,7 @@ static int i2c_mspm0g3xxx_init(const struct device *dev)
847839 }
848840
849841 data -> watchdog_timer_cfg .user_data = (void * )data ;
850- data -> watchdog_timer_cfg .callback = i2c_mspm0g3xxx_target_reset ;
842+ data -> watchdog_timer_cfg .callback = i2c_mspm0g3xxx_panic ;
851843 data -> watchdog_timer_cfg .ticks = counter_us_to_ticks (
852844 config -> watchdog_timer , CONFIG_I2C_MSPM0G3XXX_WATCHDOG_TIMEOUT );
853845 }
0 commit comments