/* alarm = 0 selects Alarm A. alarm = 1 selects Alarm B.  */
static void stm32f2_alarm_irq_enable(unsigned int alarm, unsigned int enable)
/* alarm = 0 selects Alarm A. alarm = 1 selects Alarm B.  */
static void stm32f2_alarm_irq_enable(unsigned int alarm, unsigned int enable)
{
	u32 irq_enable_msk =
		alarm ? STM32F2_RTC_CR_ALRBIE_MSK : STM32F2_RTC_CR_ALRAIE_MSK;
	u32 irq_flag_msk =
		alarm ? STM32F2_RTC_ISR_ALRBF_MSK : ~STM32F2_RTC_ISR_ALRAF_MSK;
	stm32f2_rtc_write_enable(1);
	if (enable)
		STM32_RTC->cr |= irq_enable_msk;
	else
		STM32_RTC->cr &= ~irq_enable_msk;
	STM32_RTC->isr &= ~irq_flag_msk;
	stm32f2_rtc_write_enable(0);
}