From cfceee4db3504630e703b21700b85289987b5c0d Mon Sep 17 00:00:00 2001 From: optixx Date: Wed, 14 Oct 2009 17:52:01 +0200 Subject: [PATCH] add system_t stuff to irq --- avr/usbload/irq.c | 7 ++++++- avr/usbload/main.c | 2 ++ avr/usbload/system.c | 34 +++++++++++++++------------------- avr/usbload/system.h | 15 +++++++++++++++ 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/avr/usbload/irq.c b/avr/usbload/irq.c index 0785e4c..876367a 100644 --- a/avr/usbload/irq.c +++ b/avr/usbload/irq.c @@ -34,7 +34,9 @@ #include "debug.h" #include "info.h" #include "sram.h" - +#include "system.h" + +extern system_t system; void (*jump_to_app) (void) = 0x0000; @@ -43,18 +45,21 @@ void irq_init(){ PCMSK3 |=(1<req_bank_size == 0x8000) { snes_lorom(); + system.rom_mode = LOROM; info_P(PSTR("Set SNES lowrom \n")); } else { snes_hirom(); + system.rom_mode = HIROM; info_P(PSTR("Set SNES hirom \n")); } } diff --git a/avr/usbload/system.h b/avr/usbload/system.h index 9c33774..007637f 100644 --- a/avr/usbload/system.h +++ b/avr/usbload/system.h @@ -24,5 +24,20 @@ #define __SYSTEM_H__ + +typedef struct system_t { + enum bus_mode_e { MODE_AVR, MODE_SNES } bus_mode; + enum rom_mode_e { LOROM, HIROM } rom_mode; + enum reset_line_e { RESET_OFF, RESET_ON } reset_line; + enum irq_line_e { IRQ_ON, IRQ_OFF } irq_line; + enum wr_line_e { WR_DISABLE, WR_ENABLE } wr_line; + enum reset_irq_e { RESET_IRQ_OFF, RESET_IRQ_ON } reset_irq; + + uint8_t snes_reset_count; + uint8_t avr_reset_count; +} system_t; + void system_init(void); + + #endif