![]() |
FuSa 8-Bit Libraries Safety Framework
|
Contains API prototypes and defines for the Clock Manager. More...
Files | |
| file | midware_clock_manager.c |
| Implements APIs for the Clock Manager. | |
| file | midware_clock_manager_diag.c |
| Implements APIs for the Clock Manager Diagnostics. | |
| file | midware_clock_manager_diag.h |
| Contains API prototypes for the Clock Manager Diagnostics. | |
Data Structures | |
| struct | cfmWindow_t |
| Struct for configuring the Clock Frequency Measure window. More... | |
Enumerations | |
| enum | clkFrq_t { CLK_FRQ_1_MHZ = CLKCTRL_FRQSEL_1M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_2_MHZ = CLKCTRL_FRQSEL_2M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_3_MHZ = CLKCTRL_FRQSEL_3M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_4_MHZ = CLKCTRL_FRQSEL_4M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_INVALID , CLK_FRQ_8_MHZ = CLKCTRL_FRQSEL_8M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_12_MHZ = CLKCTRL_FRQSEL_12M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_16_MHZ = CLKCTRL_FRQSEL_16M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_20_MHZ = CLKCTRL_FRQSEL_20M_gc >> CLKCTRL_FRQSEL_gp , CLK_FRQ_MAX } |
| Type definitions for available High Frequency Oscillator output frequencies used for configuring the main clock. More... | |
| enum | clkFrqDiv_t { CLK_FRQ_DIV2 = CLKCTRL_PDIV_DIV2_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV4 = CLKCTRL_PDIV_DIV4_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV8 = CLKCTRL_PDIV_DIV8_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV16 = CLKCTRL_PDIV_DIV16_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV32 = CLKCTRL_PDIV_DIV32_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV64 = CLKCTRL_PDIV_DIV64_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV_INVALID1 , CLK_FRQ_DIV_INVALID2 , CLK_FRQ_DIV6 = CLKCTRL_PDIV_DIV6_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV10 = CLKCTRL_PDIV_DIV10_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV12 = CLKCTRL_PDIV_DIV12_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV24 = CLKCTRL_PDIV_DIV24_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV48 = CLKCTRL_PDIV_DIV48_gc >> CLKCTRL_PDIV_gp , CLK_FRQ_DIV_OFF , CLK_FRQ_DIV_MAX } |
| Type definitions for available pre-scaler division used for configuring the main clock. More... | |
| enum | cfdSource_t { CFD_SRC_MAINCLK = CLKCTRL_CFDSRC_MCLK_gc >> CLKCTRL_CFDSRC_gp , CFD_SRC_OSCHF = CLKCTRL_CFDSRC_OSCHF_gc >> CLKCTRL_CFDSRC_gp , CFD_SRC_OSC32K = CLKCTRL_CFDSRC_OSC32K_gc >> CLKCTRL_CFDSRC_gp , CFD_SRC_XOSCHF = CLKCTRL_CFDSRC_XOSCHF_gc >> CLKCTRL_CFDSRC_gp , CFD_SRC_XOSC32K = CLKCTRL_CFDSRC_XOSC32K_gc >> CLKCTRL_CFDSRC_gp , CFD_SRC_EVSYS = CLKCTRL_CFDSRC_EVSYS_gc >> CLKCTRL_CFDSRC_gp , CFD_SRC_MAX } |
| Type definitions for available Clock Failure Detection (CFD) sources used for configuring the CFDs. More... | |
| enum | cfdReference_t { CFD_REF_OSC32K = CLKCTRL_CFDREF_OSC32K_gc >> CLKCTRL_CFDREF_gp , CFD_REF_ONEDIV32 = CLKCTRL_CFDREF_ONEDIV32_gc >> CLKCTRL_CFDREF_gp , CFD_REF_XOSC32K = CLKCTRL_CFDREF_XOSC32K_gc >> CLKCTRL_CFDREF_gp , CFD_REF_MAX } |
| Type definitions for available Clock Failure Detection (CFD) references used for configuring the CFDs. More... | |
| enum | cfmSource_t { CFM_SRC_MAINCLK = CLKCTRL_CFMSRC_CLK_MAIN_gc >> CLKCTRL_CFMSRC_gp , CFM_SRC_OSCHF = CLKCTRL_CFMSRC_OSCHF_gc >> CLKCTRL_CFMSRC_gp , CFM_SRC_OSC32K = CLKCTRL_CFMSRC_OSC32K_gc >> CLKCTRL_CFMSRC_gp , CFM_SRC_XOSCHF = CLKCTRL_CFMSRC_XOSCHF_gc >> CLKCTRL_CFMSRC_gp , CFM_SRC_XOSC32K = CLKCTRL_CFMSRC_XOSC32K_gc >> CLKCTRL_CFMSRC_gp , CFM_SRC_EVSYS = CLKCTRL_CFMSRC_EVSYS_gc >> CLKCTRL_CFMSRC_gp , CFM_SRC_MAX } |
| Type definitions for available Clock Frequency Measure (CFM) sources used for configuring the CFMs. More... | |
| enum | cfmReference_t { CFM_REF_OSCHF = CLKCTRL_CFMREF_OSCHF_gc >> CLKCTRL_CFMREF_gp , CFM_REF_XOSCHF = CLKCTRL_CFMREF_XOSCHF_gc >> CLKCTRL_CFMREF_gp , CFM_REF_XOSC32K = CLKCTRL_CFMREF_XOSC32K_gc >> CLKCTRL_CFMREF_gp , CFM_REF_OSC32K = CLKCTRL_CFMREF_OSC32K_gc >> CLKCTRL_CFMREF_gp , CFM_REF_MAX } |
| Type definitions for available Clock Frequency Measure (CFM) references used for configuring the CFMs. More... | |
Functions | |
| errFlag_t | MW_GetClearClockCfd0Error (void) |
| Reads and clears the flag indicating a clock failure detected by CFD0. | |
| errFlag_t | MW_GetClearClockCfd1Error (void) |
| Reads and clears the flag indicating a clock failure detected by CFD1. | |
| errFlag_t | MW_GetClearClockCfm0Error (void) |
| Reads and clears the flag indicating a clock frequency error measured by CFM0. | |
| errFlag_t | MW_GetClearClockCfm1Error (void) |
| Reads and clears the flag indicating a clock frequency error measured by CFM1. | |
| void | MW_ClearClockCfmDoneFlags (void) |
| Clears the Clock Frequency Measure Done (CFMDn) flags indicating that a clock frequency measurement is done. | |
| errFlag_t | MW_SetMainClockFrequency (clkFrq_t frequency, clkFrqDiv_t divider) |
| Initializes main clock with internal High Frequency Oscillator (OSCHF) as clock source. | |
| errFlag_t | MW_StartCfd0 (cfdSource_t src, cfdReference_t ref) |
| Starts Clock Failure Detect 0 (CFD0) to monitor the configured clock source with the configured reference. | |
| errFlag_t | MW_StartCfd1 (cfdSource_t src, cfdReference_t ref) |
| Starts Clock Failure Detect 1 (CFD1) to monitor the configured clock source with the configured reference. | |
| errFlag_t | MW_StartCfm0 (cfmSource_t src, cfmReference_t ref, cfmWindow_t window, bool useContinuous) |
| Starts continuous Clock Frequency Measure 0 (CFM0) to monitor the configured clock source with the configured reference. | |
| errFlag_t | MW_StartCfm1 (cfmSource_t src, cfmReference_t ref, cfmWindow_t window, bool useContinuous) |
| Starts continuous Clock Frequency Measure 1 (CFM1) to monitor the configured clock source with the configured reference. | |
| void | MW_EnableClockInterrupts (void) |
| Enables all Clock Failure Detect (CFD) and Clock Frequency Measure (CFM) interrupts. | |
| errFlag_t | MW_DiagClockCfd0Begin (void) |
| Starts error injection diagnostic to detect faults in the Clock Failure Detection 0 (CFD0) monitor. | |
| errFlag_t | MW_DiagClockCfd0End (void) |
| Completes error injection diagnostic to detect faults in the CFD0 monitor. | |
| bool | MW_IsDiagCfd0Ongoing (void) |
| Checks if the CFD0 error injection is ongoing. | |
| errFlag_t | MW_DiagClockCfd1Begin (void) |
| Starts error injection diagnostic to detect faults in the Clock Failure Detection 1 (CFD1) monitor. | |
| errFlag_t | MW_DiagClockCfd1End (void) |
| Completes error injection diagnostic to detect faults in the CFD1 monitor. | |
| bool | MW_IsDiagCfd1Ongoing (void) |
| Checks if the CFD1 error injection is ongoing. | |
| errFlag_t | MW_DiagClockCfm0 (void) |
| Performs error injection diagnostic to detect faults in the Clock Frequency Measure 0 (CFM0) monitor. | |
| errFlag_t | MW_DiagClockCfm1 (void) |
| Performs error injection diagnostic to detect faults in the Clock Frequency Measure 1 (CFM1) monitor. | |
Contains API prototypes and defines for the Clock Manager.
The Clock Manager provides services to Tasks to ensure correct interaction with features of the CLKCTRL peripheral.
| enum cfdReference_t |
Type definitions for available Clock Failure Detection (CFD) references used for configuring the CFDs.
| Enumerator | |
|---|---|
| CFD_REF_OSC32K | OSC32K as reference |
| CFD_REF_ONEDIV32 | 1MHz/32 as reference |
| CFD_REF_XOSC32K | XOSC32K as reference |
| CFD_REF_MAX | Reserved value, indicates highest CFD reference value |
Definition at line 111 of file midware_clock_manager.h.
| enum cfdSource_t |
Type definitions for available Clock Failure Detection (CFD) sources used for configuring the CFDs.
Definition at line 93 of file midware_clock_manager.h.
| enum cfmReference_t |
Type definitions for available Clock Frequency Measure (CFM) references used for configuring the CFMs.
Definition at line 144 of file midware_clock_manager.h.
| enum cfmSource_t |
Type definitions for available Clock Frequency Measure (CFM) sources used for configuring the CFMs.
Definition at line 126 of file midware_clock_manager.h.
| enum clkFrq_t |
Type definitions for available High Frequency Oscillator output frequencies used for configuring the main clock.
Definition at line 47 of file midware_clock_manager.h.
| enum clkFrqDiv_t |
Type definitions for available pre-scaler division used for configuring the main clock.
Definition at line 67 of file midware_clock_manager.h.
| errFlag_t MW_DiagClockCfd0Begin | ( | void | ) |
Starts error injection diagnostic to detect faults in the Clock Failure Detection 0 (CFD0) monitor.
This function starts a CFD0 monitor diagnostic. The diagnostic must be completed by calling MW_DiagClockCfd0End after an appropriate amount of time has passed.
| ERROR | Diagnostic failed to start due to ongoing NONCRITICAL errors or existing unhandled CFD0 NOTIFICATION errors. |
| NO_ERROR | CFD0 diagnostic successfully started. |
Definition at line 133 of file midware_clock_manager_diag.c.
| errFlag_t MW_DiagClockCfd0End | ( | void | ) |
Completes error injection diagnostic to detect faults in the CFD0 monitor.
This function completes the CFD0 monitor diagnostic by checking the result of the error injection started by MW_DiagClockCfd0Begin. It evaluates the results of the diagnostic and restores the original configurations of CFD0 registers and the CFD0 error channel.
| ERROR | Fault detected in the CFD0 monitor or inappropriate function call. |
| NO_ERROR | No fault detected in CFD0 monitor. |
Definition at line 160 of file midware_clock_manager_diag.c.
| errFlag_t MW_DiagClockCfd1Begin | ( | void | ) |
Starts error injection diagnostic to detect faults in the Clock Failure Detection 1 (CFD1) monitor.
This function starts a CFD1 monitor diagnostic. The diagnostic must be completed by calling MW_DiagClockCfd1End after an appropriate amount of time has passed.
| ERROR | Diagnostic failed to start due to ongoing NONCRITICAL errors or existing unhandled CFD1 NOTIFICATION errors. |
| NO_ERROR | CFD1 diagnostic successfully started. |
Definition at line 199 of file midware_clock_manager_diag.c.
| errFlag_t MW_DiagClockCfd1End | ( | void | ) |
Completes error injection diagnostic to detect faults in the CFD1 monitor.
This function completes the CFD1 monitor diagnostic by checking the result of the error injection started by MW_DiagClockCfd1Begin. It evaluates the results of the diagnostic and restores the original configurations of CFD1 registers and the CFD1 error channel.
| ERROR | Fault detected in the CFD1 monitor or inappropriate function call. |
| NO_ERROR | No fault detected in CFD1 monitor. |
Definition at line 225 of file midware_clock_manager_diag.c.
| errFlag_t MW_DiagClockCfm0 | ( | void | ) |
Performs error injection diagnostic to detect faults in the Clock Frequency Measure 0 (CFM0) monitor.
This function performs a diagnostic of the CFM0 monitor by running the monitor in different configurations and observing the responses. The CFM monitors can detect if the frequency falls below or rises above a set window. The diagnostic therefore runs 3 tests:
| ERROR | Fault detected in the CFM0 monitor. |
| NO_ERROR | No fault detected in the CFM0 monitor. |
Definition at line 264 of file midware_clock_manager_diag.c.
| errFlag_t MW_DiagClockCfm1 | ( | void | ) |
Performs error injection diagnostic to detect faults in the Clock Frequency Measure 1 (CFM1) monitor.
This function performs a diagnostic of the CFM1 monitor by running the monitor in different configurations and observing the responses. The CFM monitors can detect if the frequency falls below or rises above a set window. The diagnostic therefore runs 3 tests:
| ERROR | Fault detected in the CFM1 monitor. |
| NO_ERROR | No fault detected in the CFM1 monitor. |
Definition at line 298 of file midware_clock_manager_diag.c.
| void MW_EnableClockInterrupts | ( | void | ) |
Enables all Clock Failure Detect (CFD) and Clock Frequency Measure (CFM) interrupts.
This function enables the Clock Frequency Measurement Error Detected for CFM0 and CFM1 and Clock Failure Detected for CFD0 and CFD1.
Definition at line 252 of file midware_clock_manager.c.
| errFlag_t MW_GetClearClockCfd0Error | ( | void | ) |
Reads and clears the flag indicating a clock failure detected by CFD0.
This function checks whether the CFD0 interrupt flag has been set or not. If set, clears the flag and returns ERROR.
| ERROR | Clock failure detected by CFD0. |
| NO_ERROR | Clock failure not detected by CFD0. |
Definition at line 33 of file midware_clock_manager.c.
| errFlag_t MW_GetClearClockCfd1Error | ( | void | ) |
Reads and clears the flag indicating a clock failure detected by CFD1.
This function checks whether the CFD1 interrupt flag has been set or not. If set, clears the flag and returns ERROR.
| ERROR | Clock failure detected by CFD1. |
| NO_ERROR | Clock failure not detected by CFD1. |
Definition at line 49 of file midware_clock_manager.c.
| errFlag_t MW_GetClearClockCfm0Error | ( | void | ) |
Reads and clears the flag indicating a clock frequency error measured by CFM0.
This function checks whether the CFM0 interrupt flag has been set or not. If set, clears the flag and returns ERROR.
| ERROR | Clock frequency error measured by CFM0. |
| NO_ERROR | No clock frequency error measured by CFM0. |
Definition at line 65 of file midware_clock_manager.c.
| errFlag_t MW_GetClearClockCfm1Error | ( | void | ) |
Reads and clears the flag indicating a clock frequency error measured by CFM1.
This function checks whether the CFM1 interrupt flag has been set or not. If set, clears the flag and returns ERROR.
| ERROR | Clock frequency error measured by CFM1. |
| NO_ERROR | No clock frequency error measured by CFM1. |
Definition at line 81 of file midware_clock_manager.c.
| bool MW_IsDiagCfd0Ongoing | ( | void | ) |
Checks if the CFD0 error injection is ongoing.
This function checks the status of the CFD0 diagnostics to determine if it's appropriate to end the diagnostic by calling MW_DiagClockCfd0End.
| true | The CFD0 diagnostic is ongoing. |
| false | The CFD0 diagnostic is either finished or was never started. |
Definition at line 194 of file midware_clock_manager_diag.c.
| bool MW_IsDiagCfd1Ongoing | ( | void | ) |
Checks if the CFD1 error injection is ongoing.
This function checks the status of the CFD1 diagnostics to determine if it's appropriate to end the diagnostic by calling MW_DiagClockCfd1End.
| true | The CFD1 diagnostic is ongoing. |
| false | The CFD1 diagnostic is either finished or was never started. |
Definition at line 259 of file midware_clock_manager_diag.c.
| errFlag_t MW_SetMainClockFrequency | ( | clkFrq_t | frequency, |
| clkFrqDiv_t | divider ) |
Initializes main clock with internal High Frequency Oscillator (OSCHF) as clock source.
| frequency | The OSCHF main clock frequency to use. |
| divider | The division factor to divide the selected frequency by. |
| ERROR | Invalid clock source or division selected, main clock not configured. |
| NO_ERROR | All inputs are valid, clock configured correctly. |
Definition at line 104 of file midware_clock_manager.c.
| errFlag_t MW_StartCfd0 | ( | cfdSource_t | src, |
| cfdReference_t | ref ) |
Starts Clock Failure Detect 0 (CFD0) to monitor the configured clock source with the configured reference.
| src | The clock source to be monitored by CFD0. |
| ref | The clock reference to be used by CFD0. |
| ERROR | Invalid clock source or reference selected, CFD0 not configured. |
| NO_ERROR | All inputs are valid, CFD0 configured correctly. |
Definition at line 134 of file midware_clock_manager.c.
| errFlag_t MW_StartCfd1 | ( | cfdSource_t | src, |
| cfdReference_t | ref ) |
Starts Clock Failure Detect 1 (CFD1) to monitor the configured clock source with the configured reference.
| src | The clock source to be monitored by CFD1. |
| ref | The clock reference to be used by CFD1. |
| ERROR | Invalid clock source or reference selected, CFD1 not configured. |
| NO_ERROR | All inputs are valid, CFD1 configured correctly. |
Definition at line 157 of file midware_clock_manager.c.
| errFlag_t MW_StartCfm0 | ( | cfmSource_t | src, |
| cfmReference_t | ref, | ||
| cfmWindow_t | window, | ||
| bool | useContinuous ) |
Starts continuous Clock Frequency Measure 0 (CFM0) to monitor the configured clock source with the configured reference.
| src | The clock source to be monitored by CFM0. |
| ref | The clock reference to be used by CFM0. |
| window | The window configuration for the measurement. |
| useContinuous | Selects between continuous mode (true) and one-shot mode (false). |
| ERROR | Invalid clock source or reference selected, CFM0 not configured. |
| NO_ERROR | All inputs are valid, CFM configured correctly. |
Definition at line 180 of file midware_clock_manager.c.
| errFlag_t MW_StartCfm1 | ( | cfmSource_t | src, |
| cfmReference_t | ref, | ||
| cfmWindow_t | window, | ||
| bool | useContinuous ) |
Starts continuous Clock Frequency Measure 1 (CFM1) to monitor the configured clock source with the configured reference.
| src | The clock source to be monitored by CFM1. |
| ref | The clock reference to be used by CFM1. |
| window | The window configuration for the measurement. |
| useContinuous | Selects between continuous mode (true) and one-shot mode (false). |
| ERROR | Invalid clock source or reference selected, CFM1 not configured. |
| NO_ERROR | All inputs are valid, CFM1 configured correctly. |
Definition at line 216 of file midware_clock_manager.c.