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

📄 csl_edma2.h

📁 Dm6455 driver,magbe useful to you!
💻 H
📖 第 1 页 / 共 2 页
字号:
/*  ===========================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
 *
 *   Use of this software is controlled by the terms and conditions found
 *   in the license agreement under which this software has been supplied.
 *   ==========================================================================
 */

/** @file  csl_edma2.h
 *
 *  @path $(CSLPATH)\inc
 *
 *  @brief  Inline functions for CSL of EDMA
 *
 */

/** @mainpage EDMA CSL 2.x
 *
 * @section Introduction
 *
 * @subsection xxx Purpose and Scope
 * The purpose of this document is to identify a set of common CSL APIs for
 * the EDMA module across various devices. The CSL developer is expected to
 * refer to this document while designing APIs for these modules. Some of the
 * listed APIs may not be applicable to a given EDMA module. While other cases
 * this list of APIs may not be sufficient to cover all the features of a
 * particular EDMA Module. The CSL developer should use his discretion
 * designing new APIs or extending the existing ones to cover these.
 *
 * @subsection aaa Terms and Abbreviations
 *  -# CSL:  Chip Support Library
 *  -# API:  Application Programmer Interface
 *
 * @subsection References
 *  -# EDMA 3.0 CHANNEL CONTROLLER REVISION 3.0.2, SPRU234.pdf and SPRU401J.pdf
 *
 */

/*****************************************************************************\
* FILENAME...... csl_edma2.h
* DATE CREATED.. 06/11/1999
* LAST MODIFIED. 09/28/2005 Modified the EDMA channel 32 definition
*                09/16/2005 Changes according to the review comments
*                08/04/2005 Interrupt related API are modified to remove the
*                           calls to 'CSL_edma3Open'
*                08/03/2005 Modified to work with the EDMA 3.0.2 and renamed
*                           to cls_edma2.h
*                08/13/2004 Modified tccAllocTable type from static to
*                           global fn.
*                08/02/2004 - Adding support for C6418
*                04/16/2004 Modified tccAllocTable[0] entry to 0.
*                02/09/2004 Removed volatile variable type from EDMA_chain
*                           inline fn.
*                06/17/2003 added support for 6712C
*                05/28/2003 added support for 6711C
*                02/15/2002 added EDMA channel events 6713/DM642 - EDMA_map()
*                04/16/2001
\*****************************************************************************/
#ifndef _CSL_EDMA_2X_H_
#define _CSL_EDMA_2X_H_

#include <csl.h>
#include <csl_edma3.h>
#include <cslr_edma3cc.h>
#include <soc.h>


/*****************************************************************************\
* scope and inline control macros
\*****************************************************************************/
#ifdef __cplusplus
#define CSLAPI extern "C" far
#else
#define CSLAPI extern far
#endif

#undef  USEDEFS
#undef  IDECL
#undef  IDEF

#ifdef  _EDMA_MOD_
#define IDECL CSLAPI
#define USEDEFS
#define IDEF
#else
#ifdef  _INLINE
#define IDECL static inline
#define USEDEFS
#define IDEF  static inline
#else
#define IDECL CSLAPI
#endif
#endif

#define _EDMA_CHA_CNT         (64)
#define _QEDMA_PARAM_CNT      (1)       /* NOT the QDMA channel count */
#define _EDMA_BASE_PRAM       0x02A00000u
#define _EDMA_PRAM_START      ((_EDMA_BASE_PRAM) + 0x4000)
#define _EDMA_PRAM_SIZE       0x00002000u
#define _EDMA_PRAM_ERASE       0x00000800u

#define _EDMA_ENTRY_SIZE      0x00000020u
#define _EDMA_QDMA_PARAM      (_EDMA_PRAM_START+ \
                               _EDMA_ENTRY_SIZE*(_EDMA_CHA_CNT))

#define _EDMA_NULL_PARAM      (_EDMA_PRAM_START+ \
                       _EDMA_ENTRY_SIZE*(_EDMA_CHA_CNT + _QEDMA_PARAM_CNT))

#define _EDMA_RSVD_PARAM      (_EDMA_NULL_PARAM+_EDMA_ENTRY_SIZE)
#define _EDMA_LINK_START      (_EDMA_RSVD_PARAM+_EDMA_ENTRY_SIZE)
#define _EDMA_LINK_CNT        ((_EDMA_PRAM_SIZE/_EDMA_ENTRY_SIZE)- \
                       (_EDMA_CHA_CNT + _QEDMA_PARAM_CNT + 2 + 1))

#define _EDMA_SCRATCH_START   (_EDMA_LINK_START+ \
                       _EDMA_LINK_CNT*_EDMA_ENTRY_SIZE)

