Statistics
| Branch: | Revision:

root / hw / r2d.c @ 00f82b8a

History | View | Annotate | Download (2.4 kB)

1 0d78f544 ths
/*
2 0d78f544 ths
 * Renesas SH7751R R2D-PLUS emulation
3 0d78f544 ths
 *
4 0d78f544 ths
 * Copyright (c) 2007 Magnus Damm
5 0d78f544 ths
 *
6 0d78f544 ths
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 0d78f544 ths
 * of this software and associated documentation files (the "Software"), to deal
8 0d78f544 ths
 * in the Software without restriction, including without limitation the rights
9 0d78f544 ths
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 0d78f544 ths
 * copies of the Software, and to permit persons to whom the Software is
11 0d78f544 ths
 * furnished to do so, subject to the following conditions:
12 0d78f544 ths
 *
13 0d78f544 ths
 * The above copyright notice and this permission notice shall be included in
14 0d78f544 ths
 * all copies or substantial portions of the Software.
15 0d78f544 ths
 *
16 0d78f544 ths
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 0d78f544 ths
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 0d78f544 ths
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 0d78f544 ths
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 0d78f544 ths
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 0d78f544 ths
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 0d78f544 ths
 * THE SOFTWARE.
23 0d78f544 ths
 */
24 0d78f544 ths
25 87ecb68b pbrook
#include "hw.h"
26 87ecb68b pbrook
#include "sh.h"
27 87ecb68b pbrook
#include "sysemu.h"
28 87ecb68b pbrook
#include "boards.h"
29 0d78f544 ths
30 0d78f544 ths
#define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
31 0d78f544 ths
#define SDRAM_SIZE 0x04000000
32 0d78f544 ths
33 00f82b8a aurel32
static void r2d_init(ram_addr_t ram_size, int vga_ram_size,
34 b881c2c6 blueswir1
              const char *boot_device, DisplayState * ds,
35 0d78f544 ths
              const char *kernel_filename, const char *kernel_cmdline,
36 0d78f544 ths
              const char *initrd_filename, const char *cpu_model)
37 0d78f544 ths
{
38 0d78f544 ths
    CPUState *env;
39 0d78f544 ths
    struct SH7750State *s;
40 0d78f544 ths
41 aaed909a bellard
    if (!cpu_model)
42 aaed909a bellard
        cpu_model = "any";
43 aaed909a bellard
44 aaed909a bellard
    env = cpu_init(cpu_model);
45 aaed909a bellard
    if (!env) {
46 aaed909a bellard
        fprintf(stderr, "Unable to find CPU definition\n");
47 aaed909a bellard
        exit(1);
48 aaed909a bellard
    }
49 0d78f544 ths
50 0d78f544 ths
    /* Allocate memory space */
51 0d78f544 ths
    cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, 0);
52 0d78f544 ths
    /* Register peripherals */
53 0d78f544 ths
    s = sh7750_init(env);
54 0d78f544 ths
    /* Todo: register on board registers */
55 0d78f544 ths
    {
56 0d78f544 ths
      int kernel_size;
57 0d78f544 ths
58 0d78f544 ths
      kernel_size = load_image(kernel_filename, phys_ram_base);
59 0d78f544 ths
60 0d78f544 ths
      if (kernel_size < 0) {
61 0d78f544 ths
        fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
62 0d78f544 ths
        exit(1);
63 0d78f544 ths
      }
64 0d78f544 ths
65 0d78f544 ths
      env->pc = SDRAM_BASE | 0xa0000000; /* Start from P2 area */
66 0d78f544 ths
    }
67 0d78f544 ths
}
68 0d78f544 ths
69 0d78f544 ths
QEMUMachine r2d_machine = {
70 0d78f544 ths
    "r2d",
71 0d78f544 ths
    "r2d-plus board",
72 7fb4fdcf balrog
    r2d_init,
73 7fb4fdcf balrog
    SDRAM_SIZE | RAMSIZE_FIXED
74 0d78f544 ths
};