[7188] Adds SM501 usb host emulation feature.
Revision: 7188
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7188 Author: aurel32 Date: 2009-04-19 09:15:50 +0000 (Sun, 19 Apr 2009)
Log Message:
-----------
Adds SM501 usb host emulation feature.
It makes usb keyboard available for sh4/r2d system emulation.
The changes for "hw/usb-ohci.c" are as follows.
- 'localmem_base' is introduced as OHCIState struct member. SM501 has a local memory, and it is used to pass and receive data with OHCI driver. OHCI driver accesses it with SH4 physical memory address, and SM501 accesses it with SM501 local address. 'localmem_base' holds where the SM501 local memory is mapped into SH4 physical address space.
- Memory access functions modified to adjust address with 'localmem_base'. The functions are, ohci_read_*(), ohci_put_*(), and ohci_copy_*().
- ohci_read_hcca() and ohci_put_hcca() are introduced for more consistent implementation.
For other source files, it does,
- introduces usb_ohci_init_sm501().
- adds irq argument for SM501 initialization, to emulate USB interrupts.
Modified Paths:
--------------
trunk/hw/devices.h
trunk/hw/r2d.c
trunk/hw/sm501.c
trunk/hw/usb-ohci.cModified: trunk/hw/devices.h
===================================================================
hw/devices.h +6 -1
@@ -74,5 +74,10 @@qemu_irq tc6393xb_l3v_get (struct tc6393xb_s *s);/* sm501.c */ -void sm501_init (uint32_t base,uint32_t local_mem_bytes,CharDriverState *chr); +void sm501_init (uint32_t base,uint32_t local_mem_bytes,qemu_irq irq, +CharDriverState *chr); + +/* usb-ohci.c */ +void usb_ohci_init_sm501 (uint32_t mmio_base,uint32_t localmem_base, +int num_ports,int devfn,qemu_irq irq);#endif
Modified: trunk/hw/r2d.c
===================================================================
hw/r2d.c +1 -1
@@ -222,7 +222,7 @@ irq =r2d_fpga_init (0x04000000 ,sh7750_irl (s)); pci =sh_pci_register_bus (r2d_pci_set_irq, r2d_pci_map_irq, irq,0 ,4 ); -sm501_init (0x10000000 ,SM501_VRAM_SIZE , serial_hds[2 ]); +sm501_init (0x10000000 ,SM501_VRAM_SIZE , irq[SM501 ], serial_hds[2 ]);/* onboard CF (True IDE mode, Master only). */ if ((i =drive_get_index (IF_IDE ,0 ,0 )) !=-1 )
Modified: trunk/hw/sm501.c
===================================================================
hw/sm501.c +6 -1
@@ -1055,7 +1055,8 @@sm501_draw_crt (s); } -void sm501_init (uint32_t base,uint32_t local_mem_bytes,CharDriverState *chr) +void sm501_init (uint32_t base,uint32_t local_mem_bytes,qemu_irq irq, +CharDriverState *chr) {SM501State * s;int sm501_system_config_index;
@@ -1089,6 +1090,10 @@cpu_register_physical_memory (base +MMIO_BASE_OFFSET +SM501_DC ,0x1000 , sm501_disp_ctrl_index); +/* bridge to usb host emulation module */ +usb_ohci_init_sm501 (base +MMIO_BASE_OFFSET +SM501_USB_HOST , base, +2 ,-1 , irq); +/* bridge to serial emulation module */ if (chr) serial_mm_init(base + MMIO_BASE_OFFSET + SM501_UART0, 2,
Modified: trunk/hw/usb-ohci.c
===================================================================
hw/usb-ohci.c +96 -41
341 lines not on this page · raw message