From 97dce7b94464b891a25170e6556daac5bb30f7ef Mon Sep 17 00:00:00 2001 From: gdisirio Date: Thu, 10 May 2012 12:26:24 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4180 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-AT91SAM7S-FATFS-GCC/main.c | 17 ++++------------- demos/ARM7-AT91SAM7X-FATFS-GCC/main.c | 17 ++++------------- demos/ARM7-LPC214x-FATFS-GCC/main.c | 17 ++++------------- demos/ARMCM3-STM32F103-FATFS/main.c | 7 +++++-- demos/ARMCM3-STM32F103ZG-FATFS/main.c | 2 +- 5 files changed, 18 insertions(+), 42 deletions(-) (limited to 'demos') diff --git a/demos/ARM7-AT91SAM7S-FATFS-GCC/main.c b/demos/ARM7-AT91SAM7S-FATFS-GCC/main.c index 8b6e0d32b..fea6e72b9 100644 --- a/demos/ARM7-AT91SAM7S-FATFS-GCC/main.c +++ b/demos/ARM7-AT91SAM7S-FATFS-GCC/main.c @@ -61,15 +61,8 @@ static SPIConfig ls_spicfg = { (MIN_SPI_BITRATE << 8) | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8 }; -/* Card insertion verification.*/ -static bool_t mmc_is_inserted(void) { - return !palReadPad(IOPORT1, PIOA_MMC_CP); -} - -/* Card protection verification.*/ -static bool_t mmc_is_protected(void) { - return palReadPad(IOPORT1, PIOA_MMC_WP); -} +/* MMC/SD over SPI driver configuration.*/ +static MMCConfig mmccfg = {&SPID1, &ls_spicfg, &hs_spicfg}; /* Generic large buffer.*/ uint8_t fbuff[1024]; @@ -306,10 +299,8 @@ int main(void) { */ palSetPadMode(IOPORT1, PIOA_MMC_NPCS0, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(IOPORT1, PIOA_MMC_NPCS0); - mmcObjectInit(&MMCD1, &SPID1, - &ls_spicfg, &hs_spicfg, - mmc_is_protected, mmc_is_inserted); - mmcStart(&MMCD1, NULL); + mmcObjectInit(&MMCD1); + mmcStart(&MMCD1, &mmccfg); /* * Creates the blinker threads. diff --git a/demos/ARM7-AT91SAM7X-FATFS-GCC/main.c b/demos/ARM7-AT91SAM7X-FATFS-GCC/main.c index 54bee4680..0b3f838fd 100644 --- a/demos/ARM7-AT91SAM7X-FATFS-GCC/main.c +++ b/demos/ARM7-AT91SAM7X-FATFS-GCC/main.c @@ -61,15 +61,8 @@ static SPIConfig ls_spicfg = { (MIN_SPI_BITRATE << 8) | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8 }; -/* Card insertion verification.*/ -static bool_t mmc_is_inserted(void) { - return !palReadPad(IOPORT2, PIOB_MMC_CP); -} - -/* Card protection verification.*/ -static bool_t mmc_is_protected(void) { - return palReadPad(IOPORT2, PIOB_MMC_WP); -} +/* MMC/SD over SPI driver configuration.*/ +static MMCConfig mmccfg = {&SPID1, &ls_spicfg, &hs_spicfg}; /* Generic large buffer.*/ uint8_t fbuff[1024]; @@ -288,10 +281,8 @@ int main(void) { */ palSetPadMode(IOPORT1, PIOA_CS_MMC, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(IOPORT1, PIOA_CS_MMC); - mmcObjectInit(&MMCD1, &SPID1, - &ls_spicfg, &hs_spicfg, - mmc_is_protected, mmc_is_inserted); - mmcStart(&MMCD1, NULL); + mmcObjectInit(&MMCD1); + mmcStart(&MMCD1, &mmccfg); /* * Creates the blinker threads. diff --git a/demos/ARM7-LPC214x-FATFS-GCC/main.c b/demos/ARM7-LPC214x-FATFS-GCC/main.c index d541e4899..1b3b86848 100644 --- a/demos/ARM7-LPC214x-FATFS-GCC/main.c +++ b/demos/ARM7-LPC214x-FATFS-GCC/main.c @@ -60,15 +60,8 @@ static SPIConfig ls_spicfg = { 254 }; -/* Card insertion verification.*/ -static bool_t mmc_is_inserted(void) { - return !palReadPad(IOPORT2, PB_CP1); -} - -/* Card protection verification.*/ -static bool_t mmc_is_protected(void) { - return palReadPad(IOPORT2, PB_WP1); -} +/* MMC/SD over SPI driver configuration.*/ +static MMCConfig mmccfg = {&SPID1, &ls_spicfg, &hs_spicfg}; /* Generic large buffer.*/ uint8_t fbuff[1024]; @@ -255,10 +248,8 @@ int main(void) { /* * Initializes the MMC driver to work with SPI2. */ - mmcObjectInit(&MMCD1, &SPID1, - &ls_spicfg, &hs_spicfg, - mmc_is_protected, mmc_is_inserted); - mmcStart(&MMCD1, NULL); + mmcObjectInit(&MMCD1); + mmcStart(&MMCD1, &mmccfg); /* * Creates the blinker threads. diff --git a/demos/ARMCM3-STM32F103-FATFS/main.c b/demos/ARMCM3-STM32F103-FATFS/main.c index 8df04aef7..16d04dd49 100644 --- a/demos/ARMCM3-STM32F103-FATFS/main.c +++ b/demos/ARMCM3-STM32F103-FATFS/main.c @@ -53,6 +53,9 @@ static SPIConfig hs_spicfg = {NULL, IOPORT2, GPIOB_SPI2NSS, 0}; static SPIConfig ls_spicfg = {NULL, IOPORT2, GPIOB_SPI2NSS, SPI_CR1_BR_2 | SPI_CR1_BR_1}; +/* MMC/SD over SPI driver configuration.*/ +static MMCConfig mmccfg = {&SPID2, &ls_spicfg, &hs_spicfg}; + /* Generic large buffer.*/ uint8_t fbuff[1024]; @@ -271,8 +274,8 @@ int main(void) { */ palSetPadMode(IOPORT2, GPIOB_SPI2NSS, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(IOPORT2, GPIOB_SPI2NSS); - mmcObjectInit(&MMCD1, &SPID2, &ls_spicfg, &hs_spicfg); - mmcStart(&MMCD1, NULL); + mmcObjectInit(&MMCD1); + mmcStart(&MMCD1, &mmccfg); /* * Creates the blinker thread. diff --git a/demos/ARMCM3-STM32F103ZG-FATFS/main.c b/demos/ARMCM3-STM32F103ZG-FATFS/main.c index 8ce90f704..b21e7a864 100644 --- a/demos/ARMCM3-STM32F103ZG-FATFS/main.c +++ b/demos/ARMCM3-STM32F103ZG-FATFS/main.c @@ -227,7 +227,7 @@ static void cmd_tree(BaseSequentialStream *chp, int argc, char *argv[]) { chprintf(chp, "FS: %lu free clusters, %lu sectors per cluster, %lu bytes free\r\n", clusters, (uint32_t)SDC_FS.csize, - clusters * (uint32_t)SDC_FS.csize * (uint32_t)SDC_BLOCK_SIZE); + clusters * (uint32_t)SDC_FS.csize * (uint32_t)MMCSD_BLOCK_SIZE); fbuff[0] = 0; scan_files(chp, (char *)fbuff); } -- cgit v1.2.3