/* Checks if a clock failure is detected. 
Checks if a given clock failure is detected or not. */
bool system_clock_source_failure_is_detect(const enum system_clock_source clock_source)
/* Checks if a clock failure is detected. 
Checks if a given clock failure is detected or not. */
bool system_clock_source_failure_is_detect(const enum system_clock_source clock_source)
{
	uint32_t mask = 0;
	switch (clock_source) {
	case SYSTEM_CLOCK_SOURCE_XOSC:
		mask = OSCCTRL_STATUS_XOSCFAIL;
		return ((OSCCTRL->STATUS.reg & mask) == mask);
	case SYSTEM_CLOCK_SOURCE_XOSC32K:
		mask = OSC32KCTRL_STATUS_CLKFAIL;
		return ((OSC32KCTRL->STATUS.reg & mask) == mask);
	default:
		return false;
	}
}