#define _EDMA_SCRATCH_SIZE    ((_EDMA_PRAM_START+_EDMA_PRAM_SIZE- \
                       _EDMA_SCRATCH_START) - (2 * sizeof(Uint32)))
 /*
  * Decrement by 8 (2 * sizeof(Uint32)) to not to use the words of the
  * PaRAM, that have reserved
  * fields, for the scratch purposes
  */

/*****************************************************************************\
* global macro declarations
\*****************************************************************************/
/** Number of EDMA channels */
#define EDMA_CHA_CNT              (_EDMA_CHA_CNT)

/** Number of PaRAM tables available */
#define EDMA_TABLE_CNT            (_EDMA_LINK_CNT)

/**
 * Argument used to allocate a unspecific resource of a type
 * @b Example: EDMA_open(EDMA_ALLOC_ANY, EDMA_OPEN_RESET);
 */
#define EDMA_ALLOC_ANY            (-1)

/** Reset flag passed to EDMA_open */
#define EDMA_OPEN_RESET           (0x00000001)

/**
 * Enable flag passed to EDMA_open, enables the particular channel to
 *  service events
 */
#define EDMA_OPEN_ENABLE          (0x00000002)

#define _EDMACC_REGS  _EDMA_BASE_PRAM
                           /* The base address of EDMA registers */

/** Macros for EDMA channels */

/** Use this to open any EDMA channel */
#define EDMA_CHA_ANY      -1

/** EDMA channel  0 */
#define EDMA_CHA_DSPINT   0
/** EDMA channel 1 */
#define EDMA_CHA_TINT0L   1
/** EDMA channel 2 */
#define EDMA_CHA_TINT0H   2
/** EDMA channel 3 */
#define EDMA_CHA_3        3
/** EDMA channel 4 */
#define EDMA_CHA_4        4
/** EDMA channel 5 */
#define EDMA_CHA_5        5
/** EDMA channel 6 */
#define EDMA_CHA_6        6
/** EDMA channel 7 */
#define EDMA_CHA_7        7
/** EDMA channel 8 */
#define EDMA_CHA_8        8
/** EDMA channel 9 */
#define EDMA_CHA_9        9
/** EDMA channel 10 */
#define EDMA_CHA_10       10
/** EDMA channel 11*/
#define EDMA_CHA_11       11
/** EDMA channel 12*/
#define EDMA_CHA_XEVT0    12
/** EDMA channel 13*/
#define EDMA_CHA_REVT0    13
/** EDMA channel 14*/
#define EDMA_CHA_XEVT1    14
/** EDMA channel 15*/
#define EDMA_CHA_REVT1    15
/** EDMA channel 16*/
#define EDMA_CHA_TINT1L   16
/** EDMA channel 17*/
#define EDMA_CHA_TINT1H   17
/** EDMA channel 18*/
#define EDMA_CHA_18       18
/** EDMA channel 19*/
#define EDMA_CHA_19       19
/** EDMA channel 20*/
#define EDMA_CHA_20       20
/** EDMA channel 21*/
#define EDMA_CHA_21       21
/** EDMA channel 22*/
#define EDMA_CHA_22       22
/** EDMA channel 23*/
#define EDMA_CHA_23       23
/** EDMA channel 24*/
#define EDMA_CHA_24       24
/** EDMA channel 25*/
#define EDMA_CHA_25       25
/** EDMA channel 26*/
#define EDMA_CHA_26       26
/** EDMA channel 27*/
#define EDMA_CHA_27       27
/** EDMA channel 28*/
#define EDMA_CHA_VCPREVT0 28
/** EDMA channel 29*/
#define EDMA_CHA_VCPXEVT0 29
/** EDMA channel 30*/
#define EDMA_CHA_TCPREVT0 30
/** EDMA channel 31*/
#define EDMA_CHA_TCPXEVT0 31
/** EDMA channel 32*/
#define EDMA_CHA_UREVT    32
/** EDMA channel 33*/
#define EDMA_CHA_33       33
/** EDMA channel 34*/
#define EDMA_CHA_34       34
/** EDMA channel 35*/
#define EDMA_CHA_35       35
/** EDMA channel 36*/
#define EDMA_CHA_36       36
/** EDMA channel 37*/
#define EDMA_CHA_37       37
/** EDMA channel 38*/
#define EDMA_CHA_38       38
/** EDMA channel 39*/
#define EDMA_CHA_39       39
/** EDMA channel 40*/
#define EDMA_CHA_UXEVT    40
/** EDMA channel 41*/
#define EDMA_CHA_41       41
/** EDMA channel 42*/
#define EDMA_CHA_42       42
/** EDMA channel 43*/
#define EDMA_CHA_43       43
/** EDMA channel 44*/
#define EDMA_CHA_ICREVT   44
/** EDMA channel 45*/
#define EDMA_CHA_ICXEVT   45
/** EDMA channel 46*/
#define EDMA_CHA_46       46
/** EDMA channel 47*/
#define EDMA_CHA_47       47
/** EDMA channel 48*/
#define EDMA_CHA_GPINT0   48
/** EDMA channel 49*/
#define EDMA_CHA_GPINT1   49
/** EDMA channel 50*/
#define EDMA_CHA_GPINT2   50
/** EDMA channel 51*/
#define EDMA_CHA_GPINT3   51
/** EDMA channel 52*/
#define EDMA_CHA_GPINT4   52
/** EDMA channel 53*/
#define EDMA_CHA_GPINT5   53
/** EDMA channel 54*/
#define EDMA_CHA_GPINT6   54
/** EDMA channel 55*/
#define EDMA_CHA_GPINT7   55
/** EDMA channel 56*/
#define EDMA_CHA_GPINT8   56
/** EDMA channel 57*/
#define EDMA_CHA_GPINT9   57
/** EDMA channel 58*/
#define EDMA_CHA_GPINT10  58
/** EDMA channel 59*/
#define EDMA_CHA_GPINT11  59
/** EDMA channel 60*/
#define EDMA_CHA_GPINT12  60
/** EDMA channel 61*/
#define EDMA_CHA_GPINT13  61
/** EDMA channel 62*/
#define EDMA_CHA_GPINT14  62
/** EDMA channel 63*/
#define EDMA_CHA_GPINT15  63


