Add SDIO preflight method

This commit is contained in:
Gregory Nutt 2013-10-18 08:15:09 -06:00
parent 944e0fe81d
commit 46bf97abfc
3 changed files with 34 additions and 2 deletions

View File

@ -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).

View File

@ -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"

View File

@ -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
@ -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,