prepare commands
This commit is contained in:
parent
ab3f7704f0
commit
b092b3e182
@ -60,7 +60,6 @@ void leave_application(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ISR (SIG_PIN_CHANGE3)
|
ISR (SIG_PIN_CHANGE3)
|
||||||
{
|
{
|
||||||
if (snes_reset_test()){
|
if (snes_reset_test()){
|
||||||
|
|||||||
@ -248,13 +248,12 @@ int main(void)
|
|||||||
uart_init();
|
uart_init();
|
||||||
stdout = &uart_stdout;
|
stdout = &uart_stdout;
|
||||||
banner();
|
banner();
|
||||||
|
shared_memory_init();
|
||||||
|
system_init();
|
||||||
sram_init();
|
sram_init();
|
||||||
pwm_init();
|
pwm_init();
|
||||||
shared_memory_init();
|
|
||||||
snes_reset_hi();
|
|
||||||
snes_reset_off();
|
|
||||||
irq_init();
|
irq_init();
|
||||||
|
|
||||||
boot_startup_rom(50);
|
boot_startup_rom(50);
|
||||||
|
|
||||||
globals_init();
|
globals_init();
|
||||||
@ -262,14 +261,14 @@ int main(void)
|
|||||||
|
|
||||||
usbInit();
|
usbInit();
|
||||||
usb_connect();
|
usb_connect();
|
||||||
|
sei();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
avr_bus_active();
|
avr_bus_active();
|
||||||
info_P(PSTR("Activate AVR bus\n"));
|
info_P(PSTR("Activate AVR bus\n"));
|
||||||
snes_lorom();
|
//snes_lorom();
|
||||||
info_P(PSTR("Disable SNES WR\n"));
|
info_P(PSTR("Disable SNES WR\n"));
|
||||||
snes_wr_disable();
|
snes_wr_disable();
|
||||||
sei();
|
|
||||||
info_P(PSTR("USB poll\n"));
|
info_P(PSTR("USB poll\n"));
|
||||||
while (usb_trans.req_state != REQ_STATUS_SNES) {
|
while (usb_trans.req_state != REQ_STATUS_SNES) {
|
||||||
usbPoll();
|
usbPoll();
|
||||||
@ -277,7 +276,6 @@ int main(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if DO_SHM
|
#if DO_SHM
|
||||||
|
|
||||||
shared_memory_write(SHARED_MEM_TX_CMD_TERMINATE, 0);
|
shared_memory_write(SHARED_MEM_TX_CMD_TERMINATE, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -23,6 +23,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#include <util/delay.h> /* for _delay_ms() */
|
#include <util/delay.h> /* for _delay_ms() */
|
||||||
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sram.h"
|
#include "sram.h"
|
||||||
@ -30,10 +32,64 @@
|
|||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
|
#include "requests.h"
|
||||||
|
|
||||||
|
|
||||||
void system_init(void)
|
void system_init(void)
|
||||||
{
|
{
|
||||||
|
snes_reset_hi();
|
||||||
|
snes_reset_off();
|
||||||
|
snes_irq_hi();
|
||||||
|
snes_irq_off();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void system_reset()
|
||||||
|
{
|
||||||
|
info_P(PSTR("Reset SNES\n"));
|
||||||
|
cli();
|
||||||
|
snes_reset_on();
|
||||||
|
snes_reset_lo();
|
||||||
|
_delay_ms(2);
|
||||||
|
snes_reset_hi();
|
||||||
|
snes_reset_off();
|
||||||
|
sei();
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_send_irq()
|
||||||
|
{
|
||||||
|
snes_irq_on();
|
||||||
|
snes_irq_lo();
|
||||||
|
_delay_us(20);
|
||||||
|
snes_irq_hi();
|
||||||
|
snes_irq_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_bus_avr()
|
||||||
|
{
|
||||||
|
info_P(PSTR("Activate AVR bus\n"));
|
||||||
|
avr_bus_active();
|
||||||
|
info_P(PSTR("Disable SNES WR\n"));
|
||||||
|
snes_wr_disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_bus_snes()
|
||||||
|
{
|
||||||
|
snes_wr_disable();
|
||||||
|
info_P(PSTR("Disable SNES WR\n"));
|
||||||
|
snes_bus_active();
|
||||||
|
info_P(PSTR("Activate SNES bus\n"));
|
||||||
|
irq_stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_rom_mode(usb_transaction_t *usb_trans)
|
||||||
|
{
|
||||||
|
if (usb_trans->req_bank_size == 0x8000) {
|
||||||
|
snes_lorom();
|
||||||
|
info_P(PSTR("Set SNES lowrom \n"));
|
||||||
|
} else {
|
||||||
|
snes_hirom();
|
||||||
|
info_P(PSTR("Set SNES hirom \n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user