fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
1/*****************************************************************************
2 * pce *
3 *****************************************************************************/
4
5/*****************************************************************************
6 * File name: src/arch/macplus/rtc.h *
7 * Created: 2007-11-16 by Hampa Hug <hampa@hampa.ch> *
8 * Copyright: (C) 2007-2018 Hampa Hug <hampa@hampa.ch> *
9 *****************************************************************************/
10
11/*****************************************************************************
12 * This program is free software. You can redistribute it and / or modify it *
13 * under the terms of the GNU General Public License version 2 as published *
14 * by the Free Software Foundation. *
15 * *
16 * This program is distributed in the hope that it will be useful, but *
17 * WITHOUT ANY WARRANTY, without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
19 * Public License for more details. *
20 *****************************************************************************/
21
22
23#ifndef PCE_MACPLUS_RTC_H
24#define PCE_MACPLUS_RTC_H 1
25
26
27typedef struct {
28 unsigned char data[256];
29
30 unsigned char reg_wp;
31 unsigned char reg_test;
32
33 unsigned long clock;
34 unsigned long rtime;
35
36 int data_out;
37 unsigned state;
38 unsigned bitcnt;
39 unsigned char cmd1;
40 unsigned char cmd2;
41 unsigned char shift;
42 unsigned char sigval;
43
44 int realtime;
45 long gmtoff;
46
47 unsigned long clkcnt;
48
49 void *set_data_ext;
50 void (*set_data) (void *ext, unsigned char val);
51 unsigned char set_data_val;
52
53 void *set_osi_ext;
54 void (*set_osi) (void *ext, unsigned char val);
55 unsigned char set_osi_val;
56} mac_rtc_t;
57
58
59void mac_rtc_init (mac_rtc_t *rtc);
60void mac_rtc_free (mac_rtc_t *rtc);
61
62void mac_rtc_set_data_fct (mac_rtc_t *rtc, void *ext, void *fct);
63void mac_rtc_set_osi_fct (mac_rtc_t *rtc, void *ext, void *fct);
64
65void mac_rtc_set_realtime (mac_rtc_t *rtc, int realtime);
66
67void mac_rtc_set_defaults (mac_rtc_t *rtc);
68
69int mac_rtc_load_file (mac_rtc_t *rtc, const char *fname);
70int mac_rtc_save_file (mac_rtc_t *rtc, const char *fname);
71
72void mac_rtc_set_time (mac_rtc_t *rtc, unsigned long time, int utc);
73void mac_rtc_set_time_now (mac_rtc_t *rtc);
74void mac_rtc_set_time_str (mac_rtc_t *rtc, const char *str);
75void mac_rtc_set_time_gmtoff (mac_rtc_t *rtc);
76
77void mac_rtc_set_uint8 (mac_rtc_t *rtc, unsigned char val);
78
79void mac_rtc_clock (mac_rtc_t *rtc, unsigned long n);
80
81
82#endif