Interface for enabling or disabling the clock and updating the clock frequency.
interface, both directly and passing to a HAL driver to manipulate.
The clock driver is a single interface designed to allow reading and configuring any clock in the system.
API Reference | |
Clock HAL Results | |
Clock specific return codes. | |
Data Structures | |
struct | mtb_hal_clock_tolerance_t |
Structure defining a clock tolerance. More... | |
Macros | |
#define | mtb_hal_clock_interface mtb_hal_clock_peri_interface |
TODO: Temporarily preserved for backwards compatibility. | |
Enumerations | |
enum | mtb_hal_clock_tolerance_unit_t { MTB_HAL_TOLERANCE_HZ , MTB_HAL_TOLERANCE_PPM , MTB_HAL_TOLERANCE_PERCENT } |
Enum defining the different ways of specifying the acceptable clock tolerance. More... | |
Functions | |
cy_rslt_t | mtb_hal_clock_set_enabled (mtb_hal_clock_t *clock, bool enabled, bool wait_for_lock) |
Attempts to update the enablement of the specified clock. More... | |
cy_rslt_t | mtb_hal_clock_set_frequency (mtb_hal_clock_t *clock, uint32_t hz, const mtb_hal_clock_tolerance_t *tolerance) |
Attempts to update the operating frequency of the clock. More... | |
uint32_t | mtb_hal_clock_get_peri_clock_freq (const void *clk) |
Gets the frequency in hertz the peripheral clock is currently operating at. More... | |
cy_rslt_t | mtb_hal_clock_set_peri_clock_freq (const void *clk, uint32_t frequency, uint32_t tolerance_ppm) |
Update the operating frequency of the peripheral clock. More... | |
cy_rslt_t | mtb_hal_clock_set_peri_clock_enabled (const void *clk, bool enable) |
Enable/Disable the peripheral clock. More... | |
uint32_t | mtb_hal_clock_get_peri_src_clock_freq (const void *clk) |
Gets the peripheral source clock frequency that is feeding the clock tree for the specified resource. More... | |
uint32_t | mtb_hal_clock_get_hf_clock_freq (const void *clk) |
Gets the frequency in hertz the high frequency clock is currently operating at. More... | |
cy_rslt_t | mtb_hal_clock_set_hf_clock_freq (const void *clk, uint32_t frequency, uint32_t tolerance_ppm) |
Update the operating frequency of the high frequency clock. More... | |
cy_rslt_t | mtb_hal_clock_set_hf_clock_enabled (const void *clk, bool enable) |
Enable/Disable the high frequency clock. More... | |
Variables | |
const mtb_hal_clock_interface_t | mtb_hal_clock_peri_interface |
Default global interface for peripheral clocks. | |
const mtb_hal_clock_interface_t | mtb_hal_clock_hf_interface |
Default global interface for high freqeuncy clocks. | |
struct mtb_hal_clock_tolerance_t |
Data Fields | ||
---|---|---|
mtb_hal_clock_tolerance_unit_t | type | The type of the clock tolerance value. |
uint32_t | value | The tolerance value to use. |
cy_rslt_t mtb_hal_clock_set_enabled | ( | mtb_hal_clock_t * | clock, |
bool | enabled, | ||
bool | wait_for_lock | ||
) |
Attempts to update the enablement of the specified clock.
[in] | clock | The clock object to update the enablement of. |
[in] | enabled | Whether the clock should be enabled (true) or disabled (false). |
[in] | wait_for_lock | Whether to wait for the clock to enable & lock (true), or just send the request and return (false). Most clocks behave the same either way, however Crystals, PLLs, and similar require time to lock. If false, the clocks enabled state needs be checked before using the clock. |
cy_rslt_t mtb_hal_clock_set_frequency | ( | mtb_hal_clock_t * | clock, |
uint32_t | hz, | ||
const mtb_hal_clock_tolerance_t * | tolerance | ||
) |
Attempts to update the operating frequency of the clock.
[in] | clock | The clock object to set the frequency for. |
[in] | hz | The frequency, in hertz, to set the clock to. |
[in] | tolerance | The allowed tolerance from the desired hz that is acceptable, use NULL if no tolerance check is required. |
uint32_t mtb_hal_clock_get_peri_clock_freq | ( | const void * | clk | ) |
Gets the frequency in hertz the peripheral clock is currently operating at.
[in] | clk | Clock reference. For peri clock, expected clock object is of type mtb_hal_peri_div_t* |
cy_rslt_t mtb_hal_clock_set_peri_clock_freq | ( | const void * | clk, |
uint32_t | frequency, | ||
uint32_t | tolerance_ppm | ||
) |
Update the operating frequency of the peripheral clock.
[in] | clk | Clock reference. For peri clock, expected clock object is of type mtb_hal_peri_div_t* |
[in] | frequency | Desired clock frequency |
[in] | tolerance_ppm | The allowed tolerance in the units of PPM from the desired frequency that is acceptable , |
cy_rslt_t mtb_hal_clock_set_peri_clock_enabled | ( | const void * | clk, |
bool | enable | ||
) |
Enable/Disable the peripheral clock.
[in] | clk | Clock reference. For peri clock, expected clock object is of type mtb_hal_peri_div_t* |
[in] | enable | true to enable. false to diable |
uint32_t mtb_hal_clock_get_peri_src_clock_freq | ( | const void * | clk | ) |
Gets the peripheral source clock frequency that is feeding the clock tree for the specified resource.
[in] | clk | Clock reference. For peri clock, expected clock object is of type mtb_hal_peri_div_t* |
uint32_t mtb_hal_clock_get_hf_clock_freq | ( | const void * | clk | ) |
Gets the frequency in hertz the high frequency clock is currently operating at.
[in] | clk | Clock reference. For HF clock, expected clock object is of type mtb_hal_hf_clock_t* |
cy_rslt_t mtb_hal_clock_set_hf_clock_freq | ( | const void * | clk, |
uint32_t | frequency, | ||
uint32_t | tolerance_ppm | ||
) |
Update the operating frequency of the high frequency clock.
[in] | clk | Clock reference. For HF clock, expected clock object is of type mtb_hal_hf_clock_t* |
[in] | frequency | Desired clock frequency |
[in] | tolerance_ppm | The allowed tolerance in the units of PPM from the desired frequency that is acceptable , |
cy_rslt_t mtb_hal_clock_set_hf_clock_enabled | ( | const void * | clk, |
bool | enable | ||
) |
Enable/Disable the high frequency clock.
[in] | clk | Clock reference. For HF clock, expected clock object is of type mtb_hal_hf_clock_t* |
[in] | enable | true to enable. false to diable |