csl_gptimer.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 814 行 · 第 1/2 页
H
814 行
/** Specifies a particular instance of general purpose timer */
CSL_InstNum perNum;
} CSL_GptimerObj;
/** Default hardware setup parameters
*
* The timer is configured to work in auto reload mode
* idle mode-wakeup operations, output generation, input event capture,
* compare operation interrupt generation,sensitivity to suspend signal
* posted mode and prescaling are all disabled
*/
#define CSL_GPTIMER_HWSETUP_DEFAULTS {\
FALSE,\
CSL_GPTIMER_IDLE_FORCE,\
FALSE,\
{\
FALSE,\
FALSE,\
FALSE\
},\
TRUE,\
FALSE,\
FALSE,\
CSL_GPTIMER_PRESCALE_CLKBY2,\
0,\
0,\
CSL_GPTIMER_ONESHOT,\
CSL_GPTIMER_PWM_PULSE,\
CSL_GPTIMER_PWM_CLEAR,\
CSL_GPTIMER_TRIG_NO,\
FALSE,\
0,\
CSL_GPTIMER_CAPT_NO,\
{\
FALSE,\
FALSE,\
FALSE\
}\
}
/** Default Values for Config structure */
#define CSL_GPTIMER_CONFIG_DEFAULTS {\
CSL_GPTIMER_TIOCP_CFG_RESETVAL,\
CSL_GPTIMER_TISR_RESETVAL,\
CSL_GPTIMER_TIER_RESETVAL,\
CSL_GPTIMER_TWER_RESETVAL,\
CSL_GPTIMER_TCLR_RESETVAL,\
CSL_GPTIMER_TCRR_RESETVAL,\
CSL_GPTIMER_TLDR_RESETVAL,\
CSL_GPTIMER_TTGR_RESETVAL,\
CSL_GPTIMER_TMAR_RESETVAL,\
CSL_GPTIMER_TSICR_RESETVAL\
}
/**
* This data type is used to return the handle to an instance of
* general-purpose timer
*/
typedef struct CSL_GptimerObj *CSL_GptimerHandle;
/* Arbitrary value to be written to trigger register. For CSL internal use */
#define CSL_GPTIMER_TRIG_VAL 0xFFFFFFFF
/*******************************************************************************
* General purpose timer global function declarations
******************************************************************************/
/*
* =============================================================================
* @func CSL_gptimerInit
*
* @desc
* This is the initialization function for the general purpose timer CSL.
* This function needs to be called before any GP timer CSL functions
* are to be called. This function is idem-potent.Currently, this function
* does not perform anything.
*
* @arg pContext
* Context information for General purpose timer
*
* @ret CSL_Status
* CSL_SOK - Always returns
*
* @eg
* CSL_gptimerInit (NULL);
* =============================================================================
*/
extern CSL_Status CSL_gptimerInit(
CSL_GptimerContext * pContext
);
/*
*============================================================================
* @func CSL_gptimerOpen
*
* @desc
* This function populates the peripheral data object for the instance and
* returns a handle to the instance
*
* @arg pGptimerObj
* Pointer to the General purpose timer instance object
*
* @arg gptimerNum
* Instance of the timer to be opened. There are 8 instances ofgeneral
* purpose timer
*
* @arg pGptimerParam
* Pointer to module specific parameters
*
* @arg pStatus
* pointer for returning status of the function call
*
* @ret CSL_GptimerHandle
* Valid timer instance handle will be returned if status value is
* equal to CSL_SOK.
*
* @eg
* CSL_status status;
* CSL_GptimerObj gptimerObj;
* CSL_GptimerHandle hGptimer;
*
* hGptimer = CSL_GptimerOpen (&gptimerObj,
* CSL_GPTIMER_1,
* NULL,
* &status
* );
*
* ===========================================================================
*/
extern CSL_GptimerHandle CSL_gptimerOpen (
CSL_GptimerObj *pGptimerObj,
CSL_InstNum gptimerNum,
CSL_GptimerParam *pGptimerParam,
CSL_Status *pStatus
);
/*
* =============================================================================
* @func CSL_gptimerClose
*
* @b Description
* @n This function closes the specified instance of General purpose timer.
*
* @arg hGptimer
Handle to the general purpose timer instance
*
* @ret CSL_Status
* CSL_SOK - Close successful
* CSL_ESYS_BADHANDLE - Invalid handle
*
* @eg
* CSL_gptimerClose (hGptimer);
* =============================================================================
*/
extern CSL_Status CSL_gptimerClose (
CSL_GptimerHandle hGptimer
);
/*
* =============================================================================
* @func CSL_gptimerHwSetup
*
* @desc
* Configures the timer instance with the specified setup parameters.
*
* @arg hGptimer
* Handle to the timer instance
*
* @arg hwSetup
* Pointer to hardware setup structure
*
* @ret CSL_Status
* CSL_SOK - Hardware setup successful
* CSL_ESYS_BADHANDLE - Invalid handle
*
* @eg
*
* CSL_status status;
* CSL_GptimerHwSetup hwSetup;
*
* hwSetup.prescaleEnable = TRUE;
* hwSetup.prescaleValue = CSL_GPTIMER_PRESCALE_CLKBY32;
* hwSetup.mode = CSL_GPTIMER_AUTORELOAD;
* hwSetup.count = TLDR_TEST_VALUE;
* hwSetup.loadValue = TLDR_TEST_VALUE;
* hwSetup.intConfig.capture = FALSE;
* hwSetup.intConfig.match = FALSE;
* hwSetup.intConfig.overflow = TRUE;
* hwSetup.compEnable = FALSE;
* hwSetup.matchValue = 0;
* hwSetup.captConfig = CSL_GPTIMER_CAPT_NO;
* hwSetup.pwmMode = CSL_GPTIMER_PWM_PULSE;
* hwSetup.pwmLevel = CSL_GPTIMER_PWM_CLEAR;
* hwSetup.trigConfig = CSL_GPTIMER_TRIG_NO;
* hwSetup.autoIdleEnable = FALSE;
* hwSetup.idleModeConfig = CSL_GPTIMER_IDLE_NO;
* hwSetup.wakeupConfig.capture = FALSE;
* hwSetup.wakeupConfig.match = FALSE;
* hwSetup.wakeupConfig.overflow = FALSE;
* hwSetup.wakeupEnable = FALSE;
* hwSetup.emuFreeEnable = TRUE;
* hwSetup.postedModeEnable = TRUE;
*
* status = CSL_gptimerHwsetup (hGptimer, &hwSetup);
*
* ===========================================================================
*/
extern CSL_Status CSL_gptimerHwSetup (
CSL_GptimerHandle hGptimer,
CSL_GptimerHwSetup *hwSetup
);
/*
* =============================================================================
* @func CSL_gptimerHwSetupRaw
*
* @desc
* This function configures the registers of timer instance as per the
* values given in the Config structure.
*
* @arg hGptimer
* Handle to the general purpose timer instance
*
* @arg hwConfig
* Pointer to general purpose timer config structure
*
* @ret CSL_Status
* CSL_SOK - Configuration successful
* CSL_ESYS_BADHANDLE - Invalid handle
*
* @eg
*
* CSL_Status status;
* CSL_GptimerConfig hwConfig;
*
* status = CSL_gptimerHwsetupRaw (hGptimer, &hwConfig);
*
* ===========================================================================
*/
extern CSL_Status CSL_gptimerHwSetupRaw (
CSL_GptimerHandle hGptimer,
CSL_GptimerConfig * config
);
/*
* ============================================================================
* @func CSL_gptimerGetHwSetup
*
* @desc
* It retrives the hardware setup parameters
*
* @arg hTimer
* Handle to the timer instance
*
* @arg hwSetup
* Pointer to hardware setup structure
*
* @ret CSL_Status
* CSL_SOK - Hardware setup successful
* CSL_ESYS_BADHANDLE - Invalid handle
*
* @eg
* CSL_status status;
* CSL_GptimerHwSetup hwSetup;
*
* status = CSL_gptimerGetHwsetup (hGptimer, &hwSetup);
*
* ===========================================================================
*/
extern CSL_Status CSL_gptimerGetHwSetup (
CSL_GptimerHandle hGptimer,
CSL_GptimerHwSetup *hwSetup
);
/** ============================================================================
* @func CSL_gptimerHwControl
*
* @desc
* This function performs various control operations on the timer instance,
* based on the command passed.
*
* @arg hGptimer
* Handle to the general purpose timer instance
*
* @arg cmd
* Operation to be performed on the timer instance
*
* @arg cmdArg
* Arguement specific to the command
*
* @ret CSL_Status
* CSL_SOK - Command execution successful.
* CSL_ESYS_BADHANDLE - Invalid handle
* CSL_ESYS_INVCMD - Invalid command
*
* @eg
* CSL_Status status;
*
* status = CSL_gptimerHwControl (hGptimer,
* CSL_GPTIMER_CMD_START, NULL);
*
* ===========================================================================
*/
extern CSL_Status CSL_gptimerHwControl (
CSL_GptimerHandle hGptimer,
CSL_GptimerHwControlCmd cmd,
void *arg
);
/*
* =============================================================================
* @n@b CSL_gptimerGetHwStatus
*
* @desc
* This function is used to get the value of various parameters of an
* instance of general purpose timer. The value returned depends on the
* query passed.
*
* @arg hGptimer
* Handle to the general purpose timer
*
* @arg query
* Query to be performed.
*
* @arg response
* Pointer to buffer to return the data requested by the query passed
*
* @arg CSL_Status
* CSL_SOK - Successful completion of the query
* CSL_ESYS_BADHANDLE - Invalid handle
* CSL_ESYS_INVQUERY - Query command not supported
*
* @eg
* CSL_Status status;
* Bool resetDone;
* status = CSL_gptimerGetHwStatus (hGptimer,
* CSL_GPTIMER_QUERY_RESETSTATE,
* &resetDone);
*
* ===========================================================================
*/
extern CSL_Status CSL_gptimerGetHwStatus (
CSL_GptimerHandle hGptimer,
CSL_GptimerHwStatusQuery query,
void *response
);
/** ============================================================================
* @n@b CSL_gptimerGetBaseAddress
*
* @b Description
* @n Function to get the base address of the peripheral instance.
* This function is used for getting the base address of the peripheral
* instance. This function will be called inside the CSL_gptimerOpen()
* function call.This function is open for re-implementing if the user
* wants to modify the base address of the peripheral object to point to
* a different location and there by allow CSL initiated write/reads into
* peripheral MMR's go to an alternate location.
*
* @b Arguments
* @verbatim
gptimerNum Specifies the instance of the GP Timer to be opened.
pGptimerParam Module specific parameters.
pBaseAddress Pointer to baseaddress structure containing base
address details.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_OK Open call is successful
* @li CSL_ESYS_FAIL The instance number is invalid.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Base Address structure is populated
*
* @b Modifies
* @n 1. The status variable
*
* 2. Base address structure is modified.
*
* @b Example
* @verbatim
CSL_Status status;
CSL_GptimerBaseAddress baseAddress;
...
status = CSL_gptimerGetBaseAddress(CSL_GPTIMER_1, NULL, &baseAddress);
@endverbatim
* ===========================================================================
*/
extern CSL_Status CSL_gptimerGetBaseAddress (
CSL_InstNum gptimerNum,
CSL_GptimerParam * pGptimerParam,
CSL_GptimerBaseAddress * pBaseAddress
);
#ifdef __cplusplus
}
#endif
#endif /* _CSL_GPTIMER_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?