#ifndef AVREMU_HARDWARE_H_ #define AVREMU_HARDWARE_H_ #include "util.h" #include "pinout.h" #include struct avr_memory; typedef void (*avr_io_setup_func_t)(struct avr_memory *mem); /* The type of the microcontroller to emulate. */ enum avr_setup_type { AVR_ATMEGA8, AVR_ATMEGA168, //TODO AVR_NR_TYPES, }; struct avr_setup { /* The device type */ enum avr_setup_type type; /* Physical device pinout configuration. */ const struct avr_device_pinout *pinout; /* Size of the memory data space including * the register file, IO, MMIO and SRAM. */ size_t memory_size; /* The offset where the general purpose SRAM starts. */ size_t sram_offset; /* The offset of the stack pointer in the IO space. */ uint8_t sp_offset; /* Using a 22 bit PC */ bool pc_22bit; /* Size of the flash memory. */ size_t flash_size; /* Size of the EEPROM memory. */ size_t eeprom_size; /* Maximum CPU frequency in HZ. */ size_t max_hz; /* Function to setup the virtual->physical IO map * and initialize the peripheral IO devices. */ avr_io_setup_func_t io_setup; /* Pointer to the memory data space (regs, IO, MMIO, SRAM) */ uint8_t *memory_data;//FIXME this should be moved to struct avr_memory. }; extern struct avr_setup active_setup; int avr_do_setup(enum avr_setup_type type); void avr_do_cleanup(void); #endif /* AVREMU_HARDWARE_H_ */