diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-10-18 08:15:09 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-10-18 08:15:09 -0600 |
commit | c670a1d60d6a9b2f6e470f575628208e7ae0e790 (patch) | |
tree | 6b28dae843c05d7a5dc877115a5ff5d7c6011b37 | |
parent | e1d399b339878b4106e02a2803558a1566e6dd6b (diff) | |
download | px4-nuttx-c670a1d60d6a9b2f6e470f575628208e7ae0e790.tar.gz px4-nuttx-c670a1d60d6a9b2f6e470f575628208e7ae0e790.tar.bz2 px4-nuttx-c670a1d60d6a9b2f6e470f575628208e7ae0e790.zip |
Add SDIO preflight method
-rw-r--r-- | nuttx/ChangeLog | 3 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/Kconfig | 1 | ||||
-rw-r--r-- | nuttx/include/nuttx/sdio.h | 32 |
3 files changed, 34 insertions, 2 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 246b69341..99708875b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -5801,3 +5801,6 @@ required. Implemented stm32_dmacapable for stm32f1xx devices. Enhanced stm32_dmacapable for stm32f2xx and stm32f4xx devices to check for additional conditions that will cause DMA to fail or lose data (2013-10-18). + * include/nuttx/sdio.h: Add a preflight method to the SDIO interface. + From Mike Smith (2013-10-18). + diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index 8458becbf..e2322c627 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -723,6 +723,7 @@ config STM32_SDIO default n depends on !STM32_CONNECTIVITYLINE && !STM32_VALUELINE select ARCH_HAVE_SDIO + select SDIO_PREFLIGHT config STM32_SPI1 bool "SPI1" diff --git a/nuttx/include/nuttx/sdio.h b/nuttx/include/nuttx/sdio.h index 186736e86..fddab8bbd 100644 --- a/nuttx/include/nuttx/sdio.h +++ b/nuttx/include/nuttx/sdio.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/sdio.h * - * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -107,7 +107,7 @@ * -Addressed Command, R2 response 31:16=RCA */ # define MMCSD_CMDIDX10 10 /* SEND_CID: Asks card to send its card identification (CID) * -Addressed Command, R2 response 31:16=RCA */ -# define MMC_CMDIDX11 11 /* READ_DAT_UNTIL_STOP +# define MMC_CMDIDX11 11 /* READ_DAT_UNTIL_STOP * -Addressed data transfer command, R1 response 31:0=DADR */ # define MMCSD_CMDIDX12 12 /* STOP_TRANSMISSION: Forces the card to stop transmission * -Addressed Command, R1b response */ @@ -709,6 +709,30 @@ #endif /**************************************************************************** + * Name: SDIO_DMAPREFLIGHT + * + * Description: + * Preflight an SDIO DMA operation. If the buffer is not well-formed for + * SDIO DMA transfer (alignment, size, etc.) returns an error. + * + * Input Parameters: + * dev - An instance of the SDIO device interface + * buffer - The memory to DMA to/from + * buflen - The size of the DMA transfer in bytes + * + * Returned Value: + * OK on success; a negated errno on failure + * + ****************************************************************************/ + +#if defined(CONFIG_SDIO_DMA) && defined(CONFIG_SDIO_PREFLIGHT) +# define SDIO_DMAPREFLIGHT(dev,buffer,len) \ + ((dev)->dmapreflight?(dev)->dmapreflight(dev,buffer,len):OK) +#else +# define SDIO_DMAPREFLIGHT(dev,buffer,len) (OK) +#endif + +/**************************************************************************** * Name: SDIO_DMARECVSETUP * * Description: @@ -848,6 +872,10 @@ struct sdio_dev_s #ifdef CONFIG_SDIO_DMA bool (*dmasupported)(FAR struct sdio_dev_s *dev); +#ifdef CONFIG_SDIO_PREFLIGHT + int (*dmapreflight)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, + size_t buflen); +#endif int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer, size_t buflen); int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer, |