/[gxemul]/trunk/src/machines/machine_test.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/machines/machine_test.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2005-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: machine_test.c,v 1.22 2006/10/25 09:24:06 debug Exp $   *  $Id: machine_test.c,v 1.30 2007/02/10 14:38:39 debug Exp $
29   *   *
30   *  Various "test" machines (bare machines with just a CPU, or a bare machine   *  Various "test" machines (bare machines with just a CPU, or a bare machine
31   *  plus some experimental devices).   *  plus some experimental devices).
# Line 36  Line 36 
36    
37  #include "cpu.h"  #include "cpu.h"
38  #include "device.h"  #include "device.h"
 #include "devices.h"  
39  #include "machine.h"  #include "machine.h"
40  #include "memory.h"  #include "memory.h"
41  #include "misc.h"  #include "misc.h"
# Line 53  static void default_test(struct machine Line 52  static void default_test(struct machine
52  {  {
53          char tmpstr[1000];          char tmpstr[1000];
54    
55          snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=0",          snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=none",
56              (uint64_t) DEV_CONS_ADDRESS);              (uint64_t) DEV_CONS_ADDRESS);
57          machine->main_console_handle = (size_t)device_add(machine, tmpstr);          machine->main_console_handle = (size_t)device_add(machine, tmpstr);
58    
# Line 69  static void default_test(struct machine Line 68  static void default_test(struct machine
68              (uint64_t) DEV_DISK_ADDRESS);              (uint64_t) DEV_DISK_ADDRESS);
69          device_add(machine, tmpstr);          device_add(machine, tmpstr);
70    
71          snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=0",          snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=none",
72              (uint64_t) DEV_ETHER_ADDRESS);              (uint64_t) DEV_ETHER_ADDRESS);
73          device_add(machine, tmpstr);          device_add(machine, tmpstr);
74    
75          snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=0",          snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=none",
76              (uint64_t) DEV_RTC_ADDRESS);              (uint64_t) DEV_RTC_ADDRESS);
77          device_add(machine, tmpstr);          device_add(machine, tmpstr);
78  }  }
# Line 186  MACHINE_REGISTER(testarm) Line 185  MACHINE_REGISTER(testarm)
185    
186    
187    
 MACHINE_SETUP(bareavr32)  
 {  
         machine->machine_name = "Generic \"bare\" AVR32 machine";  
         machine->stable = 1;  
 }  
   
   
 MACHINE_SETUP(testavr32)  
 {  
         machine->machine_name = "AVR32 test machine";  
         machine->stable = 1;  
   
         /*  TODO: interrupts  */  
   
         default_test(machine, cpu);  
 }  
   
   
 MACHINE_DEFAULT_CPU(bareavr32)  
 {  
         machine->cpu_name = strdup("AVR32A");  
 }  
   
   
 MACHINE_DEFAULT_CPU(testavr32)  
 {  
         machine->cpu_name = strdup("AVR32A");  
 }  
   
   
 MACHINE_REGISTER(bareavr32)  
 {  
         MR_DEFAULT(bareavr32, "Generic \"bare\" AVR32 machine",  
             ARCH_AVR32, MACHINE_BAREAVR32);  
   
         machine_entry_add_alias(me, "bareavr32");  
 }  
   
   
 MACHINE_REGISTER(testavr32)  
 {  
         MR_DEFAULT(testavr32, "Test-machine for AVR32",  
             ARCH_AVR32, MACHINE_TESTAVR32);  
   
         machine_entry_add_alias(me, "testavr32");  
 }  
   
   
 MACHINE_SETUP(barehppa)  
 {  
         machine->machine_name = "Generic \"bare\" HPPA machine";  
         machine->stable = 1;  
 }  
   
   
 MACHINE_SETUP(testhppa)  
 {  
         machine->machine_name = "HPPA test machine";  
         machine->stable = 1;  
   
         /*  TODO: interrupt for HPPA?  */  
   
         default_test(machine, cpu);  
 }  
   
   
 MACHINE_DEFAULT_CPU(barehppa)  
 {  
         machine->cpu_name = strdup("HPPA");  
 }  
   
   
 MACHINE_DEFAULT_CPU(testhppa)  
 {  
         machine->cpu_name = strdup("HPPA");  
 }  
   
   
 MACHINE_REGISTER(barehppa)  
 {  
         MR_DEFAULT(barehppa, "Generic \"bare\" HPPA machine",  
             ARCH_HPPA, MACHINE_BAREHPPA);  
   
         machine_entry_add_alias(me, "barehppa");  
 }  
   
   
 MACHINE_REGISTER(testhppa)  
 {  
         MR_DEFAULT(testhppa, "Test-machine for HPPA",  
             ARCH_HPPA, MACHINE_TESTHPPA);  
   
         machine_entry_add_alias(me, "testhppa");  
 }  
   
   
 MACHINE_SETUP(barei960)  
 {  
         machine->machine_name = "Generic \"bare\" i960 machine";  
         machine->stable = 1;  
 }  
   
   
 MACHINE_SETUP(testi960)  
 {  
         machine->machine_name = "i960 test machine";  
         machine->stable = 1;  
   
         /*  TODO: interrupt for i960?  */  
   
         default_test(machine, cpu);  
 }  
   
   
 MACHINE_DEFAULT_CPU(barei960)  
 {  
         machine->cpu_name = strdup("i960");  
 }  
   
   
 MACHINE_DEFAULT_CPU(testi960)  
 {  
         machine->cpu_name = strdup("i960");  
 }  
   
   
 MACHINE_REGISTER(barei960)  
 {  
         MR_DEFAULT(barei960, "Generic \"bare\" i960 machine",  
             ARCH_I960, MACHINE_BAREI960);  
   
         machine_entry_add_alias(me, "barei960");  
 }  
   
   
 MACHINE_REGISTER(testi960)  
 {  
         MR_DEFAULT(testi960, "Test-machine for i960",  
             ARCH_I960, MACHINE_TESTI960);  
   
         machine_entry_add_alias(me, "testi960");  
 }  
   
   
 MACHINE_SETUP(bareia64)  
 {  
         machine->machine_name = "Generic \"bare\" IA64 machine";  
         machine->stable = 1;  
 }  
   
   
 MACHINE_SETUP(testia64)  
 {  
         machine->machine_name = "IA64 test machine";  
         machine->stable = 1;  
   
         /*  TODO: interrupt for IA64?  */  
   
         default_test(machine, cpu);  
 }  
   
   
 MACHINE_DEFAULT_CPU(bareia64)  
 {  
         machine->cpu_name = strdup("IA64");  
 }  
   
   
 MACHINE_DEFAULT_CPU(testia64)  
 {  
         machine->cpu_name = strdup("IA64");  
 }  
   
   
 MACHINE_REGISTER(bareia64)  
 {  
         MR_DEFAULT(bareia64, "Generic \"bare\" IA64 machine",  
             ARCH_IA64, MACHINE_BAREIA64);  
   
         machine_entry_add_alias(me, "bareia64");  
 }  
   
   
 MACHINE_REGISTER(testia64)  
 {  
         MR_DEFAULT(testia64, "Test-machine for IA64",  
             ARCH_IA64, MACHINE_TESTIA64);  
   
         machine_entry_add_alias(me, "testia64");  
 }  
   
   
