⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lh7a404_dma_driver.h

📁 在sharp 404开发板的串口测试代码
💻 H
字号:
/***********************************************************************
 * $Workfile:   lh7a404_dma_driver.h  $
 * $Revision:   1.0  $
 * $Author:   WellsK  $
 * $Date:   Dec 04 2003 17:38:32  $
 *
 * Project: LH7A404 DMA driver
 *
 * Description:
 *     This file contains driver support for the DMA module on the
 *     LH7A404
 *
 * Notes:
 *     DMA memory to memory operations are not yet implemented. These
 *     will be implemented in a later version of this driver.
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a404/include/lh7a404_dma_driver.h-arc  $
 * 
 *    Rev 1.0   Dec 04 2003 17:38:32   WellsK
 * Initial revision.
 * 
 *
 ***********************************************************************
 * SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
 * OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
 * AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES, 
 * SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
 *
 * SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY 
 * FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A 
 * SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
 * FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
 *
 * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
 *     CAMAS, WA
 **********************************************************************/

#ifndef LH7A404_DMA_DRIVER_H
#define LH7A404_DMA_DRIVER_H

#ifdef __cplusplus
extern "C" {
#endif

#include "lh7a404_dmac.h"

/***********************************************************************
 * DMA driver types
 **********************************************************************/

/* DMA channel enumeration */
typedef enum
{
    DMAC_USB_RX,       /* DMA USB RX channel */
    DMAC_USB_TX,       /* DMA USB TX channel */
    DMAC_SDMMC_RX,     /* DMA SDMMC RX channel */
    DMAC_SDMMC_TX,     /* DMA SDMMC TX channel */
    DMAC_AAC_RX1,      /* DMA AC97 RX channel 1 */
    DMAC_AAC_TX1,      /* DMA AC97 TX channel 1 */
    DMAC_AAC_RX2,      /* DMA AC97 TX channel 2 */
    DMAC_AAC_TX2,      /* DMA AC97 RX channel 2 */
    DMAC_AAC_RX3,      /* DMA AC97 RX channel 3 */
    DMAC_AAC_TX3,      /* DMA AC97 TX channel 3 */
    DMAC_UART_RX1,     /* DMA UART RX channel 1 */
    DMAC_UART_TX1,     /* DMA UART TX channel 1 */
    DMAC_UART_RX2,     /* DMA UART RX channel 2 */
    DMAC_UART_TX2,     /* DMA UART TX channel 2 */
    DMAC_UART_RX3,     /* DMA UART RX channel 3 */
    DMAC_UART_TX3,     /* DMA UART TX channel 3 */
    DMAC_CHANNEL_NONE  /* DMA channel delimiter */
} DMAC_CHANNEL_T;

/* This type is a function pointer to a callback function the DMA
   driver will call when it needs more data to keep the DMA stream
   going. This function type is only used with the dmac_start_using_cb()
   function when starting DMA transfers that use callbacks. For a user
   of this driver function, another function needs to be defined with
   the following prototype. For a receive and transmit channel, this
   function requires different arguments:
   For transmit:
       Argument 1 is a pointer to a buffer to get data from the
           callback
       Argument 2 is a pointer to a UNS_32. The value contains the
           number of bytes that were transferred in the last DMA
           transfer when calling the callback function. The value will
           contain the number of bytes to transfer in the buffer when
           returning from the callback function. This value should never
           be more than 64KBytes and should be a multiple of 4.
       Argument 3 is a pointer to a boolean flag. The flag value will
           be sent as TRUE to the callback if the DMA transfer was
           aborted due to an error. The callback must return the flag
           as TRUE if it wants to abort the transfer.
   For receive:
       Argument 1 is a pointer to a buffer that is allocated by the
           callback function. The DMA data will be placed into this
           area.
       Argument 2 is a pointer to a UNS_32. The value contains the
           number of bytes that were transferred in the last DMA
           transfer when calling the callback function. The value will
           contain the number of bytes to transfer in the buffer when
           returning from the callback function. This value should never
           be more than 64KBytes and should be a multiple of 4.
       Argument 3 is a pointer to a boolean flag. The flag value will
           be sent as TRUE to the callback if the DMA transfer was
           aborted due to an error. The callback must return the flag
           as TRUE if it wants to abort the transfer. */
typedef void (*DMACFUNC_T) (void *,     /* Address to place data */
                            UNS_32 *,   /* Requested # of bytes */
                            BOOL_32 *); /* Abort flag */

/* DMA channel status types */
typedef enum
{
    DMA_DISABLED,       /* DMA channel is disabled */
    DMA_ERROR,          /* Error occured on DMA channel */
    DMA_ENABLED,        /* DMA channel is enabled, not stalled or
                           waiting for next buffer */
    DMA_STALLED,        /* DMA channel is stalled */
    DMA_NEXT_BUFFER     /* DMA channel is enabled and waiting for
                           next buffer */
} DMAC_STATUS_T;

/***********************************************************************
 * DMA driver functions
 **********************************************************************/

/* Start a DMA channel transfer using a callback function */
BOOL_32 dmac_start_using_cb(DMAC_CHANNEL_T channel,
                         DMACFUNC_T dcb_func,
                         BOOL_32 no_terminate);

/* Start a DMA channel transfer using a set buffer size */
BOOL_32 dmac_start(DMAC_CHANNEL_T channel,
                void *buffer,
                UNS_32 bytes,
                BOOL_32 no_terminate);

/* Force a stalled channel to restart */
void dmac_restart(DMAC_CHANNEL_T channel);

/* Stop and deallocate a DMA channel */
void dmac_stop(DMAC_CHANNEL_T channel);

/* Return a DMA channel status */
DMAC_STATUS_T dmac_get_status(DMAC_CHANNEL_T channel);

/* DMA interrupt enable and disable */
void dmac_channel_int_enable(DMAC_CHANNEL_T channel,
                             BOOL_32 enable);

/* DMA interrupt handler */
void dmac_isr(void);

#endif /* LH7A404_DMA_DRIVER_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -