1
0
Fork 0
forked from nuttx/nuttx-update

arch/arm/src/max326xx: Add framework for MAX326XX standard DMA support.

This commit is contained in:
Gregory Nutt 2018-11-20 08:08:28 -06:00
parent a588d64b45
commit 7a45fc6f1c
37 changed files with 603 additions and 78 deletions

View file

@ -141,15 +141,15 @@ void up_initialize(void)
#endif
#ifdef CONFIG_ARCH_DMA
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
/* Initialize the DMA subsystem if the weak function up_dma_initialize has been
* brought into the build
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (up_dmainitialize)
if (up_dma_initialize)
#endif
{
up_dmainitialize();
up_dma_initialize();
}
#endif

View file

@ -476,7 +476,7 @@ void lowconsole_init(void);
/* DMA **********************************************************************/
#ifdef CONFIG_ARCH_DMA
void weak_function up_dmainitialize(void);
void weak_function up_dma_initialize(void);
#endif
/* Cache control ************************************************************/

View file

@ -255,7 +255,7 @@ static int efm32_dmac_interrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -265,7 +265,7 @@ static int efm32_dmac_interrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
uint32_t regval;
int i;

View file

@ -736,7 +736,7 @@ static int imxrt_error_interrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -746,7 +746,7 @@ static int imxrt_error_interrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
uintptr_t regaddr;
uint32_t regval;

View file

@ -160,7 +160,7 @@ size_t kinetis_dmaresidual(DMA_HANDLE handle)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
int i;
uint32_t regval;

View file

