diff --git a/nuttx/arch/arm/src/stm32/chip/stm32f10xxx_dma.h b/nuttx/arch/arm/src/stm32/chip/stm32f10xxx_dma.h index f04b15d23f..a8241bc724 100644 --- a/nuttx/arch/arm/src/stm32/chip/stm32f10xxx_dma.h +++ b/nuttx/arch/arm/src/stm32/chip/stm32f10xxx_dma.h @@ -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 * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/arm/src/stm32/chip/stm32f40xxx_dma.h b/nuttx/arch/arm/src/stm32/chip/stm32f40xxx_dma.h index 7865305995..80bbb10214 100644 --- a/nuttx/arch/arm/src/stm32/chip/stm32f40xxx_dma.h +++ b/nuttx/arch/arm/src/stm32/chip/stm32f40xxx_dma.h @@ -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 * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/arm/src/stm32/stm32_sdio.c b/nuttx/arch/arm/src/stm32/stm32_sdio.c index e08bcb3071..9dbdb6b20c 100644 --- a/nuttx/arch/arm/src/stm32/stm32_sdio.c +++ b/nuttx/arch/arm/src/stm32/stm32_sdio.c @@ -1,8 +1,8 @@ /**************************************************************************** * arch/arm/src/stm32/stm32_sdio.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * 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 -# define CONFIG_SDIO_DMAPRIO DMA_CCR_PRIMED +# 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) @@ -105,7 +111,7 @@ * be defined in the board-specific board.h header file: SDIO_INIT_CLKDIV, * SDIO_MMCXFR_CLKDIV, and SDIO_SDXFR_CLKDIV. */ - + #define STM32_CLCKCR_INIT (SDIO_INIT_CLKDIV|SDIO_CLKCR_RISINGEDGE|\ SDIO_CLKCR_WIDBUS_D1) #define SDIO_CLKCR_MMCXFR (SDIO_MMCXFR_CLKDIV|SDIO_CLKCR_RISINGEDGE|\ @@ -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 diff --git a/nuttx/configs/stm3210e-eval/buttons/defconfig b/nuttx/configs/stm3210e-eval/buttons/defconfig index 3c2c561a50..93f4ac7f07 100644 --- a/nuttx/configs/stm3210e-eval/buttons/defconfig +++ b/nuttx/configs/stm3210e-eval/buttons/defconfig @@ -65,7 +65,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization diff --git a/nuttx/configs/stm3240g-eval/dhcpd/defconfig b/nuttx/configs/stm3240g-eval/dhcpd/defconfig index 8fe199c99f..30ff4d5455 100644 --- a/nuttx/configs/stm3240g-eval/dhcpd/defconfig +++ b/nuttx/configs/stm3240g-eval/dhcpd/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 # diff --git a/nuttx/configs/stm3240g-eval/include/board.h b/nuttx/configs/stm3240g-eval/include/board.h index aae5f0e221..322387b8f5 100755 --- a/nuttx/configs/stm3240g-eval/include/board.h +++ b/nuttx/configs/stm3240g-eval/include/board.h @@ -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 ************************************************************************************/ diff --git a/nuttx/configs/stm3240g-eval/nettest/defconfig b/nuttx/configs/stm3240g-eval/nettest/defconfig index efa32516ff..6fb7f862d2 100644 --- a/nuttx/configs/stm3240g-eval/nettest/defconfig +++ b/nuttx/configs/stm3240g-eval/nettest/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 # diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig index c82ebc04db..76800c6712 100644 --- a/nuttx/configs/stm3240g-eval/nsh/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 # diff --git a/nuttx/configs/stm3240g-eval/nsh2/defconfig b/nuttx/configs/stm3240g-eval/nsh2/defconfig index df2d3eec4f..61fcddf218 100644 --- a/nuttx/configs/stm3240g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh2/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 # diff --git a/nuttx/configs/stm3240g-eval/ostest/defconfig b/nuttx/configs/stm3240g-eval/ostest/defconfig index 2a5443bcb5..d95fc96e73 100644 --- a/nuttx/configs/stm3240g-eval/ostest/defconfig +++ b/nuttx/configs/stm3240g-eval/ostest/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 diff --git a/nuttx/configs/stm3240g-eval/telnetd/defconfig b/nuttx/configs/stm3240g-eval/telnetd/defconfig index b1b3d806e1..7a1394e9f9 100644 --- a/nuttx/configs/stm3240g-eval/telnetd/defconfig +++ b/nuttx/configs/stm3240g-eval/telnetd/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 # diff --git a/nuttx/configs/stm32f4discovery/nsh/defconfig b/nuttx/configs/stm32f4discovery/nsh/defconfig index b95d2a52c0..e4e8789c33 100755 --- a/nuttx/configs/stm32f4discovery/nsh/defconfig +++ b/nuttx/configs/stm32f4discovery/nsh/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization @@ -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 # diff --git a/nuttx/configs/stm32f4discovery/ostest/defconfig b/nuttx/configs/stm32f4discovery/ostest/defconfig index 3d174535f6..27cbb770d9 100755 --- a/nuttx/configs/stm32f4discovery/ostest/defconfig +++ b/nuttx/configs/stm32f4discovery/ostest/defconfig @@ -66,7 +66,7 @@ # CONFIG_ARCH_CALIBRATION - Enables some build in instrumentation that # cause a 100 second delay during boot-up. This 100 second delay # serves no purpose other than it allows you to calibrate -# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure +# CONFIG_BOARD_LOOPSPERMSEC. You simply use a stop watch to measure # the 100 second delay then adjust CONFIG_BOARD_LOOPSPERMSEC until # the delay actually is 100 seconds. # CONFIG_ARCH_DMA - Support DMA initialization