From 2f4ca47a51cb660b91fecbe39ee549d8fe024f8f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 25 Oct 2014 17:53:29 -0600 Subject: EFM32: dma_config_t needs to be only 16-bits for now --- nuttx/arch/arm/src/efm32/efm32_dma.h | 75 ++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/nuttx/arch/arm/src/efm32/efm32_dma.h b/nuttx/arch/arm/src/efm32/efm32_dma.h index a0bd5cc0c..ee3fb02aa 100644 --- a/nuttx/arch/arm/src/efm32/efm32_dma.h +++ b/nuttx/arch/arm/src/efm32/efm32_dma.h @@ -53,7 +53,8 @@ * Pre-processor Definitions ************************************************************************************/ -/* Bit encoded input parameter to efm32_channel() +/* Bit encoded input parameter to efm32_channel(). These encodings must fit in the + * an unsigned integer of type dma_config_t. * * Current limitations/assumptions in the encoding: * @@ -76,9 +77,9 @@ # define EFM32_DMA_XFERSIZE_SHIFT_HWORD (1 << EFM32_DMA_SOURCSEL_SHIFT) # define EFM32_DMA_XFERSIZE_SHIFT_WORD (2 << EFM32_DMA_SOURCSEL_SHIFT) -#define EFM32_DMA_SINGLE_MASK (1 << 12) /* Bit 12: Single or Buffer full request */ -# define EFM32_DMA_SINGLE (1 << 12) /* 1=Buffer full request */ -# define EFM32_DMA_BUFFER_FULL (0) /* 0=Buffer full request */ +#define EFM32_DMA_SINGLE_MASK (1 << 12) /* Bit 12: Single or Buffer full request */ +# define EFM32_DMA_SINGLE (1 << 12) /* 1=Buffer full request */ +# define EFM32_DMA_BUFFER_FULL (0) /* 0=Buffer full request */ /************************************************************************************ * Public Types @@ -132,9 +133,12 @@ struct efm32_dmaregs_s }; #endif -/* Type of 'config' argument passed to efm32_rxdmasetup() and efm32_txdmasetup */ +/* Type of 'config' argument passed to efm32_rxdmasetup() and efm32_txdmasetup. + * See EFM32_DMA_* encodings above. If these encodings exceed 16-bits, then this + * should be changed to a uint32_t. + */ -typedef uint32_t dma_config_t; +typedef uint16_t dma_config_t; /************************************************************************************ * Public Data @@ -155,16 +159,15 @@ extern "C" * Public Function Prototypes ************************************************************************************/ -/**************************************************************************** +/************************************************************************************ * Name: efm32_dmachannel * * Description: - * Allocate a DMA channel. This function gives the caller mutually - * exclusive access to a DMA channel. + * Allocate a DMA channel. This function gives the caller mutually exclusive + * access to a DMA channel. * - * If no DMA channel is available, then efm32_dmachannel() will wait - * until the holder of a channel relinquishes the channel by calling - * efm32_dmafree(). + * If no DMA channel is available, then efm32_dmachannel() will wait until the + * holder of a channel relinquishes the channel by calling efm32_dmafree(). * * Input parameters: * None @@ -173,22 +176,21 @@ extern "C" * This function ALWAYS returns a non-NULL, void* DMA channel handle. * * Assumptions: - * - The caller can wait for a DMA channel to be freed if it is not - * available. + * - The caller can wait for a DMA channel to be freed if it is not available. * - ****************************************************************************/ + ************************************************************************************/ DMA_HANDLE efm32_dmachannel(void); -/**************************************************************************** +/************************************************************************************ * Name: efm32_dmafree * * Description: - * Release a DMA channel. If another thread is waiting for this DMA channel - * in a call to efm32_dmachannel, then this function will re-assign the - * DMA channel to that thread and wake it up. NOTE: The 'handle' used - * in this argument must NEVER be used again until efm32_dmachannel() is - * called again to re-gain access to the channel. + * Release a DMA channel. If another thread is waiting for this DMA channel in a + * call to efm32_dmachannel, then this function will re-assign the DMA channel to + * that thread and wake it up. NOTE: The 'handle' used in this argument must + * NEVER be used again until efm32_dmachannel() is called again to re-gain access + * to the channel. * * Returned Value: * None @@ -197,11 +199,11 @@ DMA_HANDLE efm32_dmachannel(void); * - The caller holds the DMA channel. * - There is no DMA in progress * - ****************************************************************************/ + ************************************************************************************/ void efm32_dmafree(DMA_HANDLE handle); -/**************************************************************************** +/************************************************************************************ * Name: efm32_rxdmasetup * * Description: @@ -214,12 +216,12 @@ void efm32_dmafree(DMA_HANDLE handle); * configured transfer size. * config - Channel configuration selections * - ****************************************************************************/ + ************************************************************************************/ void efm32_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, size_t nbytes, dma_config_t config); -/**************************************************************************** +/************************************************************************************ * Name: efm32_txdmasetup * * Description: @@ -232,12 +234,12 @@ void efm32_rxdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, * configured transfer size. * config - Channel configuration selections * - ****************************************************************************/ + ************************************************************************************/ void efm32_txdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, size_t nbytes, dma_config_t config); -/**************************************************************************** +/************************************************************************************ * Name: efm32_dmastart * * Description: @@ -247,26 +249,25 @@ void efm32_txdmasetup(DMA_HANDLE handle, uintptr_t paddr, uintptr_t maddr, * - DMA handle allocated by efm32_dmachannel() * - No DMA in progress * - ****************************************************************************/ + ************************************************************************************/ void efm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg); -/**************************************************************************** +/************************************************************************************ * Name: efm32_dmastop * * Description: - * Cancel the DMA. After efm32_dmastop() is called, the DMA channel is - * reset and efm32_dmasetup() must be called before efm32_dmastart() can be - * called again + * Cancel the DMA. After efm32_dmastop() is called, the DMA channel is reset and + * efm32_dmasetup() must be called before efm32_dmastart() can be called again * * Assumptions: * - DMA handle allocated by efm32_dmachannel() * - ****************************************************************************/ + ************************************************************************************/ void efm32_dmastop(DMA_HANDLE handle); -/**************************************************************************** +/************************************************************************************ * Name: efm32_dmasample * * Description: @@ -275,7 +276,7 @@ void efm32_dmastop(DMA_HANDLE handle); * Assumptions: * - DMA handle allocated by efm32_dmachannel() * - ****************************************************************************/ + ************************************************************************************/ #ifdef CONFIG_DEBUG_DMA void efm32_dmasample(DMA_HANDLE handle, struct efm32_dmaregs_s *regs); @@ -283,7 +284,7 @@ void efm32_dmasample(DMA_HANDLE handle, struct efm32_dmaregs_s *regs); # define efm32_dmasample(handle,regs) #endif -/**************************************************************************** +/************************************************************************************ * Name: efm32_dmadump * * Description: @@ -292,7 +293,7 @@ void efm32_dmasample(DMA_HANDLE handle, struct efm32_dmaregs_s *regs); * Assumptions: * - DMA handle allocated by efm32_dmachannel() * - ****************************************************************************/ + ************************************************************************************/ #ifdef CONFIG_DEBUG_DMA void efm32_dmadump(DMA_HANDLE handle, const struct efm32_dmaregs_s *regs, -- cgit v1.2.3