csl_ocpt2.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 587 行 · 第 1/2 页

H
587
字号
/** ============================================================================
 *   @file  csl_ocpt2.h
 *
 *   @path  $(CSLPATH)\arm\ocpt2\src
 *
 *   @desc  API header file for OCP T2 port CSL
 *
 */

/*  ============================================================================
 *   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.
 *   ===========================================================================
 */

/*  @(#) PSP/CSL 3.00.01.00[5912] (2004-05-27)  */

/* =============================================================================
 *  Revision History
 *  ===============
 *  31-Jan-2005 sd File created.
 * =============================================================================
 */
#ifndef _CSL_OCPT2_H_
#define _CSL_OCPT2_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <csl.h>
#include <cslr_ocpt2.h>

/**
 *  OCP T2 global typedef declarations
 */

/**
 * This enumeration defines the values for the status and cause of the abort.
 */
typedef enum {
	/** Abort signal was not generated					*/
	CSL_OCPT2_NO_ABORT		= 0,

	/** Abort signal was generated due to timeout error	*/
	CSL_OCPT2_TIMEOUT_ERR	= 1,

	/** Abort signal was generated due to error from external peripherals */
	CSL_OCPT2_BUS_ERR		= 2
} CSL_Ocpt2AbortStatus;

/**
 * This enumeration defines the values for the host that caused the abort.
 */
typedef enum {
	/** Abort was caused due to a request form MPU host	*/
	CSL_OCPT2_MPU_ABORT		= 0,

	/** Abort was caused due to a request form DSP host	*/
	CSL_OCPT2_DSP_ABORT		= 1,

	/** Abort was caused due to a request form OCPI host */
	CSL_OCPT2_OCPI_ABORT	= 2,

	/** Abort was caused due to a request form DMA host  */
	CSL_OCPT2_DMA_ABORT		= 3
} CSL_Ocpt2AbortHostId;

/**
 * This enum describes the commands used to get status of various parameters of
 * the OCP T2 port.  These values are used in CSL_ocpt2GetHwStatus() function.
 */
typedef enum {
	/**
     * @brief   Gets the address that caused the abort.
     * @param   Uint32
     */
    CSL_OCPT2_QUERY_ABORT_ADDR			= 0,

	/**
     * @brief   Gets the abort status with type.
     * @param   CSL_Ocpt2AbortStatus
     */
    CSL_OCPT2_QUERY_ABORT_STATUS		= 1,

	/**
     * @brief   Gets the ID of the host that caused the abort.
     * @param   CSL_Ocpt2AbortHostId
     */
    CSL_OCPT2_QUERY_ABORT_HOST_ID		= 2

} CSL_Ocpt2HwStatusQuery;

/** Priority setup structure to define the priority of the hosts */
typedef struct CSL_Ocpt2PrioritySetup {
	/** Configures the consecutive accesses by a DMA host	*/
	Uint8	dmaPriority;
	/** Configures the consecutive accesses by an OCPI host	*/
	Uint8	ocpiPriority;
	/** Configures the consecutive accesses by a DSP host	*/
	Uint8	dspPriority;
	/** Configures the consecutive accesses by an ARM host	*/
	Uint8	armPriority;
} CSL_Ocpt2PrioritySetup;

/**
 * Timeout setup structure to define the fields for setting up the OCP T2
 * priority timeout value, after which the requests are made high priority.
 */
typedef struct CSL_Ocpt2TimeoutSetup {
	/** Configures the priority timeout for a DMA host		*/
	Uint8	dmaPriorityTimeout;
	/** Configures the priority timeout for an OCPI host	*/
	Uint8	ocpiPriorityTimeout;
	/** Configures the priority timeout for a DSP host		*/
	Uint8	dspPriorityTimeout;
	/** Configures the priority timeout for an LCD host		*/
	Uint8	lcdPriorityTimeout;
} CSL_Ocpt2TimeoutSetup;

/** Abort setup structure for the OCP T2 port CSL */
typedef struct CSL_Ocpt2AbortSetup {
	/** Enables/disables the abort on timeout						*/
	Bool	abortOnTimeoutEn;
	/** Configures the timeout value for a response from the target */
	Uint8	responseTimeout;
} CSL_Ocpt2AbortSetup;

/** Target setup structure for the OCP T2 port CSL */
typedef struct CSL_Ocpt2TargetSetup {
	/** Enables/disables the pipeline read operation	*/
	Bool		pipelineReadEn;
	/** Enables/disables the autogating clock feature	*/
	Bool		autogatedClockEn;

} CSL_Ocpt2TargetSetup;

/** Hardware setup structure for OCP T2 port CSL*/
typedef struct CSL_Ocpt2HwSetup {
	/** Configures the consecutive accesses to the OCP T2 port, by a host	 */
	CSL_Ocpt2PrioritySetup	prioritySetup;
	/** Configures the priority timeout for a host							 */
	CSL_Ocpt2TimeoutSetup	timeoutSetup;
	/** Configures the timeout parameters for a response from the slave		 */
	CSL_Ocpt2AbortSetup		abortSetup;
	/** Configures the target for pipeline read and autogating clock feature */
	CSL_Ocpt2TargetSetup	targetSetup;
} CSL_Ocpt2HwSetup;

/**
 * Config-structure used to configure the OCP T2 port using
 * CSL_ocpt2HwSetupRaw()
 */
