semu icon indicating copy to clipboard operation
semu copied to clipboard

Implement VirtIO sound device

Open Cuda-Chen opened this issue 1 year ago • 7 comments

Implement VirtIO sound device supporting these operations (the item with checked box checked means it is implemented right now):

  • For setting up the device:
    • [x] VIRTIO_SND_R_JACK_INFO
    • [x] VIRTIO_SND_R_PCM_INFO
    • [x] VIRTIO_SND_R_CHMAP_INFO
  • For playing the sound (PCM):
    • [x] VIRTIO_SND_R_PCM_SET_PARAMS
    • [x] VIRTIO_SND_R_PCM_PREPARE
    • [ ] VIRTIO_SND_R_PCM_RELEASE
    • [ ] VIRTIO_SND_R_PCM_START
    • [ ] VIRTIO_SND_R_PCM_STOP

Test Cases

The test cases are subjected to be altered.

boot up test

test procedures

  1. Execute make check to run semu.
  2. Check kernel message (dmesg).

expected results

  1. The following message should appear while booting up:
[    4.011962] ALSA device list:
[    4.015962]   #0: Loopback 1
[    4.015962]   #1: VirtIO SoundCard at platform/f4400000.virtio/virtio2

check driver configuration

test procedures

  1. Execute aplay -l in emulator.
  2. Check the output messages.

expected results

  1. The following message should appear after Step 1:
$ aplay -l          
**** List of PLAYBACK Hardware Devices ****

<other sound device here>

card 1: SoundCard [VirtIO SoundCard], device 0: virtio-snd [VirtIO PCM 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

play sound

test procedures

  1. Execute speaker-test in emulator.
  2. Check the host speaker.

expected results

  1. A white noise will be played by host speaker while speaker-test is executing.

Cuda-Chen avatar Aug 31 '24 08:08 Cuda-Chen