00001
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _RTC_H_
00049 #define _RTC_H_
00050
00051 #include "compiler.h"
00052 #include <avr32/io.h>
00053
00054
00057
00058 #define RTC_OSC_32KHZ 1
00059 #define RTC_OSC_RC 0
00061
00062
00064
00065
00068 #define RTC_PSEL_32KHZ_1HZ 14
00069
00072 #define RTC_PSEL_RC_1_76HZ 15
00073
00075
00076
00092 extern int rtc_init(volatile avr32_rtc_t *rtc, unsigned char osc_type, unsigned char psel);
00093
00098 extern void rtc_enable(volatile avr32_rtc_t *rtc);
00099
00104 extern void rtc_disable(volatile avr32_rtc_t *rtc);
00105
00110 extern void rtc_enable_wake_up(volatile avr32_rtc_t *rtc);
00111
00116 extern void rtc_disable_wake_up(volatile avr32_rtc_t *rtc);
00117
00124 extern void rtc_enable_interrupt(volatile avr32_rtc_t *rtc);
00125
00130 extern void rtc_disable_interrupt(volatile avr32_rtc_t *rtc);
00131
00137 extern void rtc_clear_interrupt(volatile avr32_rtc_t *rtc);
00138
00144 extern int rtc_interrupt_enabled(volatile avr32_rtc_t *rtc);
00145
00151 extern int rtc_is_interrupt(volatile avr32_rtc_t *rtc);
00152
00158 extern void rtc_set_top_value(volatile avr32_rtc_t *rtc, unsigned long top);
00159
00165 extern unsigned long rtc_get_top_value(volatile avr32_rtc_t *rtc);
00166
00172 extern int rtc_is_busy(volatile avr32_rtc_t *rtc);
00173
00179 extern void rtc_set_value(volatile avr32_rtc_t *rtc, unsigned long val);
00180
00186 extern unsigned long rtc_get_value(volatile avr32_rtc_t *rtc);
00187
00188
00189 #endif // _RTC_H_