Statistics
| Branch: | Revision:

root / hw / r2d.c @ bfa30a38

History | View | Annotate | Download (2.1 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 0d78f544 ths
#include "vl.h"
26 0d78f544 ths
27 0d78f544 ths
#define SDRAM_BASE 0x0c000000 /* Physical location of SDRAM: Area 3 */
28 0d78f544 ths
#define SDRAM_SIZE 0x04000000
29 0d78f544 ths
30 6ac0e82d balrog
static void r2d_init(int ram_size, int vga_ram_size, const char *boot_device,
31 0d78f544 ths
              DisplayState * ds, const char **fd_filename, int snapshot,
32 0d78f544 ths
              const char *kernel_filename, const char *kernel_cmdline,
33 0d78f544 ths
              const char *initrd_filename, const char *cpu_model)
34 0d78f544 ths
{
35 0d78f544 ths
    CPUState *env;
36 0d78f544 ths
    struct SH7750State *s;
37 0d78f544 ths
38 0d78f544 ths
    env = cpu_init();
39 0d78f544 ths
40 0d78f544 ths
    /* Allocate memory space */
41 0d78f544 ths
    cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, 0);
42 0d78f544 ths
    /* Register peripherals */
43 0d78f544 ths
    s = sh7750_init(env);
44 0d78f544 ths
    /* Todo: register on board registers */
45 0d78f544 ths
    {
46 0d78f544 ths
      int kernel_size;
47 0d78f544 ths
48 0d78f544 ths
      kernel_size = load_image(kernel_filename, phys_ram_base);
49 0d78f544 ths
50 0d78f544 ths
      if (kernel_size < 0) {
51 0d78f544 ths
        fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
52 0d78f544 ths
        exit(1);
53 0d78f544 ths
      }
54 0d78f544 ths
55 0d78f544 ths
      env->pc = SDRAM_BASE | 0xa0000000; /* Start from P2 area */
56 0d78f544 ths
    }
57 0d78f544 ths
}
58 0d78f544 ths
59 0d78f544 ths
QEMUMachine r2d_machine = {
60 0d78f544 ths
    "r2d",
61 0d78f544 ths
    "r2d-plus board",
62 0d78f544 ths
    r2d_init
63 0d78f544 ths
};