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

📄 csl_dmax.h

📁 基于ti tms320c672x下音频开发例子程式
💻 H
📖 第 1 页 / 共 3 页
字号:
/** @mainpage DMAX CSL 3.x
 *
 * @section Introduction
 *
 * @subsection xxx Purpose and Scope
 * The purpose of this document is to identify a set of common CSL APIs for
 * the DMAX 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 DMAX module. While other cases
 * this list of APIs may not be sufficient to cover all the features of a
 * particular DMAX 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
 *   -# DMAX: Data Movement Accelerator
 *
 * @subsection References
 *    -# CSL-001-DES, CSL 3.x Design Specification DocumentVersion 1.02
 *
 */

 /** @file csl_dmax.h
 *
 * @brief    Header file for functional layer of CSL
 *
 * Description
 *    - The different enumerations, structure definitions
 *      and function declarations
 *
 * Modification 
 *    - modified on: 10/Mar/2005
 *    - reason: Created the sources
 *
 * 
 * @author asr.
 *
 */

#ifndef _CSL_DMAX_H_
#define _CSL_DMAX_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <cslr.h>
#include <csl_error.h>
#include <soc.h>
#include <csl_types.h>
#include <cslr_dmax.h>

/**==========================================================================
* CSL Dmax Generic Pointers
*==========================================================================*/
/**
 * @brief Dmax Event Setup 
 */
typedef void * CSL_DmaxEventSetup;
/**
 * @brief DMAX Prameter Setup
 */
typedef void * CSL_DmaxParameterSetup;

/**
 * @brief   Invalid handle
 */

#define CSL_DMAX_BADHANDLE        					(0)

/**************************************************************************\
* DMAX global macro declarations
\**************************************************************************/
#define CFGBRIDGE *((volatile unsigned int *) (0x40000024))
/** DMAX Module ID */
#define CSL_DMAX_ID									(1)
/** DMAX First */
#define CSL_EDMAX_FIRST								(-(((CSL_DMAX_ID+1)<<5)+1))
/** DMAX Last */
#define CSL_EDMAX_LAST								(-((CSL_DMAX_ID+1)<<6))
/** DMAX Parameter Entry Full Error */
#define CSL_EDMAX_PARAM_ENTRY_FULL_ERROR			(CSL_EDMAX_FIRST-0)
/** DMAX Bad ESR Flag */
#define CSL_EDMAX_BAD_ESR_FLAG              		(CSL_EDMAX_FIRST-1)
/** DMAX Bad Event Type */
#define CSL_EDMAX_BAD_ETYPE                 		(CSL_EDMAX_FIRST-2)
/** DMAX Polarity Rising Edge */
#define CSL_DMAX_POLARITY_RISING_EDGE           	(0x00000001u)
/** DMAX polarity Falling Edge */
#define CSL_DMAX_POLARITY_FALLING_EDGE          	(0x00000000u)
/** DMAX word size */
#define CSL_DMAX_WORD_SIZE                      	(0x00000004u)
/** DMAX Transfer Complete split */
#define CSL_DMAX_TCC_SPLIT                      	(0x000000FFu)
/** DMAX High Priority Event */
#define CSL_DMAX_HIPRIORITY_EVENT_ANY				(0x1000FFFFu)
/** DMAX Low Priority Event */
#define CSL_DMAX_LOPRIORITY_EVENT_ANY				(0x2000FFFFu)
/** DMAX High Priority Parameter entry */
#define CSL_DMAX_HIPRIORITY_PARAMETERENTRY_ANY		(0x3000FFFFu)
/** DMAX Low Priority Parameter entry */
#define CSL_DMAX_LOPRIORITY_PARAMETERENTRY_ANY		(0x4000FFFFu)
/** DMAX High Priority */
#define CSL_DMAX_HI_PRIORITY                    	(0x00000001u)
/** DMAX FIFO Full */
#define CSL_DMAX_FIFO_FULL_MASK                     (0x01000000u)
/** DMAX FIFO Full shift */
#define CSL_DMAX_FIFO_FULL_SHIFT                    (0x00000018u)
/** DMAX FIFO UnderFlow mask*/
#define CSL_DMAX_FIFO_UNDERFLOW_MASK                (0x00000001u)
/** DMAX FIFO Underflow shift */
#define CSL_DMAX_FIFO_UNDERFLOW_SHIFT               (0x00000000u)
/** DMAX FIFO Nonsequential Underflow mask */
#define CSL_DMAX_FIFO_NONSEQUENTIAL_UNDERFLOW_MASK  (0x00000100u)
/** DMAX FIFO Nonsequential Underflow shift */
#define CSL_DMAX_FIFO_NONSEQUENTIAL_UNDERFLOW_SHIFT (0x00000008u)
/** DMAX FIFO OverFlow mask */
#define CSL_DMAX_FIFO_OVERFLOW_MASK                 (0x00010000u)
/** DMAX FIFO Overflow shift */
#define CSL_DMAX_FIFO_OVERFLOW_SHIFT                (0x00000010u)
/** DMAX Parameter Entry Size */
#define _CSL_DMAX_PARAM_ENTRY_SIZE		 			(11)
/** DMAX Parameter table entry Base offset */
#define CSL_DMAX_PTE_BASE_OFFSET                	(0x00000028u)
/** DMAX Event High Priority */
#define CSL_DMAX_EVENT_HI_PRIORITY              	(0x00000001u)
/** DMAX Event Low Priority */
#define CSL_DMAX_EVENT_LO_PRIORITY              	(0x00000000u)
/** DMAX Bad ESR Flag */
#define CSL_DMAX_BAD_ESR_FLAG   					(0x000000FFu)
/** DMAX ESR Fifo Error */
#define CSL_DMAX_ESR_FIFOERR_MASK               	(0x00000080u)
/** DMAX ESR Fifo Error */
#define CSL_DMAX_ESR_FIFOERR_SHIFT              	(0x00000007u)
/** DMAX Get Parameter Entry offset */
#define CSL_DMAX_GET_PARAM_ENTRY_OFFSET(uid)		(((uid) & 0xFFFFu)*_CSL_DMAX_PARAM_ENTRY_SIZE)
/**************************************************************************\
* DSMAX global typedef declarations
\**************************************************************************/

