avr->state = cpu_Limbo;
avr->frequency = 1000000; // can be overridden via avr_mcu_section
avr_interrupt_init(avr);
- if (avr->special_init)
- avr->special_init(avr, avr->special_data);
+ if (avr->custom.init)
+ avr->custom.init(avr, avr->custom.data);
if (avr->init)
avr->init(avr);
// set default (non gdb) fast callbacks
void avr_terminate(avr_t * avr)
{
- if (avr->special_deinit)
- avr->special_deinit(avr, avr->special_data);
+ if (avr->custom.deinit)
+ avr->custom.deinit(avr, avr->custom.data);
if (avr->gdb) {
avr_deinit_gdb(avr);
avr->gdb = NULL;
// called at init time
void (*init)(struct avr_t * avr);
- // called at init time (for special purposes like using a memory mapped file as flash see: simduino)
- void (*special_init)(struct avr_t * avr, void * data);
- // called at termination time ( to clean special initializations)
- void (*special_deinit)(struct avr_t * avr, void * data);
- // value passed to special_init() and special_deinit()
- void *special_data;
// called at reset time
void (*reset)(struct avr_t * avr);
+ struct {
+ // called at init time (for special purposes like using a
+ // memory mapped file as flash see: simduino)
+ void (*init)(struct avr_t * avr, void * data);
+ // called at termination time ( to clean special initializations)
+ void (*deinit)(struct avr_t * avr, void * data);
+ // value passed to init() and deinit()
+ void *data;
+ } custom;
+
/*!
* Default AVR core run function.
* Two modes are available, a "raw" run that goes as fast as
// assert that the simulation has not finished before that.
jmp_buf jmp;
special_deinit_jmpbuf = &jmp;
- avr->special_deinit = special_deinit_longjmp_cb;
+ avr->custom.deinit = special_deinit_longjmp_cb;
avr_cycle_timer_register_usec(avr, run_usec,
cycle_timer_longjmp_cb, &jmp);
int reason = setjmp(jmp);