Skip to content

Commit b65cf18

Browse files
committed
Handler control queue
1 parent 3577dea commit b65cf18

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

virtio-snd.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ static int virtio_snd_desc_handler(virtio_snd_state_t *vsnd,
548548
return 0;
549549
}
550550

551-
static void virtio_queue_notify_handler(virtio_snd_state_t *vsnd, int index)
551+
static void virtio_queue_notify_handler(virtio_snd_state_t *vsnd, int index, int (*handler)(virtio_snd_state_t *, const virtio_snd_queue_t *, uint32_t, uint32_t *))
552552
{
553553
uint32_t *ram = vsnd->ram;
554554
virtio_snd_queue_t *queue = &vsnd->queues[index];
@@ -586,7 +586,7 @@ static void virtio_queue_notify_handler(virtio_snd_state_t *vsnd, int index)
586586
* descriptor list.
587587
*/
588588
uint32_t len = 0;
589-
int result = virtio_snd_desc_handler(vsnd, queue, buffer_idx, &len);
589+
int result = handler(vsnd, queue, buffer_idx, &len);
590590
if (result != 0)
591591
return virtio_snd_set_fail(vsnd);
592592

@@ -716,16 +716,11 @@ static bool virtio_snd_reg_write(virtio_snd_state_t *vsnd,
716716
if (value < ARRAY_SIZE(vsnd->queues)) {
717717
switch (value) {
718718
case VSND_QUEUE_CTRL:
719-
virtio_queue_notify_handler(vsnd, value);
720-
break;
721-
case VSND_QUEUE_EVT:
722-
fprintf(stderr, "VSND_QUEUE_EVT\n");
719+
virtio_queue_notify_handler(vsnd, value, virtio_snd_desc_handler);
723720
break;
724721
case VSND_QUEUE_TX:
725-
fprintf(stderr, "VSND_QUEUE_TX\n");
726-
break;
727-
case VSND_QUEUE_RX:
728-
fprintf(stderr, "VSND_QUEUE_RX\n");
722+
// virtio_queue_notify_handler(vsnd, value, );
723+
printf("TX\n");
729724
break;
730725
}
731726
} else {

0 commit comments

Comments
 (0)