Changeset d86c9736 in mainline
- Timestamp:
- 2012-08-19T14:35:32Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fa91c0f
- Parents:
- ad42844
- Location:
- uspace
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/drec/drec.c
rad42844 rd86c9736 89 89 ipc_callid_t callid = async_get_call(&call); 90 90 switch(IPC_GET_IMETHOD(call)) { 91 case PCM_EVENT_FRAMES_ RECORDED:91 case PCM_EVENT_FRAMES_CAPTURED: 92 92 printf("%u frames\n", IPC_GET_ARG1(call)); 93 93 async_answer_0(callid, EOK); 94 94 break; 95 case PCM_EVENT_ RECORDING_TERMINATED:95 case PCM_EVENT_CAPTURE_TERMINATED: 96 96 printf("Recording terminated\n"); 97 97 return; … … 124 124 const unsigned frames = rec->buffer.size / 125 125 (BUFFER_PARTS * channels * pcm_sample_format_size(format)); 126 int ret = audio_pcm_start_ record(rec->device,126 int ret = audio_pcm_start_capture(rec->device, 127 127 frames, channels, sampling_rate, format); 128 128 if (ret != EOK) { … … 133 133 getchar(); 134 134 printf("\n"); 135 audio_pcm_stop_ record(rec->device);135 audio_pcm_stop_capture(rec->device); 136 136 } 137 137 -
uspace/drv/audio/sb16/dsp.c
rad42844 rd86c9736 215 215 } 216 216 217 if (dsp->status == DSP_ RECORDING) {217 if (dsp->status == DSP_CAPTURE) { 218 218 sb_dsp_start_active(dsp, SINGLE_DMA_16B_AD); 219 219 } … … 232 232 PCM_EVENT_FRAMES_PLAYED, dsp->active.frame_count); 233 233 break; 234 case DSP_ RECORDING:234 case DSP_CAPTURE: 235 235 async_msg_1(dsp->event_exchange, 236 PCM_EVENT_FRAMES_ RECORDED, dsp->active.frame_count);236 PCM_EVENT_FRAMES_CAPTURED, dsp->active.frame_count); 237 237 break; 238 238 default: … … 251 251 { 252 252 switch(cap) { 253 case AUDIO_CAP_ RECORD:253 case AUDIO_CAP_CAPTURE: 254 254 case AUDIO_CAP_PLAYBACK: 255 255 case AUDIO_CAP_INTERRUPT: … … 393 393 } 394 394 395 int sb_dsp_start_ record(sb_dsp_t *dsp, unsigned frames,395 int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames, 396 396 unsigned channels, unsigned sampling_rate, pcm_sample_format_t format) 397 397 { … … 401 401 402 402 /* Check supported parameters */ 403 ddf_log_debug("Requested record: %u frames, %uHz, %s, %u channel(s).",403 ddf_log_debug("Requested capture: %u frames, %uHz, %s, %u channel(s).", 404 404 frames, sampling_rate, pcm_sample_format_str(format), channels); 405 405 if (sb_dsp_test_format(dsp, &channels, &sampling_rate, &format) != EOK) … … 433 433 "(~1/%u sec)", dsp->active.samples, 434 434 sampling_rate / (dsp->active.samples * channels)); 435 dsp->status = DSP_ RECORDING;436 437 return EOK; 438 } 439 440 int sb_dsp_stop_ record(sb_dsp_t *dsp)435 dsp->status = DSP_CAPTURE; 436 437 return EOK; 438 } 439 440 int sb_dsp_stop_capture(sb_dsp_t *dsp) 441 441 { 442 442 assert(dsp); 443 443 sb_dsp_write(dsp, DMA_16B_EXIT); 444 ddf_log_debug("Stopped recording");445 async_msg_0(dsp->event_exchange, PCM_EVENT_ RECORDING_TERMINATED);444 ddf_log_debug("Stopped capture"); 445 async_msg_0(dsp->event_exchange, PCM_EVENT_CAPTURE_TERMINATED); 446 446 async_exchange_end(dsp->event_exchange); 447 447 dsp->event_exchange = NULL; -
uspace/drv/audio/sb16/dsp.h
rad42844 rd86c9736 63 63 enum { 64 64 DSP_PLAYBACK, 65 DSP_ RECORDING,65 DSP_CAPTURE, 66 66 DSP_STOPPED, 67 67 } status; … … 83 83 unsigned channels, unsigned sample_rate, pcm_sample_format_t format); 84 84 int sb_dsp_stop_playback(sb_dsp_t *dsp); 85 int sb_dsp_start_ record(sb_dsp_t *dsp, unsigned frames,85 int sb_dsp_start_capture(sb_dsp_t *dsp, unsigned frames, 86 86 unsigned channels, unsigned sample_rate, pcm_sample_format_t format); 87 int sb_dsp_stop_ record(sb_dsp_t *dsp);87 int sb_dsp_stop_capture(sb_dsp_t *dsp); 88 88 89 89 #endif -
uspace/drv/audio/sb16/pcm_iface.c
rad42844 rd86c9736 104 104 } 105 105 106 static int sb_start_ record(ddf_fun_t *fun, unsigned frames,106 static int sb_start_capture(ddf_fun_t *fun, unsigned frames, 107 107 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 108 108 { … … 110 110 assert(fun->driver_data); 111 111 sb_dsp_t *dsp = fun->driver_data; 112 return sb_dsp_start_ record(112 return sb_dsp_start_capture( 113 113 dsp, frames, channels, sample_rate, format); 114 114 } 115 115 116 static int sb_stop_ record(ddf_fun_t *fun)116 static int sb_stop_capture(ddf_fun_t *fun) 117 117 { 118 118 assert(fun); 119 119 assert(fun->driver_data); 120 120 sb_dsp_t *dsp = fun->driver_data; 121 return sb_dsp_stop_ record(dsp);121 return sb_dsp_stop_capture(dsp); 122 122 } 123 123 … … 134 134 .stop_playback = sb_stop_playback, 135 135 136 .start_ record = sb_start_record,137 .stop_ record = sb_stop_record136 .start_capture = sb_start_capture, 137 .stop_capture = sb_stop_capture, 138 138 }; 139 139 /** -
uspace/lib/drv/generic/remote_audio_pcm.c
rad42844 rd86c9736 51 51 IPC_M_AUDIO_PCM_START_PLAYBACK, 52 52 IPC_M_AUDIO_PCM_STOP_PLAYBACK, 53 IPC_M_AUDIO_PCM_START_ RECORD,54 IPC_M_AUDIO_PCM_STOP_ RECORD,53 IPC_M_AUDIO_PCM_START_CAPTURE, 54 IPC_M_AUDIO_PCM_STOP_CAPTURE, 55 55 } audio_pcm_iface_funcs_t; 56 56 … … 219 219 } 220 220 221 int audio_pcm_start_ record(audio_pcm_sess_t *sess, unsigned frames,221 int audio_pcm_start_capture(audio_pcm_sess_t *sess, unsigned frames, 222 222 unsigned channels, unsigned sample_rate, pcm_sample_format_t format) 223 223 { … … 228 228 async_exch_t *exch = async_exchange_begin(sess); 229 229 const int ret = async_req_4_0(exch, 230 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_ RECORD,230 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_START_CAPTURE, 231 231 frames, sample_rate, packed); 232 232 async_exchange_end(exch); … … 234 234 } 235 235 236 int audio_pcm_stop_ record(audio_pcm_sess_t *sess)236 int audio_pcm_stop_capture(audio_pcm_sess_t *sess) 237 237 { 238 238 async_exch_t *exch = async_exchange_begin(sess); 239 239 const int ret = async_req_1_0(exch, 240 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_STOP_ RECORD);240 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_STOP_CAPTURE); 241 241 async_exchange_end(exch); 242 242 return ret; … … 253 253 static void remote_audio_pcm_start_playback(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 254 254 static void remote_audio_pcm_stop_playback(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 255 static void remote_audio_pcm_start_ record(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);256 static void remote_audio_pcm_stop_ record(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);255 static void remote_audio_pcm_start_capture(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 256 static void remote_audio_pcm_stop_capture(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 257 257 258 258 /** Remote audio pcm buffer interface operations. */ … … 265 265 [IPC_M_AUDIO_PCM_START_PLAYBACK] = remote_audio_pcm_start_playback, 266 266 [IPC_M_AUDIO_PCM_STOP_PLAYBACK] = remote_audio_pcm_stop_playback, 267 [IPC_M_AUDIO_PCM_START_ RECORD] = remote_audio_pcm_start_record,268 [IPC_M_AUDIO_PCM_STOP_ RECORD] = remote_audio_pcm_stop_record,267 [IPC_M_AUDIO_PCM_START_CAPTURE] = remote_audio_pcm_start_capture, 268 [IPC_M_AUDIO_PCM_STOP_CAPTURE] = remote_audio_pcm_stop_capture, 269 269 }; 270 270 … … 436 436 } 437 437 438 void remote_audio_pcm_start_ record(ddf_fun_t *fun, void *iface,438 void remote_audio_pcm_start_capture(ddf_fun_t *fun, void *iface, 439 439 ipc_callid_t callid, ipc_call_t *call) 440 440 { … … 446 446 const pcm_sample_format_t format = DEV_IPC_GET_ARG3(*call) & UINT16_MAX; 447 447 448 const int ret = pcm_iface->start_ record449 ? pcm_iface->start_ record(fun, frames, channels, rate, format)448 const int ret = pcm_iface->start_capture 449 ? pcm_iface->start_capture(fun, frames, channels, rate, format) 450 450 : ENOTSUP; 451 451 async_answer_0(callid, ret); 452 452 } 453 453 454 void remote_audio_pcm_stop_ record(ddf_fun_t *fun, void *iface,454 void remote_audio_pcm_stop_capture(ddf_fun_t *fun, void *iface, 455 455 ipc_callid_t callid, ipc_call_t *call) 456 456 { 457 457 const audio_pcm_iface_t *pcm_iface = iface; 458 458 459 const int ret = pcm_iface->stop_ record?460 pcm_iface->stop_ record(fun) : ENOTSUP;459 const int ret = pcm_iface->stop_capture ? 460 pcm_iface->stop_capture(fun) : ENOTSUP; 461 461 async_answer_0(callid, ret); 462 462 } -
uspace/lib/drv/include/audio_pcm_iface.h
rad42844 rd86c9736 45 45 46 46 typedef enum { 47 AUDIO_CAP_ RECORD,47 AUDIO_CAP_CAPTURE, 48 48 AUDIO_CAP_PLAYBACK, 49 49 AUDIO_CAP_MAX_BUFFER, … … 56 56 enum { 57 57 PCM_EVENT_FRAMES_PLAYED = IPC_FIRST_USER_METHOD, 58 PCM_EVENT_FRAMES_ RECORDED,58 PCM_EVENT_FRAMES_CAPTURED, 59 59 PCM_EVENT_PLAYBACK_TERMINATED, 60 PCM_EVENT_ RECORDING_TERMINATED60 PCM_EVENT_CAPTURE_TERMINATED 61 61 }; 62 62 … … 80 80 int audio_pcm_stop_playback(audio_pcm_sess_t *); 81 81 82 int audio_pcm_start_ record(audio_pcm_sess_t *, unsigned,82 int audio_pcm_start_capture(audio_pcm_sess_t *, unsigned, 83 83 unsigned, unsigned, pcm_sample_format_t); 84 int audio_pcm_stop_ record(audio_pcm_sess_t *);84 int audio_pcm_stop_capture(audio_pcm_sess_t *); 85 85 86 86 /** Audio pcm communication interface. */ … … 96 96 unsigned, unsigned, pcm_sample_format_t); 97 97 int (*stop_playback)(ddf_fun_t *); 98 int (*start_ record)(ddf_fun_t *, unsigned,98 int (*start_capture)(ddf_fun_t *, unsigned, 99 99 unsigned, unsigned, pcm_sample_format_t); 100 int (*stop_ record)(ddf_fun_t *);100 int (*stop_capture)(ddf_fun_t *); 101 101 } audio_pcm_iface_t; 102 102 -
uspace/srv/audio/hound/audio_device.c
rad42844 rd86c9736 153 153 const unsigned frames = dev->buffer.size / 154 154 (BUFFER_PARTS * pcm_format_frame_size(&dev->sink.format)); 155 ret = audio_pcm_start_ record(dev->sess, frames,155 ret = audio_pcm_start_capture(dev->sess, frames, 156 156 dev->sink.format.channels, dev->sink.format.sampling_rate, 157 157 dev->sink.format.sample_format); … … 163 163 } 164 164 } else { /* Disconnected */ 165 int ret = audio_pcm_stop_ record(dev->sess);165 int ret = audio_pcm_stop_capture(dev->sess); 166 166 if (ret != EOK) { 167 167 log_error("Failed to start recording: %s", … … 208 208 break; 209 209 } 210 case PCM_EVENT_PLAYBACK_TERMINATED: {210 case PCM_EVENT_PLAYBACK_TERMINATED: 211 211 log_verbose("Playback terminated!"); 212 212 return; 213 } 214 case PCM_EVENT_FRAMES_RECORDED: { 213 case PCM_EVENT_FRAMES_CAPTURED: 215 214 //TODO implement 216 215 break; 217 } 218 case PCM_EVENT_RECORDING_TERMINATED: 216 case PCM_EVENT_CAPTURE_TERMINATED: 219 217 log_verbose("Recording terminated!"); 220 218 return;
Note:
See TracChangeset
for help on using the changeset viewer.