mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 06:57:51 +00:00
5073cba536
This patch enhances the audio driver with the option to operate as a client of the record and play services instead of providing the audio-in and audio-out services. The record/play mode can be enabled by setting the 'record_play="yes"' config attribute. The audio_in.run and audio_out.run scripts support the selection of the mode via the 'use_record_play_sessions' hook function. Issue #5097
185 lines
4.4 KiB
Plaintext
185 lines
4.4 KiB
Plaintext
assert_spec x86
|
|
|
|
if {[have_include "power_on/qemu"]} {
|
|
puts "\nAudio_out test running on Qemu is not supported.\n"
|
|
exit 0
|
|
}
|
|
|
|
if {[have_spec linux]} {
|
|
puts"\nAudio_out test running on Linux is not supported.\n"
|
|
exit 0
|
|
}
|
|
|
|
# select use of 'Audio_in/Audio_out' or 'Record/Play' sessions
|
|
proc use_record_play_sessions { } { return 1 }
|
|
|
|
create_boot_directory
|
|
|
|
proc build_targets { } {
|
|
|
|
set targets {
|
|
core init timer
|
|
drivers/acpi drivers/platform app/pci_decode server/report_rom
|
|
drivers/audio
|
|
}
|
|
|
|
if {[use_record_play_sessions]} {
|
|
lappend targets server/record_play_mixer app/waveform_player \
|
|
test/audio_play lib/vfs
|
|
} else {
|
|
lappend targets test/audio_out
|
|
}
|
|
}
|
|
|
|
build [build_targets]
|
|
|
|
proc audio_driver_config_attr { } {
|
|
|
|
if {[use_record_play_sessions]} {
|
|
return {report_mixer="yes" record_play="yes"}
|
|
} else {
|
|
return {report_mixer="yes"}
|
|
}
|
|
}
|
|
|
|
proc record_play_start_nodes { } {
|
|
|
|
if {![use_record_play_sessions]} {
|
|
return "" }
|
|
|
|
return {
|
|
<start name="mixer">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<resource name="CPU" quantum="20"/>
|
|
<binary name="record_play_mixer"/>
|
|
<provides> <service name="Record"/> <service name="Play"/> </provides>
|
|
<config jitter_ms="10">
|
|
|
|
<mix name="left"> <play label_suffix="left" /> </mix>
|
|
<mix name="right"> <play label_suffix="right"/> </mix>
|
|
|
|
<policy label_suffix="left" record="left" volume="1.0"/>
|
|
<policy label_suffix="right" record="right" volume="1.0"/>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="test-audio_play">
|
|
<resource name="RAM" quantum="40M"/>
|
|
<config sample_path="sample.f32">
|
|
<vfs> <rom name="sample.f32"/> </vfs>
|
|
</config>
|
|
<route>
|
|
<any-service><parent/><any-child/></any-service>
|
|
</route>
|
|
</start>
|
|
}
|
|
}
|
|
|
|
proc audio_in_out_start_nodes { } {
|
|
|
|
if {[use_record_play_sessions]} {
|
|
return "" }
|
|
|
|
return {
|
|
<start name="test-audio_out">
|
|
<resource name="RAM" quantum="4M"/>
|
|
<config>
|
|
<filename>sample.f32</filename>
|
|
</config>
|
|
<route>
|
|
<any-service><parent/><any-child/></any-service>
|
|
</route>
|
|
</start>
|
|
}
|
|
}
|
|
|
|
install_config {
|
|
<config verbose="yes">
|
|
<parent-provides>
|
|
<service name="ROM"/>
|
|
<service name="IRQ"/>
|
|
<service name="IO_MEM"/>
|
|
<service name="PD"/>
|
|
<service name="RM"/>
|
|
<service name="CPU"/>
|
|
<service name="LOG"/>
|
|
</parent-provides>
|
|
<default-route>
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
</default-route>
|
|
<default caps="100"/>
|
|
<start name="timer">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides><service name="Timer"/></provides>
|
|
</start>
|
|
|
|
<start name="report_rom">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<provides> <service name="Report"/> <service name="ROM"/> </provides>
|
|
<config verbose="yes">
|
|
<policy label="pci_decode -> system" report="acpi_drv -> acpi"/>
|
|
<policy label="platform_drv -> devices" report="pci_decode -> devices"/>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="acpi_drv" caps="350">
|
|
<resource name="RAM" quantum="4M"/>
|
|
<route>
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="pci_decode" caps="350">
|
|
<resource name="RAM" quantum="2M"/>
|
|
<route>
|
|
<service name="Report"> <child name="report_rom"/> </service>
|
|
<service name="ROM" label="system"> <child name="report_rom"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
</start>
|
|
|
|
<start name="platform_drv" caps="100" managing_system="yes">
|
|
<resource name="RAM" quantum="1M"/>
|
|
<provides>
|
|
<service name="Platform"/>
|
|
</provides>
|
|
<route>
|
|
<service name="ROM" label="devices"> <child name="report_rom"/> </service>
|
|
<service name="Timer"> <child name="timer"/> </service>
|
|
<any-service> <parent/> </any-service>
|
|
</route>
|
|
<config>
|
|
<policy label="audio_drv -> "> <pci class="AUDIO"/> <pci class="HDAUDIO"/> </policy>
|
|
</config>
|
|
</start>
|
|
|
|
<start name="audio_drv">
|
|
<binary name="pci_audio_drv"/>
|
|
<resource name="RAM" quantum="2M"/>
|
|
<provides> <service name="Audio_out"/> <service name="Audio_in"/> </provides>
|
|
<config } [audio_driver_config_attr] {/>
|
|
</start>
|
|
|
|
} [record_play_start_nodes] {
|
|
} [audio_in_out_start_nodes] {
|
|
|
|
</config>}
|
|
|
|
#
|
|
# Get sample file
|
|
#
|
|
|
|
if {![file exists bin/sample.f32]} {
|
|
puts ""
|
|
puts "The sample file is missing. Please take a look at"
|
|
puts "repos/dde_bsd/README, create 'sample.f32' and put"
|
|
puts "the file into './bin'. afterwards"
|
|
puts ""
|
|
exit 1
|
|
}
|
|
|
|
build_boot_image [list {*}[build_artifacts] sample.f32]
|
|
|
|
run_genode_until forever
|