From 361e43c4dcc20cfcc463a3f1577e663f3db02473 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 3 Nov 2012 09:39:53 +0000 Subject: [PATCH] Fixed bug 3581929. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4793 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- boards/OLIMEX_STM32_P407/board.c | 24 ++++++++++++++++++++++++ boards/OLIMEX_STM32_P407/board.h | 4 ++-- readme.txt | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/boards/OLIMEX_STM32_P407/board.c b/boards/OLIMEX_STM32_P407/board.c index 59b6e9de6..2be03d673 100644 --- a/boards/OLIMEX_STM32_P407/board.c +++ b/boards/OLIMEX_STM32_P407/board.c @@ -51,6 +51,30 @@ void __early_init(void) { stm32_clock_init(); } +#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) +/** + * @brief MMC_SPI card detection. + */ +bool_t mmc_lld_is_card_inserted(MMCDriver *mmcp) { + static bool_t last_status = FALSE; + (void)mmcp; + + if ((palReadLatch(GPIOD) & PAL_PORT_BIT(GPIOD_SPI3_CS)) == 0) + return last_status; + return last_status = (bool_t)palReadPad(GPIOD, GPIOD_SPI3_CS); +} + +/** + * @brief MMC_SPI card write protection detection. + */ +bool_t mmc_lld_is_write_protected(MMCDriver *mmcp) { + + (void)mmcp; + /* TODO: Fill the implementation.*/ + return FALSE; +} +#endif + /* * Board-specific initialization code. */ diff --git a/boards/OLIMEX_STM32_P407/board.h b/boards/OLIMEX_STM32_P407/board.h index 1fd941809..042e6f3c5 100644 --- a/boards/OLIMEX_STM32_P407/board.h +++ b/boards/OLIMEX_STM32_P407/board.h @@ -362,7 +362,7 @@ * * PD0 - GPIOD_USELESS0 (input pull-up). * PD1 - GPIOD_USELESS1 (input pull-up). - * PD2 - GPIOD_SPI3_CS (output push-pull). + * PD2 - GPIOD_SPI3_CS (output opendrain). * PD3 - GPIOD_LCD_RST (output push-pull). * PD4 - GPIOD_USELESS4 (input pull-up). * PD5 - GPIOD_USELESS5 (input pull-up). @@ -393,7 +393,7 @@ PIN_MODE_INPUT(GPIOD_USB_HS_FAULT) | \ PIN_MODE_INPUT(GPIOD_USELESS14) | \ PIN_MODE_INPUT(GPIOD_USELESS15)) -#define VAL_GPIOD_OTYPER 0x00000000 +#define VAL_GPIOD_OTYPER PIN_OTYPE_OPENDRAIN(GPIOD_SPI3_CS) #define VAL_GPIOD_OSPEEDR 0xFFFFFFFF #define VAL_GPIOD_PUPDR (PIN_PUDR_PULLUP(GPIOD_USELESS0) | \ PIN_PUDR_PULLUP(GPIOD_USELESS1) | \ diff --git a/readme.txt b/readme.txt index 0b811a5a9..4b27046f0 100644 --- a/readme.txt +++ b/readme.txt @@ -82,6 +82,8 @@ ***************************************************************************** *** 2.5.1 *** +- FIX: Fixed STM32_P407: implement mmc_lld_is_card_inserted (bug 3581929) + (backported to 2.4.3). - FIX: Fixed double chSysInit() call in MSP430F1611 demo (bug 3581304) (backported to 2.2.10 and 2.4.3). - FIX: Fixed patch for various demos (bug 3579734).