1 /*
2  * cal.h
3  *
4  * CPU Abstraction Layer interface.
5  */
6 
7 /* $Id: cal.h,v 1.20 2001/03/16 18:18:42 nyef Exp $ */
8 
9 #ifndef __CAL_H__
10 #define __CAL_H__
11 
12 #include "memtypes.h"
13 
14 typedef struct cal_cpu *cal_cpu;
15 
16 void cal_maratz80_init(cal_cpu *cpu);
17 void cal_junk68k_init(cal_cpu *cpu);
18 void cal_torr68k_init(cal_cpu *cpu);
19 void cal_cpu6280_init(cal_cpu *cpu);
20 void cal_cpu6502_init(cal_cpu *cpu);
21 
22 #define CPUT_MARATZ80  cal_maratz80_init
23 #define CPUT_JUNK68K   cal_junk68k_init
24 #define CPUT_TORR68K   cal_torr68k_init
25 #define CPUT_CPU6280   cal_cpu6280_init
26 #define CPUT_CPU6502   cal_cpu6502_init
27 
28 typedef void (*cpureset_t)(cal_cpu);
29 typedef void (*cpurun_t)(cal_cpu);
30 typedef void (*cpurunfor_t)(cal_cpu, int);
31 typedef void (*cpuirq_t)(cal_cpu, int);
32 typedef void (*cpunmi_t)(cal_cpu);
33 typedef void (*cpusetzpage_t)(cal_cpu, void *);
34 typedef int (*cputimeleft_t)(cal_cpu);
35 typedef void (*cpusetmmu0_t)(cal_cpu, ranged_mmu *);
36 typedef void (*cpusetmmu8_t)(cal_cpu, int, int, memread8_t *, memwrite8_t *);
37 typedef void (*cpusetmmu16_t)(cal_cpu, int, int, memread16_t *, memwrite16_t *);
38 typedef void (*cpusetmmu32_t)(cal_cpu, int, int, memread32_t *, memwrite32_t *);
39 typedef void (*cpusetiou_t)(cal_cpu, memread8_t, memwrite8_t);
40 
41 struct cal_cpu {
42     void *userdata;
43     cpureset_t reset;
44     cpurun_t run;
45     cpurunfor_t runfor;
46     cpuirq_t irq;
47     cpunmi_t nmi;
48     cpusetzpage_t setzpage;
49     cputimeleft_t timeleft;
50     cpusetmmu0_t setmmu0;
51     cpusetmmu8_t setmmu8;
52     cpusetmmu16_t setmmu16;
53     cpusetmmu32_t setmmu32;
54     cpusetiou_t setiou;
55     union {
56 	struct M6502 *d_marat6502;
57 	struct emu6502_context *d_emu6502;
58 	struct emu6502_context *d_emu6502a;
59 	struct emu6502_context *d_emu65c02;
60 	struct emu6280_context *d_emu6280;
61 	struct Z80 *d_maratz80;
62 	struct emuz80_context *d_emuz80;
63 	struct emu68k_context *d_junk68k;
64 	struct M6280 *d_marat6280;
65 	struct cpu6280_context *d_cpu6280;
66 	struct cpu6502_context *d_cpu6502;
67     } data;
68 };
69 
70 void cal_event_delay_callback(void *, int);
71 
72 typedef void (*cal_cpuinit_t)(cal_cpu *cpu);
73 cal_cpu cal_create(cal_cpuinit_t initfunc);
74 
75 #endif /* __CAL_H__ */
76 
77 /*
78  * $Log: cal.h,v $
79  * Revision 1.20  2001/03/16 18:18:42  nyef
80  * moved memory accessor type definitions out to new memtypes.h
81  *
82  * Revision 1.19  2001/03/16 18:07:22  nyef
83  * changed mem{read,write}{8,16,32}_t definitions to take a struct
84  * cal_cpu * instead of a cal_cpu
85  *
86  * Revision 1.18  2001/02/27 04:19:18  nyef
87  * removed useless include of cpudefs.h
88  *
89  * Revision 1.17  2001/02/27 04:14:09  nyef
90  * added cal_event_delay_callback to support the new event.c interface
91  *
92  * Revision 1.16  2001/02/26 03:04:10  nyef
93  * changed the interface for cal_create()
94  * added some glue to allow system drivers to operate with the new cal_create()
95  * interface without modification
96  *
97  * Revision 1.15  2000/05/01 00:36:40  nyef
98  * added cpu6502 support
99  *
100  * Revision 1.14  2000/01/17 00:59:43  nyef
101  * changed to always define cpu data pointers, even if the cpu isn't enabled
102  *
103  * Revision 1.13  2000/01/17 00:58:06  nyef
104  * added cpu6280 support
105  *
106  * Revision 1.12  1999/11/08 01:31:11  nyef
107  * added preliminary definition and interface for ranged mmu
108  *
109  * Revision 1.11  1999/08/29 13:06:00  nyef
110  * updated to new IRQ interface
111  *
112  * Revision 1.10  1999/08/15 02:28:21  nyef
113  * added TORR68K support
114  *
115  * Revision 1.9  1999/08/02 00:17:03  nyef
116  * added marat6280 support
117  * added conditional compilation of junk68k support
118  *
119  * Revision 1.8  1999/04/17 20:05:57  nyef
120  * changed interface to allow 68k support.
121  * added 68k support.
122  *
123  * Revision 1.7  1999/01/26 03:06:08  nyef
124  * expanded "address bus" to 32 bits.
125  *
126  * Revision 1.6  1999/01/09 19:47:47  nyef
127  * added 'void *userdata' to struct cal_cpu.
128  *
129  * Revision 1.5  1999/01/03 02:25:40  nyef
130  * added maratz80 support.
131  *
132  * Revision 1.4  1999/01/02 06:35:46  nyef
133  * added io interface for z80 support.
134  *
135  * Revision 1.3  1999/01/01 07:00:46  nyef
136  * added emuz80 support
137  *
138  * Revision 1.2  1998/12/12 20:35:13  nyef
139  * fixed marat6502 support.
140  *
141  * Revision 1.1  1998/11/29 18:28:34  nyef
142  * Initial revision
143  *
144  */
145