Changeset 57e8b3b in mainline for uspace/lib/drv/generic/remote_audio_pcm.c
- Timestamp:
- 2012-07-15T15:25:43Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5cd5079
- Parents:
- 2cc5c835
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_audio_pcm.c
r2cc5c835 r57e8b3b 148 148 } 149 149 150 int audio_pcm_start_playback(audio_pcm_sess_t *sess, unsigned parts,150 int audio_pcm_start_playback(audio_pcm_sess_t *sess, unsigned frames, 151 151 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 152 152 { 153 if ( parts > UINT8_MAX || channels > UINT8_MAX)153 if (channels > UINT16_MAX) 154 154 return EINVAL; 155 155 assert((format & UINT16_MAX) == format); 156 const sysarg_t packed = 157 (parts << 24) | (channels << 16) | (format & UINT16_MAX); 158 async_exch_t *exch = async_exchange_begin(sess); 159 const int ret = async_req_3_0(exch, 156 const sysarg_t packed = (channels << 16) | (format & UINT16_MAX); 157 async_exch_t *exch = async_exchange_begin(sess); 158 const int ret = async_req_4_0(exch, 160 159 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), 161 160 IPC_M_AUDIO_PCM_START_PLAYBACK, 162 sample_rate, packed);161 frames, sample_rate, packed); 163 162 async_exchange_end(exch); 164 163 return ret; … … 175 174 } 176 175 177 int audio_pcm_start_record(audio_pcm_sess_t *sess, unsigned parts,176 int audio_pcm_start_record(audio_pcm_sess_t *sess, unsigned frames, 178 177 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 179 178 { 180 if ( parts > UINT8_MAX || channels > UINT8_MAX)179 if (channels > UINT16_MAX) 181 180 return EINVAL; 182 181 assert((format & UINT16_MAX) == format); 183 const sysarg_t packed = 184 (parts << 24) | (channels << 16) | (format & UINT16_MAX); 185 async_exch_t *exch = async_exchange_begin(sess); 186 const int ret = async_req_3_0(exch, 182 const sysarg_t packed = (channels << 16) | (format & UINT16_MAX); 183 async_exch_t *exch = async_exchange_begin(sess); 184 const int ret = async_req_4_0(exch, 187 185 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_RECORD, 188 sample_rate, packed);186 frames, sample_rate, packed); 189 187 async_exchange_end(exch); 190 188 return ret; … … 345 343 const audio_pcm_iface_t *pcm_iface = iface; 346 344 347 const unsigned rate= DEV_IPC_GET_ARG1(*call);348 const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX;349 const unsigned channels = (DEV_IPC_GET_ARG 2(*call) >> 16) & UINT8_MAX;350 const pcm_sample_format_t format = DEV_IPC_GET_ARG 2(*call) & UINT16_MAX;345 const unsigned frames = DEV_IPC_GET_ARG1(*call); 346 const unsigned rate = DEV_IPC_GET_ARG2(*call); 347 const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT8_MAX; 348 const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 351 349 352 350 const int ret = pcm_iface->start_playback 353 ? pcm_iface->start_playback(fun, parts, channels, rate, format)351 ? pcm_iface->start_playback(fun, frames, channels, rate, format) 354 352 : ENOTSUP; 355 353 async_answer_0(callid, ret); … … 371 369 const audio_pcm_iface_t *pcm_iface = iface; 372 370 373 const unsigned rate= DEV_IPC_GET_ARG1(*call);374 const unsigned parts = (DEV_IPC_GET_ARG2(*call) >> 24) & UINT8_MAX;375 const unsigned channels = (DEV_IPC_GET_ARG 2(*call) >> 16) & UINT8_MAX;376 const pcm_sample_format_t format = DEV_IPC_GET_ARG 2(*call) & UINT16_MAX;371 const unsigned frames = DEV_IPC_GET_ARG1(*call); 372 const unsigned rate = DEV_IPC_GET_ARG2(*call); 373 const unsigned channels = (DEV_IPC_GET_ARG3(*call) >> 16) & UINT16_MAX; 374 const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 377 375 378 376 const int ret = pcm_iface->start_record 379 ? pcm_iface->start_record(fun, parts, channels, rate, format)377 ? pcm_iface->start_record(fun, frames, channels, rate, format) 380 378 : ENOTSUP; 381 379 async_answer_0(callid, ret);
Note:
See TracChangeset
for help on using the changeset viewer.