Changes in uspace/lib/drv/generic/remote_audio_pcm.c [b7fd2a0:e172429] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_audio_pcm.c
rb7fd2a0 re172429 114 114 static category_id_t pcm_id = 0; 115 115 if (!resolved) { 116 const errno_t ret = loc_category_get_id("audio-pcm", &pcm_id,116 const int ret = loc_category_get_id("audio-pcm", &pcm_id, 117 117 IPC_FLAG_BLOCKING); 118 118 if (ret != EOK) … … 123 123 service_id_t *svcs = NULL; 124 124 size_t count = 0; 125 const errno_t ret = loc_category_get_svcs(pcm_id, &svcs, &count);125 const int ret = loc_category_get_svcs(pcm_id, &svcs, &count); 126 126 if (ret != EOK) 127 127 return NULL; … … 143 143 { 144 144 devman_handle_t device_handle = 0; 145 const errno_t ret = devman_fun_get_handle(name, &device_handle, 0);145 const int ret = devman_fun_get_handle(name, &device_handle, 0); 146 146 if (ret != EOK) 147 147 return NULL; … … 184 184 * @note Caller is responsible for freeing newly allocated memory. 185 185 */ 186 errno_t audio_pcm_get_info_str(audio_pcm_sess_t *sess, const char **name)186 int audio_pcm_get_info_str(audio_pcm_sess_t *sess, const char **name) 187 187 { 188 188 if (!name) … … 190 190 async_exch_t *exch = async_exchange_begin(sess); 191 191 sysarg_t name_size; 192 const errno_t ret = async_req_1_1(exch,192 const int ret = async_req_1_1(exch, 193 193 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 194 194 IPC_M_AUDIO_PCM_GET_INFO_STR, &name_size); … … 202 202 return ENOMEM; 203 203 } 204 const errno_t ret =204 const int ret = 205 205 async_data_read_start(exch, name_place, name_size); 206 206 if (ret != EOK) { … … 225 225 * @return Error code. 226 226 */ 227 errno_t audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, sysarg_t *value)228 { 229 async_exch_t *exch = async_exchange_begin(sess); 230 const errno_t ret = async_req_2_1(exch,227 int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, sysarg_t *value) 228 { 229 async_exch_t *exch = async_exchange_begin(sess); 230 const int ret = async_req_2_1(exch, 231 231 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_QUERY_CAPS, 232 232 cap, value); … … 245 245 * Works for both playback and capture. 246 246 */ 247 errno_t audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos)247 int audio_pcm_get_buffer_pos(audio_pcm_sess_t *sess, size_t *pos) 248 248 { 249 249 if (!pos) … … 251 251 async_exch_t *exch = async_exchange_begin(sess); 252 252 sysarg_t value = 0; 253 const errno_t ret = async_req_1_1(exch,253 const int ret = async_req_1_1(exch, 254 254 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 255 255 IPC_M_AUDIO_PCM_GET_BUFFER_POS, &value); … … 273 273 * parameters to the nearest values supported by the device. 274 274 */ 275 errno_t audio_pcm_test_format(audio_pcm_sess_t *sess, unsigned *channels,275 int audio_pcm_test_format(audio_pcm_sess_t *sess, unsigned *channels, 276 276 unsigned *rate, pcm_sample_format_t *format) 277 277 { … … 280 280 sysarg_t rate_arg = rate ? *rate : 0; 281 281 sysarg_t format_arg = format ? *format : 0; 282 const errno_t ret = async_req_4_3(exch,282 const int ret = async_req_4_3(exch, 283 283 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 284 284 IPC_M_AUDIO_PCM_TEST_FORMAT, channels_arg, rate_arg, format_arg, … … 311 311 * @return Error code. 312 312 */ 313 errno_t audio_pcm_register_event_callback(audio_pcm_sess_t *sess,313 int audio_pcm_register_event_callback(audio_pcm_sess_t *sess, 314 314 async_port_handler_t event_callback, void *arg) 315 315 { … … 319 319 async_exch_t *exch = async_exchange_begin(sess); 320 320 321 errno_t ret = async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),321 int ret = async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 322 322 IPC_M_AUDIO_PCM_REGISTER_EVENTS); 323 323 if (ret == EOK) { … … 338 338 * @return Error code. 339 339 */ 340 errno_t audio_pcm_unregister_event_callback(audio_pcm_sess_t *sess)341 { 342 async_exch_t *exch = async_exchange_begin(sess); 343 const errno_t ret = async_req_1_0(exch,340 int audio_pcm_unregister_event_callback(audio_pcm_sess_t *sess) 341 { 342 async_exch_t *exch = async_exchange_begin(sess); 343 const int ret = async_req_1_0(exch, 344 344 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 345 345 IPC_M_AUDIO_PCM_UNREGISTER_EVENTS); … … 357 357 * @return Error code. 358 358 */ 359 errno_t audio_pcm_get_buffer(audio_pcm_sess_t *sess, void **buffer, size_t *size)359 int audio_pcm_get_buffer(audio_pcm_sess_t *sess, void **buffer, size_t *size) 360 360 { 361 361 if (!buffer || !size) … … 365 365 366 366 sysarg_t buffer_size = *size; 367 errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),367 int ret = async_req_2_1(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 368 368 IPC_M_AUDIO_PCM_GET_BUFFER, (sysarg_t)buffer_size, &buffer_size); 369 369 if (ret == EOK) { … … 388 388 * @return Error code. 389 389 */ 390 errno_t audio_pcm_release_buffer(audio_pcm_sess_t *sess)391 { 392 async_exch_t *exch = async_exchange_begin(sess); 393 const errno_t ret = async_req_1_0(exch,390 int audio_pcm_release_buffer(audio_pcm_sess_t *sess) 391 { 392 async_exch_t *exch = async_exchange_begin(sess); 393 const int ret = async_req_1_0(exch, 394 394 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 395 395 IPC_M_AUDIO_PCM_RELEASE_BUFFER); … … 412 412 * 0 to turn off event generation. 413 413 */ 414 errno_t audio_pcm_start_playback_fragment(audio_pcm_sess_t *sess, unsigned frames,414 int audio_pcm_start_playback_fragment(audio_pcm_sess_t *sess, unsigned frames, 415 415 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 416 416 { … … 420 420 const sysarg_t packed = (channels << 16) | (format & UINT16_MAX); 421 421 async_exch_t *exch = async_exchange_begin(sess); 422 const errno_t ret = async_req_4_0(exch,422 const int ret = async_req_4_0(exch, 423 423 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 424 424 IPC_M_AUDIO_PCM_START_PLAYBACK, … … 434 434 * @return Error code. 435 435 */ 436 errno_t audio_pcm_last_playback_fragment(audio_pcm_sess_t *sess)437 { 438 async_exch_t *exch = async_exchange_begin(sess); 439 const errno_t ret = async_req_2_0(exch,436 int audio_pcm_last_playback_fragment(audio_pcm_sess_t *sess) 437 { 438 async_exch_t *exch = async_exchange_begin(sess); 439 const int ret = async_req_2_0(exch, 440 440 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 441 441 IPC_M_AUDIO_PCM_STOP_PLAYBACK, false); … … 454 454 * @return Error code. 455 455 */ 456 errno_t audio_pcm_start_playback(audio_pcm_sess_t *sess,456 int audio_pcm_start_playback(audio_pcm_sess_t *sess, 457 457 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 458 458 { … … 468 468 * @return Error code. 469 469 */ 470 errno_t audio_pcm_stop_playback_immediate(audio_pcm_sess_t *sess)471 { 472 async_exch_t *exch = async_exchange_begin(sess); 473 const errno_t ret = async_req_2_0(exch,470 int audio_pcm_stop_playback_immediate(audio_pcm_sess_t *sess) 471 { 472 async_exch_t *exch = async_exchange_begin(sess); 473 const int ret = async_req_2_0(exch, 474 474 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 475 475 IPC_M_AUDIO_PCM_STOP_PLAYBACK, true); … … 485 485 * @return Error code. 486 486 */ 487 errno_t audio_pcm_stop_playback(audio_pcm_sess_t *sess)488 { 489 async_exch_t *exch = async_exchange_begin(sess); 490 const errno_t ret = async_req_2_0(exch,487 int audio_pcm_stop_playback(audio_pcm_sess_t *sess) 488 { 489 async_exch_t *exch = async_exchange_begin(sess); 490 const int ret = async_req_2_0(exch, 491 491 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 492 492 IPC_M_AUDIO_PCM_STOP_PLAYBACK, false); … … 509 509 * 0 to turn off event generation. 510 510 */ 511 errno_t audio_pcm_start_capture_fragment(audio_pcm_sess_t *sess, unsigned frames,511 int audio_pcm_start_capture_fragment(audio_pcm_sess_t *sess, unsigned frames, 512 512 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 513 513 { … … 517 517 const sysarg_t packed = (channels << 16) | (format & UINT16_MAX); 518 518 async_exch_t *exch = async_exchange_begin(sess); 519 const errno_t ret = async_req_4_0(exch,519 const int ret = async_req_4_0(exch, 520 520 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_CAPTURE, 521 521 frames, sample_rate, packed); … … 534 534 * @return Error code. 535 535 */ 536 errno_t audio_pcm_start_capture(audio_pcm_sess_t *sess,536 int audio_pcm_start_capture(audio_pcm_sess_t *sess, 537 537 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 538 538 { … … 549 549 * @return Error code. 550 550 */ 551 errno_t audio_pcm_last_capture_fragment(audio_pcm_sess_t *sess)552 { 553 async_exch_t *exch = async_exchange_begin(sess); 554 const errno_t ret = async_req_2_0(exch,551 int audio_pcm_last_capture_fragment(audio_pcm_sess_t *sess) 552 { 553 async_exch_t *exch = async_exchange_begin(sess); 554 const int ret = async_req_2_0(exch, 555 555 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 556 556 IPC_M_AUDIO_PCM_STOP_CAPTURE, false); … … 566 566 * @return Error code. 567 567 */ 568 errno_t audio_pcm_stop_capture_immediate(audio_pcm_sess_t *sess)569 { 570 async_exch_t *exch = async_exchange_begin(sess); 571 const errno_t ret = async_req_2_0(exch,568 int audio_pcm_stop_capture_immediate(audio_pcm_sess_t *sess) 569 { 570 async_exch_t *exch = async_exchange_begin(sess); 571 const int ret = async_req_2_0(exch, 572 572 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 573 573 IPC_M_AUDIO_PCM_STOP_CAPTURE, true); … … 583 583 * @return Error code. 584 584 */ 585 errno_t audio_pcm_stop_capture(audio_pcm_sess_t *sess)586 { 587 async_exch_t *exch = async_exchange_begin(sess); 588 const errno_t ret = async_req_2_0(exch,585 int audio_pcm_stop_capture(audio_pcm_sess_t *sess) 586 { 587 async_exch_t *exch = async_exchange_begin(sess); 588 const int ret = async_req_2_0(exch, 589 589 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 590 590 IPC_M_AUDIO_PCM_STOP_CAPTURE, false); … … 641 641 } 642 642 const char *name = NULL; 643 const errno_t ret = pcm_iface->get_info_str(fun, &name);643 const int ret = pcm_iface->get_info_str(fun, &name); 644 644 const size_t name_size = name ? str_size(name) + 1 : 0; 645 645 async_answer_1(callid, ret, name_size); … … 692 692 return; 693 693 } 694 const errno_t ret = pcm_iface->set_event_session(fun, sess);694 const int ret = pcm_iface->set_event_session(fun, sess); 695 695 if (ret != EOK) { 696 696 ddf_msg(LVL_DEBUG, "Failed to set event callback."); … … 722 722 const audio_pcm_iface_t *pcm_iface = iface; 723 723 size_t pos = 0; 724 const errno_t ret = pcm_iface->get_buffer_pos ?724 const int ret = pcm_iface->get_buffer_pos ? 725 725 pcm_iface->get_buffer_pos(fun, &pos) : ENOTSUP; 726 726 async_answer_1(callid, ret, pos); … … 733 733 unsigned rate = DEV_IPC_GET_ARG2(*call); 734 734 pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call); 735 const errno_t ret = pcm_iface->test_format ?735 const int ret = pcm_iface->test_format ? 736 736 pcm_iface->test_format(fun, &channels, &rate, &format) : ENOTSUP; 737 737 async_answer_3(callid, ret, channels, rate, format); … … 750 750 void *buffer = NULL; 751 751 size_t size = DEV_IPC_GET_ARG1(*call); 752 errno_t ret = pcm_iface->get_buffer(fun, &buffer, &size);752 int ret = pcm_iface->get_buffer(fun, &buffer, &size); 753 753 async_answer_1(callid, ret, size); 754 754 if (ret != EOK || size == 0) … … 792 792 const audio_pcm_iface_t *pcm_iface = iface; 793 793 794 const errno_t ret = pcm_iface->release_buffer ?794 const int ret = pcm_iface->release_buffer ? 795 795 pcm_iface->release_buffer(fun) : ENOTSUP; 796 796 async_answer_0(callid, ret); … … 807 807 const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 808 808 809 const errno_t ret = pcm_iface->start_playback809 const int ret = pcm_iface->start_playback 810 810 ? pcm_iface->start_playback(fun, frames, channels, rate, format) 811 811 : ENOTSUP; … … 819 819 const bool immediate = DEV_IPC_GET_ARG1(*call); 820 820 821 const errno_t ret = pcm_iface->stop_playback ?821 const int ret = pcm_iface->stop_playback ? 822 822 pcm_iface->stop_playback(fun, immediate) : ENOTSUP; 823 823 async_answer_0(callid, ret); … … 834 834 const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 835 835 836 const errno_t ret = pcm_iface->start_capture836 const int ret = pcm_iface->start_capture 837 837 ? pcm_iface->start_capture(fun, frames, channels, rate, format) 838 838 : ENOTSUP; … … 846 846 const bool immediate = DEV_IPC_GET_ARG1(*call); 847 847 848 const errno_t ret = pcm_iface->stop_capture ?848 const int ret = pcm_iface->stop_capture ? 849 849 pcm_iface->stop_capture(fun, immediate) : ENOTSUP; 850 850 async_answer_0(callid, ret);
Note:
See TracChangeset
for help on using the changeset viewer.