2019-04-29 13:24:37 +00:00
|
|
|
assert_spec x86
|
2016-01-06 13:43:21 +00:00
|
|
|
set usb_raw_device ""
|
|
|
|
|
2014-12-17 15:16:36 +00:00
|
|
|
#
|
|
|
|
# Check if USB_RAW_DEVICE is set for Qemu
|
|
|
|
#
|
2016-01-06 13:43:21 +00:00
|
|
|
if {[have_include power_on/qemu]} {
|
|
|
|
if {![info exists ::env(USB_RAW_DEVICE)]} {
|
|
|
|
puts "\nPlease define USB_RAW_DEVICE environment variable and set it to your USB device <bus.device>\n"
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
set usb_raw_device $::env(USB_RAW_DEVICE)
|
2014-12-17 15:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
create_boot_directory
|
2022-05-18 14:15:51 +00:00
|
|
|
import_from_depot [depot_user]/src/[base_src] \
|
|
|
|
[depot_user]/pkg/test_usb_host_drv-[board] \
|
|
|
|
[depot_user]/src/report_rom \
|
2023-08-30 23:50:32 +00:00
|
|
|
[depot_user]/src/init \
|
|
|
|
[depot_user]/src/test-terminal_echo
|
2014-12-17 15:16:36 +00:00
|
|
|
|
2023-08-30 23:50:32 +00:00
|
|
|
build { server/usb_terminal }
|
2014-12-17 15:16:36 +00:00
|
|
|
|
2022-05-18 14:15:51 +00:00
|
|
|
install_config {
|
2014-12-17 15:16:36 +00:00
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
2017-05-07 20:36:11 +00:00
|
|
|
</default-route>
|
2022-05-18 14:15:51 +00:00
|
|
|
<default caps="100"/>
|
2014-12-17 15:16:36 +00:00
|
|
|
|
|
|
|
<start name="timer">
|
2017-01-03 13:57:18 +00:00
|
|
|
<resource name="RAM" quantum="2M"/>
|
2014-12-17 15:16:36 +00:00
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>
|
2022-05-18 14:15:51 +00:00
|
|
|
|
|
|
|
<start name="report_rom">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides><service name="Report"/>
|
|
|
|
<service name="ROM"/></provides>
|
|
|
|
<config verbose="yes"/>
|
|
|
|
</start>
|
|
|
|
|
|
|
|
<start name="usb_drv" caps="1500" managing_system="yes">
|
|
|
|
<binary name="init"/>
|
2017-01-03 13:57:18 +00:00
|
|
|
<resource name="RAM" quantum="32M"/>
|
2022-05-18 14:15:51 +00:00
|
|
|
<provides> <service name="Usb"/> </provides>
|
|
|
|
<route>
|
|
|
|
<service name="ROM" label="config">
|
|
|
|
<parent label="drivers.config"/> </service>
|
|
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
|
|
|
<any-service> <parent/> </any-service>
|
|
|
|
</route>
|
2014-12-17 15:16:36 +00:00
|
|
|
</start>
|
2022-05-18 14:15:51 +00:00
|
|
|
|
2014-12-17 15:16:36 +00:00
|
|
|
<start name="usb_terminal">
|
2017-01-03 13:57:18 +00:00
|
|
|
<resource name="RAM" quantum="4M"/>
|
2014-12-17 15:16:36 +00:00
|
|
|
<provides><service name="Terminal"/></provides>
|
|
|
|
</start>
|
2022-05-18 14:15:51 +00:00
|
|
|
|
2014-12-17 15:16:36 +00:00
|
|
|
<start name="test-terminal_echo">
|
2017-01-03 13:57:18 +00:00
|
|
|
<resource name="RAM" quantum="2M"/>
|
2014-12-17 15:16:36 +00:00
|
|
|
</start>
|
|
|
|
</config>}
|
|
|
|
|
|
|
|
#
|
2022-05-18 14:15:51 +00:00
|
|
|
# Define USB host controller config
|
2014-12-17 15:16:36 +00:00
|
|
|
#
|
2022-05-18 14:15:51 +00:00
|
|
|
set fd [open [run_dir]/genode/usb_host_drv.config w]
|
|
|
|
puts $fd {
|
|
|
|
<config bios_handoff="yes">
|
|
|
|
<report devices="yes"/>
|
|
|
|
<policy label="usb_terminal -> usb_serial" vendor_id="0x403" product_id="0x6001"/>
|
|
|
|
</config>}
|
|
|
|
close $fd
|
2014-12-17 15:16:36 +00:00
|
|
|
|
2023-08-30 23:50:32 +00:00
|
|
|
build_boot_image { usb_terminal }
|
2014-12-17 15:16:36 +00:00
|
|
|
|
2022-05-18 14:15:51 +00:00
|
|
|
append qemu_args " -chardev socket,path=$usb_raw_device,id=ser "
|
|
|
|
append qemu_args " -device nec-usb-xhci,id=xhci -device usb-serial,bus=xhci.0,chardev=ser -nographic"
|
2014-12-17 15:16:36 +00:00
|
|
|
|
|
|
|
run_genode_until forever
|