#define _EDMA_TYPE_C   (0x80000000)
#define _EDMA_TYPE_T   (0x40000000)
#define _EDMA_TYPE_Q   (0x20000000)
#define _EDMA_TYPE_S   (0x10000000)


#define _EDMA_MK_HANDLE(base,index,flags)    (EDMA_Handle)(\
  ((base)&0x0000FFFF)|(((index)<<16)&0x00FF0000)|((flags)&0xFF000000)\
)

/** Invalid handle */
#define EDMA_HINV     _EDMA_MK_HANDLE(0x00000000,0,0)

#define EDMA_HNULL    _EDMA_MK_HANDLE(_EDMA_NULL_PARAM,0,_EDMA_TYPE_T)
/** NULL function */
#define NULL_FUNC     0

/* Chaining Flag */
/** Macro for EDMA tranfer completion code interrupt */
#define EDMA_TCC_SET       1

/** Macro to clear EDMA transfer completion code interrupt */
#define EDMA_TCC_CLEAR     0

/** Macro for EDMA alternate tranfer completion code interrupt */
#define EDMA_ATCC_SET      1

/** Macro to clear EDMA alternate transfer completion code interrupt */
#define EDMA_ATCC_CLEAR    0

/* Wrapper macros  */
#define _EDMA_CHANNEL_HANDLE_2X_TO_3X(handle_2x) \
 EDMA_Wrapper_Data_Objs[(((Uint32)handle_2x & 0x00FF0000)>>16)].hChannel

#define _EDMA_MODULE_HANDLE    ((CSL_Edma3ccRegsOvly)_EDMACC_REGS)

#define _EDMA_CHANNEL_HANDLE_2X_TO_3X_PARAM_HANDLE(handle_2x) \
  ((CSL_Edma3ParamHandle)(&(_EDMA_MODULE_HANDLE->PARAMSET[(((Uint32)handle_2x \
    & 0x00FF0000)>>16)])))

#define _EDMA_CHANNEL_NUMBER(handle)    ((handle & 0x00FF0000) >> 16)

/*****************************************************************************\
* global typedef declarations
\*****************************************************************************/

/** EDMA handle returned by EDMA_open and EDMA_allocTable */
typedef Uint32 EDMA_Handle;

typedef struct
{
    CSL_Edma3ChannelObj ChObj;       /* EDMA per channel 3x object */
    CSL_Edma3ParamHandle param;      /* Corresponding EDMA PaRAM handle */
    CSL_Edma3ChannelHandle hChannel; /* EDMA channel handled returned by 3x */
} EDMA_Wrapper_Data;             /* This is to maintain the opened channel
                                   data and its handle required for the 3x */

extern EDMA_Wrapper_Data EDMA_Wrapper_Data_Objs[EDMA_CHA_CNT];

/* A global structure to maintain the EDMA object instance */
extern CSL_Edma3Obj edmaObj;

/** EDMA PaRAM configuration structure */
typedef struct
{
/** Options word of the configuration */
    Uint32 opt;
/** Source address word */
    Uint32 src;
/** Transfer count word */
    Uint32 cnt;
/** Destination address word */
    Uint32 dst;
/** Index configuration word */
    Uint32 idx;
/** Reload address and Link offset */
    Uint32 rld;

⌨️ 快捷键说明

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