@ -339,10 +339,10 @@ void lc823450_dma_test()
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
****************************************************************************/
void up_dmainitialize(void)
void up_dma_initialize(void)
{
int i;

View file

@ -269,7 +269,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the GPDMA subsystem. Called from up_initialize() early in the
@ -280,7 +280,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
uint32_t regval;
int ret;

View file

@ -269,7 +269,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the GPDMA subsystem. Called from up_initialize() early in the
@ -280,7 +280,7 @@ static int gpdma_interrupt(int irq, FAR void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
uint32_t regval;
int ret;

View file

@ -217,7 +217,7 @@ static int lpc54_dma_interrupt(int irq, FAR void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem. Called from up_initialize() early in the
@ -228,7 +228,7 @@ static int lpc54_dma_interrupt(int irq, FAR void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
int ret;

View file

@ -97,6 +97,7 @@ config ARCH_FAMILY_MAX32660
bool
default n
select ARCH_CORTEXM4
select MAX326XX_HAVE_DMA
select MAX326XX_HAVE_I2CS1
select MAX326XX_HAVE_SPIS1
select MAX326XX_HAVE_WDOG
@ -104,6 +105,10 @@ config ARCH_FAMILY_MAX32660
# Chip-Specific Peripheral support
config MAX326XX_HAVE_AES
bool
default n
config MAX326XX_HAVE_WDOG
bool
default n
@ -128,7 +133,7 @@ config MAX326XX_HAVE_CRC
bool
default n
config MAX326XX_HAVE_AES
config MAX326XX_HAVE_DMA
bool
default n
@ -404,8 +409,9 @@ config MAX326XX_ICC
select ARMV7M_HAVE_ICACHE
config MAX326XX_DMA
bool "DMA"
bool "Standard DMA"
default n
depends on MAX326XX_HAVE_DMA
config MAX326_GPIOIRQ
bool "GPIO Interrupt Support"

View file

@ -47,13 +47,40 @@
* Pre-processor Definitions
************************************************************************************/
/* Register Offsets *****************************************************************/
/* DMA Channels */
#define MAX326_DMA_CHAN0 0 /* DMA Channel 0 */
#define MAX326_DMA_CHAN1 1 /* DMA Channel 1 */
#define MAX326_DMA_CHAN2 2 /* DMA Channel 2 */
#define MAX326_DMA_CHAN3 3 /* DMA Channel 3 */
#define MAX326_DMA_NCHAN 4 /* Four DMA Channels */
#define MAX326_DMA_CHAN0 0 /* DMA Channel 0 */
#define MAX326_DMA_CHAN1 1 /* DMA Channel 1 */
#define MAX326_DMA_CHAN2 2 /* DMA Channel 2 */
#define MAX326_DMA_CHAN3 3 /* DMA Channel 3 */
#define MAX326_DMA_NCHAN 4 /* Four DMA Channels */
/* DMA priorities */
#define MAX326_DMAPRIO_LO 3 /* Lowest priority */
#define MAX326_DMAPRIO_MEDLO 2
#define MAX326_DMAPRIO_MEDHI 1
#define MAX326_DMAPRIO_HI 0 /* Highest priority */
/* DMA Prescaler */
#define MAX326_DMA_PS_DISABLE 0 /* Disable timer */
#define MAX326_DMA_PS_DIV256 1 /* fhclk / 256 */
#define MAX326_DMA_PS_DIV64K 2 /* fhclk / 64K */
#define MAX326_DMA_PS_DIV16M 3 /* fhclk / 16M */
/* DMA Timeouts */
#define MAX326_DMATO_3to4 0 /* 3-4 prescaler clocks */
#define MAX326_DMATO_7to8 1 /* 7-8 prescaler clocks */
#define MAX326_DMATO_15to16 2 /* 15-16 prescaler clocks */
#define MAX326_DMATO_31to82 3 /* 31-32 prescaler clocks */
#define MAX326_DMATO_63to64 4 /* 63-64 prescaler clocks */
#define MAX326_DMATO_127to128 5 /* 127-128 prescaler clocks */
#define MAX326_DMATO_255to256 6 /* 255-256 prescaler clocks */
#define MAX326_DMATO_511to512 7 /* 511-512 prescaler clocks */
/* Register Offsets *****************************************************************/
/* DMA Control Registers */
@ -118,26 +145,30 @@
#define DMACH_CFG_CHEN (1 << 0) /* Bit nn: Channel Enable */
#define DMACH_CFG_RLDEN (1 << 1) /* Bit nn: Reload Enable */
#define DMACH_CFG_PRI_SHIFT (2) /* Bits 2-3: DMA priority */
#define DMACH_CFG_PRI_MASK (xx << DMACH_CFG_PRI_SHIFT)
#define DMACH_CFG_PRI_MASK (3 << DMACH_CFG_PRI_SHIFT)
# define DMACH_CFG_PRI(n) ((uint32_t)(n) << DMACH_CFG_PRI_SHIFT)
# define DMACH_CFG_PRI_LO (3 << DMACH_CFG_PRI_SHIFT)
# define DMACH_CFG_PRI_MEDLO (2 << DMACH_CFG_PRI_SHIFT)
# define DMACH_CFG_PRI_MEDHI (1 << DMACH_CFG_PRI_SHIFT)
# define DMACH_CFG_PRI_HI (0 << DMACH_CFG_PRI_SHIFT)
#define DMACH_CFG_REQSEL_SHIFT (4) /* Bits 4-9: Request Select */
#define DMACH_CFG_REQSEL_MASK (0x3f << DMACH_CFG_REQSEL_SHIFT)
# define DMACH_CFG_REQSEL_LO (3 << DMACH_CFG_REQSEL_SHIFT)
# define DMACH_CFG_REQSEL_MEDLO (2 << DMACH_CFG_REQSEL_SHIFT)
# define DMACH_CFG_REQSEL_MEDHI (1 << DMACH_CFG_REQSEL_SHIFT)
# define DMACH_CFG_REQSEL_HI (0 << DMACH_CFG_REQSEL_SHIFT)
# define DMACH_CFG_REQSEL(n) ((uint32_t)(n) << DMACH_CFG_REQSEL_SHIFT)
#define DMACH_CFG_REQWAIT (1 << 10) /* Bit 10: Request Wait Enable */
#define DMACH_CFG_TOSEL_SHIFT (11) /* Bits 11-13: Time-Out Select */
#define DMACH_CFG_TOSEL_MASK (7 << DMACH_CFG_TOSEL_SHIFT)
# define DMACH_CFG_TOSEL_ 3to4 (0 << DMACH_CFG_TOSEL_SHIFT) /* 3-4 */
# define DMACH_CFG_TOSEL_ 7to8 (1 << DMACH_CFG_TOSEL_SHIFT) /* 7-8 */
# define DMACH_CFG_TOSEL_ 15to16 (2 << DMACH_CFG_TOSEL_SHIFT) /* 15-16 */
# define DMACH_CFG_TOSEL_ 31to82 (3 << DMACH_CFG_TOSEL_SHIFT) /* 31-32 */
# define DMACH_CFG_TOSEL_ 63to64 (4 << DMACH_CFG_TOSEL_SHIFT) /* 63-64 */
# define DMACH_CFG_TOSEL_ 127to128 (5 << DMACH_CFG_TOSEL_SHIFT) /* 127-128 */
# define DMACH_CFG_TOSEL_ 255to256 (6 << DMACH_CFG_TOSEL_SHIFT) /* 255-256 */
# define DMACH_CFG_TOSEL_ 511to512 (7 << DMACH_CFG_TOSEL_SHIFT) /* 511-512 */
# define DMACH_CFG_TOSEL(n) ((uint32_t)(n) << DMACH_CFG_TOSEL_SHIFT)
# define DMACH_CFG_TOSEL_3to4 (0 << DMACH_CFG_TOSEL_SHIFT) /* 3-4 */
# define DMACH_CFG_TOSEL_7to8 (1 << DMACH_CFG_TOSEL_SHIFT) /* 7-8 */
# define DMACH_CFG_TOSEL_15to16 (2 << DMACH_CFG_TOSEL_SHIFT) /* 15-16 */
# define DMACH_CFG_TOSEL_31to82 (3 << DMACH_CFG_TOSEL_SHIFT) /* 31-32 */
# define DMACH_CFG_TOSEL_63to64 (4 << DMACH_CFG_TOSEL_SHIFT) /* 63-64 */
# define DMACH_CFG_TOSEL_127to128 (5 << DMACH_CFG_TOSEL_SHIFT) /* 127-128 */
# define DMACH_CFG_TOSEL_255to256 (6 << DMACH_CFG_TOSEL_SHIFT) /* 255-256 */
# define DMACH_CFG_TOSEL_511to512 (7 << DMACH_CFG_TOSEL_SHIFT) /* 511-512 */
#define DMACH_CFG_PSSEL_SHIFT (14) /* Bits 14-15: Pre-Scale Select */
#define DMACH_CFG_PSSEL_MASK (3 << DMACH_CFG_PSSEL_SHIFT)
# define DMACH_CFG_PSSEL(n) ((uint32_t)(n) << DMACH_CFG_PSSEL_SHIFT)
# define DMACH_CFG_PSSEL_DISABLE (0 << DMACH_CFG_PSSEL_SHIFT) /* Disable timer */
# define DMACH_CFG_PSSEL_DIV256 (1 << DMACH_CFG_PSSEL_SHIFT) /* fhclk / 256 */
# define DMACH_CFG_PSSEL_DIV64K (2 << DMACH_CFG_PSSEL_SHIFT) /* fhclk / 64K */
@ -146,14 +177,14 @@
# define DMACH_CFG_SRCWD_1BYTE (0 << DMACH_CFG_SRCWD_SHIFT)
# define DMACH_CFG_SRCWD_2BYTES (1 << DMACH_CFG_SRCWD_SHIFT)
# define DMACH_CFG_SRCWD_4BYTES (2 << DMACH_CFG_SRCWD_SHIFT)
#define DMACH_CFG_SRINC (1 << 18) /* Bit 18: Source Increment
#define DMACH_CFG_SRCINC (1 << 18) /* Bit 18: Source Increment
* Enable */
#define DMACH_CFG_DSTWD_SHIFT (20) /* Bits 20-21: Destination Width */
#define DMACH_CFG_DSTWD_MASK (3 << DMACH_CFG_DSTWD_SHIFT)
# define DMACH_CFG_DSTWD_1BYTE (0 << DMACH_CFG_DSTWD_SHIFT)
# define DMACH_CFG_DSTWD_2BYTES (1 << DMACH_CFG_DSTWD_SHIFT)
# define DMACH_CFG_DSTWD_4BYTES (2 << DMACH_CFG_DSTWD_SHIFT)
#define DMACH_CFG_DISTINC (1 << 22) /* Bit 22: Destination Increment
#define DMACH_CFG_DSTINC (1 << 22) /* Bit 22: Destination Increment
* Enable */
#define DMACH_CFG_BRST_SHIFT (24) /* Bits 24-28: Burst Size */
#define DMACH_CFG_BRST_MASK (31 << DMACH_CFG_BRST_SHIFT)

View file

@ -43,6 +43,7 @@
#include <assert.h>
#include "up_arch.h"
#include "chip/max326_icc.h"
#include "max326_periphclks.h"
#include "max326_icc.h"

View file

@ -0,0 +1,210 @@
/****************************************************************************
* arch/arm/src/max32660/max326_dma.c
*
* Copyright (C) 2018 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/irq.h>
#include "up_arch.h"
#include "max326_dma.h"
#ifdef CONFIG_MAX326_DMA
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: stm32_dmainitialize
*
* Description:
* Initialize the DMA subsystem
*
* Returned Value:
* None
*
****************************************************************************/
void weak_function up_dma_initialize(void)
{
}
/****************************************************************************
* Name: max326_dma_channel
*
* Description:
* Allocate a DMA channel.
*
* Returned Value:
* If a DMA channel is available, this function returns a non-NULL, void*
* DMA channel handle. NULL is returned on any failure.
*
****************************************************************************/
DMA_HANDLE max326_dma_channel(void)
{
}
/****************************************************************************
* Name: max326_dma_free
*
* Description:
* Release a DMA channel. NOTE: The 'handle' used in this argument must
* NEVER be used again until max326_dma_channel() is called again to re-gain
* a valid handle.
*
* Returned Value:
* None
*
****************************************************************************/
void max326_dma_free(DMA_HANDLE handle)
{
}
/****************************************************************************
* Name: max326_dma_setup
*
* Description:
* Configure DMA for one transfer.
*
* NOTE that an image of the DMA CFG is a required input. Only the
* following fields need be provided however. The DMA logic will handle
* the rest.
*
****************************************************************************/
int max326_dma_setup(DMA_HANDLE handle, uint32_t cfg, uint32_t saddr,
uint32_t daddr, size_t nbytes)
{
}
/****************************************************************************
* Name: max326_dma_setup
*
* Description:
* Append one buffer to the DMA chain. max326_dma_setup() should have
* been called to set up the first buffer. This function may be called
* to chain the DMA to a second buffer. This is done by setting the
* source, destination, and count reload registers.
*
* REVISIT: Currently, the implementation is limited to a single
* appended buffer in the chain.
*
****************************************************************************/
int max326_dma_setup(DMA_HANDLE handle, uint32_t saddr, uint32_t daddr,
size_t nbytes)
{
}
/****************************************************************************
* Name: max326_dmastart
*
* Description:
* Start the DMA transfer
*
****************************************************************************/
int max326_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
{
}
/****************************************************************************
* Name: max326_dmastop
*
* Description:
* Cancel the DMA. After max326_dmastop() is called, the DMA channel is
* reset and max326_dma_setup() must be called before max326_dmastart() can
* be called again
*
****************************************************************************/
void max326_dmastop(DMA_HANDLE handle)
{
}
/****************************************************************************
* Name: max326_dmasample
*
* Description:
* Sample DMA register contents
*
****************************************************************************/
#ifdef CONFIG_DEBUG_DMA_INFO
void max326_dmasample(DMA_HANDLE handle, struct max326_dmaregs_s *regs)
{
}
#endif
/****************************************************************************
* Name: max326_dmadump
*
* Description:
* Dump previously sampled DMA register contents
*
****************************************************************************/
#ifdef CONFIG_DEBUG_DMA_INFO
void max326_dmadump(DMA_HANDLE handle, const struct max326_dmaregs_s *regs,
const char *msg)
{
}
#endif
#endif /* CONFIG_MAX326_DMA */

View file

@ -0,0 +1,226 @@
/****************************************************************************
* arch/arm/src/max326xx/max32660_dma.h
*
* Copyright (C) 2018 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_MAX436XX_MAX32660_MAX32660_DMA_H
#define __ARCH_ARM_SRC_MAX436XX_MAX32660_MAX32660_DMA_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/* DMA channel handle and DMA completion callback function */
typedef FAR void *DMA_HANDLE;
typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result);
/* The following is used for sampling DMA registers when CONFIG DEBUG_DMA is
* selected
*/
#ifdef CONFIG_DEBUG_DMA_INFO
struct max326_dmaregs_s
{
/* Global Registers */
uint32_t inten; /* DMA Control register */
uint32_t intfl; /* DMA Interrupt Status register */
/* Channel Registers */
uint32_t cfg; /* DMA Channel Configuration Register */
uint32_t stat; /* DMA Channel Status Register */
uint32_t src; /* DMA Channel Source Register */
uint32_t dst; /* DMA Channel Destination Register */
uint32_t cnt; /* DMA Channel Count Register */
uint32_t srcrld; /* DMA Channel Source Reload Register */
uint32_t dstrld; /* DMA Channel Destination Reload Register */
uint32_t cntrld; /* DMA Channel Count Reload Register */
};
#endif
/****************************************************************************
* Inline Functions
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: max326_dma_channel
*
* Description:
* Allocate a DMA channel.
*
* Returned Value:
* If a DMA channel is available, this function returns a non-NULL, void*
* DMA channel handle. NULL is returned on any failure.
*
****************************************************************************/
DMA_HANDLE max326_dma_channel(void);
/****************************************************************************
* Name: max326_dma_free
*
* Description:
* Release a DMA channel. NOTE: The 'handle' used in this argument must
* NEVER be used again until max326_dma_channel() is called again to re-gain
* a valid handle.
*
* Returned Value:
* None
*
****************************************************************************/
void max326_dma_free(DMA_HANDLE handle);
/****************************************************************************
* Name: max326_dma_setup
*
* Description:
* Configure DMA for one transfer.
*
* NOTE that an image of the DMA CFG is a required input. Only the
* following fields need be provided however. The DMA logic will handle
* the rest.
*
****************************************************************************/
int max326_dma_setup(DMA_HANDLE handle, uint32_t cfg, uint32_t saddr,
uint32_t daddr, size_t nbytes);
/****************************************************************************
* Name: max326_dma_setup
*
* Description:
* Append one buffer to the DMA chain. max326_dma_setup() should have
* been called to set up the first buffer. This function may be called
* to chain the DMA to a second buffer. This is done by setting the
* source, destination, and count reload registers.
*
* REVISIT: Currently, the implementation is limited to a single
* appended buffer in the chain.
*
****************************************************************************/
int max326_dma_setup(DMA_HANDLE handle, uint32_t saddr, uint32_t daddr,
size_t nbytes);
/****************************************************************************
* Name: max326_dmastart
*
* Description:
* Start the DMA transfer
*
****************************************************************************/
int max326_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
/****************************************************************************
* Name: max326_dmastop
*
* Description:
* Cancel the DMA. After max326_dmastop() is called, the DMA channel is
* reset and max326_dma_setup() must be called before max326_dmastart() can
* be called again
*
****************************************************************************/
void max326_dmastop(DMA_HANDLE handle);
/****************************************************************************
* Name: max326_dmasample
*
* Description:
* Sample DMA register contents
*
****************************************************************************/
#ifdef CONFIG_DEBUG_DMA_INFO
void max326_dmasample(DMA_HANDLE handle, struct max326_dmaregs_s *regs);
#else
# define max326_dmasample(handle,regs)
#endif
/****************************************************************************
* Name: max326_dmadump
*
* Description:
* Dump previously sampled DMA register contents
*
****************************************************************************/
#ifdef CONFIG_DEBUG_DMA_INFO
void max326_dmadump(DMA_HANDLE handle, const struct max326_dmaregs_s *regs,
const char *msg);
#else
# define max326_dmadump(handle,regs,msg)
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM_SRC_MAX436XX_MAX32660_MAX32660_DMA_H */

View file

@ -0,0 +1,51 @@
/****************************************************************************
* arch/arm/src/max326xx/max326_dma.h
*
* Copyright (C) 2018 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
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_MAX436XX_MAX326_DMA_H
#define __ARCH_ARM_SRC_MAX436XX_MAX326_DMA_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/* Standard DMA is only available for the MAX32660 */
#ifdef (CONFIG_ARCH_FAMILY_MAX32660)
# include "max32660/max32660_dma.h"
#ednif
#endif /* __ARCH_ARM_SRC_MAX436XX_MAX326_DMA_H */

View file

@ -1353,7 +1353,7 @@ static int sam_dmainterrupt(int irq, void *context, FAR void *arg)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -1363,7 +1363,7 @@ static int sam_dmainterrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
dmainfo("Initialize DMAC0\n");

View file

@ -1898,7 +1898,7 @@ void sam_dmainitialize(struct sam_dmac_s *dmac)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -1908,7 +1908,7 @@ void sam_dmainitialize(struct sam_dmac_s *dmac)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
#ifdef CONFIG_SAMA5_DMAC0
dmainfo("Initialize DMAC0\n");

View file

@ -1925,7 +1925,7 @@ void sam_dmainitialize(struct sam_xdmac_s *xdmac)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -1935,7 +1935,7 @@ void sam_dmainitialize(struct sam_xdmac_s *xdmac)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
#ifdef CONFIG_SAMA5_XDMAC0
dmainfo("Initialize XDMAC0\n");

View file

@ -790,7 +790,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr,
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -800,7 +800,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr,
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
dmainfo("Initialize DMAC\n");
int i;

View file

@ -760,7 +760,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr,
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -770,7 +770,7 @@ static int sam_rxbuffer(struct sam_dmach_s *dmach, uint32_t paddr,
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
dmainfo("Initialize DMAC\n");
int i;

View file

@ -1611,7 +1611,7 @@ void sam_dmainitialize(struct sam_xdmac_s *xdmac)
****************************************************************************/
/****************************************************************************
* Name: up_dmainitialize
* Name: up_dma_initialize
*
* Description:
* Initialize the DMA subsystem
@ -1621,7 +1621,7 @@ void sam_dmainitialize(struct sam_xdmac_s *xdmac)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
dmainfo("Initialize XDMAC\n");

View file

@ -343,7 +343,7 @@ static int stm32_dmainterrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
struct stm32_dma_s *dmach;
int chndx;

View file

@ -473,7 +473,7 @@ static int stm32_dmainterrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
struct stm32_dma_s *dmast;
int stream;

View file

@ -291,7 +291,7 @@ static int stm32_dmainterrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
struct stm32_dma_s *dmach;
int chndx;

View file

@ -472,7 +472,7 @@ static int stm32_dmainterrupt(int irq, void *context, void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
struct stm32_dma_s *dmast;
int stream;

View file

@ -475,7 +475,7 @@ static int stm32_dmainterrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
struct stm32_dma_s *dmast;
int stream;

View file

@ -342,7 +342,7 @@ static int stm32l4_dmainterrupt(int irq, void *context, FAR void *arg)
*
****************************************************************************/
void weak_function up_dmainitialize(void)
void weak_function up_dma_initialize(void)
{
struct stm32l4_dma_s *dmach;
int chndx;

View file

@ -183,15 +183,15 @@ void up_initialize(void)
#endif
#ifdef CONFIG_ARCH_DMA
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
/* Initialize the DMA subsystem if the weak function up_dma_initialize has been
* brought into the build
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (up_dmainitialize)
if (up_dma_initialize)
#endif
{
up_dmainitialize();
up_dma_initialize();
}
#endif

View file

@ -125,7 +125,7 @@ extern uint32_t _ebss; /* End+1 of .bss */
void up_irqinitialize(void);
#ifdef CONFIG_ARCH_DMA
void weak_function up_dmainitialize(void);
void weak_function up_dma_initialize(void);
#endif
void up_sigdeliver(void);
void up_lowputc(char ch);

View file

@ -105,15 +105,15 @@ void up_initialize(void)
#endif
#ifdef CONFIG_ARCH_DMA
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
/* Initialize the DMA subsystem if the weak function up_dma_initialize has been
* brought into the build
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (up_dmainitialize)
if (up_dma_initialize)
#endif
{
up_dmainitialize();
up_dma_initialize();
}
#endif

View file

@ -192,7 +192,7 @@ void up_addregion(void);
/* Sub-system/driver initialization */
#ifdef CONFIG_ARCH_DMA
void weak_function up_dmainitialize(void);
void weak_function up_dma_initialize(void);
#endif
void up_wdtinit(void);

View file

@ -107,15 +107,15 @@ void up_initialize(void)
#endif
#ifdef CONFIG_ARCH_DMA
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
/* Initialize the DMA subsystem if the weak function up_dma_initialize has been
* brought into the build
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (up_dmainitialize)
if (up_dma_initialize)
#endif
{
up_dmainitialize();
up_dma_initialize();
}
#endif

View file

@ -222,7 +222,7 @@ void up_clrpend_irq(int irq);
/* DMA */
#ifdef CONFIG_ARCH_DMA
void weak_function up_dmainitialize(void);
void weak_function up_dma_initialize(void);
#endif
/* Memory management */

View file

@ -200,15 +200,15 @@ void up_initialize(void)
#endif
#ifdef CONFIG_ARCH_DMA
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
/* Initialize the DMA subsystem if the weak function up_dma_initialize has been
* brought into the build
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (up_dmainitialize)
if (up_dma_initialize)
#endif
{
up_dmainitialize();
up_dma_initialize();
}
#endif

View file

@ -320,7 +320,7 @@ void lowconsole_init(void);
/* DMA **********************************************************************/
#ifdef CONFIG_ARCH_DMA
void weak_function up_dmainitialize(void);
void weak_function up_dma_initialize(void);
#endif
/* Cache control ************************************************************/

View file

@ -107,15 +107,15 @@ void up_initialize(void)
#endif
#ifdef CONFIG_ARCH_DMA
/* Initialize the DMA subsystem if the weak function up_dmainitialize has been
/* Initialize the DMA subsystem if the weak function up_dma_initialize has been
* brought into the build
*/
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
if (up_dmainitialize)
if (up_dma_initialize)
#endif
{
up_dmainitialize();
up_dma_initialize();
}
#endif

View file

@ -179,7 +179,7 @@ void up_savestate(uint32_t *regs);
void up_decodeirq(uint32_t *regs);
void up_irqinitialize(void);
#ifdef CONFIG_ARCH_DMA
void weak_function up_dmainitialize(void);
void weak_function up_dma_initialize(void);
#endif
int up_saveusercontext(uint32_t *saveregs);
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;