enabled faster clocking rate on cards that support it and did some transfer timing tests

This commit is contained in:
Markus Fröschle
2012-12-16 10:51:50 +00:00
parent d9f3c5e3c5
commit 05f6a79afc
3 changed files with 28 additions and 3 deletions

View File

@@ -10,7 +10,7 @@
# can be either "Y" or "N" (without quotes). "Y" for using the m68k-elf-, "N" for using the m68k-atari-mint # can be either "Y" or "N" (without quotes). "Y" for using the m68k-elf-, "N" for using the m68k-atari-mint
# toolchain # toolchain
COMPILE_ELF=N COMPILE_ELF=Y
ifeq (Y,$(COMPILE_ELF)) ifeq (Y,$(COMPILE_ELF))
TCPREFIX=m68k-elf- TCPREFIX=m68k-elf-

View File

@@ -29,10 +29,10 @@
MCF_DSPI_DCTAR_PCSSCK(0b01) | /* 3 clock DSPICS to DSPISCK delay prescaler */ \ MCF_DSPI_DCTAR_PCSSCK(0b01) | /* 3 clock DSPICS to DSPISCK delay prescaler */ \
MCF_DSPI_DCTAR_PASC_3CLK | /* 3 clock DSPISCK to DSPICS negation prescaler */ \ MCF_DSPI_DCTAR_PASC_3CLK | /* 3 clock DSPISCK to DSPICS negation prescaler */ \
MCF_DSPI_DCTAR_PDT_3CLK | /* 3 clock delay between DSPICS assertions prescaler */ \ MCF_DSPI_DCTAR_PDT_3CLK | /* 3 clock delay between DSPICS assertions prescaler */ \
MCF_DSPI_DCTAR_PBR_3CLK | /* 3 clock prescaler */ \ MCF_DSPI_DCTAR_PBR_1CLK | /* 1 clock prescaler */ \
MCF_DSPI_DCTAR_ASC(0b1001) | /* 1024 */ \ MCF_DSPI_DCTAR_ASC(0b1001) | /* 1024 */ \
MCF_DSPI_DCTAR_DT(0b1001) | /* 1024 */ \ MCF_DSPI_DCTAR_DT(0b1001) | /* 1024 */ \
MCF_DSPI_DCTAR_BR(0b0000); } MCF_DSPI_DCTAR_BR(0b0001); }
#define SPICLK_SLOW() { MCF_DSPI_DCTAR0 = MCF_DSPI_DCTAR_TRSZ(0b111) | /* transfer size = 8 bit */ \ #define SPICLK_SLOW() { MCF_DSPI_DCTAR0 = MCF_DSPI_DCTAR_TRSZ(0b111) | /* transfer size = 8 bit */ \
MCF_DSPI_DCTAR_PCSSCK(0b01) | /* 3 clock DSPICS to DSPISCK delay prescaler */ \ MCF_DSPI_DCTAR_PCSSCK(0b01) | /* 3 clock DSPICS to DSPISCK delay prescaler */ \

View File

@@ -12,6 +12,15 @@
#define WELCOME_NAME "WELCOME.MSG" #define WELCOME_NAME "WELCOME.MSG"
#define FLASHCODE_NAME "BASFLASH.BIN" #define FLASHCODE_NAME "BASFLASH.BIN"
#define FLASHCODE_ADDRESS 0x01000000L
/*
* initialize SD-card and FF FAT filesystem routines. Harness to load a file during boot.
*
* This is currently more like a proof of concept,
* but will be extended to load and execute a bootstrap flasher to be able to flash the Bee directly
* from card.
*/
void sd_card_init(void) void sd_card_init(void)
{ {
DRESULT res; DRESULT res;
@@ -63,12 +72,28 @@ void sd_card_init(void)
fres = f_open(&file, FLASHCODE_NAME, FA_READ); fres = f_open(&file, FLASHCODE_NAME, FA_READ);
if (fres == FR_OK) if (fres == FR_OK)
{ {
uint32_t size; /* length of code piece read */
uint32_t total_size = 0L;
/* /*
* yes, load and execute it * yes, load and execute it
* *
* FIXME: we will need some kind of user confirmation here * FIXME: we will need some kind of user confirmation here
* to avoid unwanted flashing or "bootsector viruses" before going productive * to avoid unwanted flashing or "bootsector viruses" before going productive
*/ */
uint32_t start_time = MCF_SLT_SCNT(0);
uint32_t end_time;
uint32_t time = 0;
while ((fres = f_read(&file, (void *) FLASHCODE_ADDRESS, 1024, &size)) == FR_OK)
{
total_size += size / 1024;
//xprintf("read hunk of %d bytes, total_size = %d kBytes\r\n", size, total_size);
}
end_time = MCF_SLT_SCNT(0);
time = (end_time - start_time) / 132L;
xprintf("result of f_read: %ld, %ld kbytes read\r\n", fres, total_size);
xprintf("time to load %s: %ld s\r\n", FLASHCODE_NAME, time / 1000 / 100);
xprintf("equals to about %ld kBytes/second\r\n", total_size / (time / 1000 / 100));
} }
f_close(&file); f_close(&file);