1 |
/* |
2 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
3 |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
6 |
* |
7 |
* 1. Redistributions of source code must retain the above copyright |
8 |
* notice, this list of conditions and the following disclaimer. |
9 |
* 2. Redistributions in binary form must reproduce the above copyright |
10 |
* notice, this list of conditions and the following disclaimer in the |
11 |
* documentation and/or other materials provided with the distribution. |
12 |
* 3. The name of the author may not be used to endorse or promote products |
13 |
* derived from this software without specific prior written permission. |
14 |
* |
15 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
16 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 |
* SUCH DAMAGE. |
26 |
* |
27 |
* |
28 |
* $Id: machine_avr.c,v 1.5 2006/06/24 10:19:19 debug Exp $ |
29 |
* |
30 |
* Experimental AVR machines. |
31 |
*/ |
32 |
|
33 |
#include <stdio.h> |
34 |
#include <string.h> |
35 |
|
36 |
#include "cpu.h" |
37 |
#include "device.h" |
38 |
#include "devices.h" |
39 |
#include "machine.h" |
40 |
#include "memory.h" |
41 |
#include "misc.h" |
42 |
|
43 |
|
44 |
MACHINE_SETUP(bareavr) |
45 |
{ |
46 |
char tmpstr[200]; |
47 |
machine->machine_name = "Generic \"bare\" AVR machine"; |
48 |
machine->cycle_accurate = 1; |
49 |
machine->stable = 1; |
50 |
snprintf(tmpstr, sizeof(tmpstr), "avr addr=0x%"PRIx64, |
51 |
(uint64_t) AVR_SRAM_BASE); |
52 |
device_add(machine, tmpstr); |
53 |
} |
54 |
|
55 |
|
56 |
MACHINE_DEFAULT_CPU(bareavr) |
57 |
{ |
58 |
machine->cpu_name = strdup("AVR"); |
59 |
} |
60 |
|
61 |
|
62 |
MACHINE_DEFAULT_RAM(bareavr) |
63 |
{ |
64 |
/* SRAM starts at 8 MB, and is 4 MB long. */ |
65 |
machine->physical_ram_in_mb = 12; |
66 |
} |
67 |
|
68 |
|
69 |
MACHINE_REGISTER(bareavr) |
70 |
{ |
71 |
MR_DEFAULT(bareavr, "Generic \"bare\" AVR machine", |
72 |
ARCH_AVR, MACHINE_BAREAVR); |
73 |
|
74 |
machine_entry_add_alias(me, "bareavr"); |
75 |
|
76 |
me->set_default_ram = machine_default_ram_bareavr; |
77 |
} |
78 |
|
79 |
|
80 |
/*****************************************************************************/ |
81 |
|
82 |
|
83 |
MACHINE_SETUP(avr_pal) |
84 |
{ |
85 |
char tmpstr[200]; |
86 |
machine->machine_name = "AVR connected to a PAL TV"; |
87 |
machine->cycle_accurate = 1; |
88 |
machine->stable = 1; |
89 |
snprintf(tmpstr, sizeof(tmpstr), "avr addr=0x%"PRIx64, |
90 |
(uint64_t) AVR_SRAM_BASE); |
91 |
device_add(machine, tmpstr); |
92 |
device_add(machine, "pal"); |
93 |
} |
94 |
|
95 |
|
96 |
MACHINE_DEFAULT_CPU(avr_pal) |
97 |
{ |
98 |
machine->cpu_name = strdup("AT90S2313"); |
99 |
} |
100 |
|
101 |
|
102 |
MACHINE_DEFAULT_RAM(avr_pal) |
103 |
{ |
104 |
/* SRAM starts at 8 MB, and is 4 MB long. */ |
105 |
machine->physical_ram_in_mb = 12; |
106 |
} |
107 |
|
108 |
|
109 |
MACHINE_REGISTER(avr_pal) |
110 |
{ |
111 |
MR_DEFAULT(avr_pal, "AVR connected to a PAL TV", |
112 |
ARCH_AVR, MACHINE_AVR_PAL); |
113 |
|
114 |
machine_entry_add_alias(me, "avr_pal"); |
115 |
|
116 |
me->set_default_ram = machine_default_ram_avr_pal; |
117 |
} |
118 |
|
119 |
|
120 |
/*****************************************************************************/ |
121 |
|
122 |
|
123 |
MACHINE_SETUP(avr_mahpong) |
124 |
{ |
125 |
char tmpstr[200]; |
126 |
machine->machine_name = "AVR setup for Mahpong"; |
127 |
machine->cycle_accurate = 1; |
128 |
machine->stable = 1; |
129 |
snprintf(tmpstr, sizeof(tmpstr), "avr addr=0x%"PRIx64, |
130 |
(uint64_t) AVR_SRAM_BASE); |
131 |
device_add(machine, tmpstr); |
132 |
device_add(machine, "pal"); |
133 |
} |
134 |
|
135 |
|
136 |
MACHINE_DEFAULT_CPU(avr_mahpong) |
137 |
{ |
138 |
machine->cpu_name = strdup("AT90S8515"); |
139 |
} |
140 |
|
141 |
|
142 |
MACHINE_DEFAULT_RAM(avr_mahpong) |
143 |
{ |
144 |
/* SRAM starts at 8 MB, and is 4 MB long. */ |
145 |
machine->physical_ram_in_mb = 12; |
146 |
} |
147 |
|
148 |
|
149 |
MACHINE_REGISTER(avr_mahpong) |
150 |
{ |
151 |
MR_DEFAULT(avr_mahpong, "AVR setup for Mahpong", |
152 |
ARCH_AVR, MACHINE_AVR_MAHPONG); |
153 |
|
154 |
machine_entry_add_alias(me, "avr_mahpong"); |
155 |
|
156 |
me->set_default_ram = machine_default_ram_avr_mahpong; |
157 |
} |
158 |
|