diff --git a/src/ff.c b/src/ff.c index 2d7862a..bcd68c1 100644 --- a/src/ff.c +++ b/src/ff.c @@ -2198,7 +2198,6 @@ FRESULT f_read ( #if !_FS_TINY #if !_FS_READONLY if (fp->flag & FA__DIRTY) { /* Write sector I/O buffer if needed */ -printf("DIRTY!?!\n"); if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) ABORT(fp->fs, FR_DISK_ERR); fp->flag &= ~FA__DIRTY; @@ -2222,7 +2221,6 @@ printf("DIRTY!?!\n"); mem_cpy(rbuff, &fp->fs->win[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */ #else mem_cpy(rbuff, &fp->buf[fp->fptr % SS(fp->fs)], rcnt); /* Pick partial sector */ - printf("final mem_cpy, rcnt=%d, rbuff-buff=%d\n", rcnt, (void*)rbuff-buff); } else { sd_offload_partial_start = fp->fptr % SS(fp->fs); sd_offload_partial_end = sd_offload_partial_start + rcnt; @@ -2376,7 +2374,6 @@ FRESULT f_sync ( res = validate(fp->fs, fp->id); /* Check validity of the object */ if (res == FR_OK) { if (fp->flag & FA__WRITTEN) { /* Has the file been written? */ -printf("DIRTY?!?!?!\n"); #if !_FS_TINY /* Write-back dirty buffer */ if (fp->flag & FA__DIRTY) { if (disk_write(fp->fs->drv, fp->buf, fp->dsect, 1) != RES_OK) diff --git a/src/fpga_spi.c b/src/fpga_spi.c index ed315ad..ebdf7c5 100644 --- a/src/fpga_spi.c +++ b/src/fpga_spi.c @@ -133,6 +133,7 @@ #include "spi.h" #include "fpga_spi.h" #include "timer.h" +#include "sdnative.h" void fpga_spi_init(void) { spi_init(SPI_SPEED_FAST); @@ -230,10 +231,12 @@ void fpga_sddma(uint8_t tgt, uint8_t partial) { FPGA_SELECT(); FPGA_TX_BYTE(0xF1); /* STATUS */ FPGA_TX_BYTE(0x00); /* dummy */ + DBG_SD printf("FPGA DMA request sent, wait for completion..."); while((status=FPGA_RX_BYTE()) & 0x80) { FPGA_RX_BYTE(); /* eat the 2nd status byte */ test++; } + DBG_SD printf("...complete\n"); FPGA_DESELECT(); if(test<5)printf("loopy: %ld %02x\n", test, status); BITBAND(SD_CLKREG->FIODIR, SD_CLKPIN) = 1; diff --git a/src/sdnative.c b/src/sdnative.c index 76218b9..474ebdb 100644 --- a/src/sdnative.c +++ b/src/sdnative.c @@ -449,9 +449,11 @@ int send_command_fast(uint8_t* cmd, uint8_t* rsp, uint8_t* buf){ j=datcnt; datshift=8; DBG_SD printf("response over, waiting for data...\n"); + /* wait for data start bit on DAT0 */ while((BITBAND(SD_DAT0REG->FIOPIN, SD_DAT0PIN)) && --timeout) { wiggle_fast_neg1(); } + DBG_SD if(!timeout) printf("timed out!\n"); wiggle_fast_neg1(); /* eat the start bit */ if(sd_offload) { if(sd_offload_partial) { @@ -588,9 +590,12 @@ int stream_datablock(uint8_t *buf) { uint8_t datdata=0; uint32_t timeout=1000000; + DBG_SD printf("stream_datablock: wait for ready...\n"); while((BITBAND(SD_DAT0REG->FIOPIN, SD_DAT0PIN)) && --timeout) { wiggle_fast_neg1(); } + DBG_SD if(!timeout) printf("timeout!\n"); + wiggle_fast_neg1(); /* eat the start bit */ if(sd_offload) { if(sd_offload_partial) {