/** @brief This structure contains the necesary information to define the FIFO
 *         paramters for the reload address for the data transmission.
 *
*/
typedef struct {
	/** Linear Address */
    Uint32 linearAddr;
    /** Pointer to FIFO Descriptor */
	Uint32 pfd;
	/** Count Value */
	Uint32 count;
	/** Index0 Value */
	Uint32 indx0;
	/** Index1 Value */
	Uint32 indx1;
	/** Pointer to Dealy Table */
	Uint32 dtabPtr0;
	/** Poiter to Dealy Table */
	Uint32 dtabPtr1;
	/** Linear Reload0 Value */
	Uint32 linearReload0;
	/** Linear Reload1 Value */
	Uint32 linearReload1;
} CSL_DmaxFifoParam;

/** @brief This structure contains the necesary information to define the FIFO
 *         paramters for any FIFO that is used in dmax FIFO read/write operations
 *
 */
typedef struct {
	/** FIFO Base Address */
	Uint32 	fifoBaseAddr;
	/** FIFO Write Pointer */
	Uint32 	wPtr;
	/** FiFO Size */
	Uint32 	fifoSize;
	/** FIFO Read Pointer */
	Uint32 	rPtr;
	/** FIFO Full Watermark */
	Uint32 	fmark;
	/** FIFO Empty Watermark */
	Uint32 	emark;
	/** FIFO Error Field */
	Uint32 	efield;
} CSL_DmaxFifoDesc;

/** @brief This structure contains the necesary information to define the FIFO
 *      paramters for any FIFO that is used in dmax FIFO read/write operations
 *
 */