typedef struct CSL_Ocpt2Config {
    /** OCP T2 priority register			 */
    Uint32  OCPT2_PRIOR;
	/** OCP T2 priority timeout register 1	 */
	Uint32	OCPT2_PTOR1;
	/** OCP T2 priority timeout register 2	 */
	Uint32	OCPT2_PTOR2;
	/** OCP T2 priority timeout register 3	 */
	Uint32	OCPT2_PTOR3;
	/** OCP T2 abort timeout register		 */
	Uint32	OCPT2_ATOR;
	/** OCP T2 target configuration register */
	Uint32	OCPT_CONFIG_REG;
} CSL_Ocpt2Config;

/**
 * Module specific context information. Present implementation of OCP T2 port
 * CSL doesn't have any context information.
 */
typedef struct {
	/**
	 * Context information of OCP T2 port CSL.
     * The below declaration is just a place-holder for future implementation.
 	 */
    Uint16	contextInfo;
} CSL_Ocpt2Context;

/**
 * Module specific parameters. Present implementation of OCP T2 port CSL
 * doesn't have any module 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_Ocpt2Param;

/**
 * This structure contains the base-address information for the peripheral
 * instance.
 */
typedef struct {
	/** Base-address of the configuration registers of the peripheral */
	CSL_Ocpt2RegsOvly		regs;
} CSL_Ocpt2BaseAddress;

/** OCP T2 port object structure */
typedef struct CSL_Ocpt2Obj {
    /** Pointer to the register overlay structure of OCP T2 module	*/
    CSL_Ocpt2RegsOvly    regs;

    /** Instance of OCP T2 port being referred by this object  		*/
    CSL_InstNum          perNum;
} CSL_Ocpt2Obj;

/**
 * This data type is used to return the handle to the CSL of the OCP T2 port.
 */
typedef struct CSL_Ocpt2Obj *CSL_Ocpt2Handle;

/** Default values for config structure */
#define CSL_OCPT2_CONFIG_DEFAULTS { \
		CSL_OCPT2_OCPT2_PRIOR_RESETVAL, \
		CSL_OCPT2_OCPT2_PTOR1_RESETVAL, \
		CSL_OCPT2_OCPT2_PTOR2_RESETVAL, \
		CSL_OCPT2_OCPT2_PTOR3_RESETVAL, \
		CSL_OCPT2_OCPT2_ATOR_RESETVAL,  \
		CSL_OCPT2_OCPT_CONFIG_REG_RESETVAL \
}

/** Default priority setup parameters	*/
#define CSL_OCPT2_PRIORITY_SETUP_DEFAULTS { \
	CSL_OCPT2_OCPT2_PRIOR_DMA_PRIORITY_RESETVAL,	\
	CSL_OCPT2_OCPT2_PRIOR_OCP_PRIORITY_RESETVAL,	\
	CSL_OCPT2_OCPT2_PRIOR_DSP_PRIORITY_RESETVAL,	\
	CSL_OCPT2_OCPT2_PRIOR_ARM_PRIORITY_RESETVAL	\
}

/** Default timeout setup parameters	*/
#define CSL_OCPT2_TIMEOUT_SETUP_DEFAULTS { \
	CSL_OCPT2_OCPT2_PTOR1_DMA_RESETVAL,   \
	CSL_OCPT2_OCPT2_PTOR3_OCPI_RESETVAL,  \
	CSL_OCPT2_OCPT2_PTOR2_DSP_RESETVAL,   \
	CSL_OCPT2_OCPT2_PTOR2_LCD_RESETVAL    \
}

/** Default abort setup parameters		*/
#define	CSL_OCPT2_ABORT_SETUP_DEFAULTS { \
	TRUE,	\
	CSL_OCPT2_OCPT2_ATOR_TIMEOUT_RESETVAL \
}

/** Default target setup parameters		*/
#define	CSL_OCPT2_TARGET_SETUP_DEFAULTS { \
	TRUE,	\
	FALSE	\
}

/** Default hardware setup parameters */
#define CSL_OCPT2_HWSETUP_DEFAULTS { \
    CSL_OCPT2_PRIORITY_SETUP_DEFAULTS, \
    CSL_OCPT2_TIMEOUT_SETUP_DEFAULTS,  \
    CSL_OCPT2_ABORT_SETUP_DEFAULTS,	   \
    CSL_OCPT2_TARGET_SETUP_DEFAULTS    \
}

/**************************************************************************\
* OCP T2 global function declarations
\**************************************************************************/

/*
 * =============================================================================
 *   @func CSL_ocpt2Init
 *
 *   @desc
 *   @n This is the initialization function for the OCP T2 CSL. This function
 *		needs to be called before any other OCP T2 CSL functions are to be
 *      called. This function is idem-potent.
 *
 *   @arg pContext
 *		  Context information to OCP T2 port CSL
 *
 *   @ret CSL_Status
 *         CSL_SOK - Always returns
 *
 *   @eg
 *        CSL_ocpt2Init (NULL);
 * =============================================================================
 */
extern CSL_Status  CSL_ocpt2Init (
	CSL_Ocpt2Context*		pContext
);

/*
 * =============================================================================
 *	 @func   CSL_ocpt2Open
 *

⌨️ 快捷键说明

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