1 /* ----------------------------------------------------------------------------
\r
2 * SAM Software Package License
\r
3 * ----------------------------------------------------------------------------
\r
4 * Copyright (c) 2011, Atmel Corporation
\r
6 * All rights reserved.
\r
8 * Redistribution and use in source and binary forms, with or without
\r
9 * modification, are permitted provided that the following conditions are met:
\r
11 * - Redistributions of source code must retain the above copyright notice,
\r
12 * this list of conditions and the disclaimer below.
\r
14 * Atmel's name may not be used to endorse or promote products derived from
\r
15 * this software without specific prior written permission.
\r
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
\r
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
\r
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
\r
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
\r
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
\r
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
\r
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
\r
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
\r
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
27 * ----------------------------------------------------------------------------
\r
33 * Interface for Real Time Clock (RTC) controller.
\r
40 /*----------------------------------------------------------------------------
\r
42 *----------------------------------------------------------------------------*/
\r
47 /*----------------------------------------------------------------------------
\r
49 *----------------------------------------------------------------------------*/
\r
51 #define RTC_HOUR_BIT_LEN_MASK 0x3F
\r
52 #define RTC_MIN_BIT_LEN_MASK 0x7F
\r
53 #define RTC_SEC_BIT_LEN_MASK 0x7F
\r
54 #define RTC_CENT_BIT_LEN_MASK 0x7F
\r
55 #define RTC_YEAR_BIT_LEN_MASK 0xFF
\r
56 #define RTC_MONTH_BIT_LEN_MASK 0x1F
\r
57 #define RTC_DATE_BIT_LEN_MASK 0x3F
\r
58 #define RTC_WEEK_BIT_LEN_MASK 0x07
\r
60 /*----------------------------------------------------------------------------
\r
61 * Exported functions
\r
62 *----------------------------------------------------------------------------*/
\r
68 extern void RTC_SetHourMode( Rtc* pRtc, uint32_t dwMode ) ;
\r
70 extern uint32_t RTC_GetHourMode( Rtc* pRtc ) ;
\r
72 extern void RTC_EnableIt( Rtc* pRtc, uint32_t dwSources ) ;
\r
74 extern void RTC_DisableIt( Rtc* pRtc, uint32_t dwSources ) ;
\r
76 extern int RTC_SetTime( Rtc* pRtc, uint8_t ucHour, uint8_t ucMinute, uint8_t ucSecond ) ;
\r
78 extern void RTC_GetTime( Rtc* pRtc, uint8_t *pucHour, uint8_t *pucMinute, uint8_t *pucSecond ) ;
\r
80 extern int RTC_SetTimeAlarm( Rtc* pRtc, uint8_t *pucHour, uint8_t *pucMinute, uint8_t *pucSecond ) ;
\r
82 extern void RTC_GetDate( Rtc* pRtc, uint16_t *pwYear, uint8_t *pucMonth, uint8_t *pucDay, uint8_t *pucWeek ) ;
\r
84 extern int RTC_SetDate( Rtc* pRtc, uint16_t wYear, uint8_t ucMonth, uint8_t ucDay, uint8_t ucWeek ) ;
\r
86 extern int RTC_SetDateAlarm( Rtc* pRtc, uint8_t *pucMonth, uint8_t *pucDay ) ;
\r
88 extern void RTC_ClearSCCR( Rtc* pRtc, uint32_t dwMask ) ;
\r
90 extern uint32_t RTC_GetSR( Rtc* pRtc, uint32_t dwMask ) ;
\r
92 #if defined(sam3s8) || defined(sam3sd8)
\r
93 extern void RTC_SetWaveForm( Rtc* pRtc, uint32_t dwWaveMode );
\r
100 #endif /* #ifndef _RTC_ */
\r