root / hw / palm.c @ 4118a970
History | View | Annotate | Download (4.7 kB)
1 |
/*
|
---|---|
2 |
* PalmOne's (TM) PDAs.
|
3 |
*
|
4 |
* Copyright (C) 2006-2007 Andrzej Zaborowski <balrog@zabor.org>
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License as
|
8 |
* published by the Free Software Foundation; either version 2 of
|
9 |
* the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
19 |
* MA 02111-1307 USA
|
20 |
*/
|
21 |
#include "vl.h" |
22 |
|
23 |
static uint32_t static_readb(void *opaque, target_phys_addr_t offset) |
24 |
{ |
25 |
uint32_t *val = (uint32_t *) opaque; |
26 |
return *val >> ((offset & 3) << 3); |
27 |
} |
28 |
|
29 |
static uint32_t static_readh(void *opaque, target_phys_addr_t offset) { |
30 |
uint32_t *val = (uint32_t *) opaque; |
31 |
return *val >> ((offset & 1) << 3); |
32 |
} |
33 |
|
34 |
static uint32_t static_readw(void *opaque, target_phys_addr_t offset) { |
35 |
uint32_t *val = (uint32_t *) opaque; |
36 |
return *val >> ((offset & 0) << 3); |
37 |
} |
38 |
|
39 |
static void static_write(void *opaque, target_phys_addr_t offset, |
40 |
uint32_t value) { |
41 |
#ifdef SPY
|
42 |
printf("%s: value %08lx written at " PA_FMT "\n", |
43 |
__FUNCTION__, value, offset); |
44 |
#endif
|
45 |
} |
46 |
|
47 |
static CPUReadMemoryFunc *static_readfn[] = {
|
48 |
static_readb, |
49 |
static_readh, |
50 |
static_readw, |
51 |
}; |
52 |
|
53 |
static CPUWriteMemoryFunc *static_writefn[] = {
|
54 |
static_write, |
55 |
static_write, |
56 |
static_write, |
57 |
}; |
58 |
|
59 |
/* Palm Tunsgten|E support */
|
60 |
static void palmte_microwire_setup(struct omap_mpu_state_s *cpu) |
61 |
{ |
62 |
} |
63 |
|
64 |
static void palmte_init(int ram_size, int vga_ram_size, int boot_device, |
65 |
DisplayState *ds, const char **fd_filename, int snapshot, |
66 |
const char *kernel_filename, const char *kernel_cmdline, |
67 |
const char *initrd_filename, const char *cpu_model) |
68 |
{ |
69 |
struct omap_mpu_state_s *cpu;
|
70 |
int flash_size = 0x00800000; |
71 |
int sdram_size = 0x02000000; |
72 |
int io;
|
73 |
static uint32_t cs0val = 0xffffffff; |
74 |
static uint32_t cs1val = 0x0000e1a0; |
75 |
static uint32_t cs2val = 0x0000e1a0; |
76 |
static uint32_t cs3val = 0xe1a0e1a0; |
77 |
ram_addr_t phys_flash; |
78 |
int rom_size, rom_loaded = 0; |
79 |
|
80 |
if (ram_size < flash_size + sdram_size + OMAP15XX_SRAM_SIZE) {
|
81 |
fprintf(stderr, "This architecture uses %i bytes of memory\n",
|
82 |
flash_size + sdram_size + OMAP15XX_SRAM_SIZE); |
83 |
exit(1);
|
84 |
} |
85 |
|
86 |
cpu = omap310_mpu_init(sdram_size, ds, cpu_model); |
87 |
|
88 |
/* External Flash (EMIFS) */
|
89 |
cpu_register_physical_memory(OMAP_CS0_BASE, flash_size, |
90 |
(phys_flash = qemu_ram_alloc(flash_size)) | IO_MEM_ROM); |
91 |
|
92 |
io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs0val);
|
93 |
cpu_register_physical_memory(OMAP_CS0_BASE + flash_size, |
94 |
OMAP_CS0_SIZE - flash_size, io); |
95 |
io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs1val);
|
96 |
cpu_register_physical_memory(OMAP_CS1_BASE, OMAP_CS1_SIZE, io); |
97 |
io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs2val);
|
98 |
cpu_register_physical_memory(OMAP_CS2_BASE, OMAP_CS2_SIZE, io); |
99 |
io = cpu_register_io_memory(0, static_readfn, static_writefn, &cs3val);
|
100 |
cpu_register_physical_memory(OMAP_CS3_BASE, OMAP_CS3_SIZE, io); |
101 |
|
102 |
palmte_microwire_setup(cpu); |
103 |
|
104 |
/* Setup initial (reset) machine state */
|
105 |
if (nb_option_roms) {
|
106 |
rom_size = get_image_size(option_rom[0]);
|
107 |
if (rom_size > flash_size)
|
108 |
fprintf(stderr, "%s: ROM image too big (%x > %x)\n",
|
109 |
__FUNCTION__, rom_size, flash_size); |
110 |
else if (rom_size > 0 && load_image(option_rom[0], |
111 |
phys_ram_base + phys_flash) > 0) {
|
112 |
rom_loaded = 1;
|
113 |
cpu->env->regs[15] = 0x00000000; |
114 |
} else
|
115 |
fprintf(stderr, "%s: error loading '%s'\n",
|
116 |
__FUNCTION__, option_rom[0]);
|
117 |
} |
118 |
|
119 |
if (!rom_loaded && !kernel_filename) {
|
120 |
fprintf(stderr, "Kernel or ROM image must be specified\n");
|
121 |
exit(1);
|
122 |
} |
123 |
|
124 |
/* Load the kernel. */
|
125 |
if (kernel_filename) {
|
126 |
/* Start at bootloader. */
|
127 |
cpu->env->regs[15] = OMAP_EMIFF_BASE;
|
128 |
|
129 |
arm_load_kernel(cpu->env, sdram_size, kernel_filename, kernel_cmdline, |
130 |
initrd_filename, 0x331, OMAP_EMIFF_BASE);
|
131 |
} |
132 |
|
133 |
dpy_resize(ds, 320, 320); |
134 |
} |
135 |
|
136 |
QEMUMachine palmte_machine = { |
137 |
"cheetah",
|
138 |
"Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
|
139 |
palmte_init, |
140 |
}; |