00001
00002
00003
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 #ifndef _RTC_H_
00048 #define _RTC_H_
00049
00050 #include "compiler.h"
00051 #include <avr32/io.h>
00052
00053
00056
00057 #define RTC_INT_GROUP 1
00058 #define RTC_INT_LINE 8
00060
00061
00063
00064 #define RTC_OSC_32KHZ 1
00065 #define RTC_OSC_RC 0
00067
00068
00070
00071 #define RTC_PSEL_32KHZ_1HZ 14
00072 #define RTC_PSEL_RC_1HZ 16
00074
00075
00090 extern int rtc_init(volatile avr32_rtc_t *rtc, unsigned char osc_type, unsigned char psel);
00091
00096 extern void rtc_enable(volatile avr32_rtc_t *rtc);
00097
00102 extern void rtc_disable(volatile avr32_rtc_t *rtc);
00103
00108 extern void rtc_enable_wake_up(volatile avr32_rtc_t *rtc);
00109
00114 extern void rtc_disable_wake_up(volatile avr32_rtc_t *rtc);
00115
00122 extern void rtc_enable_interrupt(volatile avr32_rtc_t *rtc);
00123
00128 extern void rtc_disable_interrupt(volatile avr32_rtc_t *rtc);
00129
00135 extern void rtc_clear_interrupt(volatile avr32_rtc_t *rtc);
00136
00142 extern int rtc_interrupt_enabled(volatile avr32_rtc_t *rtc);
00143
00149 extern int rtc_is_interrupt(volatile avr32_rtc_t *rtc);
00150
00156 extern void rtc_set_top_value(volatile avr32_rtc_t *rtc, unsigned long top);
00157
00163 extern unsigned long rtc_get_top_value(volatile avr32_rtc_t *rtc);
00164
00170 extern int rtc_is_busy(volatile avr32_rtc_t *rtc);
00171
00177 extern void rtc_set_value(volatile avr32_rtc_t *rtc, unsigned long val);
00178
00184 extern unsigned long rtc_get_value(volatile avr32_rtc_t *rtc);
00185
00186
00187 #endif // _RTC_H_