csl_rtc.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 877 行 · 第 1/2 页
H
877 行
/** Structure used to setup RTC device */
typedef struct CSL_RtcHwSetup {
/** Structure to load the Time and Calendar Registers
* The register values are in BCD code.
*/
CSL_RtcCalTime time;
/** Structure to load the Time and Calendar Alarm Registers
* The register values are in BCD code.
*/
CSL_RtcAlarmCalTime alarmTime;
/** Enable/Disable Split power functionality for RTC */
CSL_RtcSplitPower splitPower;
/** Enable/Disable the working of RTC */
Bool rtcDisable;
/** Set the 32-kHz Counter with compensation registers */
CSL_RtcSetCounter setCounter;
/** Configure RTC in Functional/Test mode*/
CSL_RtcTestMode testMode;
/** Configure hour mode of RTC to 12 hour/24 hour clock system */
CSL_RtcHourMode hourMode;
/** Enable/Disable Autocompensation of 32-kHz Oscillator in RTC */
CSL_RtcAutoComp autoComp;
/** Enable/Disable the Alarm Interrupt in RTC */
CSL_RtcIntAlarm intAlarm;
/** Enable/Disable the Timer Interrupt in RTC */
CSL_RtcIntTimer intTimer;
/** Configure the Interrupt period for the Timer in RTC */
CSL_RtcIntPeriod intPeriod;
/** Structure to load the RTC Compensation Registers */
CSL_RtcComp compReg;
/** Control of 32-kHz Oscillator power down */
Bool oscPwrdn;
/** Resistance values of 32-kHz oscillator. */
Uint8 oscRes;
} CSL_RtcHwSetup;
/** RTC types */
typedef struct CSL_RtcObj {
/** Pointer to the register overlay structure of the RTC */
CSL_RtcRegsOvly regs;
/** This is the instance of RTC being referred to by this object */
CSL_InstNum perNum;
} CSL_RtcObj;
/** Handle to the CSL for the RTC instance */
typedef struct CSL_RtcObj *CSL_RtcHandle;
/**************************************************************************\
* RTC global macro definitions
\**************************************************************************/
/** Macro for the Hour Register MSB */
#define CSL_RTC_HOURS_REG_MSB 6
/** Macro for the Hour Register LSB */
#define CSL_RTC_HOURS_REG_LSB 0
/** Macro for the Enable/Disable of RTC */
/** RTC_CTRL_REG RTC_DISABLE - enable */
#define CSL_RTC_ENABLE (0x00000000u)
/** RTC_CTRL_REG RTC_DISABLE - disable */
#define CSL_RTC_DISABLE (0x00000001u)
/** Macro to reset the RTC Register Bit */
#define CSL_RTC_RESET (0x00000000u)
/** Macro to set the RTC Register Bit */
#define CSL_RTC_SET (0x00000001u)
/** Default Values for Config structure */
#define CSL_RTC_CONFIG_DEFAULTS { \
CSL_RTC_SECONDS_REG_RESETVAL, \
CSL_RTC_MINUTES_REG_RESETVAL, \
CSL_RTC_HOURS_REG_RESETVAL, \
CSL_RTC_DAYS_REG_RESETVAL, \
CSL_RTC_MONTHS_REG_RESETVAL, \
CSL_RTC_YEARS_REG_RESETVAL, \
CSL_RTC_WEEKS_REG_RESETVAL, \
CSL_RTC_ALARM_SECONDS_REG_RESETVAL, \
CSL_RTC_ALARM_MINUTES_REG_RESETVAL, \
CSL_RTC_ALARM_HOURS_REG_RESETVAL, \
CSL_RTC_ALARM_DAYS_REG_RESETVAL, \
CSL_RTC_ALARM_MONTHS_REG_RESETVAL, \
CSL_RTC_ALARM_YEARS_REG_RESETVAL, \
CSL_RTC_RTC_CTRL_REG_RESETVAL, \
CSL_RTC_RTC_STATUS_REG_RESETVAL, \
CSL_RTC_RTC_INTERRUPTS_REG_RESETVAL, \
CSL_RTC_RTC_COMP_LSB_REG_RESETVAL, \
CSL_RTC_RTC_COMP_MSB_REG_RESETVAL, \
CSL_RTC_RTC_OSC_REG_RESETVAL, \
}
/** Default Values for Hardware setup structure */
#define CSL_RTC_HWSETUP_DEFAULTS { \
{0,0,0,0,1,1,0,6}, \
{0,0,0,0,1,1,0}, \
CSL_RTC_SPLITPOWER_DISABLE, \
FALSE, \
CSL_RTC_SETCOUNTER_DISABLE, \
CSL_RTC_TESTMODE_FUNCTIONAL, \
CSL_RTC_HOURMODE_24, \
CSL_RTC_AUTOCOMP_DISABLE, \
CSL_RTC_INT_ALARM_DISABLE, \
CSL_RTC_INT_TIMER_DISABLE, \
CSL_RTC_INT_PERIOD_SECOND, \
{0,0}, \
FALSE, \
0 \
}
/******************************************************************************\
* RTC global function declarations
\******************************************************************************/
/*
* =============================================================================
* @func CSL_rtcInit
*
* @desc
* @n This is the initialization function for the real time clock CSL. This
* function needs to be called before any real time clock CSL functions
* are to be called. This function is idem-potent.
*
* @arg pContext
* Context information to RTC
*
* @ret CSL_Status
* CSL_SOK - Always returns
*
* @eg
* CSL_rtcInit()
* =============================================================================
*/
extern CSL_Status CSL_rtcInit (
CSL_RtcContext * pContext
);
/*
* ============================================================================
* @func csl_rtcOpen
*
* @desc
* Opens the instance of RTC requested.
* The open call sets up the data structures for the particular instance
* of RTC 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.
*
* @arg hRtcObj
* Handle to the RTC Obj
*
* @arg rtcNum
* Specified RTC Instance to be open.
*
* @arg pRtcParam
* Module specific parameters.
*
* @arg status
* Return Status.
*
* @ret Handle
*
* Valid Rtc handle will be returned if status value is equal to
* CSL_SOK. if status returned is
* CSL_ESYS_FAIL - No Rtc Available.
*
* @eg
* CSL_RtcHandle hRtc;
* CSL_RtcObj hRtcObj;
* CSL_Status status;
*
* hRtc = CSL_RtcOpen (&rtcObj, rtcNum ,
* NULL, &status);
*
* ============================================================================
*/
extern CSL_RtcHandle CSL_rtcOpen (
CSL_RtcObj * hRtcObj,
CSL_InstNum rtcNum,
CSL_RtcParam * pRtcParam,
CSL_Status * pStatus
);
/** ============================================================================
* @n@b CSL_rtcGetBaseAddress
*
* @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_rtcOpen()
* function call.
*
* @b Arguments
* @verbatim
hRtc Pointer to the peripheral data object for RTC
rtcNum Specifies the instance of the RTC to be opened.
pRtcParam 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 RTC instance is not available.
*
* <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_RtcBaseAddress baseAddress;
...
status = CSL_rtcGetBaseAddress(CSL_RTC_1, NULL, &baseAddress);
@endverbatim
* ===========================================================================
*/
extern CSL_Status CSL_rtcGetBaseAddress (
CSL_InstNum rtcNum,
CSL_RtcParam * pRtcParam,
CSL_RtcBaseAddress * pBaseAddress
);
/*
* ============================================================================
* @func csl_rtcClose
*
* @desc
* This function closes the instance of RTC specified by the given
* handle.
*
*
* @arg hRtc
* The handle to the ARM RTC instance.
*
* @ret CSL_Status
* CSL_SOK - Successful, desired operation is done.
* CSL_ESYS_BADHANDLE - Handle pass is INVALID.
*
* @eg
* status = CSL_rtcClose (hRtc);
*
* ============================================================================
*/
extern CSL_Status CSL_rtcClose (
CSL_RtcHandle hRtc
);
/*
* =============================================================================
* @func CSL_rtcHwSetup
*
* @desc
* This function configures the registers of RTC as per the values given
* in the hardware setup structure.
*
* @arg hRtc
* Handle to the RTC 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_RtcHwSetup hwSetup;
*
* status = CSL_rtcHwsetup (hRtc, &hwSetup);
*
* ===========================================================================
*/
extern CSL_Status CSL_rtcHwSetup (
CSL_RtcHandle hRtc,
CSL_RtcHwSetup * setup
);
/*
* =============================================================================
* @func CSL_rtcHwSetupRaw
*
* @desc
* This function configures the registers of RTC as per the values given
* in the Config structure.
*
* @arg hRtc
* Handle to the RTC instance
*
* @arg hwConfig
* Pointer to RTC config structure
*
* @ret CSL_Status
* CSL_SOK - Configuration successful
* CSL_ESYS_BADHANDLE - Invalid handle
*
* @eg
*
* CSL_status status;
* CSL_RtcConfig hwConfig;
*
* status = CSL_rtcHwsetupRaw (hRtc, &hwConfig);
*
* ===========================================================================
*/
extern CSL_Status CSL_rtcHwSetupRaw (
CSL_RtcHandle hRtc,
CSL_RtcConfig * config
);
/*
* ============================================================================
* @func CSL_rtcGetHwSetup
*
* @desc
* It retrieves the hardware setup parameters
*
* @arg hRtc
* Handle to the RTC 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_RtcHwSetup hwSetup;
*
* status = CSL_rtcGetHwsetup (hRtc, &hwSetup);
*
* ===========================================================================
*/
extern CSL_Status CSL_rtcGetHwSetup (
CSL_RtcHandle hRtc,
CSL_RtcHwSetup * hwSetup
);
/*
* ============================================================================
* @func csl_rtcHwControl
*
* @desc
* Function controls the RTC specified by the handle.
* Operation done is based on the command passed.
*
* @arg hRtc
* The handle to the RTC instance.
*
* @arg cmd
* Operation performed ont the RTC Instance
*
* @arg cmdArg
* Argument related to the command passed.
*
* @ret CSL_Status
* CSL_SOK - Successful, desired operation is done.
* CSL_ESYS_INVCMD - Control Command is not supported.
*
* @eg
* CSL_Status status;
*
* status = CSL_rtcHwControl (hRtc, CSL_RTC_CMD_START, NULL);
*
* ============================================================================
*/
extern CSL_Status CSL_rtcHwControl (
CSL_RtcHandle hRtc,
CSL_RtcHwControlCmd cmd,
void * cmdArg
);
/*
* ============================================================================
* @func csl_rtcGetHwStatus
*
* @desc
* This function query's the hardware status of the RTC specified by
* the handle. The function gets the status based on the command passed.
*
* @arg hRtc
* Handle to Rtc Object. If it's NULL than it returns CSL_ESYS_BADHANDLE.
*
* @arg myQuery
* User's Query Command
*
* @arg response
* Pointer to return the data requested by the query passed
*
* @ret CSL_Status
* CSL_SOK - Successful Retreive, (* cmdArg)
* will have the desired value.
* CSL_ESYS_INVQUERY - Query Command is not supported.
*
* @eg
* status = CSL_rtcGetHwStatus (hRtc, CSL_RTC_QUERY_BUSY, &cmdArg);
*
* ==============================================================================
*/
extern CSL_Status CSL_rtcGetHwStatus (
CSL_RtcHandle hRtc,
CSL_RtcHwStatusQuery myQuery,
void * response
);
#ifdef __cplusplus
}
#endif
#endif /* _CSL_RTC_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?