diff --git a/main.c b/main.c index bb1d339..4aefae6 100644 --- a/main.c +++ b/main.c @@ -72,7 +72,8 @@ static void emu_update_vblk_interrupts(vm_t *vm) } #endif -static void emu_update_timer_interrupt(hart_t *hart) { +static void emu_update_timer_interrupt(hart_t *hart) +{ emu_state_t *data = PRIV(hart); /* Sync global timer with local timer */ @@ -634,8 +635,8 @@ static int semu_start(int argc, char **argv) #endif #if SEMU_HAS(VIRTIOSND) - if (emu.vsnd.InterruptStatus) - emu_update_vsnd_interrupts(&vm); + if (emu.vsnd.InterruptStatus) + emu_update_vsnd_interrupts(&vm); #endif } diff --git a/virtio-snd.c b/virtio-snd.c index 61ad470..cb56a40 100644 --- a/virtio-snd.c +++ b/virtio-snd.c @@ -27,8 +27,8 @@ enum { VIRTIO_SND_R_CHMAP_INFO = 0x0200, VIRTIO_SND_S_OK = 0x8000, VIRTIO_SND_S_BAD_MSG, - VIRTIO_SND_S_NOT_SUPP, - VIRTIO_SND_S_IO_ERR, + VIRTIO_SND_S_NOT_SUPP, + VIRTIO_SND_S_IO_ERR, }; enum { @@ -228,9 +228,9 @@ static void cnfa_audio_callback(struct CNFADriver *dev, } static int virtio_snd_desc_handler(virtio_snd_state_t *vsnd, - const virtio_snd_queue_t *queue, - uint32_t desc_idx, - uint32_t *plen) + const virtio_snd_queue_t *queue, + uint32_t desc_idx, + uint32_t *plen) { struct virtq_desc vq_desc[3]; @@ -260,15 +260,14 @@ static int virtio_snd_desc_handler(virtio_snd_state_t *vsnd, /* Process the header */ const virtio_snd_query_info *query = - (virtio_snd_query_info *) ((uintptr_t) vsnd->ram + - vq_desc[0].addr); + (virtio_snd_query_info *) ((uintptr_t) vsnd->ram + vq_desc[0].addr); uint32_t type = query->hdr.code; uint8_t *status = (uint8_t *) ((uintptr_t) vsnd->ram + vq_desc[2].addr); /* Process the data */ switch (type) { case VIRTIO_SND_R_JACK_INFO: { - virtio_snd_jack_info *info = (virtio_snd_jack_info *)(vq_desc[2].addr); + virtio_snd_jack_info *info = (virtio_snd_jack_info *) (vq_desc[2].addr); for (int i = 0; i < query->count; i++) { info[i].hdr.hda_fn_nid = 0; info[i].features = 0; @@ -278,9 +277,9 @@ static int virtio_snd_desc_handler(virtio_snd_state_t *vsnd, memset(&info[i].padding, 0, sizeof(info[i].padding)); } break; - } + } case VIRTIO_SND_R_PCM_INFO: { - virtio_snd_pcm_info *info = (virtio_snd_pcm_info *)(vq_desc[2].addr); + virtio_snd_pcm_info *info = (virtio_snd_pcm_info *) (vq_desc[2].addr); for (int i = 0; i < query->count; i++) { info[0].features = 0; info[0].formats = (1 << VIRTIO_SND_PCM_FMT_S16); @@ -290,16 +289,18 @@ static int virtio_snd_desc_handler(virtio_snd_state_t *vsnd, info[0].channels_max = 1; memset(&info[i].padding, 0, sizeof(info[i].padding)); } - break;} + break; + } case VIRTIO_SND_R_CHMAP_INFO: { - virtio_snd_chmap_info *info = (virtio_snd_chmap_info *)(vq_desc[2].addr); + virtio_snd_chmap_info *info = + (virtio_snd_chmap_info *) (vq_desc[2].addr); for (int i = 0; i < query->count; i++) { info[i].direction = VIRTIO_SND_D_OUTPUT; info[i].channels = 1; info[i].positions[0] = VIRTIO_SND_CHMAP_MONO; } break; - } + } default: fprintf(stderr, "unsupported virtio-snd operation!\n"); *status = VIRTIO_SND_S_NOT_SUPP;