Skip to content

Commit 33566f7

Browse files
committed
Remove _call_sram_irqs from avr_core_watch_read()
This was introduced as a workaround to catch IO register updates from hardware for the new sram tracing facility but gatk55 suggested #540 to rather modify peripherals instead. This commit fixes the adc by using calls to avr_core_watch_write intead of direct update of avr->data[] in avr_adc_int_raise().
1 parent 21ac87d commit 33566f7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

simavr/sim/avr_adc.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ avr_adc_int_raise(
3636
avr_regbit_clear(avr, p->adsc);
3737
if( p->adts_mode == avr_adts_free_running )
3838
avr_raise_irq(p->io.irq + ADC_IRQ_IN_TRIGGER, 1);
39-
if (!p->read_status) {
40-
/* Update I/O registers. */
41-
42-
avr->data[p->r_adcl] = p->result & 0xff;
43-
avr->data[p->r_adch] = p->result >> 8;
44-
}
39+
if (!p->read_status) {
40+
/* Update I/O registers. */
41+
avr_core_watch_write(avr, p->r_adcl, p->result & 0xff);
42+
avr_core_watch_write(avr, p->r_adch, p->result >> 8);
43+
}
4544
}
4645
return 0;
4746
}

simavr/sim/sim_core.c

-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ uint8_t avr_core_watch_read(avr_t *avr, uint16_t addr)
262262
}
263263

264264
// _call_register_irqs(avr, addr);
265-
_call_sram_irqs(avr, addr); // Catch update from io read callback
266265
return avr->data[addr];
267266
}
268267

0 commit comments

Comments
 (0)