Add SDIO preflight method
This commit is contained in:
parent
944e0fe81d
commit
46bf97abfc
@ -5801,3 +5801,6 @@
|
|||||||
required. Implemented stm32_dmacapable for stm32f1xx devices. Enhanced
|
required. Implemented stm32_dmacapable for stm32f1xx devices. Enhanced
|
||||||
stm32_dmacapable for stm32f2xx and stm32f4xx devices to check for
|
stm32_dmacapable for stm32f2xx and stm32f4xx devices to check for
|
||||||
additional conditions that will cause DMA to fail or lose data (2013-10-18).
|
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).
|
||||||
|
|
||||||
|
@ -723,6 +723,7 @@ config STM32_SDIO
|
|||||||
default n
|
default n
|
||||||
depends on !STM32_CONNECTIVITYLINE && !STM32_VALUELINE
|
depends on !STM32_CONNECTIVITYLINE && !STM32_VALUELINE
|
||||||
select ARCH_HAVE_SDIO
|
select ARCH_HAVE_SDIO
|
||||||
|
select SDIO_PREFLIGHT
|
||||||
|
|
||||||
config STM32_SPI1
|
config STM32_SPI1
|
||||||
bool "SPI1"
|
bool "SPI1"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* include/nuttx/sdio.h
|
* 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>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -107,7 +107,7 @@
|
|||||||
* -Addressed Command, R2 response 31:16=RCA */
|
* -Addressed Command, R2 response 31:16=RCA */
|
||||||
# define MMCSD_CMDIDX10 10 /* SEND_CID: Asks card to send its card identification (CID)
|
# define MMCSD_CMDIDX10 10 /* SEND_CID: Asks card to send its card identification (CID)
|
||||||
* -Addressed Command, R2 response 31:16=RCA */
|
* -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 */
|
* -Addressed data transfer command, R1 response 31:0=DADR */
|
||||||
# define MMCSD_CMDIDX12 12 /* STOP_TRANSMISSION: Forces the card to stop transmission
|
# define MMCSD_CMDIDX12 12 /* STOP_TRANSMISSION: Forces the card to stop transmission
|
||||||
* -Addressed Command, R1b response */
|
* -Addressed Command, R1b response */
|
||||||
@ -708,6 +708,30 @@
|
|||||||
# define SDIO_DMASUPPORTED(dev) (false)
|
# define SDIO_DMASUPPORTED(dev) (false)
|
||||||
#endif
|
#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
|
* Name: SDIO_DMARECVSETUP
|
||||||
*
|
*
|
||||||
@ -848,6 +872,10 @@ struct sdio_dev_s
|
|||||||
|
|
||||||
#ifdef CONFIG_SDIO_DMA
|
#ifdef CONFIG_SDIO_DMA
|
||||||
bool (*dmasupported)(FAR struct sdio_dev_s *dev);
|
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,
|
int (*dmarecvsetup)(FAR struct sdio_dev_s *dev, FAR uint8_t *buffer,
|
||||||
size_t buflen);
|
size_t buflen);
|
||||||
int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
|
int (*dmasendsetup)(FAR struct sdio_dev_s *dev, FAR const uint8_t *buffer,
|
||||||
|
Loading…
Reference in New Issue
Block a user