Lines Matching full:hw
43 HWVoiceOut hw; member
52 HWVoiceIn hw; member
120 static void oss_poll_out (HWVoiceOut *hw) in oss_poll_out() argument
122 OSSVoiceOut *oss = (OSSVoiceOut *) hw; in oss_poll_out()
124 qemu_set_fd_handler(oss->fd, NULL, oss_helper_poll_out, hw->s); in oss_poll_out()
127 static void oss_poll_in (HWVoiceIn *hw) in oss_poll_in() argument
129 OSSVoiceIn *oss = (OSSVoiceIn *) hw; in oss_poll_in()
131 qemu_set_fd_handler(oss->fd, oss_helper_poll_in, NULL, hw->s); in oss_poll_in()
381 return audio_ring_dist(cntinfo.ptr, oss->hw.pos_emul, oss->hw.size_emul); in oss_get_available_bytes()
384 static void oss_run_buffer_out(HWVoiceOut *hw) in oss_run_buffer_out() argument
386 OSSVoiceOut *oss = (OSSVoiceOut *)hw; in oss_run_buffer_out()
389 audio_generic_run_buffer_out(hw); in oss_run_buffer_out()
393 static size_t oss_buffer_get_free(HWVoiceOut *hw) in oss_buffer_get_free() argument
395 OSSVoiceOut *oss = (OSSVoiceOut *)hw; in oss_buffer_get_free()
400 return audio_generic_buffer_get_free(hw); in oss_buffer_get_free()
404 static void *oss_get_buffer_out(HWVoiceOut *hw, size_t *size) in oss_get_buffer_out() argument
406 OSSVoiceOut *oss = (OSSVoiceOut *)hw; in oss_get_buffer_out()
409 *size = hw->size_emul - hw->pos_emul; in oss_get_buffer_out()
410 return hw->buf_emul + hw->pos_emul; in oss_get_buffer_out()
412 return audio_generic_get_buffer_out(hw, size); in oss_get_buffer_out()
416 static size_t oss_put_buffer_out(HWVoiceOut *hw, void *buf, size_t size) in oss_put_buffer_out() argument
418 OSSVoiceOut *oss = (OSSVoiceOut *) hw; in oss_put_buffer_out()
420 assert(buf == hw->buf_emul + hw->pos_emul && size < hw->size_emul); in oss_put_buffer_out()
422 hw->pos_emul = (hw->pos_emul + size) % hw->size_emul; in oss_put_buffer_out()
425 return audio_generic_put_buffer_out(hw, buf, size); in oss_put_buffer_out()
429 static size_t oss_write(HWVoiceOut *hw, void *buf, size_t len) in oss_write() argument
431 OSSVoiceOut *oss = (OSSVoiceOut *) hw; in oss_write()
440 size_t to_copy = MIN(len, hw->size_emul - hw->pos_emul); in oss_write()
441 memcpy(hw->buf_emul + hw->pos_emul, buf, to_copy); in oss_write()
443 hw->pos_emul = (hw->pos_emul + to_copy) % hw->size_emul; in oss_write()
473 static void oss_fini_out (HWVoiceOut *hw) in oss_fini_out() argument
476 OSSVoiceOut *oss = (OSSVoiceOut *) hw; in oss_fini_out()
481 if (oss->mmapped && hw->buf_emul) { in oss_fini_out()
482 err = munmap(hw->buf_emul, hw->size_emul); in oss_fini_out()
485 hw->buf_emul, hw->size_emul); in oss_fini_out()
487 hw->buf_emul = NULL; in oss_fini_out()
491 static int oss_init_out(HWVoiceOut *hw, struct audsettings *as, in oss_init_out() argument
494 OSSVoiceOut *oss = (OSSVoiceOut *) hw; in oss_init_out()
525 audio_pcm_init_info (&hw->info, &obt_as); in oss_init_out()
529 if (obt.nfrags * obt.fragsize % hw->info.bytes_per_frame) { in oss_init_out()
531 obt.nfrags * obt.fragsize, hw->info.bytes_per_frame); in oss_init_out()
534 hw->samples = (obt.nfrags * obt.fragsize) / hw->info.bytes_per_frame; in oss_init_out()
538 hw->size_emul = hw->samples * hw->info.bytes_per_frame; in oss_init_out()
539 hw->buf_emul = mmap( in oss_init_out()
541 hw->size_emul, in oss_init_out()
547 if (hw->buf_emul == MAP_FAILED) { in oss_init_out()
549 hw->size_emul); in oss_init_out()
550 hw->buf_emul = NULL; in oss_init_out()
568 err = munmap(hw->buf_emul, hw->size_emul); in oss_init_out()
571 hw->buf_emul, hw->size_emul); in oss_init_out()
573 hw->buf_emul = NULL; in oss_init_out()
583 static void oss_enable_out(HWVoiceOut *hw, bool enable) in oss_enable_out() argument
586 OSSVoiceOut *oss = (OSSVoiceOut *) hw; in oss_enable_out()
590 hw->poll_mode = opdo->try_poll; in oss_enable_out()
593 if (hw->poll_mode) { in oss_enable_out()
594 oss_poll_out(hw); in oss_enable_out()
601 audio_pcm_info_clear_buf(&hw->info, hw->buf_emul, hw->samples); in oss_enable_out()
609 if (hw->poll_mode) { in oss_enable_out()
611 hw->poll_mode = 0; in oss_enable_out()
627 static int oss_init_in(HWVoiceIn *hw, struct audsettings *as, void *drv_opaque) in oss_init_in() argument
629 OSSVoiceIn *oss = (OSSVoiceIn *) hw; in oss_init_in()
658 audio_pcm_init_info (&hw->info, &obt_as); in oss_init_in()
662 if (obt.nfrags * obt.fragsize % hw->info.bytes_per_frame) { in oss_init_in()
664 obt.nfrags * obt.fragsize, hw->info.bytes_per_frame); in oss_init_in()
667 hw->samples = (obt.nfrags * obt.fragsize) / hw->info.bytes_per_frame; in oss_init_in()
674 static void oss_fini_in (HWVoiceIn *hw) in oss_fini_in() argument
676 OSSVoiceIn *oss = (OSSVoiceIn *) hw; in oss_fini_in()
681 static size_t oss_read(HWVoiceIn *hw, void *buf, size_t len) in oss_read() argument
683 OSSVoiceIn *oss = (OSSVoiceIn *) hw; in oss_read()
712 static void oss_enable_in(HWVoiceIn *hw, bool enable) in oss_enable_in() argument
714 OSSVoiceIn *oss = (OSSVoiceIn *) hw; in oss_enable_in()
718 hw->poll_mode = opdo->try_poll; in oss_enable_in()
720 if (hw->poll_mode) { in oss_enable_in()
721 oss_poll_in(hw); in oss_enable_in()
724 if (hw->poll_mode) { in oss_enable_in()
726 hw->poll_mode = 0; in oss_enable_in()