csl_ocpt1.h

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

H
589
字号
/** ============================================================================
 *   @file  csl_ocpt1.h
 *
 *   @path  $(CSLPATH)\arm\ocpt1\src
 *
 *   @desc  API header file for OCP T1 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
 *  ===============
 *  04-Oct-2004 sd Code review changes.
 *  29-Sep-2004 sd Design review changes.
 *  12-Sep-2004 sd File created.
 * =============================================================================
 */
#ifndef _CSL_OCPT1_H_
#define _CSL_OCPT1_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <csl.h>
#include <cslr_ocpt1.h>

/**
 *  OCP T1 global typedef declarations
 */
    
/**
 * This enumeration defines the values for the status and cause of the abort.
 */
typedef enum {
	/** Abort signal was not generated					*/
	CSL_OCPT1_NO_ABORT		= 0,
    
	/** Abort signal was generated due to timeout error	*/
	CSL_OCPT1_TIMEOUT_ERR	= 1,

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

/**
 * 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_OCPT1_MPU_ABORT		= 0,
    
	/** Abort was caused due to a request form DSP host	*/
	CSL_OCPT1_DSP_ABORT		= 1,

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

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

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

	/**
     * @brief   Gets the abort status with type.
     * @param   CSL_Ocpt1AbortStatus
     */    
    CSL_OCPT1_QUERY_ABORT_STATUS		= 1,

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

} CSL_Ocpt1HwStatusQuery;

/** Priority setup structure to define the priority of the hosts */
typedef struct CSL_Ocpt1PrioritySetup {
	/** 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_Ocpt1PrioritySetup;

/** 
 * Timeout setup structure to define the fields for setting up the OCP T1 
 * priority timeout value, after which the requests are made high priority.
 */
typedef struct CSL_Ocpt1TimeoutSetup {
	/** 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_Ocpt1TimeoutSetup;

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

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

} CSL_Ocpt1TargetSetup;

/** Hardware setup structure for OCP T1 port CSL*/
typedef struct CSL_Ocpt1HwSetup {
	/** Configures the consecutive accesses to the OCP T1 port, by a host	 */
	CSL_Ocpt1PrioritySetup	prioritySetup;
	/** Configures the priority timeout for a host							 */
	CSL_Ocpt1TimeoutSetup	timeoutSetup;
	/** Configures the timeout parameters for a response from the slave		 */
	CSL_Ocpt1AbortSetup		abortSetup;
	/** Configures the target for pipeline read and autogating clock feature */
	CSL_Ocpt1TargetSetup	targetSetup;
} CSL_Ocpt1HwSetup;		

/**
 * Config-structure used to configure the OCP T1 port using 
 * CSL_ocpt1HwSetupRaw()
 */
typedef struct CSL_Ocpt1Config {
    /** OCP T1 priority register			 */
    Uint32  PRIOR;
	/** OCP T1 priority timeout register 1	 */
	Uint32	PTOR1;	 
	/** OCP T1 priority timeout register 2	 */
	Uint32	PTOR2;
	/** OCP T1 priority timeout register 3	 */
	Uint32	PTOR3;
	/** OCP T1 abort timeout register		 */
	Uint32	ATOR;
	/** OCP T1 target configuration register */
	Uint32	CONFIG_REG;
} CSL_Ocpt1Config;		

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

/** 
 * Module specific parameters. Present implementation of OCP T1 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_Ocpt1Param;

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

/** OCP T1 port object structure */
typedef struct CSL_Ocpt1Obj {
    /** Pointer to the register overlay structure of OCP T1 module	*/
    CSL_Ocpt1RegsOvly    regs;

    /** Instance of OCP T1 port being referred by this object  		*/
    CSL_InstNum          perNum;
} CSL_Ocpt1Obj;

/**
 * This data type is used to return the handle to the CSL of the OCP T1 port.  
 */
typedef struct CSL_Ocpt1Obj *CSL_Ocpt1Handle;

/** Default values for config structure */
#define CSL_OCPT1_CONFIG_DEFAULTS { \
		CSL_OCPT1_PRIOR_RESETVAL, \
		CSL_OCPT1_PTOR1_RESETVAL, \
		CSL_OCPT1_PTOR2_RESETVAL, \
		CSL_OCPT1_PTOR3_RESETVAL, \
		CSL_OCPT1_ATOR_RESETVAL,  \
		CSL_OCPT1_CONFIG_REG_RESETVAL \
} 

/** Default priority setup parameters	*/
#define CSL_OCPT1_PRIORITY_SETUP_DEFAULTS { \
	CSL_OCPT1_PRIOR_DMA_PRIORITY_RESETVAL,	\
	CSL_OCPT1_PRIOR_OCP_PRIORITY_RESETVAL,	\
	CSL_OCPT1_PRIOR_DSP_PRIORITY_RESETVAL,	\
	CSL_OCPT1_PRIOR_ARM_PRIORITY_RESETVAL	\
}

/** Default timeout setup parameters	*/
#define CSL_OCPT1_TIMEOUT_SETUP_DEFAULTS { \
	CSL_OCPT1_PTOR1_DMA_RESETVAL,   \
	CSL_OCPT1_PTOR3_OCPI_RESETVAL,  \
	CSL_OCPT1_PTOR2_DSP_RESETVAL,   \
	CSL_OCPT1_PTOR2_LCD_RESETVAL    \
}

/** Default abort setup parameters		*/
#define	CSL_OCPT1_ABORT_SETUP_DEFAULTS { \
	TRUE,	\
	CSL_OCPT1_ATOR_TIMEOUT_RESETVAL \
}

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

/** Default hardware setup parameters */
#define CSL_OCPT1_HWSETUP_DEFAULTS { \
    CSL_OCPT1_PRIORITY_SETUP_DEFAULTS, \
    CSL_OCPT1_TIMEOUT_SETUP_DEFAULTS,  \
    CSL_OCPT1_ABORT_SETUP_DEFAULTS,	   \
    CSL_OCPT1_TARGET_SETUP_DEFAULTS    \
}
    
/**************************************************************************\
* OCP T1 global function declarations
\**************************************************************************/

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

/*
 * =============================================================================
 *	 @func   CSL_ocpt1Open

⌨️ 快捷键说明

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