📄 xllp_rtc.c
字号:
/******************************************************************************
**
** COPYRIGHT (C) 2002 Intel Corporation.
**
** This software as well as the software described in it is furnished under
** license and may only be used or copied in accordance with the terms of the
** license. The information in this file is furnished for informational use
** only, is subject to change without notice, and should not be construed as
** a commitment by Intel Corporation. Intel Corporation assumes no
** responsibility or liability for any errors or inaccuracies that may appear
** in this document or any software that may be provided in association with
** this document.
** Except as permitted by such license, no part of this document may be
** reproduced, stored in a retrieval system, or transmitted in any form or by
** any means without the express written consent of Intel Corporation.
**
** FILENAME: xllp_rtc.c
**
** PURPOSE: contains XLLP RTC primitives.
**
******************************************************************************/
#include "xllp_defs.h"
#include "xllp_rtc.h"
//
// Configures the RTC Alarm to cause an interrupt at the designated time.
// Upon completion of this routine, the RTC alarm is armed and enabled.
//
// Inputs:
// pRTCHandle - handle to a structure containing the RTC and INTC base register addresses.
// alarmtime - the unsigned 32-bit value to assign to the RTC alarm register.
//
void XllpRtcConfigureAlarm (P_XLLP_RTC_HANDLE_T pRTCHandle, XLLP_UINT32_T alarmtime)
{
P_XLLP_RTC_T pRTCRegs = pRTCHandle->pRTCRegs;
P_XLLP_INTC_T pINTCRegs = pRTCHandle->pINTCRegs;
//disable the RTC alarm interrupt
pRTCRegs->rtsr &= (~(XLLP_RTSR_MASK | XLLP_RTSR_RESERVED_BITS | XLLP_RTSR_ALE));
//clear any current RTC alarm interrupt
pRTCRegs->rtsr &= (~(XLLP_RTSR_MASK | XLLP_RTSR_RESERVED_BITS) | XLLP_RTSR_AL);
//
// Set the Alarm value
//
pRTCRegs->rtar = alarmtime;
// Enable the RTC alarm interrupt
pRTCRegs->rtsr = (pRTCRegs->rtsr & ~(XLLP_RTSR_MASK | XLLP_RTSR_RESERVED_BITS)) | XLLP_RTSR_ALE;
// Unmask alarm interrupt
pINTCRegs->icmr |= XLLP_INTC_RTCALARM;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -