![]() |
Synergy Software Package User's Manual
|
Driver for the Clock Frequency Accuracy Measurement Circuit (CAC). More...
Data Structures | |
| struct | cac_instance_ctrl_t |
Functions | |
| ssp_err_t | R_CAC_Open (cac_ctrl_t *const p_api_ctrl, cac_cfg_t const *const p_cfg) |
| Initialize the CAC peripheral. More... | |
| ssp_err_t | R_CAC_Close (cac_ctrl_t *const p_api_ctrl) |
| Release any resources that were allocated by the Open() or any subsequent CAC operations. Implements r_cac_t::close. More... | |
| ssp_err_t | R_CAC_StopMeasurement (cac_ctrl_t *const p_api_ctrl) |
| Stop the CAC measurement process. Implements r_cac_t::stopMeasurement. More... | |
| ssp_err_t | R_CAC_StartMeasurement (cac_ctrl_t *const p_api_ctrl) |
| Start the CAC measurement process. Implements r_cac_t::startMeasurement. More... | |
| ssp_err_t | R_CAC_Reset (cac_ctrl_t *const p_api_ctrl) |
| Resets the Overflow, Measurement End and Frequency Error interrupt flags. This will clear any of the CASTR status bits that have been set, but only if the CFME bit is off (Not measuring). Implements r_cac_t::reset. More... | |
| ssp_err_t | R_CAC_Read (cac_ctrl_t *const p_api_ctrl, uint8_t *const p_status, uint16_t *const p_counter) |
| Read and return the CAC status and counter registers. Implements r_cac_t::read. More... | |
| ssp_err_t | R_CAC_VersionGet (ssp_version_t *const p_version) |
| Get the API and code version information. More... | |
Driver for the Clock Frequency Accuracy Measurement Circuit (CAC).
This module supports the CAC peripheral.
| ssp_err_t R_CAC_Close | ( | cac_ctrl_t *const | p_ctrl | ) |
Release any resources that were allocated by the Open() or any subsequent CAC operations. Implements r_cac_t::close.
| SSP_SUCCESS | Successful close. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg. |
| SSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
Eliminate warning if parameter checking is disabled.
Disable interrupts in the peripheral and NVIC
Disable interrupts in NVIC.
Disable the CAC ints.
Stop measuring.
Power down peripheral.
Return the hardware lock for the CAC.
| ssp_err_t R_CAC_Open | ( | cac_ctrl_t *const | p_ctrl, |
| cac_cfg_t const *const | p_cfg | ||
| ) |
Initialize the CAC peripheral.
The Open function applies power to the CAC peripheral, checks/sets the interrupt priority, and configures the CAC based on the provided user configuration settings. If a user defined callback function has been provided in the configuration, then the CAC interrupt(s) will be enabled and the user callback function called accordingly. Implements r_cac_t::open.
| SSP_SUCCESS | CAC is available and available for measurement(s). |
| SSP_ERR_ASSERTION | Null Pointer. |
| SSP_ERR_INVALID_ARGUMENT | One or more configuration options are invalid. |
| SSP_ERR_HW_LOCKED | Hardware lock for CAC peripheral is already taken. |
| SSP_ERR_INVALID_CAC_REF_CLOCK | Measured clock rate smaller than reference clock rate. |
g_cac_version is accessed by the ASSERT macro only and so compiler toolchain can issue a warning that they are not accessed. The code below eliminates this warning and also ensures these data structures are not optimised away.
Eliminate warning if parameter checking is disabled.
Take the hardware lock for the CAC.
Setup the interrupt vectors and priorities
Return the hardware lock for the CAC.
Apply power to the peripheral
Configure the CAC per the configuration.
Store the callback and context information
Mark driver as open by initializing it to "CAC" - its ASCII equivalent.
| ssp_err_t R_CAC_Read | ( | cac_ctrl_t *const | p_ctrl, |
| uint8_t *const | p_status, | ||
| uint16_t *const | p_counter | ||
| ) |
Read and return the CAC status and counter registers. Implements r_cac_t::read.
| SSP_SUCCESS | CAC read successful. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg. |
| SSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
Eliminate warning if parameter checking is disabled.
| ssp_err_t R_CAC_Reset | ( | cac_ctrl_t *const | p_ctrl | ) |
Resets the Overflow, Measurement End and Frequency Error interrupt flags. This will clear any of the CASTR status bits that have been set, but only if the CFME bit is off (Not measuring). Implements r_cac_t::reset.
| SSP_SUCCESS | CAC reset completed. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg. |
| SSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
Eliminate warning if parameter checking is disabled.
Reset the CAC.
| ssp_err_t R_CAC_StartMeasurement | ( | cac_ctrl_t *const | p_ctrl | ) |
Start the CAC measurement process. Implements r_cac_t::startMeasurement.
| SSP_SUCCESS | CAC measurement started. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg. |
| SSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
| SSP_ERR_CLOCK_INACTIVE | Either the provided Measurement or Reference clock is not running |
Eliminate warnings if parameter checking is disabled.
Start measuring.
| ssp_err_t R_CAC_StopMeasurement | ( | cac_ctrl_t *const | p_ctrl | ) |
Stop the CAC measurement process. Implements r_cac_t::stopMeasurement.
| SSP_SUCCESS | CAC measuring has been stopped. |
| SSP_ERR_ASSERTION | NULL provided for p_ctrl or p_cfg. |
| SSP_ERR_NOT_OPEN | R_CAC_Open() has not been successfully called. |
Eliminate warning if parameter checking is disabled.
Stop measuring.
| ssp_err_t R_CAC_VersionGet | ( | ssp_version_t *const | p_version | ) |
Get the API and code version information.
| SSP_SUCCESS | Version info returned. |