typedef struct {
	/** FIFO Base Address */
    Uint32 	fifoBaseAddr;
    /** FIFO Write Pointer */
    Uint32 	wPtr;
    /** FIFO Size */
    Uint32 	fifoSize;
    /** FIFO Read Pointer */
    Uint32 	rPtr;
    /** FIFO Full Watermark */
    Uint32 	fMark;
    /** FIFO Empty Watermark */
    Uint32 	eMark;
    /** FIFO Full Mark Status */
    Uint8  	fmsc;
    /** FIFO Empty Mark Status */
    Uint8  	emsc;
    /** FIFO Error Field */
    Uint8  	esize;
} CSL_DmaxFifoDescriptorSetup;

/** @brief This structure contains blank form for a FIFO descriptor object
 */
typedef struct {
	/** Word0 */
	Uint32 	word0;
	/** Word1 */
	Uint32 	word1;
	/** Word2 */
	Uint32 	word2;
	/** Word3 */
	Uint32 	word3;
	/** Word4 */
	Uint32 	word4;
	/** Word5 */
	Uint32 	word5;
	/** Word6 */
	Uint32 	word6;
} CSL_DmaxFifoDescriptor;

/** @brief This structure contains information for setting the active set of
 *          parameters in a general purpose trasnfer parameter entry.	
 *
 */
typedef struct {
	/** Active Source Address */
	Uint32 	activeSrc;
	/** Active Destination Address */
	Uint32 	activeDst;
	/** Active Count0 Value */
	Uint16 	activeCount0;
	/** Active Count1 Value */
	Uint16 	activeCount1;
	/** Active Count2 Value */
	Uint16 	activeCount2;
	/** Active Ping Pong Value */
	Uint8  	activePP;
} CSL_DmaxActiveSet;

/** @brief This structure contains the information necessary to perform HW setup
 *         for a general purpose data transfer request for dmax.
 */
typedef struct {
	/** Source Reload Address0 */
	Uint32 	srcReloadAddr0;
	/** Destination Reload Address0 */
    Uint32 	dstReloadAddr0;
    /** Source Reload Address1 */
    Uint32 	srcReloadAddr1;
    /** Destination Reload Address1 */
    Uint32 	dstReloadAddr1;
    /** Source Index0 Value */
    Int16 	srcIndex0;
    /** Destincation Index0 Value */
    Int16 	dstIndex0;
    /** Source Index1 Value */
    Int16 	srcIndex1;
    /** Destincation Index1 Value */
    Int16 	dstIndex1;
    /** Source Index2 Value */
    Int16 	srcIndex2;
    /** Destincation Index2 Value */
    Int16 	dstIndex2;
    /** Dimension 0 Count Value */
    Uint16 	count0;
    /** Dimension 1 Count Value */
    Uint16 	count1;
    /** Dimension 2 Count Value */
    Uint16 	count2;
} CSL_DmaxGPXFRParameterSetup;

/** @brief This structure contains the data items necessary to represent an
 *         FIFO R/W Parameter Entry in dmax Parameter RAM.
 *
 */
typedef struct {
	/** Pointer to FIFO Descriptor */
	Uint32 	pfd;
	/** Count0 Value */
	Uint16 	count0;
	/** Count1 Value */
	Uint16 	count1;
	/** Linear Index0 Value */
	Int16 	linearIndx0;
	/** Linear Index1 Value */
	Int16 	linearIndx1;
	/** Pointer to Dealy Table0 */
	Uint32 	delayTabPtr0;
	/** Pointer to Dealy Table1 */
	Uint32 	delayTabPtr1;
	/** Linear Reload0 Value */
	Uint32 	linearReload0;
	/** Linear Reload1 Value */
	Uint32 	linearReload1;
}CSL_DmaxFifoParameterSetup;

/** @brief This structure contains all data necessary to setup dmax for a 
 *         General Purpose data transfer request.
 *
 */
typedef struct {
	/** Event Type */
	Uint32 					etype;
	/** Pointer to parameterSetup */
	CSL_DmaxParameterSetup 	paramSetup;
	/** Quantum Transfer Size Limit */ 
    Uint8 					qtsl;
    /** Transfer Synchronization */
    Uint8 					sync;
    /** Transfer Complete Code */
    Uint8 					tcc;
    /** Alternate Transfer Mode Interrupt */
    Uint8 					atcint;
    /** Transfer Completion Interrupt */
    Uint8 					tcint;
    /** Reload */
    Uint8 					rload;
    /** Counter Configuration */
    Uint8 					cc;
    /** Element Size */
    Uint8 					esize;
    /** Pointer to Transfer Entry */
    Uint8 					pte;
} CSL_DmaxGPTransferEventSetup;
 