188  MACHINE_SETUP(barem68k)  MACHINE_SETUP(barem68k)
189  {  {
190          machine->machine_name = "Generic \"bare\" M68K machine";          machine->machine_name = "Generic \"bare\" M68K machine";
# Line 437  MACHINE_SETUP(baremips) Line 244  MACHINE_SETUP(baremips)
244  MACHINE_SETUP(testmips)  MACHINE_SETUP(testmips)
245  {  {
246          /*          /*
247           *  A MIPS test machine (which happens to work with the           *  A MIPS test machine. Originally, this was created as a way for
248           *  code in my master's thesis).  :-)           *  me to test my master's thesis code; since then it has both
249             *  evolved to support new things, and suffered bit rot so that it
250             *  no longer can run my thesis code. Well, well...
251           *           *
252           *  IRQ map:           *  IRQ map:
253           *      7       CPU counter           *      7       CPU counter
# Line 449  MACHINE_SETUP(testmips) Line 258  MACHINE_SETUP(testmips)
258           *      2       serial console           *      2       serial console
259           */           */
260    
261          char tmpstr[1000];          char tmpstr[300];
262    
263          machine->machine_name = "MIPS test machine";          machine->machine_name = "MIPS test machine";
264          machine->stable = 1;          machine->stable = 1;
265          cpu->byte_order = EMUL_BIG_ENDIAN;          cpu->byte_order = EMUL_BIG_ENDIAN;
266    
267          snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=2",          snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%"PRIx64" irq=%s."
268              (uint64_t) DEV_CONS_ADDRESS);              "cpu[%i].2", (uint64_t) DEV_CONS_ADDRESS, machine->path,
269                machine->bootstrap_cpu);
270          machine->main_console_handle = (size_t)device_add(machine, tmpstr);          machine->main_console_handle = (size_t)device_add(machine, tmpstr);
271    
272          snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%"PRIx64,          snprintf(tmpstr, sizeof(tmpstr), "mp irq=6 addr=0x%"PRIx64,
273              (uint64_t) DEV_MP_ADDRESS);              (uint64_t) DEV_MP_ADDRESS);
274          device_add(machine, tmpstr);          device_add(machine, tmpstr);
275    
# Line 471  MACHINE_SETUP(testmips) Line 281  MACHINE_SETUP(testmips)
281              (uint64_t) DEV_DISK_ADDRESS);              (uint64_t) DEV_DISK_ADDRESS);
282          device_add(machine, tmpstr);          device_add(machine, tmpstr);
283    
284          snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=3",          snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%"PRIx64" irq=%s."
285              (uint64_t) DEV_ETHER_ADDRESS);              "cpu[%i].3", (uint64_t) DEV_ETHER_ADDRESS, machine->path,
286                machine->bootstrap_cpu);
287          device_add(machine, tmpstr);          device_add(machine, tmpstr);
288    
289          snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=4",          snprintf(tmpstr, sizeof(tmpstr), "rtc addr=0x%"PRIx64" irq=%s."
290              (uint64_t) DEV_RTC_ADDRESS);              "cpu[%i].4", (uint64_t) DEV_RTC_ADDRESS, machine->path,
291                machine->bootstrap_cpu);
292          device_add(machine, tmpstr);          device_add(machine, tmpstr);
293  }  }
294    
295    
296  MACHINE_DEFAULT_CPU(baremips)  MACHINE_DEFAULT_CPU(baremips)
297  {  {
298          machine->cpu_name = strdup("5Kc");          machine->cpu_name = strdup("5KE");
299  }  }
300    
301    
302  MACHINE_DEFAULT_CPU(testmips)  MACHINE_DEFAULT_CPU(testmips)
303  {  {
304          machine->cpu_name = strdup("5Kc");          machine->cpu_name = strdup("5KE");
305  }  }
306    
307    

Legend:
Removed from v.32  
changed lines
  Added in v.34

  ViewVC Help
Powered by ViewVC 1.1.26