Changeset b497018 in mainline
- Timestamp:
- 2012-07-15T15:13:34Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2cc5c835
- Parents:
- 44d1311
- Location:
- uspace
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/app/dplay/dplay.c ¶
r44d1311 rb497018 57 57 void *base; 58 58 size_t size; 59 unsigned id;60 59 void* position; 61 60 } buffer; … … 71 70 assert(exch); 72 71 assert(pb); 73 pb->buffer.id = 0;74 72 pb->buffer.base = NULL; 75 73 pb->buffer.size = 0; … … 113 111 buffer_part, pb->source); 114 112 if (bytes == 0) { 115 audio_pcm_stop_playback(pb->device , pb->buffer.id);113 audio_pcm_stop_playback(pb->device); 116 114 } 117 115 bzero(pb->buffer.position + bytes, buffer_part - bytes); … … 138 136 printf("Buffer data ready.\n"); 139 137 fibril_mutex_lock(&pb->mutex); 140 int ret = audio_pcm_start_playback(pb->device, pb->buffer.id,138 int ret = audio_pcm_start_playback(pb->device, 141 139 SUBBUFFERS, channels, sampling_rate, format); 142 140 if (ret != EOK) { … … 204 202 205 203 ret = audio_pcm_get_buffer(pb.device, &pb.buffer.base, 206 &pb.buffer.size, &pb.buffer.id,device_event_callback, &pb);204 &pb.buffer.size, device_event_callback, &pb); 207 205 if (ret != EOK) { 208 206 printf("Failed to get PCM buffer: %s.\n", str_error(ret)); 209 207 goto close_session; 210 208 } 211 printf("Buffer (%u): %p %zu.\n", pb.buffer.id, pb.buffer.base, 212 pb.buffer.size); 209 printf("Buffer: %p %zu.\n", pb.buffer.base, pb.buffer.size); 213 210 uintptr_t ptr = 0; 214 211 as_get_physical_mapping(pb.buffer.base, &ptr); … … 239 236 cleanup: 240 237 munmap(pb.buffer.base, pb.buffer.size); 241 audio_pcm_release_buffer(exch , pb.buffer.id);238 audio_pcm_release_buffer(exch); 242 239 close_session: 243 240 async_exchange_end(exch); -
TabularUnified uspace/app/drec/drec.c ¶
r44d1311 rb497018 72 72 assert(exch); 73 73 assert(rec); 74 rec->buffer.id = 0;75 74 rec->buffer.base = NULL; 76 75 rec->buffer.size = 0; … … 123 122 printf("Recording: %dHz, %s, %d channel(s).\n", 124 123 sampling_rate, pcm_sample_format_str(format), channels); 125 int ret = audio_pcm_start_record(rec->device, rec->buffer.id,124 int ret = audio_pcm_start_record(rec->device, 126 125 SUBBUFFERS, channels, sampling_rate, format); 127 126 if (ret != EOK) { … … 132 131 getchar(); 133 132 printf("\n"); 134 audio_pcm_stop_record(rec->device , rec->buffer.id);133 audio_pcm_stop_record(rec->device); 135 134 } 136 135 … … 186 185 187 186 ret = audio_pcm_get_buffer(rec.device, &rec.buffer.base, 188 &rec.buffer.size, &rec.buffer.id,device_event_callback, &rec);187 &rec.buffer.size, device_event_callback, &rec); 189 188 if (ret != EOK) { 190 189 printf("Failed to get PCM buffer: %s.\n", str_error(ret)); 191 190 goto close_session; 192 191 } 193 printf("Buffer (%u): %p %zu.\n", rec.buffer.id, rec.buffer.base, 194 rec.buffer.size); 192 printf("Buffer: %p %zu.\n", rec.buffer.base, rec.buffer.size); 195 193 uintptr_t ptr = 0; 196 194 as_get_physical_mapping(rec.buffer.base, &ptr); … … 222 220 cleanup: 223 221 munmap(rec.buffer.base, rec.buffer.size); 224 audio_pcm_release_buffer(exch , rec.buffer.id);222 audio_pcm_release_buffer(exch); 225 223 close_session: 226 224 async_exchange_end(exch); -
TabularUnified uspace/drv/audio/sb16/dsp.c ¶
r44d1311 rb497018 46 46 #include "dsp.h" 47 47 48 #define BUFFER_ID 149 48 #define MAX_BUFFER_SIZE (PAGE_SIZE) 50 49 … … 221 220 } 222 221 223 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size , unsigned *id)222 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size) 224 223 { 225 224 assert(dsp); … … 233 232 const int ret = sb_setup_buffer(dsp, *size); 234 233 if (ret == EOK) { 235 ddf_log_debug("Providing buffer (%u): %p, %zu B.",236 BUFFER_ID,dsp->buffer.data, dsp->buffer.size);234 ddf_log_debug("Providing buffer: %p, %zu B.", 235 dsp->buffer.data, dsp->buffer.size); 237 236 238 237 if (buffer) … … 240 239 if (size) 241 240 *size = dsp->buffer.size; 242 if (id)243 *id = BUFFER_ID;244 241 } 245 242 return ret; 246 243 } 247 244 248 int sb_dsp_set_event_session(sb_dsp_t *dsp, unsigned id,async_sess_t *session)245 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session) 249 246 { 250 247 assert(dsp); 251 248 assert(session); 252 if (id != BUFFER_ID)253 return ENOENT;254 249 if (dsp->event_session) 255 250 return EBUSY; … … 259 254 } 260 255 261 int sb_dsp_release_buffer(sb_dsp_t *dsp, unsigned id) 262 { 263 assert(dsp); 264 if (id != BUFFER_ID) 265 return ENOENT; 256 int sb_dsp_release_buffer(sb_dsp_t *dsp) 257 { 258 assert(dsp); 266 259 sb_clear_buffer(dsp); 267 260 async_exchange_end(dsp->event_exchange); … … 274 267 } 275 268 276 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned id, unsignedparts,269 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned parts, 277 270 unsigned channels, unsigned sampling_rate, pcm_sample_format_t format) 278 271 { … … 289 282 290 283 /* Check supported parameters */ 291 ddf_log_debug("Requested playback on buffer \"%u\" (%u parts): %uHz, " 292 "%s, %u channel(s).", id, parts, sampling_rate, 293 pcm_sample_format_str(format), channels); 294 if (id != BUFFER_ID) 295 return ENOENT; 284 ddf_log_debug("Requested playback (%u parts): %uHz, %s, %u channel(s).", 285 parts, sampling_rate, pcm_sample_format_str(format), channels); 296 286 if (channels != 1 && channels != 2) 297 287 return ENOTSUP; … … 338 328 } 339 329 340 int sb_dsp_stop_playback(sb_dsp_t *dsp, unsigned id) 341 { 342 assert(dsp); 343 if (id != BUFFER_ID) 344 return ENOENT; 330 int sb_dsp_stop_playback(sb_dsp_t *dsp) 331 { 332 assert(dsp); 345 333 sb_dsp_write(dsp, DMA_16B_EXIT); 346 ddf_log_debug("Stopping playback on buffer %u.", id);334 ddf_log_debug("Stopping playback on buffer."); 347 335 async_msg_0(dsp->event_exchange, PCM_EVENT_PLAYBACK_TERMINATED); 348 336 async_exchange_end(dsp->event_exchange); … … 351 339 } 352 340 353 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned id, unsignedparts,341 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned parts, 354 342 unsigned channels, unsigned sampling_rate, pcm_sample_format_t format) 355 343 { … … 366 354 367 355 /* Check supported parameters */ 368 ddf_log_debug("Requested recording on buffer \"%u\" (%u parts): %uHz, " 369 "%s, %u channel(s).", id, parts, sampling_rate, 370 pcm_sample_format_str(format), channels); 371 if (id != BUFFER_ID) 372 return ENOENT; 356 ddf_log_debug("Requested record (%u parts): %uHz, %s, %u channel(s).", 357 parts, sampling_rate, pcm_sample_format_str(format), channels); 373 358 if (channels != 1 && channels != 2) 374 359 return ENOTSUP; … … 414 399 } 415 400 416 int sb_dsp_stop_record(sb_dsp_t *dsp, unsigned id) 417 { 418 assert(dsp); 419 if (id != BUFFER_ID) 420 return ENOENT; 401 int sb_dsp_stop_record(sb_dsp_t *dsp) 402 { 403 assert(dsp); 421 404 sb_dsp_write(dsp, DMA_16B_EXIT); 422 ddf_log_debug("Stopp ing playback on buffer %u.", id);405 ddf_log_debug("Stopped recording"); 423 406 async_msg_0(dsp->event_exchange, PCM_EVENT_RECORDING_TERMINATED); 424 407 async_exchange_end(dsp->event_exchange); -
TabularUnified uspace/drv/audio/sb16/dsp.h ¶
r44d1311 rb497018 72 72 void sb_dsp_interrupt(sb_dsp_t *dsp); 73 73 74 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size , unsigned *id);75 int sb_dsp_set_event_session(sb_dsp_t *dsp, unsigned id,async_sess_t *session);76 int sb_dsp_release_buffer(sb_dsp_t *dsp , unsigned id);77 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned id, unsignedparts,74 int sb_dsp_get_buffer(sb_dsp_t *dsp, void **buffer, size_t *size); 75 int sb_dsp_set_event_session(sb_dsp_t *dsp, async_sess_t *session); 76 int sb_dsp_release_buffer(sb_dsp_t *dsp); 77 int sb_dsp_start_playback(sb_dsp_t *dsp, unsigned parts, 78 78 unsigned channels, unsigned sample_rate, pcm_sample_format_t format); 79 int sb_dsp_stop_playback(sb_dsp_t *dsp , unsigned id);80 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned id, unsignedparts,79 int sb_dsp_stop_playback(sb_dsp_t *dsp); 80 int sb_dsp_start_record(sb_dsp_t *dsp, unsigned parts, 81 81 unsigned channels, unsigned sample_rate, pcm_sample_format_t format); 82 int sb_dsp_stop_record(sb_dsp_t *dsp , unsigned id);82 int sb_dsp_stop_record(sb_dsp_t *dsp); 83 83 84 84 #endif -
TabularUnified uspace/drv/audio/sb16/pcm_iface.c ¶
r44d1311 rb497018 47 47 } 48 48 49 static int sb_get_buffer(ddf_fun_t *fun, 50 void **buffer, size_t *size, unsigned *id) 49 static int sb_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size) 51 50 { 52 51 assert(fun); 53 52 assert(fun->driver_data); 54 53 sb_dsp_t *dsp = fun->driver_data; 55 return sb_dsp_get_buffer(dsp, buffer, size , id);54 return sb_dsp_get_buffer(dsp, buffer, size); 56 55 } 57 static int sb_set_event_session(ddf_fun_t *fun, unsigned id,async_sess_t *sess)56 static int sb_set_event_session(ddf_fun_t *fun, async_sess_t *sess) 58 57 { 59 58 assert(fun); 60 59 assert(fun->driver_data); 61 60 sb_dsp_t *dsp = fun->driver_data; 62 return sb_dsp_set_event_session(dsp, id,sess);61 return sb_dsp_set_event_session(dsp, sess); 63 62 } 64 63 65 static int sb_release_buffer(ddf_fun_t *fun , unsigned id)64 static int sb_release_buffer(ddf_fun_t *fun) 66 65 { 67 66 assert(fun); 68 67 assert(fun->driver_data); 69 68 sb_dsp_t *dsp = fun->driver_data; 70 return sb_dsp_release_buffer(dsp , id);69 return sb_dsp_release_buffer(dsp); 71 70 } 72 71 73 static int sb_start_playback(ddf_fun_t *fun, unsigned id, unsignedparts,72 static int sb_start_playback(ddf_fun_t *fun, unsigned parts, 74 73 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 75 74 { … … 78 77 sb_dsp_t *dsp = fun->driver_data; 79 78 return sb_dsp_start_playback( 80 dsp, id,parts, channels, sample_rate, format);79 dsp, parts, channels, sample_rate, format); 81 80 } 82 81 83 static int sb_stop_playback(ddf_fun_t *fun , unsigned id)82 static int sb_stop_playback(ddf_fun_t *fun) 84 83 { 85 84 assert(fun); 86 85 assert(fun->driver_data); 87 86 sb_dsp_t *dsp = fun->driver_data; 88 return sb_dsp_stop_playback(dsp , id);87 return sb_dsp_stop_playback(dsp); 89 88 } 90 89 91 static int sb_start_record(ddf_fun_t *fun, unsigned id, unsignedparts,90 static int sb_start_record(ddf_fun_t *fun, unsigned parts, 92 91 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 93 92 { … … 96 95 sb_dsp_t *dsp = fun->driver_data; 97 96 return sb_dsp_start_record( 98 dsp, id,parts, channels, sample_rate, format);97 dsp, parts, channels, sample_rate, format); 99 98 } 100 99 101 static int sb_stop_record(ddf_fun_t *fun , unsigned id)100 static int sb_stop_record(ddf_fun_t *fun) 102 101 { 103 102 assert(fun); 104 103 assert(fun->driver_data); 105 104 sb_dsp_t *dsp = fun->driver_data; 106 return sb_dsp_stop_record(dsp , id);105 return sb_dsp_stop_record(dsp); 107 106 } 108 107 -
TabularUnified uspace/lib/drv/generic/remote_audio_pcm.c ¶
r44d1311 rb497018 83 83 84 84 int audio_pcm_get_buffer(async_exch_t *exch, void **buffer, size_t *size, 85 unsigned *id,async_client_conn_t event_rec, void* arg)86 { 87 if (!exch || !buffer || !size || !id)88 return EINVAL; 89 90 sysarg_t buffer_size = *size , buffer_id = 0;91 const int ret = async_req_2_ 2(exch,85 async_client_conn_t event_rec, void* arg) 86 { 87 if (!exch || !buffer || !size) 88 return EINVAL; 89 90 sysarg_t buffer_size = *size; 91 const int ret = async_req_2_1(exch, 92 92 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_GET_BUFFER, 93 (sysarg_t)buffer_size, &buffer_size , &buffer_id);93 (sysarg_t)buffer_size, &buffer_size); 94 94 if (ret == EOK) { 95 95 void *dst = NULL; … … 105 105 *buffer = dst; 106 106 *size = buffer_size; 107 *id = buffer_id;108 107 } 109 108 return ret; 110 109 } 111 110 112 int audio_pcm_release_buffer(async_exch_t *exch , unsigned id)111 int audio_pcm_release_buffer(async_exch_t *exch) 113 112 { 114 113 if (!exch) 115 114 return EINVAL; 116 return async_req_ 2_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),117 IPC_M_AUDIO_PCM_RELEASE_BUFFER , id);118 } 119 120 int audio_pcm_start_playback(async_exch_t *exch, unsigned id, unsignedparts,115 return async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 116 IPC_M_AUDIO_PCM_RELEASE_BUFFER); 117 } 118 119 int audio_pcm_start_playback(async_exch_t *exch, unsigned parts, 121 120 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 122 121 { … … 128 127 const sysarg_t packed = 129 128 (parts << 24) | (channels << 16) | (format & UINT16_MAX); 130 return async_req_ 4_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),131 IPC_M_AUDIO_PCM_START_PLAYBACK, id,sample_rate, packed);132 } 133 134 int audio_pcm_stop_playback(async_exch_t *exch , unsigned id)129 return async_req_3_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 130 IPC_M_AUDIO_PCM_START_PLAYBACK, sample_rate, packed); 131 } 132 133 int audio_pcm_stop_playback(async_exch_t *exch) 135 134 { 136 135 if (!exch) 137 136 return EINVAL; 138 return async_req_ 2_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),139 IPC_M_AUDIO_PCM_STOP_PLAYBACK , id);140 } 141 142 int audio_pcm_start_record(async_exch_t *exch, unsigned id, unsignedparts,137 return async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 138 IPC_M_AUDIO_PCM_STOP_PLAYBACK); 139 } 140 141 int audio_pcm_start_record(async_exch_t *exch, unsigned parts, 143 142 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 144 143 { … … 150 149 const sysarg_t packed = 151 150 (parts << 24) | (channels << 16) | (format & UINT16_MAX); 152 return async_req_ 4_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),153 IPC_M_AUDIO_PCM_START_RECORD, id,sample_rate, packed);154 } 155 156 int audio_pcm_stop_record(async_exch_t *exch , unsigned id)151 return async_req_3_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 152 IPC_M_AUDIO_PCM_START_RECORD, sample_rate, packed); 153 } 154 155 int audio_pcm_stop_record(async_exch_t *exch) 157 156 { 158 157 if (!exch) 159 158 return EINVAL; 160 return async_req_ 2_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE),161 IPC_M_AUDIO_PCM_STOP_RECORD , id);159 return async_req_1_0(exch, DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 160 IPC_M_AUDIO_PCM_STOP_RECORD); 162 161 } 163 162 … … 233 232 void *buffer = NULL; 234 233 size_t size = DEV_IPC_GET_ARG1(*call); 235 unsigned id = 0; 236 int ret = pcm_iface->get_buffer(fun, &buffer, &size, &id); 237 async_answer_2(callid, ret, size, id); 234 int ret = pcm_iface->get_buffer(fun, &buffer, &size); 235 async_answer_1(callid, ret, size); 238 236 if (ret != EOK || size == 0) 239 237 return; … … 246 244 if (!async_share_in_receive(&share_id, &share_size)) { 247 245 ddf_msg(LVL_DEBUG, "Failed to share pcm buffer."); 248 pcm_iface->release_buffer(fun , id);246 pcm_iface->release_buffer(fun); 249 247 async_answer_0(share_id, EPARTY); 250 248 return; … … 254 252 if (share_size != size) { 255 253 ddf_msg(LVL_DEBUG, "Incorrect pcm buffer size requested."); 256 pcm_iface->release_buffer(fun , id);254 pcm_iface->release_buffer(fun); 257 255 async_answer_0(share_id, ELIMIT); 258 256 return; … … 264 262 if (ret != EOK) { 265 263 ddf_msg(LVL_DEBUG, "Failed to share buffer."); 266 pcm_iface->release_buffer(fun , id);264 pcm_iface->release_buffer(fun); 267 265 return; 268 266 } … … 277 275 if (sess == NULL) { 278 276 ddf_msg(LVL_DEBUG, "Failed to create event callback"); 279 pcm_iface->release_buffer(fun , id);277 pcm_iface->release_buffer(fun); 280 278 async_answer_0(callid, EAGAIN); 281 279 return; 282 280 } 283 ret = pcm_iface->set_event_session(fun, id,sess);281 ret = pcm_iface->set_event_session(fun, sess); 284 282 if (ret != EOK) { 285 283 ddf_msg(LVL_DEBUG, "Failed to set event callback."); 286 pcm_iface->release_buffer(fun , id);284 pcm_iface->release_buffer(fun); 287 285 async_answer_0(callid, ret); 288 286 return; … … 298 296 const audio_pcm_iface_t *pcm_iface = iface; 299 297 300 const unsigned id = DEV_IPC_GET_ARG1(*call);301 298 const int ret = pcm_iface->release_buffer ? 302 pcm_iface->release_buffer(fun , id) : ENOTSUP;299 pcm_iface->release_buffer(fun) : ENOTSUP; 303 300 async_answer_0(callid, ret); 304 301 } … … 309 306 const audio_pcm_iface_t *pcm_iface = iface; 310 307 311 const unsigned id = DEV_IPC_GET_ARG1(*call); 312 const unsigned rate = DEV_IPC_GET_ARG2(*call); 313 const unsigned parts = (DEV_IPC_GET_ARG3(*call) >> 24) & UINT8_MAX; 314 const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX; 315 const pcm_sample_format_t format =DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 308 const unsigned rate = DEV_IPC_GET_ARG1(*call); 309 const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX; 310 const unsigned channels = (DEV_IPC_GET_ARG2(*call) >> 16) & UINT8_MAX; 311 const pcm_sample_format_t format = DEV_IPC_GET_ARG2(*call) & UINT16_MAX; 316 312 317 313 const int ret = pcm_iface->start_playback 318 ? pcm_iface->start_playback(fun, id,parts, channels, rate, format)314 ? pcm_iface->start_playback(fun, parts, channels, rate, format) 319 315 : ENOTSUP; 320 316 async_answer_0(callid, ret); … … 326 322 const audio_pcm_iface_t *pcm_iface = iface; 327 323 328 const unsigned id = DEV_IPC_GET_ARG1(*call);329 324 const int ret = pcm_iface->stop_playback ? 330 pcm_iface->stop_playback(fun , id) : ENOTSUP;325 pcm_iface->stop_playback(fun) : ENOTSUP; 331 326 async_answer_0(callid, ret); 332 327 } … … 337 332 const audio_pcm_iface_t *pcm_iface = iface; 338 333 339 const unsigned id = DEV_IPC_GET_ARG1(*call); 340 const unsigned rate = DEV_IPC_GET_ARG2(*call); 341 const unsigned parts = (DEV_IPC_GET_ARG3(*call) >> 24) & UINT8_MAX; 342 const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX; 343 const pcm_sample_format_t format =DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 334 const unsigned rate = DEV_IPC_GET_ARG1(*call); 335 const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX; 336 const unsigned channels = (DEV_IPC_GET_ARG2(*call) >> 16) & UINT8_MAX; 337 const pcm_sample_format_t format = DEV_IPC_GET_ARG2(*call) & UINT16_MAX; 344 338 345 339 const int ret = pcm_iface->start_record 346 ? pcm_iface->start_record(fun, id,parts, channels, rate, format)340 ? pcm_iface->start_record(fun, parts, channels, rate, format) 347 341 : ENOTSUP; 348 342 async_answer_0(callid, ret); … … 354 348 const audio_pcm_iface_t *pcm_iface = iface; 355 349 356 const unsigned id = DEV_IPC_GET_ARG1(*call);357 350 const int ret = pcm_iface->stop_record ? 358 pcm_iface->stop_record(fun , id) : ENOTSUP;351 pcm_iface->stop_record(fun) : ENOTSUP; 359 352 async_answer_0(callid, ret); 360 353 } -
TabularUnified uspace/lib/drv/include/audio_pcm_iface.h ¶
r44d1311 rb497018 52 52 53 53 int audio_pcm_get_info_str(async_exch_t *, const char **); 54 int audio_pcm_get_buffer(async_exch_t *, void **, size_t *, unsigned *,54 int audio_pcm_get_buffer(async_exch_t *, void **, size_t *, 55 55 async_client_conn_t, void *); 56 int audio_pcm_release_buffer(async_exch_t * , unsigned);56 int audio_pcm_release_buffer(async_exch_t *); 57 57 58 int audio_pcm_start_playback(async_exch_t *, unsigned, unsigned,58 int audio_pcm_start_playback(async_exch_t *, unsigned, 59 59 unsigned, unsigned, pcm_sample_format_t); 60 int audio_pcm_stop_playback(async_exch_t * , unsigned);60 int audio_pcm_stop_playback(async_exch_t *); 61 61 62 int audio_pcm_start_record(async_exch_t *, unsigned, unsigned,62 int audio_pcm_start_record(async_exch_t *, unsigned, 63 63 unsigned, unsigned, pcm_sample_format_t); 64 int audio_pcm_stop_record(async_exch_t * , unsigned);64 int audio_pcm_stop_record(async_exch_t *); 65 65 66 66 /** Audio pcm communication interface. */ 67 67 typedef struct { 68 68 int (*get_info_str)(ddf_fun_t *, const char **); 69 int (*get_buffer)(ddf_fun_t *, void **, size_t * , unsigned *);70 int (*release_buffer)(ddf_fun_t * , unsigned);71 int (*set_event_session)(ddf_fun_t *, unsigned,async_sess_t *);72 int (*start_playback)(ddf_fun_t *, unsigned, unsigned,69 int (*get_buffer)(ddf_fun_t *, void **, size_t *); 70 int (*release_buffer)(ddf_fun_t *); 71 int (*set_event_session)(ddf_fun_t *, async_sess_t *); 72 int (*start_playback)(ddf_fun_t *, unsigned, 73 73 unsigned, unsigned, pcm_sample_format_t); 74 int (*stop_playback)(ddf_fun_t * , unsigned);75 int (*start_record)(ddf_fun_t *, unsigned, unsigned,74 int (*stop_playback)(ddf_fun_t *); 75 int (*start_record)(ddf_fun_t *, unsigned, 76 76 unsigned, unsigned, pcm_sample_format_t); 77 int (*stop_record)(ddf_fun_t * , unsigned);77 int (*stop_record)(ddf_fun_t *); 78 78 } audio_pcm_iface_t; 79 79 -
TabularUnified uspace/srv/audio/hound/audio_device.c ¶
r44d1311 rb497018 80 80 fibril_mutex_initialize(&dev->buffer.guard); 81 81 fibril_condvar_initialize(&dev->buffer.wc); 82 dev->buffer.id = 0;83 82 dev->buffer.base = NULL; 84 83 dev->buffer.position = NULL; … … 232 231 async_exch_t *exch = async_exchange_begin(dev->sess); 233 232 const int ret = audio_pcm_get_buffer(exch, &dev->buffer.base, 234 &dev->buffer.size, &dev->buffer.id,device_event_callback, dev);233 &dev->buffer.size, device_event_callback, dev); 235 234 async_exchange_end(exch); 236 235 return ret; … … 256 255 257 256 async_exch_t *exch = async_exchange_begin(dev->sess); 258 const int ret = audio_pcm_release_buffer(exch , dev->buffer.id);257 const int ret = audio_pcm_release_buffer(exch); 259 258 async_exchange_end(exch); 260 259 if (ret == EOK) { … … 274 273 275 274 async_exch_t *exch = async_exchange_begin(dev->sess); 276 const int ret = audio_pcm_start_playback(exch, dev->buffer.id,275 const int ret = audio_pcm_start_playback(exch, 277 276 BUFFER_BLOCKS, dev->sink.format.channels, 278 277 dev->sink.format.sampling_rate, dev->sink.format.sample_format); … … 286 285 287 286 async_exch_t *exch = async_exchange_begin(dev->sess); 288 const int ret = audio_pcm_stop_playback(exch , dev->buffer.id);287 const int ret = audio_pcm_stop_playback(exch); 289 288 async_exchange_end(exch); 290 289 return ret; … … 296 295 297 296 async_exch_t *exch = async_exchange_begin(dev->sess); 298 const int ret = audio_pcm_start_record(exch, dev->buffer.id,297 const int ret = audio_pcm_start_record(exch, 299 298 BUFFER_BLOCKS, dev->sink.format.channels, 300 299 dev->sink.format.sampling_rate, dev->sink.format.sample_format); … … 308 307 309 308 async_exch_t *exch = async_exchange_begin(dev->sess); 310 const int ret = audio_pcm_stop_record(exch , dev->buffer.id);309 const int ret = audio_pcm_stop_record(exch); 311 310 async_exchange_end(exch); 312 311 return ret; -
TabularUnified uspace/srv/audio/hound/audio_device.h ¶
r44d1311 rb497018 55 55 fibril_mutex_t guard; 56 56 fibril_condvar_t wc; 57 unsigned id;58 57 void *base; 59 58 size_t size;
Note:
See TracChangeset
for help on using the changeset viewer.