git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2272 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2010-10-23 16:44:32 +00:00
parent 341a89dfd5
commit 16423f7781
4 changed files with 15 additions and 3 deletions

View File

@ -45,17 +45,17 @@ static bool_t fs_ready = FALSE;
/* Maximum speed SPI configuration (__MHz, NCPHA=1, CPOL=0).*/
static SPIConfig hs_spicfg = {
NULL,
IOPORT1,
PIOA_MMC_NPCS0,
AT91C_SPI_MSTR | AT91C_SPI_MODFDIS,
(MAX_SPI_BITRATE << 8) | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8
};
/* Low speed SPI configuration (192KHz, NCPHA=1, CPOL=0).*/
static SPIConfig ls_spicfg = {
NULL,
IOPORT1,
PIOA_MMC_NPCS0,
AT91C_SPI_MSTR | AT91C_SPI_MODFDIS,
(MIN_SPI_BITRATE << 8) | AT91C_SPI_NCPHA | AT91C_SPI_BITS_8
};
@ -320,7 +320,7 @@ int main(int argc, char **argv) {
*/
palSetPadMode(IOPORT1, PIOA_MMC_NPCS0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(IOPORT1, PIOA_MMC_NPCS0);
mmcObjectInit(&MMCD1, &SPID,
mmcObjectInit(&MMCD1, &SPID1,
&ls_spicfg, &hs_spicfg,
mmc_is_protected, mmc_is_inserted);
mmcStart(&MMCD1, &mmc_cfg);

View File

@ -57,3 +57,7 @@
* SPI driver system settings.
*/
#define USE_AT91SAM7_SPI TRUE
#define AT91SAM7_SPI_USE_SPI0 TRUE
#define AT91SAM7_SPI_USE_SPI1 FALSE
#define AT91SAM7_SPI0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)
#define AT91SAM7_SPI1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)

View File

@ -57,3 +57,7 @@
* SPI driver system settings.
*/
#define USE_AT91SAM7_SPI TRUE
#define AT91SAM7_SPI_USE_SPI0 TRUE
#define AT91SAM7_SPI_USE_SPI1 TRUE
#define AT91SAM7_SPI0_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)
#define AT91SAM7_SPI1_PRIORITY (AT91C_AIC_PRIOR_HIGHEST - 1)

View File

@ -95,6 +95,10 @@
/* Derived constants and error checks. */
/*===========================================================================*/
#if defined (AT91C_BASE_SPI) && AT91SAM7_SPI_USE_SPI1
#error "SPI1 not present"
#endif
#if !AT91SAM7_SPI_USE_SPI0 && !AT91SAM7_SPI_USE_SPI1
#error "SPI driver activated but no SPI peripheral assigned"
#endif