Clock Manager Device Interface Functions More...
#include <stdint.h>#include "sw/device/lib/base/macros.h"#include "sw/device/lib/base/mmio.h"#include "sw/device/lib/dif/dif_base.h"#include "sw/device/lib/dif/autogen/dif_clkmgr_autogen.h"Go to the source code of this file.
Typedefs | |
| typedef uint32_t | dif_clkmgr_gateable_clock_t |
| An Index of a "Gateable" Clock. | |
| typedef uint32_t | dif_clkmgr_hintable_clock_t |
| An Index of a "Hintable" Clock. | |
| typedef uint32_t | dif_clkmgr_measure_clock_t |
| typedef enum dif_clkmgr_recov_err_type | dif_clkmgr_recov_err_type_t |
| typedef uint32_t | dif_clkmgr_recov_err_codes_t |
| A set of recoverable errors. | |
| typedef enum dif_clkmgr_fatal_err_type | dif_clkmgr_fatal_err_type_t |
| typedef uint32_t | dif_clkmgr_fatal_err_codes_t |
| A set of fatal errors. | |
Enumerations | |
| enum | dif_clkmgr_recov_err_type |
| enum | dif_clkmgr_fatal_err_type { kDifClkmgrFatalErrTypeRegfileIntegrity = 1u << 0 , kDifClkmgrFatalErrTypeIdleCount = 1u << 1 , kDifClkmgrFatalErrTypeShadowStorage = 1u << 2 } |
Clock Manager Device Interface Functions
Definition in file dif_clkmgr.h.
| typedef uint32_t dif_clkmgr_fatal_err_codes_t |
A set of fatal errors.
This type is used to read the fatal error codes.
Definition at line 144 of file dif_clkmgr.h.
| typedef uint32_t dif_clkmgr_gateable_clock_t |
An Index of a "Gateable" Clock.
"Gateable" clocks are under full software control: they can be enabled and disabled by software, which directly starts and stops the identified clock.
Definition at line 32 of file dif_clkmgr.h.
| typedef uint32_t dif_clkmgr_hintable_clock_t |
An Index of a "Hintable" Clock.
"Hintable" clocks are under partial software control: software can suggest they are stopped, but the clock manager may delay stopping the peripheral, or may ignore the request altogether.
Definition at line 41 of file dif_clkmgr.h.
| typedef uint32_t dif_clkmgr_measure_clock_t |
Definition at line 43 of file dif_clkmgr.h.
| typedef uint32_t dif_clkmgr_recov_err_codes_t |
A set of recoverable errors.
This type is used to clear and read the recoverable error codes.
Definition at line 122 of file dif_clkmgr.h.
Definition at line 124 of file dif_clkmgr.h.
| enum dif_clkmgr_recov_err_type |
Definition at line 45 of file dif_clkmgr.h.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_disable_measure_counts | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_measure_clock_t | clock ) |
Disable count measurements.
Does not modify the thresholds.
| clkmgr | Clock Manager Handle. |
| clock | A clock to be measured. |
Definition at line 408 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_enable_measure_counts | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_measure_clock_t | clock, | ||
| uint32_t | min_threshold, | ||
| uint32_t | max_threshold ) |
Configure count measurements.
| clkmgr | Clock Manager Handle. |
| clock | A clock to be measured. |
| min_threshold | The smallest permissible cycle count. |
| max_threshold | The largest permissible cycle count. |
Definition at line 371 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_fatal_err_code_get_codes | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_fatal_err_codes_t * | codes ) |
Read the fatal error codes.
| clkmgr | Clock Manager Handle. | |
| [out] | codes | The fatal error codes. |
Definition at line 497 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_find_gateable_clock | ( | const dif_clkmgr_t * | clkmgr, |
| dt_instance_id_t | inst_id, | ||
| dif_clkmgr_gateable_clock_t * | clock ) |
Obtain the index of a gateable clock for a device.
Given a module instance (identified by its instance ID), return the index of the gateable clock which controls this device and can be used with the clkmgr DIF.
Example (find gateable clock of UART0):
| clkmgr | A clock manager handle. | |
| inst_id | An instance ID. | |
| [out] | clock | The index of the clock. |
kDifError if no gateable clock matches the description, kDifOk otherwise. Definition at line 151 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_find_hintable_clock | ( | const dif_clkmgr_t * | clkmgr, |
| dt_instance_id_t | inst_id, | ||
| dif_clkmgr_hintable_clock_t * | clock ) |
Obtain the index of a hintable clock for a device.
Given a module instance (identified by its instance ID), return the index of the hintable clock which controls this device and can be used with the clkmgr DIF.
Example (find hintable clock of KMAC):
| clkmgr | A clock manager handle. | |
| inst_id | An instance ID. | |
| [out] | clock | The index of the clock. |
kDifError if no hintable clock matches the description, kDifOk otherwise. Definition at line 203 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_find_measure_clock | ( | const dif_clkmgr_t * | clkmgr, |
| dt_clock_t | dt_clk, | ||
| dif_clkmgr_measure_clock_t * | clock ) |
Obtain the index of a measureable clock for a DT clock.
Given a clock (identified by its DT index), return the index of the measurable clock which controls this clock and can be used with the clkmgr DIF.
Example (find main measurable clock):
| clkmgr | A clock manager handle. | |
| dt_clk | A DT clock. | |
| [out] | clock | The index of the clock. |
kDifError if this clock is not measurable, kDifOk otherwise. Definition at line 353 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_gateable_clock_get_enabled | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_gateable_clock_t | clock, | ||
| dif_toggle_t * | state ) |
Check if a Gateable Clock is Enabled or Disabled.
| clkmgr | Clock Manager Handle. | |
| clock | Gateable Clock ID. | |
| [out] | is_enabled | whether the clock is enabled or not. |
Definition at line 169 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_gateable_clock_set_enabled | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_gateable_clock_t | clock, | ||
| dif_toggle_t | new_state ) |
Enable or Disable a Gateable Clock.
| clkmgr | Clock Manager Handle. |
| clock | Gateable Clock ID. |
| new_state | whether to enable or disable the clock. |
Definition at line 183 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_hintable_clock_get_enabled | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_hintable_clock_t | clock, | ||
| dif_toggle_t * | state ) |
Check if a Hintable Clock is Enabled or Disabled.
Hintable clocks are not under full software control, but this operation accurately reflects the state of the current clock, regardless of any hint requests made by software.
To read what hint the software has given the hardware, use dif_clkmgr_hintable_clock_get_hint.
| clkmgr | Clock Manager Handle. | |
| clock | Hintable Clock ID. | |
| [out] | is_enabled | whether the clock is enabled or not. |
Definition at line 221 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_hintable_clock_get_hint | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_hintable_clock_t | clock, | ||
| dif_toggle_t * | state ) |
Read the current Hint for a Hintable Clock.
Hintable clocks are not under full software control; this operation accurately reflects the current software hint, not the current state of the clock.
To read whether the clock is currently enabled or disabled, use dif_clkmgr_hintable_clock_get_enabled.
| clkmgr | Clock Manager Handle. | |
| clock | Hintable Clock ID. | |
| [out] | hinted_is_enabled | the current software request (hint) for this clock. |
Definition at line 253 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_hintable_clock_set_hint | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_hintable_clock_t | clock, | ||
| dif_toggle_t | new_state ) |
Enable or Disable a Hintable Clock.
This only sets a hint that the clock should be enabled or disabled. The clock manager is in control of whether the clock should actually be enabled or disabled.
To read what hint the software has given the hardware, use dif_clkmgr_hintable_clock_get_hint. To read whether the clock is currently enabled or disabled, use dif_clkmgr_hintable_clock_get_enabled.
| clkmgr | Clock Manager Handle. |
| clock | Hintable Clock ID. |
| new_state | whether to enable or disable the clock. |
Definition at line 235 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_jitter_enable_is_locked | ( | const dif_clkmgr_t * | clkmgr, |
| bool * | is_locked ) |
Check if jitter enable is locked.
| clkmgr | Clock Manager Handle. | |
| [out] | is_locked | whether jitter is locked or not. |
Definition at line 90 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_jitter_get_enabled | ( | const dif_clkmgr_t * | clkmgr, |
| dif_toggle_t * | state ) |
Check if jitter is Enabled.
| clkmgr | Clock Manager Handle. | |
| [out] | is_enabled | whether jitter is enabled or not. |
Definition at line 109 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_jitter_set_enabled | ( | const dif_clkmgr_t * | clkmgr, |
| dif_toggle_t | new_state ) |
Enable of Disable jitter.
| clkmgr | Clock Manager Handle. |
| new_state | whether to enable or disable jitter. |
Definition at line 125 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_lock_jitter_enable | ( | const dif_clkmgr_t * | clkmgr | ) |
Lock jitter enable.
| clkmgr | Clock Manager Handle. |
Definition at line 101 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_measure_counts_get_enable | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_measure_clock_t | clock, | ||
| dif_toggle_t * | state ) |
Get the count measurement enable.
| clkmgr | Clock Manager Handle. | |
| clock | A clock to be measured. | |
| [out] | state | The state of control enable. |
Definition at line 431 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_measure_counts_get_thresholds | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_measure_clock_t | clock, | ||
| uint32_t * | min_threshold, | ||
| uint32_t * | max_threshold ) |
Get the count measurement thresholds.
| clkmgr | Clock Manager Handle. | |
| clock | A clock to be measured. | |
| [out] | min_threshold | The minumum threshold. |
| [out] | max_threshold | The maximum threshold. |
Definition at line 453 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_measure_ctrl_disable | ( | const dif_clkmgr_t * | clkmgr | ) |
Disable measurement control updates.
This can only be disabled, and stays disabled until the next POR.
| clkmgr | Clock Manager Handle. |
Definition at line 335 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_measure_ctrl_get_enable | ( | const dif_clkmgr_t * | clkmgr, |
| dif_toggle_t * | state ) |
Get measurement control state.
| clkmgr | Clock Manager Handle. | |
| [out] | state | The state of control enable. |
Definition at line 344 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_recov_err_code_clear_codes | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_recov_err_codes_t | codes ) |
Clear selected recoverable error codes.
| clkmgr | Clock Manager Handle. |
| codes | The recoverable error codes to be cleared. |
Definition at line 487 of file dif_clkmgr.c.
| OT_WARN_UNUSED_RESULT dif_result_t dif_clkmgr_recov_err_code_get_codes | ( | const dif_clkmgr_t * | clkmgr, |
| dif_clkmgr_recov_err_codes_t * | codes ) |
Read the recoverable error codes.
| clkmgr | Clock Manager Handle. | |
| [out] | codes | The recoverable error codes. |
Definition at line 477 of file dif_clkmgr.c.