diff --git a/src/ff.h b/src/ff.h index 6f44794..d7477e9 100644 --- a/src/ff.h +++ b/src/ff.h @@ -260,10 +260,10 @@ typedef enum { FR_NO_FILESYSTEM, /* 11 */ FR_INVALID_OBJECT, /* 12 */ FR_MKFS_ABORTED, /* 13 */ - FR_IS_DIRECTORY, /* 13 */ - FR_IS_READONLY, /* 14 */ - FR_DIR_NOT_EMPTY, /* 15 */ - FR_NOT_DIRECTORY /* 16 */ + FR_IS_DIRECTORY, /* 14 */ + FR_IS_READONLY, /* 15 */ + FR_DIR_NOT_EMPTY, /* 16 */ + FR_NOT_DIRECTORY /* 17 */ } FRESULT; diff --git a/src/fpga.c b/src/fpga.c index ecf6b04..4968a50 100644 --- a/src/fpga.c +++ b/src/fpga.c @@ -119,13 +119,13 @@ void set_avr_ena(uint8_t val) { if(val) { // shared mode PORTD |= _BV(PD7); // Disable SPI double speed mode -> clock = f/4 -// SPSR = 0; -// dprintf("SPI slow\n"); + SPSR = 0; + dprintf("SPI slow\n"); } else { // avr only PORTD &= ~_BV(PD7); // Enable SPI double speed mode -> clock = f/2 -// SPSR = _BV(SPI2X); -// dprintf("SPI fast\n"); + SPSR = _BV(SPI2X); + dprintf("SPI fast\n"); } } diff --git a/src/main.c b/src/main.c index 08bc66d..07df1c4 100644 --- a/src/main.c +++ b/src/main.c @@ -185,11 +185,12 @@ restart: uint32_t mem_magic = sram_readlong(SRAM_SCRATCHPAD); while(0) { - SD_SPI_OFFLOAD=1; + SD_SPI_OFFLOAD=0; set_avr_addr(0L); - sd_read(0, file_buf, 8L, 1); + sd_read(0, file_buf, 0L, 1); + uart_trace((void*)file_buf, 0, 0x200); // sram_writeblock((void*)file_buf, 0, 0x200); - sram_hexdump(0,0x10); +// sram_hexdump(0,0x200); uart_putc('+'); } /* here be strange monsters */ diff --git a/src/memory.c b/src/memory.c index 0be394c..51b197d 100644 --- a/src/memory.c +++ b/src/memory.c @@ -297,8 +297,8 @@ uint8_t sram_reliable() { val=sram_readlong(SRAM_SCRATCHPAD); if(val==0x12345678) { score++; - } else { - dprintf("i=%d val=%08lX\n", i, val); +// } else { +// dprintf("i=%d val=%08lX\n", i, val); } } if(score 1) { + if (i > 1) // Command not accepted, could be MMC return; - } // Send ACMD41: SD_SEND_OP_COND // 1L<<30 == Host has High Capacity Support @@ -526,7 +524,6 @@ DSTATUS disk_initialize(BYTE drv) __attribute__ ((weak, alias("sd_initialize"))) DRESULT sd_read(BYTE drv, BYTE *buffer, DWORD sector, BYTE count) { uint8_t sec,res,tmp,errorcount; uint16_t crc,recvcrc; - if (drv >= MAX_CARDS) return RES_PARERR; @@ -617,7 +614,6 @@ DRESULT sd_read(BYTE drv, BYTE *buffer, DWORD sector, BYTE count) { if (errorcount >= CONFIG_SD_AUTO_RETRIES) return RES_ERROR; } - return RES_OK; } DRESULT disk_read(BYTE drv, BYTE *buffer, DWORD sector, BYTE count) __attribute__ ((weak, alias("sd_read"))); diff --git a/verilog/sd2snes/main.v b/verilog/sd2snes/main.v index 3815264..107bf4e 100644 --- a/verilog/sd2snes/main.v +++ b/verilog/sd2snes/main.v @@ -341,7 +341,7 @@ initial begin AVR_DATA_TO_MEM_ARRAY[1'b1] = 13'b0_000000_000000; // AVR read SRAM_DATA_TO_SNES_MEM_ARRAY[1'b0] = 13'b0_000000_000000; // SNES write - SRAM_DATA_TO_SNES_MEM_ARRAY[1'b1] = 13'b0_000010_000000; // SNES read + SRAM_DATA_TO_SNES_MEM_ARRAY[1'b1] = 13'b0_000100_000000; // SNES read /* 13'b0000100000000; */ SRAM_DATA_TO_AVR_MEM_ARRAY[1'b0] = 13'b0_000000_000000; // AVR write diff --git a/verilog/sd2snes/sd2snes.xise b/verilog/sd2snes/sd2snes.xise index 48c1616..2b105cd 100644 --- a/verilog/sd2snes/sd2snes.xise +++ b/verilog/sd2snes/sd2snes.xise @@ -70,20 +70,20 @@ - + - - + + - - + +