#endif
#include "sim_irq.h"
+#include "sim_interrupts.h"
#include "sim_cycle_timers.h"
+typedef uint32_t avr_flashaddr_t;
+
struct avr_t;
typedef uint8_t (*avr_io_read_t)(
struct avr_t * avr,
R_SREG = 32+0x3f,
// maximum number of IO registers, on normal AVRs
- MAX_IOs = 256 - 32, // minus 32 GP registers
+ MAX_IOs = 256, // Bigger AVRs need more than 256-32 (mega1280)
};
#define AVR_DATA_TO_IO(v) ((v) - 32)
* this is why you will see >>1 and <<1 in the decoder to handle jumps.
* It CAN be a little confusing, so concentrate, young grasshopper.
*/
- uint32_t pc;
+ avr_flashaddr_t pc;
/*
* callback when specific IO registers are read/written.
// queue of io modules
struct avr_io_t *io_port;
+ // cycle timers tracking & delivery
avr_cycle_timer_pool_t cycle_timers;
-
- // interrupt vectors, and their enable/clear registers
- struct avr_int_vector_t * vector[64];
- uint8_t vector_count;
- uint8_t pending_wait; // number of cycles to wait for pending
- struct avr_int_vector_t * pending[64]; // needs to be >= vectors and a power of two
- uint8_t pending_w, pending_r; // fifo cursors
+ // interrupt vectors and delivery fifo
+ avr_int_table_t interrupts;
// DEBUG ONLY -- value ignored if CONFIG_SIMAVR_TRACE = 0
int trace : 1,
int
avr_init(
avr_t * avr);
+// Used by the cores, allocated a mutable avr_t from the const global
+avr_t *
+avr_core_allocate(
+ const avr_t * core,
+ uint32_t coreLen);
+
// resets the AVR, and the IO modules
void
avr_reset(
avr_t * avr,
uint8_t * code,
uint32_t size,
- uint32_t address);
+ avr_flashaddr_t address);
/*
* these are accessors for avr->data but allows watchpoints to be set for gdb
#include "sim_io.h"
#include "sim_regbit.h"
-#include "sim_interrupts.h"
-#include "sim_cycle_timers.h"
#endif /*__SIM_AVR_H__*/