Changeset 0387b92 in mainline for uspace/drv/audio/sb16/dsp.c
- Timestamp:
- 2012-08-20T14:52:54Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e7bf5f6
- Parents:
- c04ff9f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
rc04ff9f r0387b92 187 187 } 188 188 189 static inline void dsp_report_event(sb_dsp_t *dsp, pcm_event_t event) 190 { 191 assert(dsp); 192 if (!dsp->event_exchange) 193 ddf_log_warning("No one listening for event %u", event); 194 async_msg_1(dsp->event_exchange, event, dsp->active.frame_count); 195 } 196 189 197 static inline size_t sample_count(pcm_sample_format_t format, size_t byte_count) 190 198 { … … 235 243 { 236 244 case DSP_PLAYBACK_ACTIVE_EVENTS: 237 async_msg_1(dsp->event_exchange, 238 PCM_EVENT_FRAMES_PLAYED, dsp->active.frame_count); 245 dsp_report_event(dsp, PCM_EVENT_FRAMES_PLAYED); 239 246 case DSP_PLAYBACK_NOEVENTS: 240 247 #ifndef AUTO_DMA_MODE … … 243 250 break; 244 251 case DSP_CAPTURE_ACTIVE_EVENTS: 245 async_msg_1(dsp->event_exchange, 246 PCM_EVENT_FRAMES_CAPTURED, dsp->active.frame_count); 252 dsp_report_event(dsp, PCM_EVENT_FRAMES_CAPTURED); 247 253 case DSP_CAPTURE_NOEVENTS: 248 254 #ifndef AUTO_DMA_MODE … … 418 424 sb_dsp_change_state(dsp, 419 425 frames ? DSP_PLAYBACK_ACTIVE_EVENTS : DSP_PLAYBACK_NOEVENTS); 426 if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) 427 dsp_report_event(dsp, PCM_EVENT_PLAYBACK_STARTED); 420 428 421 429 return EOK; … … 425 433 { 426 434 assert(dsp); 435 if (dsp->state != DSP_PLAYBACK_NOEVENTS && 436 dsp->state != DSP_PLAYBACK_ACTIVE_EVENTS) 437 return EINVAL; 438 427 439 sb_dsp_write(dsp, DMA_16B_EXIT); 428 440 ddf_log_debug("Stopping playback on buffer."); 429 async_msg_0(dsp->event_exchange, PCM_EVENT_PLAYBACK_TERMINATED); 441 if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) 442 dsp_report_event(dsp, PCM_EVENT_PLAYBACK_TERMINATED); 430 443 async_exchange_end(dsp->event_exchange); 431 444 dsp->event_exchange = NULL; … … 475 488 sb_dsp_change_state(dsp, 476 489 frames ? DSP_CAPTURE_ACTIVE_EVENTS : DSP_CAPTURE_NOEVENTS); 490 if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) 491 dsp_report_event(dsp, PCM_EVENT_CAPTURE_STARTED); 477 492 return EOK; 478 493 } … … 481 496 { 482 497 assert(dsp); 498 if (dsp->state != DSP_CAPTURE_NOEVENTS && 499 dsp->state != DSP_CAPTURE_ACTIVE_EVENTS) 500 return EINVAL; 501 483 502 sb_dsp_write(dsp, DMA_16B_EXIT); 484 503 ddf_log_debug("Stopped capture"); 485 async_msg_0(dsp->event_exchange, PCM_EVENT_CAPTURE_TERMINATED); 504 if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) 505 dsp_report_event(dsp, PCM_EVENT_CAPTURE_TERMINATED); 486 506 async_exchange_end(dsp->event_exchange); 487 507 dsp->event_exchange = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.