/* Change the source of the main system clock.  */
void sysclk_set_source(uint32_t src)
/* Change the source of the main system clock.  */
void sysclk_set_source(uint32_t src)
{
	irqflags_t flags;
	Assert(src <= SYSCLK_SRC_RC1M);
	flags = cpu_irq_save();
	PM->PM_UNLOCK = PM_UNLOCK_KEY(0xAAu)
		| PM_UNLOCK_ADDR((uint32_t)&PM->PM_MCCTRL - (uint32_t)PM);
	PM->PM_MCCTRL = src;
	cpu_irq_restore(flags);
}