STM32 SDIO driver now build with DMA enabled

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4404 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-02-19 16:31:12 +00:00
parent c3e6ead339
commit a7d27685a4
13 changed files with 82 additions and 104 deletions

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/stm32/chip/stm32f10xxx_dma.h
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,7 +1,7 @@
/************************************************************************************
* arch/arm/src/stm32/chip/stm32f40xxx_dma.h
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without

View File

@ -1,8 +1,8 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_sdio.c
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -89,7 +89,13 @@
#endif
#ifndef CONFIG_SDIO_DMAPRIO
# if defined(CONFIG_STM32_STM32F10XX)
# define CONFIG_SDIO_DMAPRIO DMA_CCR_PRIMED
# elif defined(CONFIG_STM32_STM32F40XX)
# define CONFIG_SDIO_DMAPRIO DMA_SCR_PRIMED
# else
# error "Unknown STM32 DMA"
# endif
#endif
#if !defined(CONFIG_DEBUG_FS) || !defined(CONFIG_DEBUG_VERBOSE)
@ -124,13 +130,49 @@
#define SDIO_DTIMER_DATATIMEOUT (0x000fffff)
/* DMA CCR register settings */
/* DMA channel/stream configuration register settings. The following
* must be selected. The DMA driver will select the remaining fields.
*
* - 32-bit DMA
* - Memory increment
* - Direction (memory-to-peripheral, peripheral-to-memory)
* - Memory burst size (F4 only)
*/
#define SDIO_RXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_CCR_MSIZE_32BITS|\
/* STM32 F1 channel configuration register (CCR) settings */
#if defined(CONFIG_STM32_STM32F10XX)
# define SDIO_RXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_CCR_MSIZE_32BITS|\
DMA_CCR_PSIZE_32BITS|DMA_CCR_MINC)
#define SDIO_TXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_CCR_MSIZE_32BITS|\
# define SDIO_TXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_CCR_MSIZE_32BITS|\
DMA_CCR_PSIZE_32BITS|DMA_CCR_MINC|DMA_CCR_DIR)
/* STM32 F4 stream configuration register (SCR) settings */
#elif defined(CONFIG_STM32_STM32F40XX)
# define SDIO_RXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_SCR_MSIZE_32BITS|\
DMA_SCR_PSIZE_32BITS|DMA_SCR_MINC|DMA_SCR_DIR_P2M|\
DMA_SCR_PBURST_SINGLE|DMA_SCR_PBURST_INCR8)
# define SDIO_TXDMA32_CONFIG (CONFIG_SDIO_DMAPRIO|DMA_SCR_MSIZE_32BITS|\
DMA_SCR_PSIZE_32BITS|DMA_SCR_MINC|DMA_SCR_DIR_M2P|\
DMA_SCR_PBURST_SINGLE|DMA_SCR_PBURST_INCR8)
#else
# error "Unknown STM32 DMA"
#endif
/* SDIO DMA Channel/Stream selection. For the the case of the STM32 F4, there
* are multiple DMA stream options that must be dis-ambiguated in the board.h
* file.
*/
#if defined(CONFIG_STM32_STM32F10XX)
# define SDIO_DMACHAN DMACHAN_SDIO
#elif defined(CONFIG_STM32_STM32F40XX)
# define SDIO_DMACHAN DMAMAP_SDIO
#else
# error "Unknown STM32 DMA"
#endif
/* FIFO sizes */
#define SDIO_HALFFIFO_WORDS (8)
@ -2617,7 +2659,7 @@ FAR struct sdio_dev_s *sdio_initialize(int slotno)
/* Allocate a DMA channel */
#ifdef CONFIG_SDIO_DMA
priv->dma = stm32_dmachannel(DMACHAN_SDIO);
priv->dma = stm32_dmachannel(SDIO_DMACHAN);
#endif
/* Configure GPIOs for 4-bit, wide-bus operation (the chip is capable of

View File

@ -711,20 +711,6 @@ CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# TCP/IP and UDP support via uIP
#

View File

@ -420,6 +420,17 @@
#define GPIO_I2C1_SCL GPIO_I2C1_SCL_1
#define GPIO_I2C1_SDA GPIO_I2C1_SDA_2
/* DMA Channl/Stream Selections *****************************************************/
/* Stream selections are arbitrary for now but might become important in the future
* is we set aside more DMA channels/streams.
*
* SDIO DMA
* DMAMAP_SDIO_1 = Channel 4, Stream 3
* DMAMAP_SDIO_2 = Channel 4, Stream 5
*/
#define DMAMAP_SDIO DMAMAP_SDIO_1
/************************************************************************************
* Public Data
************************************************************************************/

View File

@ -711,20 +711,6 @@ CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# TCP/IP and UDP support via uIP
#

View File

@ -788,20 +788,6 @@ CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# TCP/IP and UDP support via uIP
#

View File

@ -498,6 +498,7 @@ CONFIG_DEBUG_ANALOG=n
CONFIG_DEBUG_PWM=n
CONFIG_DEBUG_CAN=n
CONFIG_DEBUG_I2C=n
CONFIG_DEBUG_DMA=n
CONFIG_HAVE_CXX=y
CONFIG_MM_REGIONS=2
CONFIG_ARCH_LOWPUTC=y
@ -788,20 +789,6 @@ CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# TCP/IP and UDP support via uIP
#

View File

@ -678,16 +678,24 @@ CONFIG_FS_READAHEAD=n
CONFIG_FS_WRITEBUFFER=n
#
# SDIO-based MMC/SD driver
# STM32 SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_SDIO_PRI - Select SDIO interrupt prority. Default: 128
# CONFIG_SDIO_DMAPRIO - Select SDIO DMA interrupt priority.
# Default: Medium
# CONFIG_SDIO_WIDTH_D1_ONLY - Select 1-bit transfer mode. Default:
# 4-bit transfer mode.
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
#CONFIG_SDIO_PRI=128
#CONFIG_SDIO_DMAPRIO
#CONFIG_SDIO_WIDTH_D1_ONLY
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n

View File

@ -711,20 +711,6 @@ CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# TCP/IP and UDP support via uIP
#

View File

@ -718,20 +718,6 @@ CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# SDIO-based MMC/SD driver
#
# CONFIG_SDIO_DMA
# SDIO driver supports DMA
# CONFIG_MMCSD_MMCSUPPORT
# Enable support for MMC cards
# CONFIG_MMCSD_HAVECARDDETECT
# SDIO driver card detection is 100% accurate
#
CONFIG_SDIO_DMA=n
CONFIG_MMCSD_MMCSUPPORT=n
CONFIG_MMCSD_HAVECARDDETECT=n
#
# TCP/IP and UDP support via uIP
#