/** @brief This structure contains all data necessary to setup dmax for a 
 *         data transfer request.
 *
 */
typedef struct {
	/** Event Type */
	Uint32 					etype;
	/** Pointer to parameterSetup */
	CSL_DmaxParameterSetup 	paramSetup;
	/** Quantum Transfer Size Limit */ 	
    Uint8 					qtsl;
    /** Transfer Synchronization */    
    Uint8 					sync;
    /** Transfer Complete Code */    
    Uint8 					tcc;
    /** Alternate Transfer Mode Interrupt */    
    Uint8 					atcint;
    /** Transfer Completion Interrupt */    
    Uint8 					tcint;
    /** Reload */    
    Uint8 					rload;
	/** Water Mark Enable */    
    Uint8 					wmenab;
    /** Pointer to Transfer Entry */
    Uint8 					pte;
} CSL_DmaxFifoTransferEventSetup;

/** @brief This structure contains the information needed to perform HW setup
 *         for CPU interrupt requests.
 *
 */
 typedef struct {
	 /** Event Type */
	 Uint32 	etype;
	 /** CPU Interrupt Line */
     Uint8 		cpuInt;				
 }CSL_DmaxCpuintEventSetup;

/** @brief This object contains the reference to the instance of DMAX opened
 *         using in the @a CSL_dmaxOpen().
 *
 */
typedef struct CSL_DmaxAlloc {
	/** Maximum Count */
	Uint16		maxCount;
	/** Allocation Map */
	Uint32		allocMap;
} CSL_DmaxAlloc;	

/** @brief This object contains the reference to the instance of DMAX opened
 *  using in the @a CSL_dmaxOpen().
 *
 */
typedef struct CSL_DmaxResourceAlloc {
	/** Dmax High Priority Event */
	CSL_DmaxAlloc	cslDmaxHpecrAlloc;
	/** Dmax Low Priority Event */
	CSL_DmaxAlloc	cslDmaxLpecrAlloc;
	/** Dmax High Priority Parameter */
	CSL_DmaxAlloc	cslDmaxHpptAlloc;
	/** Dmax Low Priority Parameter */
	CSL_DmaxAlloc	cslDmaxLpptAlloc;
} CSL_DmaxResourceAlloc;	

/** @brief This object contains the reference to the instance of DMAX opened
 *  using the @a CSL_dmaxOpen().
 *
 *  The pointer to this, is passed to all DMAX CSL APIs.
 */
typedef struct CSL_DmaxObj {
	/** Pointer to entry in High Event Table reserved for this event */
	Uint32	*hiTableEventEntryPtr;
	/** Pointer to entry in Low Event Table reserved for this event */
	Uint32 	*loTableEventEntryPtr;
	/** Pointer to the dmax Registers */
    CSL_DmaxRegsOvly regs;
    /** Event Number */
    Uint32 	eventUid;
    /** Parameter Entry Number */
    Uint32 	paramUid;
    /** Pointer to the associated parameter entry */
    Uint8	paramPtr; 
    /** This is the instance of DMAX being referred to by this object  */
    CSL_InstNum perNum;
}CSL_DmaxObj;

/** @brief This will have the base-address information for the peripheral
 *  instance
 */
typedef struct {
    /** Base-address of the Configuration registers of DMAX.
     */
    CSL_DmaxRegsOvly 	regs;
} CSL_DmaxBaseAddress;

/** @brief DMAX specific parameters. Present implementation doesn't have
 *  any specific parameters.
 */
typedef struct {
    /** Bit mask to be used for module specific parameters.
     *  The below declaration is just a place-holder for future
     *  implementation.
     */
    CSL_BitMask16   flags;
} CSL_DmaxParam;

/** @brief DMAX specific parameters. Present implementation doesn't have

⌨️ 快捷键说明

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