Debian Codegraph @

ports/renesas-ra/ra/ra_rtc.h

raw
1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2021 Renesas Electronics Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 #ifndef RA_RTC_H_
26 #define RA_RTC_H_
27
28 #include <stdint.h>
29 #include <stdbool.h>
30
31 #define RTC_PERIOD_MINUTE 0x00
32 #define RTC_PERIOD_SECOND 0x01
33
34 typedef struct {
35 unsigned short year;
36 unsigned char month;
37 unsigned char date;
38 unsigned char weekday;
39 unsigned char hour;
40 unsigned char minute;
41 unsigned char second;
42 } ra_rtc_t;
43
44 typedef void (*ra_rtc_cb_t)(void *);
45
46 int ra_rtc_get_year(void);
47 int ra_rtc_get_month(void);
48 int ra_rtc_get_date(void);
49 int ra_rtc_get_hour(void);
50 int ra_rtc_get_minute(void);
51 int ra_rtc_get_second(void);
52 int ra_rtc_get_weekday(void);
53 void ra_rtc_period_on();
54 void ra_rtc_period_off();
55 void ra_rtc_set_period_time(uint32_t period);
56 void ra_rtc_set_period_func(void *cb, void *param);
57 void ra_rtc_alarm_on(void);
58 void ra_rtc_alarm_off(void);
59 void ra_rtc_set_alarm_time(int hour, int min, int week_flag);
60 void ra_rtc_set_alarm_func(void *cb, void *param);
61 void ra_rtc_set_adjustment(int adj, int aadjp);
62 uint8_t ra_rtc_get_adjustment(void);
63 bool ra_rtc_set_time(ra_rtc_t *time);
64 bool ra_rtc_get_time(ra_rtc_t *time);
65 bool ra_rtc_init(uint8_t source);
66 bool ra_rtc_deinit(void);
67 void rtc_alarm_periodic_isr(void);
68 void rtc_carry_isr(void);
69
70 #endif /* RA_RTC_H_ */