📄 csl_idma.h
字号:
/* ============================================================================
* 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.
* ===========================================================================
*/
/*---------------------------------------------------------------------*/
/* NAME */
/* idma.h */
/* */
/* REVISION HISTORY: */
/* 03-25-04...Initial version of Channel 1 routines.......S.Jagadeesh */
/* 05-20-04...Integration of CSL Register Layer...........C.Courtney */
/* 06-10-04...Changed Return Types of all functions except Open to */
/* Status......................................C.Courtney */
/* 06-14-04...Removed Open/Close APIs and re-implemented Init API */
/* Also redocumented...........................C.Courtney */
/* */
/* DESCRIPTION: */
/* This file contains various function defeinitions that define a */
/* IDMA (Internal DMA) for GEM. Functions for Channel0 contain */
/* support for transferring from GEM internal memory to memory */
/* hooked to Config space. Channel 1 functions contain support */
/* for paging from local memories. These may be from Level 1 */
/* data memory to Level 2 memory or shared L2 memory. */
/* */
/* PRIVATE DATA STRUCTURES: */
/* */
/* Private data structures are defined in the header file "idma.h" */
/* and are shown below: */
/* */
/* typedef struct idma1_handle */
/* { */
/* unsigned int status; */
/* unsigned int reserved; */
/* unsigned int *src; */
/* unsigned int *dst; */
/* unsigned int cnt; */
/* }IDMA1_handle; */
/* */
/* This handle holds all the descriptors needed to issue a Channel 1 */
/* transfer. In the routines shown below, the cnt register */
/* fields of this structure is used to hold information regarding */
/* the priority of IDMA relative to CPU, and whether interrupt is */
/* desired or not. Once these properties are set in the IDMA1_init() */
/* function, all transfers performed on Channel 1, use this field */
/* to submit transfers, unless they are re-configured again by */
/* seperate calls to setpriority and setInt. */
/* */
/* The following configuration structure holds all the fields needed */
/* to describe a Channel 0 transfer and has trhe following structure. */
/* */
/* typedef struct idma0_config */
/* { */
/* unsigned int status; */
/* unsigned int mask; */
/* unsigned int *src; */
/* unsigned int *dst; */
/* unsigned int cnt; */
/* }IDMA0_Config; */
/* */
/* The "src" contains the start address in internal memory or */
/* configspace, the "dst" contains the destination address in */
/* configspace or internal memory respectively. Transfers from */
/* configspace to configspace using Channel 1 will raise an */
/* exception. The mask is a 32-bit field of 1-hot encoding of */
/* registers to access within the 32-bit register window. The cnt */
/* register fields of this structure is used to hold information */
/* regarding whether interrupt is desired or not. Along with the */
/* the number of 32-bit fields will be transfered */
/* */
/* FUNCTIONS SUPPORTED: */
/* */
/* CHANNEL 0: */
/* */
/* void IDMA0_config( IDMA_Config *config): This function performs */
/* a Channel 0 transfer using the paremeters contained in the */
/* configuration structure pointer "config". */
/* */
/* void IDMA0_configArgs */
/* ( */
/* Uint32 mask, */
/* Uint32 *src, */
/* Uint32 *dst, */
/* Uint8 cnt */
/* ) */
/* */
/* This function issues a Channel 0 transfer from source "src" */
/* to destination "dst" performing "cnt" 32-word transfers in */
/* which the individual 32-word transfers are controlled by a */
/* "1-hot" encoding in a 32-bit field "mask". "src" and "dst" */
/* must be word aligned, cnt must be <=15. */
/* */
/* */
/* Uint32 IDMA0_getStatus(): This function returns the ACTV */
/* and PEND bits. */
/* */
/* Uint32 IDMA0_wait(): This function waits for all previous */
/* transfers on Channel 0 to complete by waiting for ACTV == 0 */
/* && PEND==0. */
/* */
/* int IDMA0_setInt(interrupt): This function is used to set */
/* the IDMA to interrupt the DSP on completion. */
/* */
/* CHANNEL 1: */
/* */
/* int IDMA1_init(priority, interrupt): This function sets the */
/* priority and interrupt for transfers on Channel 1, for all */
/* further transfers. This returns the value of the formatted */
/* IDMA1_COUNT. */
/* */
/* int IDMA1_copy(src, dst, byteCnt): This function transfers */
/* "byteCnt" bytes from source "src" to destination "dst". */
/* */
/* int IDMA1_fill(fillValue, dst, byteCnt): This function fills */
/* destination "dst" with "byteCnt" bytes of the fill, contained */
/* in fill_value (32-bit field". This requires the "byteCnt" to */
/* be a multiple of four. */
/* */
/* Uint32 IDMA1_getStatus(): This function returns the ACTV and */
/* PEND bits. */
/* */
/* int IDMA1_wait(): This function waits to make sure that */
/* all previous transfers on Channel 1 have completed by */
/* waiting for ACTV==0 && PEND==0. */
/* */
/* int IDMA1_setPriority(priority): This function is used to */
/* set the priority between CPU and IDMA. A value of 0x111 */
/* implies that CPU is higher priority than IDMA. A value */
/* of 0x0 implies IDMA is higher priority than CPU. These are */
/* the only values that are allowed. */
/* */
/* int IDMA1_setInt(interrupt): This function is used to set */
/* the IDMA to interrupt the DSP on completion. */
/* */
/*---------------------------------------------------------------------*/
/* Copyright, Texas Instruments Incorporated.... 1997-2005. */
/*=====================================================================*/
/* =========================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found
* in the license agreement under which this software has been supplied
* provided
* ==========================================================
*/
/** @mainpage IDMA Module
*
* @section Introduction
*
* @subsection xxx Purpose and Scope
* The purpose of this document is to identify a set of common CSL APIs for
* the IDMA Module across various devices. The CSL developer
* is expected to refer to this document while implementing APIs for these
* modules . Some of the listed APIs may not be applicable to a given IDMA
*
*
*
* @subsection aaa Terms and Abbreviations
* -# CSL : Chip Support Library
* -# API : Application Programmer Interface
* -# IDMA : Bandwidth Management Module
*
* @subsection References
* -# CSL 3.x Technical Requirements Specifications Version 0.5, dated
* May 14th, 2003
* -# L2 Controller and L1P Controller Specification (Revision 0.99.4 &1.01.0)
*
* @subsection Assumptions
* The abbreviations CSL, IDMA have been used throughout this
* document to refer to the C64Plus Bandwidth Management Module.
*/
/**
@defgroup CSL_IDMA_ENUM Enumerated Data Types
@ingroup CSL_IDMA_API
*/
/**
@defgroup CSL_IDMA_API IDMA
*/
/**
@defgroup CSL_IDMA_DATASTRUCT IDMA Data Structures
@ingroup CSL_IDMA_API
*/
/**
@defgroup CSL_IDMA_SYMBOL Symbols
@ingroup CSL_IDMA_API
*/
/**
@defgroup CSL_IDMA_FUNCTION Functions
@ingroup CSL_IDMA_API
*/
#ifndef _IDMA_GEM
#define _IDMA_GEM 1
#ifdef __cplusplus
extern "C" {
#endif
#include <csl.h>
#include <cslr_idma.h>
//#include <soc64plus.h>
#define CSL_IDMA_0_REGS (0x01820000u)
/**@defgroup CSL_IDMA_CHAN IDMA Channel Specifier.
* @ingroup CSL_IDMA_ENUM
@{*/
/** @brief Specifies which IDMA channel will be used
*
* Used to indicate which IDMA channel (0 or 1) will be used by API
*/
typedef enum {
IDMA_CHAN_0 = 0,
IDMA_CHAN_1 = 1
} IDMA_Chan;
/**
@}*/
/**@defgroup CSL_IDMA_INT_EN_ENUM IDMA Interrupt Enable Specifier.
* @ingroup CSL_IDMA_ENUM
@{*/
/** @brief Specifies whether the interrupt event generation is enabled or
disabled.
*
* Used to indicate whether the interrupt event generation is enabled
* or disabled.
*/
typedef enum {
IDMA_INT_DIS = 0,
IDMA_INT_EN = 1
} IDMA_intEn;
/**
@}*/
/**@defgroup CSL_IDMA_PRI_ENUM IDMA Priority Specifier.
* @ingroup CSL_IDMA_ENUM
@{*/
/** @brief Specifies what priority level the IDMA channel is set to.
*
* Used to specify what priority level the IDMA channel is set to.
*/
typedef enum {
IDMA_PRI_0 = CSL_IDMA_IDMA1_CNT_PRI_PRI0,
IDMA_PRI_1 = CSL_IDMA_IDMA1_CNT_PRI_PRI1,
IDMA_PRI_2 = CSL_IDMA_IDMA1_CNT_PRI_PRI2,
IDMA_PRI_3 = CSL_IDMA_IDMA1_CNT_PRI_PRI3,
IDMA_PRI_4 = CSL_IDMA_IDMA1_CNT_PRI_PRI4,
IDMA_PRI_5 = CSL_IDMA_IDMA1_CNT_PRI_PRI5,
IDMA_PRI_6 = CSL_IDMA_IDMA1_CNT_PRI_PRI6,
IDMA_PRI_7 = CSL_IDMA_IDMA1_CNT_PRI_PRI7,
IDMA_PRI_NULL = -1
}IDMA_priSet;
/**
@}*/
/*
* The pointer to this is passed to all IDMA CSL APIs.
* This structure has the fields required to configure IDMA for any test
* case/application. It should be initialized as per requirements of a
* test case/application and passed on to the setup function.
*/
/** @addtogroup CSL_IDMA_DATASTRUCT
*
* @{ */
/** @brief IDMA1_handle IDMA Channel 1 handle - Contains Status, Source and
* Destination locations and count for channel 1 transfer.
*/
typedef struct idma1_handle {
unsigned int status; /**< IDMA channel 0 status */
unsigned int reserved;
unsigned int *src; /**< IDMA channel 0 source location */
unsigned int *dst; /**< IDMA channel 0 destination */
unsigned int cnt; /**< Number of bytes to be transfered */
}IDMA1_handle;
/**
@}
*/
/** @addtogroup CSL_IDMA_DATASTRUCT
*
* @{ */
/** @brief IDMA0_Config IDMA Channel 0 configuration - Contains Status, Mask,
* Source and Destination locations and count for channel 0 (configuration)
* transfer.
*/
typedef struct idma0_config {
unsigned int status; /**< IDMA channel 0 status */
unsigned int mask; /**< IDMA channel 0 mask value */
unsigned int *src; /**< IDMA channel 0 source location */
unsigned int *dst; /**< IDMA channel 0 destination */
unsigned int cnt; /**< Number of bytes to be transfered */
}IDMA0_Config;
/**
@}
*/
typedef unsigned int Status;
/** Pointer to the IDMA register overlay */
typedef CSL_IdmaRegs *CSL_idmaOvly;
/**
@defgroup CSL_IDMA1_INIT_API IDMA1 Initialization API
@ingroup CSL_IDMA_FUNCTION
@{*/
/** ===========================================================================
* @n@b IDMA1_init
*
* @b Description
* @n This function obtains a priority and an interrupt flag and remembers
* them so that all future transfers on Channel 1 will use these
* priorities. The priority is contained in the argument "priority" and
* interrupt flag in "interr".
* This function performs IDMA Channel 1 initialization by setting the
* priority level and the enabling/disabling the interrupt event
* generation for the channel.
*
* @b Arguments
* @verbatim
priority Priority 0-7 of handle
interr interrupt event generated on/off
@endverbatim
*
* <b> Return Value </b> idma1_handle_priv.cnt
*
* <b> Pre Condition </b>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -