FuSa 8-Bit Libraries Safety Framework
Loading...
Searching...
No Matches
Clock Manager

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.

Detailed Description

Contains API prototypes and defines for the Clock Manager.

Version
1.0.0-alpha.1

The Clock Manager provides services to Tasks to ensure correct interaction with features of the CLKCTRL peripheral.

UML Class Diagrams

UML Activity Diagrams

Enumeration Type Documentation

◆ cfdReference_t

Type definitions for available Clock Failure Detection (CFD) references used for configuring the CFDs.

Note
Group configurations are shifted to reduce value range gaps, simplifying input validation.
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.

◆ cfdSource_t

Type definitions for available Clock Failure Detection (CFD) sources used for configuring the CFDs.

Note
Group configurations are shifted to reduce value range gaps, simplifying input validation.
Enumerator
CFD_SRC_MAINCLK 

MAINCLK as source

CFD_SRC_OSCHF 

OSCHF as source

CFD_SRC_OSC32K 

OSC32K as source

CFD_SRC_XOSCHF 

XOSCHF as source

CFD_SRC_XOSC32K 

XOSC32K as source

CFD_SRC_EVSYS 

EVSYS as source

CFD_SRC_MAX 

Reserved value, indicates highest CFD source value

Definition at line 93 of file midware_clock_manager.h.

◆ cfmReference_t

Type definitions for available Clock Frequency Measure (CFM) references used for configuring the CFMs.

Note
Group configurations are shifted to reduce value range gaps, simplifying input validation.
Enumerator
CFM_REF_OSCHF 

OSCHF as reference

CFM_REF_XOSCHF 

XOSCHF as reference

CFM_REF_XOSC32K 

XOSC32K as reference

CFM_REF_OSC32K 

OSC32K as reference

CFM_REF_MAX 

Reserved value, indicates highest CFM reference value

Definition at line 144 of file midware_clock_manager.h.

◆ cfmSource_t

Type definitions for available Clock Frequency Measure (CFM) sources used for configuring the CFMs.

Note
Group configurations are shifted to reduce value range gaps, simplifying input validation.
Enumerator
CFM_SRC_MAINCLK 

MAINCLK as source

CFM_SRC_OSCHF 

OSCHF as source

CFM_SRC_OSC32K 

OSC32K as source

CFM_SRC_XOSCHF 

XOSCHF as source

CFM_SRC_XOSC32K 

XOSC32K as source

CFM_SRC_EVSYS 

EVSYS as source

CFM_SRC_MAX 

Reserved value, indicates highest CFM source value

Definition at line 126 of file midware_clock_manager.h.

◆ clkFrq_t

enum clkFrq_t

Type definitions for available High Frequency Oscillator output frequencies used for configuring the main clock.

Note
Group configurations are shifted to reduce value range gaps, simplifying input validation.
Enumerator
CLK_FRQ_1_MHZ 

1 MHz

CLK_FRQ_2_MHZ 

2 MHz

CLK_FRQ_3_MHZ 

3 MHz

CLK_FRQ_4_MHZ 

4 MHz

CLK_FRQ_INVALID 

Reserved value

CLK_FRQ_8_MHZ 

8 MHz

CLK_FRQ_12_MHZ 

12 MHz

CLK_FRQ_16_MHZ 

16 MHz

CLK_FRQ_20_MHZ 

20 MHz

CLK_FRQ_MAX 

Reserved value, indicates highest clock frequency value

Definition at line 47 of file midware_clock_manager.h.

◆ clkFrqDiv_t

Type definitions for available pre-scaler division used for configuring the main clock.

Note
Group configurations are shifted to reduce value range gaps, simplifying input validation.
Enumerator
CLK_FRQ_DIV2 

Divide by 2

CLK_FRQ_DIV4 

Divide by 4

CLK_FRQ_DIV8 

Divide by 8

CLK_FRQ_DIV16 

Divide by 16

CLK_FRQ_DIV32 

Divide by 32

CLK_FRQ_DIV64 

Divide by 64

CLK_FRQ_DIV_INVALID1 

Reserved value

CLK_FRQ_DIV_INVALID2 

Reserved value

CLK_FRQ_DIV6 

Divide by 6

CLK_FRQ_DIV10 

Divide by 10

CLK_FRQ_DIV12 

Divide by 12

CLK_FRQ_DIV24 

Divide by 24

CLK_FRQ_DIV48 

Divide by 48

CLK_FRQ_DIV_OFF 

Disables clock division

CLK_FRQ_DIV_MAX 

Reserved value, indicates highest clock divider value

Definition at line 67 of file midware_clock_manager.h.

Function Documentation

◆ MW_DiagClockCfd0Begin()

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.

Note
The CFD monitor uses 10 reference clock cycles to do a full CFD period but due to the previous cycle needing to complete up to 2 periods are required to complete the diagnostic. The user should make sure that 20 cycles on the reference clock has passed before calling the end diagnostic.
The CFD Diagnostics process involves backing up the current source and reference configurations. This precaution is taken to prevent unwanted resets that would happen if an error is injected while monitoring the main clock. The system is then set to a configuration needed for the diagnostics. Once the diagnostic process is completed, the original configuration is restored.
Warning
This diagnostic temporarily disables the safety mechanism in Mission Mode, potentially masking true faults during execution. It also disables global interrupt during execution, which may delay the servicing of other error-handling interrupts. The global interrupts are only disabled for the duration of the begin or end functions and are restored for the duration between the start and completion of this diagnostic.
Return values
ERRORDiagnostic failed to start due to ongoing NONCRITICAL errors or existing unhandled CFD0 NOTIFICATION errors.
NO_ERRORCFD0 diagnostic successfully started.

Definition at line 133 of file midware_clock_manager_diag.c.

◆ MW_DiagClockCfd0End()

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.

Note
If this function is called without having called MW_DiagClockCfd0Begin beforehand, it will do nothing and return ERROR in order to avoid data hazards in regard to modifying the CFD0 registers and the CFD0 error channel configuration.
Warning
This diagnostic temporarily disables global interrupt during execution, which may delay the servicing of other error-handling interrupts. The global interrupts are only disabled for the duration of the function and are restored before returning.
Return values
ERRORFault detected in the CFD0 monitor or inappropriate function call.
NO_ERRORNo fault detected in CFD0 monitor.

Definition at line 160 of file midware_clock_manager_diag.c.

◆ MW_DiagClockCfd1Begin()

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.

Note
The CFD monitor uses 10 reference clock cycles to do a full CFD period but due to the previous cycle needing to complete up to 2 periods are required to complete the diagnostic. The user should make sure that 20 cycles on the reference clock has passed before calling the end diagnostic.
The CFD Diagnostics process involves backing up the current source and reference configurations. This precaution is taken to prevent unwanted resets that would happen if an error is injected while monitoring the main clock. The system is then set to a configuration needed for the diagnostics. Once the diagnostic process is completed, the original configuration is restored.
Warning
This diagnostic temporarily disables the safety mechanism in Mission Mode, potentially masking true faults during execution. It also disables global interrupt during execution, which may delay the servicing of other error-handling interrupts. The global interrupts are only disabled for the duration of the begin or end functions and are restored for the duration between the start and completion of this diagnostic.
Return values
ERRORDiagnostic failed to start due to ongoing NONCRITICAL errors or existing unhandled CFD1 NOTIFICATION errors.
NO_ERRORCFD1 diagnostic successfully started.

Definition at line 199 of file midware_clock_manager_diag.c.

◆ MW_DiagClockCfd1End()

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.

Note
If this function is called without having called MW_DiagClockCfd1Begin beforehand, it will do nothing and return ERROR in order to avoid data hazards in regard to modifying the CFD1 registers and the CFD1 error channel configuration.
Warning
This diagnostic temporarily disables global interrupt during execution, which may delay the servicing of other error-handling interrupts. The global interrupts are only disabled for the duration of the function and are restored before returning.
Return values
ERRORFault detected in the CFD1 monitor or inappropriate function call.
NO_ERRORNo fault detected in CFD1 monitor.

Definition at line 225 of file midware_clock_manager_diag.c.

◆ MW_DiagClockCfm0()

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:

  • Inside the window, expects no error to be triggered.
  • Above the window, expect the interrupt flag and error channel to be set.
  • Below the window, expect the interrupt flag and error channel to be set.
Note
The CFM Diagnostics process involves backing up the current source, reference and window configurations. The system is then set to a configuration needed for the diagnostics. Once the diagnostic process is completed, the original configuration is restored.
Warning
The CFM Diagnostic will not complete if the reference clock stops working. The reference clock is set to the internal high frequency oscillator (OSCHF) for the duration of the diagnostic. The consequences of this depends on the Main Clock and CFD settings in addition to the severity configuration of the connected error channels.
  • If a CFD monitor is set to monitor the Main Clock, and OSCHF is set as the Main Clock for the device, the device will reset immediately.
  • If OSCHF is not set as the Main Clock but is monitored by a CFD monitor the CFD interrupt flag will trigger.
  • The function is also monitored by the Synchronous Watchdog Timer (SWDT) that will expire after the duration set for T_RunStartupDiagnostics or T_RunNextLatentFaultDiag, the expiration will set a interrupt flag in the SWDT.
  • Since the interrupts are disabled during the execution of the diagnostic, the behavior of a set interrupt flag depends on the severity configuration of the connected error channels. If set to anything other than NOTIFICATION the error controller will reset the device (after a timeout in the case of NONCRITICAL severity).
  • The Watchdog Timer will eventually expire if the CFD and SWDT error channels are set to NOTIFICATION. The duration before this happens will depend on if the diagnostic is called as part of the TM_Startup or TM_Scheduler. The device will reset after the Watchdog Timer expires.
This diagnostic temporarily disables the safety mechanism in Mission Mode, potentially masking true faults during execution. It also disables global interrupt during execution, which may delay the servicing of other error-handling interrupts.
Return values
ERRORFault detected in the CFM0 monitor.
NO_ERRORNo fault detected in the CFM0 monitor.

Definition at line 264 of file midware_clock_manager_diag.c.

◆ MW_DiagClockCfm1()

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:

  • Inside the window, expects no error to be triggered.
  • Above the window, expect the interrupt flag and error channel to be set.
  • Below the window, expect the interrupt flag and error channel to be set.
Note
The CFM Diagnostics process involves backing up the current source, reference and window configurations. The system is then set to a configuration needed for the diagnostics. Once the diagnostic process is completed, the original configuration is restored.
Warning
The CFM Diagnostic will not complete if the reference clock stops working. The reference clock is set to the internal high frequency oscillator (OSCHF) for the duration of the diagnostic. The consequences of this depends on the Main Clock and CFD settings in addition to the severity configuration of the connected error channels.
  • If a CFD monitor is set to monitor the Main Clock, and OSCHF is set as the Main Clock for the device, the device will reset immediately.
  • If OSCHF is not set as the Main Clock but is monitored by a CFD monitor the CFD interrupt flag will trigger.
  • The function is also monitored by the Synchronous Watchdog Timer (SWDT) that will expire after the duration set for T_RunStartupDiagnostics or T_RunNextLatentFaultDiag, the expiration will set a interrupt flag in the SWDT.
  • Since the interrupts are disabled during the execution of the diagnostic, the behavior of a set interrupt flag depends on the severity configuration of the connected error channels. If set to anything other than NOTIFICATION the error controller will reset the device (after a timeout in the case of NONCRITICAL severity).
  • The Watchdog Timer will eventually expire if the CFD and SWDT error channels are set to NOTIFICATION. The duration before this happens will depend on if the diagnostic is called as part of the TM_Startup or TM_Scheduler. The device will reset after the Watchdog Timer expires.
This diagnostic temporarily disables the safety mechanism in Mission Mode, potentially masking true faults during execution. It also disables global interrupt during execution, which may delay the servicing of other error-handling interrupts.
Return values
ERRORFault detected in the CFM1 monitor.
NO_ERRORNo fault detected in the CFM1 monitor.

Definition at line 298 of file midware_clock_manager_diag.c.

◆ MW_EnableClockInterrupts()

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.

Note
The Clock Frequency Measurement Done interrupt is not enabled by default and is expected to be enabled by the application if needed.

Definition at line 252 of file midware_clock_manager.c.

◆ MW_GetClearClockCfd0Error()

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.

Return values
ERRORClock failure detected by CFD0.
NO_ERRORClock failure not detected by CFD0.

Definition at line 33 of file midware_clock_manager.c.

◆ MW_GetClearClockCfd1Error()

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.

Return values
ERRORClock failure detected by CFD1.
NO_ERRORClock failure not detected by CFD1.

Definition at line 49 of file midware_clock_manager.c.

◆ MW_GetClearClockCfm0Error()

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.

Return values
ERRORClock frequency error measured by CFM0.
NO_ERRORNo clock frequency error measured by CFM0.

Definition at line 65 of file midware_clock_manager.c.

◆ MW_GetClearClockCfm1Error()

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.

Return values
ERRORClock frequency error measured by CFM1.
NO_ERRORNo clock frequency error measured by CFM1.

Definition at line 81 of file midware_clock_manager.c.

◆ MW_IsDiagCfd0Ongoing()

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.

Note
This check is not enough to determine if the diagnostic is done, see MW_DiagClockCfd0Begin for more information.
Return values
trueThe CFD0 diagnostic is ongoing.
falseThe CFD0 diagnostic is either finished or was never started.

Definition at line 194 of file midware_clock_manager_diag.c.

◆ MW_IsDiagCfd1Ongoing()

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.

Note
This check is not enough to determine if the diagnostic is done, see MW_DiagClockCfd1Begin for more information.
Return values
trueThe CFD1 diagnostic is ongoing.
falseThe CFD1 diagnostic is either finished or was never started.

Definition at line 259 of file midware_clock_manager_diag.c.

◆ MW_SetMainClockFrequency()

errFlag_t MW_SetMainClockFrequency ( clkFrq_t frequency,
clkFrqDiv_t divider )

Initializes main clock with internal High Frequency Oscillator (OSCHF) as clock source.

Warning
This function always configures the main clock to use the High Frequency Oscillator (OSCHF) as the clock source.
Parameters
frequencyThe OSCHF main clock frequency to use.
dividerThe division factor to divide the selected frequency by.
Return values
ERRORInvalid clock source or division selected, main clock not configured.
NO_ERRORAll inputs are valid, clock configured correctly.

Definition at line 104 of file midware_clock_manager.c.

◆ MW_StartCfd0()

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.

Note
The CFD expects the MW_EnableClockInterrupts to be run before any error can be reported through an interrupt. Regardless of interrupt configuration, a CFD error will always be reported to the error controller.
Parameters
srcThe clock source to be monitored by CFD0.
refThe clock reference to be used by CFD0.
Return values
ERRORInvalid clock source or reference selected, CFD0 not configured.
NO_ERRORAll inputs are valid, CFD0 configured correctly.

Definition at line 134 of file midware_clock_manager.c.

◆ MW_StartCfd1()

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.

Note
The CFD expects the MW_EnableClockInterrupts to be run before any error can be reported through an interrupt. Regardless of interrupt configuration, a CFD error will always be reported to the error controller.
Parameters
srcThe clock source to be monitored by CFD1.
refThe clock reference to be used by CFD1.
Return values
ERRORInvalid clock source or reference selected, CFD1 not configured.
NO_ERRORAll inputs are valid, CFD1 configured correctly.

Definition at line 157 of file midware_clock_manager.c.

◆ MW_StartCfm0()

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.

Note
The CFM expects the MW_EnableClockInterrupts to be run before any error can be reported through an interrupt. Regardless of interrupt configuration, a CFM error will always be reported to the error controller.
Parameters
srcThe clock source to be monitored by CFM0.
refThe clock reference to be used by CFM0.
windowThe window configuration for the measurement.
useContinuousSelects between continuous mode (true) and one-shot mode (false).
Return values
ERRORInvalid clock source or reference selected, CFM0 not configured.
NO_ERRORAll inputs are valid, CFM configured correctly.

Definition at line 180 of file midware_clock_manager.c.

◆ MW_StartCfm1()

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.

Note
The CFM expects the MW_EnableClockInterrupts to be run before any error can be reported through an interrupt. Regardless of interrupt configuration, a CFM error will always be reported to the error controller.
Parameters
srcThe clock source to be monitored by CFM1.
refThe clock reference to be used by CFM1.
windowThe window configuration for the measurement.
useContinuousSelects between continuous mode (true) and one-shot mode (false).
Return values
ERRORInvalid clock source or reference selected, CFM1 not configured.
NO_ERRORAll inputs are valid, CFM1 configured correctly.

Definition at line 216 of file midware_clock_manager.c.