diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-05-10 12:26:24 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2012-05-10 12:26:24 +0000 |
commit | 97dce7b94464b891a25170e6556daac5bb30f7ef (patch) | |
tree | 41c359d3c2297f48867eb614be59c9f91d51e65d /demos | |
parent | 6a8a643ab00e5964a3fb77e5b2394561bb797e55 (diff) | |
download | ChibiOS-97dce7b94464b891a25170e6556daac5bb30f7ef.tar.gz ChibiOS-97dce7b94464b891a25170e6556daac5bb30f7ef.tar.bz2 ChibiOS-97dce7b94464b891a25170e6556daac5bb30f7ef.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4180 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos')
-rw-r--r-- | demos/ARM7-AT91SAM7S-FATFS-GCC/main.c | 17 | ||||
-rw-r--r-- | demos/ARM7-AT91SAM7X-FATFS-GCC/main.c | 17 | ||||
-rw-r--r-- | demos/ARM7-LPC214x-FATFS-GCC/main.c | 17 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103-FATFS/main.c | 7 | ||||
-rw-r--r-- | demos/ARMCM3-STM32F103ZG-FATFS/main.c | 2 |
5 files changed, 18 insertions, 42 deletions
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);
}
|