HRCAP Module¶
The High Resolution Enhanced Capture (HRCAP) API provides a set of functions for configuring and using the high resolution capability of the HRCAP module. The functions provided allow for the setup and configuration of the high resolution capture capability. The necessary APIs to configure the high resolution capture calibration hardware are also provided.
-
group
hrcap_api
Defines
-
HRCAP_GLOBAL_CALIBRATION_INTERRUPT
0x1U¶ Global calibration interrupt flag
-
HRCAP_CALIBRATION_DONE
0x2U¶ Calibration done flag
-
HRCAP_CALIBRATION_PERIOD_OVERFLOW
0x4U¶ Calibration period overflow flag
Enums
-
enum
HRCAP_CalibrationClockSource
¶ Values that can be passed to HRCAP_getCalibrationClockPeriod() as the clockSource parameter.
Values:
-
enumerator
HRCAP_CALIBRATION_CLOCK_SYSCLK
= 0x0¶ Use SYSCLK for period match.
-
enumerator
HRCAP_CALIBRATION_CLOCK_HRCLK
= 0x4¶ Use HRCLK for period match.
-
enumerator
-
enum
HRCAP_ContinuousCalibrationMode
¶ Values that can be passed to HRCAP_setCalibrationMode(), as the continuousMode parameter.
Values:
-
enumerator
HRCAP_CONTINUOUS_CALIBRATION_DISABLED
= 0x00¶ Continuous calibration disabled.
-
enumerator
HRCAP_CONTINUOUS_CALIBRATION_ENABLED
= 0x20¶ Continuous calibration enabled.
-
enumerator
Functions
-
void
HRCAP_enableHighResolution
(uint32_t base)¶ enables HRCAP.
This function enables High Resolution Capture module.
- Parameters
base
: is the base address of the HRCAP instance used.
- Note
High resolution clock must be enabled before High Resolution Module is enabled.
- Return
None.
-
void
HRCAP_disableHighResolution
(uint32_t base)¶ Disables HRCAP.
This function disable High Resolution Capture module.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
None.
-
void
HRCAP_enableHighResolutionClock
(uint32_t base)¶ Enables high resolution clock.
This function enables High Resolution clock.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
None.
-
void
HRCAP_disbleHighResolutionClock
(uint32_t base)¶ Disables High resolution clock.
This function disables High Resolution clock.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
None.
-
void
HRCAP_startCalibration
(uint32_t base)¶ Starts calibration.
This function starts calibration.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
None.
-
void
HRCAP_setCalibrationMode
(uint32_t base)¶ Sets the calibration mode.
This function sets the the calibration mode by turning on continuous calibration.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
None.
-
void
HRCAP_enableCalibrationInterrupt
(uint32_t base, uint16_t intFlags)¶ Enables calibration interrupt.
This function enables HRCAP calibration interrupt flags. Valid values for intFlags are:
HRCAP_CALIBRATION_DONE - Calibration done interrupt.
HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow check interrupt.
- Return
None.
- Parameters
base
: is the base address of the HRCAP module.intFlags
: is the calibration interrupt flags to be enabled.
-
void
HRCAP_disableCalibrationInterrupt
(uint32_t base, uint16_t intFlags)¶ Disables calibration interrupt source.
This function disables HRCAP calibration interrupt flags. Valid values for intFlags are:
HRCAP_CALIBRATION_DONE - Calibration done interrupt.
HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period check interrupt.
- Return
None.
- Parameters
base
: is the base address of the HRCAP module.intFlags
: is the calibration interrupt flags to be disabled.
-
uint16_t
HRCAP_getCalibrationFlags
(uint32_t base)¶ Returns the calibration interrupt source.
This function returns the HRCAP calibration interrupt source.
- Parameters
base
: is the base address of the HRCAP module.
- Return
Returns the HRCAP interrupt that has occurred. The following are valid return values.
HRCAP_GLOBAL_CALIBRATION_INTERRUPT - Global calibration interrupt.
HRCAP_CALIBRATION_DONE - Calibration done interrupt.
HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow interrupt.
- Note
- User can check if a combination of the interrupts have occurred by ORing the above return values.
-
void
HRCAP_clearCalibrationFlags
(uint32_t base, uint16_t flags)¶ Clears calibration flags.
This function clears HRCAP calibration flags. The following are valid values for flags.
HRCAP_GLOBAL_CALIBRATION_INTERRUPT - Global calibration interrupt.
HRCAP_CALIBRATION_DONE - Calibration done flag.
HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow flag.
- Parameters
base
: is the base address of the HRCAP module.flags
: is the calibration flags to be cleared.
- Return
None.
-
bool
HRCAP_isCalibrationBusy
(uint32_t base)¶ Return the Calibration status
This function returns the calibration status.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
This functions returns true if the calibration is in process,false if there is no active calibration.
-
void
HRCAP_forceCalibrationFlags
(uint32_t base, uint16_t flag)¶ Force a software based calibration
This function forces a software based calibration done flag. The following are valid values for flag.
HRCAP_CALIBRATION_DONE - Calibration done flag.
HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow flag.
- Parameters
base
: is the base address of the HRCAP instance used.flag
: is the calibration flag source.
- Return
None.
-
void
HRCAP_setCalibrationPeriod
(uint32_t base, uint32_t sysclkHz)¶ Sets the calibration period count
This function sets the calibration period count value to achieve a period of 1.6 milliseconds given the SYSCLK frequency in Hz (the
sysclkHz parameter).- Parameters
base
: is the base address of the HRCAP instance used.sysclkHz
: is the rate of the SYSCLK in Hz.
- Return
None.
-
uint32_t
HRCAP_getCalibrationClockPeriod
(uint32_t base, HRCAP_CalibrationClockSource clockSource)¶ Returns the calibration clock period
This function returns the period match value of the calibration clock. The return value has a valid count when a period match occurs.
- Parameters
base
: is the base address of the HRCAP instance used.clockSource
: is the calibration clock source (HRCAP_CALIBRATION_CLOCK_SYSCLK or HRCAP_CALIBRATION_CLOCK_HRCLK).
- Return
This function returns the captured value of the clock counter specified by clockSource.
-
float32_t
HRCAP_getScaleFactor
(uint32_t base)¶ Calculates the scale factor
This function reads the SYSCLK and HRCLK calibration periods and then uses them to calculate the scale factor.
- Parameters
base
: is the base address of the HRCAP instance used.
- Return
This function returns the calculated scale factor.
-
float32_t
HRCAP_convertEventTimeStampNanoseconds
(uint32_t timeStamp, float32_t scaleFactor)¶ Returns event time stamp in nanoseconds
This function converts a raw CAP time stamp (the
timeStamp parameter) to nanoseconds using the provided scale factor (the scaleFactor parameter).- Parameters
timeStamp
: is a raw time stamp count returned by ECAP_getEventTimeStamp().scaleFactor
: is the calculated scale factor returned by HRCAP_getScaleFactor().
- Return
Returns the converted time stamp in nanoseconds.
-
The code for this module is contained in driverlib/hrcap.c, with driverlib/hrcap.h containing the API declarations for use by applications.