cleanup shared mem code

This commit is contained in:
optixx 2009-09-20 09:38:56 +02:00 committed by Jannis (jix) Harder
parent 9c4c880b0b
commit b9425b1da5
6 changed files with 21 additions and 10 deletions

View File

@ -47,8 +47,8 @@
#define HW_VERSION "2.6"
#define SW_VERSION "1.0"
#define DO_CRC_CHECK_LOADER 0
#define DO_CRC_CHECK 1
#define DO_CRC_CHECK_LOADER 1
#define DO_CRC_CHECK 0
#define DO_SHM_SCRATCHPAD 1
#define DO_SHM 1

View File

@ -1,6 +1,6 @@
/*
File: main.smc
Time: Thu, 06 Aug 2009 20:01:38
File: ../snes/quickdevloader/main.smc
Time: Sat, 19 Sep 2009 18:19:26
*/
#include <avr/pgmspace.h>
#include <loader.h>

View File

@ -6,6 +6,4 @@
#define ROM_HUFFMAN_SIZE 0
#define ROM_RLE_SIZE 31091
void irq_init();
#endif

View File

@ -286,8 +286,12 @@ void boot_startup_rom(uint16_t init_delay)
info(PSTR("crc=%x\n"),crc);
#endif
snes_irq_lo();
snes_irq_off();
snes_hirom();
snes_wr_disable();
irq_stop();
snes_bus_active();
info_P(PSTR("Activate SNES bus\n"));
send_reset();
@ -332,7 +336,7 @@ int main(void)
snes_reset_hi();
snes_reset_off();
irq_init();
boot_startup_rom(50);
boot_startup_rom(500);
globals_init();
usbInit();

View File

@ -239,8 +239,13 @@ void shared_memory_write(uint8_t cmd, uint8_t value)
SHARED_MEM_TX_LOC_CMD, cmd, SHARED_MEM_TX_LOC_PAYLOAD, value);
sram_bulk_addr_save();
#if (DO_SHM_SCRATCHPAD==0)
shared_memory_scratchpad_tx_save();
#endif
#if SHARED_MEM_SWITCH_IRQ
shared_memory_irq_hook();
#endif
sram_write(SHARED_MEM_TX_LOC_STATE, SHARED_MEM_TX_SNES_ACK);
sram_write(SHARED_MEM_TX_LOC_CMD, cmd);
@ -266,8 +271,12 @@ void shared_memory_write(uint8_t cmd, uint8_t value)
snes_lorom();
snes_wr_disable();
#if (DO_SHM_SCRATCHPAD==0)
shared_memory_scratchpad_tx_restore();
#endif
#if SHARED_MEM_SWITCH_IRQ
shared_memory_irq_restore();
#endif
sram_bulk_addr_restore();
#endif
}

View File

@ -22,7 +22,7 @@
#define __SHARED_MEMORY_H__
#define SHARED_MEM_SWITCH_IRQ 1
#define SHARED_MEM_SWITCH_IRQ 0
#define SHARED_MEM_SWITCH_DELAY 20
#define SHARED_MEM_TX_SNES_ACK 0xa5
@ -37,7 +37,7 @@
#define SHARED_MEM_TX_CMD_TERMINATE 0x06
#define SHARED_MEM_TX_LOC_STATE 0x000000
#define SHARED_MEM_TX_LOC_SIZE 0x000020
#define SHARED_MEM_TX_LOC_SIZE 0x000100
#define SHARED_MEM_TX_LOC_CMD 0x000001
#define SHARED_MEM_TX_LOC_PAYLOAD 0x000002
@ -48,7 +48,7 @@
#define SHARED_MEM_RX_CMD_FILESEL 0x01
#define SHARED_MEM_RX_LOC_STATE 0x001000
#define SHARED_MEM_RX_LOC_SIZE 0x000020
#define SHARED_MEM_RX_LOC_SIZE 0x000100
#define SHARED_MEM_RX_LOC_CMD 0x001001
#define SHARED_MEM_RX_LOC_LEN 0x001002
#define SHARED_MEM_RX_LOC_PAYLOAD 0x001003