Changeset 92b638c in mainline for uspace/drv/audio/sb16/dsp.c
- Timestamp:
- 2012-08-30T11:41:48Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5eed99d
- Parents:
- ed3816d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
red3816d r92b638c 403 403 return EINVAL; 404 404 405 if (dsp->state != DSP_READY && dsp->state != DSP_STOPPED) 406 return EINVAL; 407 405 408 /* Check supported parameters */ 406 409 ddf_log_debug("Requested playback: %u frames, %uHz, %s, %u channel(s).", … … 444 447 } 445 448 446 int sb_dsp_stop_playback(sb_dsp_t *dsp) 447 { 448 assert(dsp); 449 if (dsp->state != DSP_PLAYBACK_NOEVENTS && 450 dsp->state != DSP_PLAYBACK_ACTIVE_EVENTS) 451 return EINVAL; 452 453 sb_dsp_write(dsp, DMA_16B_EXIT); 454 ddf_log_debug("Stopping playback on buffer."); 455 sb_dsp_change_state(dsp, DSP_PLAYBACK_TERMINATE); 456 return EOK; 449 int sb_dsp_stop_playback(sb_dsp_t *dsp, bool immediate) 450 { 451 assert(dsp); 452 if ((dsp->state == DSP_PLAYBACK_NOEVENTS || 453 dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) && 454 immediate) 455 { 456 sb_dsp_write(dsp, DMA_16B_PAUSE); 457 sb_dsp_reset(dsp); 458 ddf_log_debug("Stopped playback"); 459 sb_dsp_change_state(dsp, DSP_STOPPED); 460 return EOK; 461 } 462 if (dsp->state == DSP_PLAYBACK_ACTIVE_EVENTS) 463 { 464 /* Stop after current fragment */ 465 assert(!immediate); 466 sb_dsp_write(dsp, DMA_16B_EXIT); 467 ddf_log_debug("Last playback fragment"); 468 sb_dsp_change_state(dsp, DSP_PLAYBACK_TERMINATE); 469 return EOK; 470 } 471 return EINVAL; 457 472 } 458 473 … … 462 477 assert(dsp); 463 478 if (!dsp->buffer.data) 479 return EINVAL; 480 if (dsp->state != DSP_READY && dsp->state != DSP_STOPPED) 464 481 return EINVAL; 465 482 … … 503 520 } 504 521 505 int sb_dsp_stop_capture(sb_dsp_t *dsp) 506 { 507 assert(dsp); 508 if (dsp->state != DSP_CAPTURE_NOEVENTS && 509 dsp->state != DSP_CAPTURE_ACTIVE_EVENTS) 510 return EINVAL; 511 512 sb_dsp_write(dsp, DMA_16B_EXIT); 513 ddf_log_debug("Stopped capture"); 514 sb_dsp_change_state(dsp, DSP_CAPTURE_TERMINATE); 515 return EOK; 522 int sb_dsp_stop_capture(sb_dsp_t *dsp, bool immediate) 523 { 524 assert(dsp); 525 if ((dsp->state == DSP_CAPTURE_NOEVENTS || 526 dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) && 527 immediate) 528 { 529 sb_dsp_write(dsp, DMA_16B_PAUSE); 530 sb_dsp_reset(dsp); 531 ddf_log_debug("Stopped capture fragment"); 532 sb_dsp_change_state(dsp, DSP_STOPPED); 533 return EOK; 534 } 535 if (dsp->state == DSP_CAPTURE_ACTIVE_EVENTS) 536 { 537 /* Stop after current fragment */ 538 assert(!immediate); 539 sb_dsp_write(dsp, DMA_16B_EXIT); 540 ddf_log_debug("Last capture fragment"); 541 sb_dsp_change_state(dsp, DSP_CAPTURE_TERMINATE); 542 return EOK; 543 } 544 return EINVAL; 516 545 } 517 546 /**
Note:
See TracChangeset
for help on using the changeset viewer.