#include <time.h>
#include <string.h>
+#define USE_SPISCARD_RECLOCKING
+
#ifdef CSR_SPISDCARD_BASE
// Import prototypes for the functions
#include <spisdcard.h>
{
uint32_t r;
int i, timeout=32;
-
+
// Initialise SPI mode
// set CS to HIGH
// Send pulses
return FAILURE;
}
+#ifdef USE_SPISCARD_RECLOCKING
// Reclock the card
// Calculate 16MHz as an integer divider from the CONFIG_CLOCK_FREQUENCY
// Add 1 as will be rounded down
divider=2;
printf("Reclocking from %dKHz to %dKHz\n\n", CONFIG_CLOCK_FREQUENCY/(int)spisdcard_clk_divider_read()/1000, CONFIG_CLOCK_FREQUENCY/divider/1000);
spisdcard_clk_divider_write(divider);
-
+
// Read in FAT16 File Allocation Table, array of 16bit unsinged integers
// Calculate Storage from TOP of MAIN RAM
sdCardFatTable = (uint16_t *)(MAIN_RAM_BASE+MAIN_RAM_SIZE-sdCardFatBootSector.sector_size*sdCardFatBootSector.fat_size_sectors);
return FAILURE;
}
}
+#endif
// Read in FAT16 Root Directory
// Calculate Storage from TOP of MAIN RAM