📄 csl_tmr.h
字号:
CSL_TMR_PRDHI_RESETVAL, \
CSL_TMR_TCR_RESETVAL, \
CSL_TMR_TGCR_RESETVAL, \
CSL_TMR_WDTCR_RESETVAL \
}
/**
* @brief This data type is used to return the handle to the CSL of the GP timer
*/
typedef CSL_TmrObj *CSL_TmrHandle;
/*******************************************************************************
* Timer global function declarations
******************************************************************************/
/** ============================================================================
* @n@b CSL_tmrInit
*
* @b Description
* @n This is the initialization function for the General purpose timer CSL.
* The function must be called before calling any other API from this CSL.
* This function is idem-potent. Currently, the function just return
* status CSL_SOK, without doing anything.
*
* @b Arguments
* @verbatim
pContext Pointer to module-context. As General purpose timer doesn't
have any context based information user is expected to pass
NULL.
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Always returns
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The CSL for gptimer is initialized
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_tmrInit();
@endverbatim
* =============================================================================
*/
CSL_Status CSL_tmrInit (
CSL_TmrContext *pContext
);
/** ============================================================================
* @n@b CSL_tmrOpen
*
* @b Description
* @n This function populates the peripheral data object for the TIMER instance
* and returns a handle to the instance.
* The open call sets up the data structures for the particular instance
* of TIMER device. The device can be re-opened anytime after it has been
* normally closed if so required. The handle returned by this call is
* input as an essential argument for rest of the APIs described
* for this module.
*
* @b Arguments
* @verbatim
tmrObj Pointer to gptimer object.
tmrNum Instance of gptimer CSL to be opened.
There are three instance of the gptimer
available. So, the value for this parameter will be
based on the instance.
pTmrParam Module specific parameters.
status Status of the function call
@endverbatim
*
* <b> Return Value </b> CSL_TmrHandle
* @n Valid gptimer handle will be returned if
* status value is equal to CSL_SOK.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n 1. The status is returned in the status variable. If status
* returned is
* @li CSL_SOK Valid gptimer handle is returned
* @li CSL_ESYS_FAIL The gptimer instance is invalid
* @li CSL_ESYS_INVPARAMS The object structure is not
* properly initialized
*
* 2. Gptimer object structure is populated
*
* @b Modifies
* @n 1. The status variable
*
* 2. Gptimer object structure
*
* @b Example
* @verbatim
CSL_status status;
CSL_TmrObj tmrObj;
CSL_TmrHandle hTmr;
hTmr = CSL_tmrOpen(&tmrObj, CSL_TMR_1, NULL, &status);
...
@endverbatim
* =============================================================================
*/
CSL_TmrHandle CSL_tmrOpen (
CSL_TmrObj *tmrObj,
CSL_InstNum tmrNum,
CSL_TmrParam *pTmrParam,
CSL_Status *status
);
/** ============================================================================
* @n@b CSL_tmrGetBaseAddress
*
* @b Description
* @n This function gets the base address of the given gptimer
* instance.
*
* @b Arguments
* @verbatim
tmrNum Specifies the instance of the gptimer to be opened
pTmrParam Gptimer module specific parameters
pBaseAddress Pointer to base address structure containing base
address details
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_OK Open call is successful
* @li CSL_ESYS_FAIL gptimer instance is not
* available.
* @li CSL_ESYS_INVPARAMS Invalid Parameters
*
* <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_TmrBaseAddress baseAddress;
...
status = CSL_tmrGetBaseAddress(CSL_TMR_1, NULL, &baseAddress);
...
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_tmrGetBaseAddress (
CSL_InstNum tmrNum,
CSL_TmrParam *pTmrParam,
CSL_TmrBaseAddress *pBaseAddress
);
/** ============================================================================
* @n@b CSL_tmrClose
*
* @b Description
* @n This function marks that CSL for the GP timer instance is closed.
* CSL for the GP timer instance need to be reopened before using any
* GP timer CSL API.
*
* @b Arguments
* @verbatim
hTmr Handle to the GP timer instance
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - GP timer is closed
* successfully
*
* @li CSL_ESYS_BADHANDLE - The handle passed is invalid
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n 1. The GP timer CSL APIs can not be called until the GP timer
* CSL is reopened again using CSL_tmrOpen()
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_tmrClose(hTmr);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_tmrClose (
CSL_TmrHandle hTmr
);
/** ============================================================================
* @n@b CSL_tmrHwSetup
*
* @b Description
* @n It configures the timer instance registers as per the values passed
* in the hardware setup structure.
*
* @b Arguments
* @verbatim
htmr Handle to the timer instance
setup Pointer to hardware setup structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Hardware setup successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Hardware structure is not
* properly initialized
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The specified instance will be setup according to value passed
*
* @b Modifies
* @n Hardware registers for the specified instance
*
* @b Example
* @verbatim
CSL_status status;
CSL_tmrHwSetup hwSetup;
status = CSL_tmrHwSetup(htmr, &hwSetup);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_tmrHwSetup (
CSL_TmrHandle hTmr,
CSL_TmrHwSetup *hwSetup
);
/** ============================================================================
* @n@b CSL_tmrHwControl
*
* @b Description
* @n This function performs various control operations on the timer instance,
* based on the command passed.
*
* @b Arguments
* @verbatim
hTmr Handle to the timer instance
cmd Operation to be performed on the timer
cmdArg Arguement specific to the command
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Command execution successful.
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVCMD - Invalid command
* @li CSL_ESYS_INVPARAMS - Invalid Parameter
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Registers of the timer instance are configured according to the command
* and the command arguments. The command determines which registers are
* modified.
*
* @b Modifies
* @n Registers determined by the command
*
* @b Example
* @verbatim
CSL_Status status;
status = CSL_tmrHwControl(hTmr, CSL_TMR_CMD_START_TIMLO, NULL);
@endverbatim
* ============================================================================
*/
CSL_Status CSL_tmrHwControl(
CSL_TmrHandle hTmr,
CSL_TmrHwControlCmd cmd,
void *cmdArg
);
/** ===========================================================================
* @n@b CSL_tmrGetHwStatus
*
* @b Description
* @n This function is used to get the value of various parameters of the
* timer instance. The value returned depends on the query passed.
*
* @b Arguments
* @verbatim
hTmr Handle to the timer instance
query Query to be performed
response Pointer to buffer to return the data requested by
the query passed
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Successful completion of the
* query
*
* @li CSL_ESYS_BADHANDLE - Invalid handle
*
* @li CSL_ESYS_INVQUERY - Query command not supported
*
* @li CSL_ESYS_INVPARAMS - Invalid Parameter
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* Data requested by the query is returned through the variable "response"
*
* @b Modifies
* @n The input arguement "response" is modified
*
* @b Example
* @verbatim
CSL_status status;
Uint8 response;
status = CSL_tmrGetHwStatus(hGptimer, CSL_TMR_QUERY_COUNT_LO,
&response);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_tmrGetHwStatus (
CSL_TmrHandle hTmr,
CSL_TmrHwStatusQuery query,
void *response
);
/** ============================================================================
* @n@b CSL_tmrHwSetupRaw
*
* @b Description
* @n This function initializes the device registers with the register-values
* provided through the config data structure.
*
* @b Arguments
* @verbatim
hTmr Pointer to the object that holds reference to the
instance of TIMER requested after the call
config Pointer to the config structure containing the
device register values
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Configuration successful
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVPARAMS - Configuration structure
* pointer is not properly
* initialized
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The registers of the specified General purpose timer instance will be setup
* according to the values passed through the config structure
*
* @b Modifies
* @n Hardware registers of the specified General purpose timer instance
*
* @b Example
* @verbatim
CSL_TmrHandle hTmr;
CSL_TmrConfig config = CSL_TMR_CONFIG_DEFAULTS;
CSL_Status status;
status = CSL_tmrHwSetupRaw (hTmr, &config);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_tmrHwSetupRaw (
CSL_TmrHandle hTmr,
CSL_TmrConfig *config
);
/** ============================================================================
* @n@b CSL_tmrGetHwSetup
*
* @b Description
* @n It retrives the hardware setup parameters
*
* @b Arguments
* @verbatim
hTmr Handle to the timer instance
hwSetup Pointer to hardware setup structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Hardware setup retrived
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_BADHANDLE - Invalid handle
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n The hardware set up structure will be populated with values from
* the registers
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_status status;
CSL_TmrHwSetup hwSetup;
status = CSL_tmrGetHwsetup (hTmr, &hwSetup);
@endverbatim
* ===========================================================================
*/
CSL_Status CSL_tmrGetHwSetup (
CSL_TmrHandle hTmr,
CSL_TmrHwSetup *hwSetup
);
#ifdef __cplusplus
}
#endif
#endif /* _CSL_TMR_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -