本文整理汇总了C++中snd_pcm_stop函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_pcm_stop函数的具体用法?C++ snd_pcm_stop怎么用?C++ snd_pcm_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_pcm_stop函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: uni_reader_irq_handler
/*
* uni_reader_irq_handler
* In case of error audio stream is stopped; stop action is protected via PCM
* stream lock to avoid race condition with trigger callback.
*/
static irqreturn_t uni_reader_irq_handler(int irq, void *dev_id)
{
irqreturn_t ret = IRQ_NONE;
struct uniperif *reader = dev_id;
unsigned int status;
if (reader->state == UNIPERIF_STATE_STOPPED) {
/* Unexpected IRQ: do nothing */
dev_warn(reader->dev, "unexpected IRQ ");
return IRQ_HANDLED;
}
/* Get interrupt status & clear them immediately */
status = GET_UNIPERIF_ITS(reader);
SET_UNIPERIF_ITS_BCLR(reader, status);
/* Check for fifo overflow error */
if (unlikely(status & UNIPERIF_ITS_FIFO_ERROR_MASK(reader))) {
dev_err(reader->dev, "FIFO error detected");
snd_pcm_stream_lock(reader->substream);
snd_pcm_stop(reader->substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock(reader->substream);
return IRQ_HANDLED;
}
return ret;
}
示例2: snd_atiixp_xrun_dma
/*
* XRUN detected, and stop the PCM substream
*/
static void snd_atiixp_xrun_dma(atiixp_t *chip, atiixp_dma_t *dma)
{
if (! dma->substream || ! dma->running)
return;
snd_printdd("atiixp: XRUN detected (DMA %d)\n", dma->ops->type);
snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
}
示例3: pcm_disconnect_substream
/*
Stop substream if still running.
*/
static void pcm_disconnect_substream(struct snd_pcm_substream *substream)
{
if (substream->runtime && snd_pcm_running(substream)) {
snd_pcm_stream_lock_irq(substream);
snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
snd_pcm_stream_unlock_irq(substream);
}
}
示例4: snd_atiixp_xrun_dma
/*
* XRUN detected, and stop the PCM substream
*/
static void snd_atiixp_xrun_dma(struct atiixp *chip, struct atiixp_dma *dma)
{
if (! dma->substream || ! dma->running)
return;
dev_dbg(chip->card->dev, "XRUN detected (DMA %d)\n", dma->ops->type);
snd_pcm_stream_lock(dma->substream);
snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock(dma->substream);
}
示例5: abort_alsa_playback
static void abort_alsa_playback(struct ua101 *ua)
{
unsigned long flags;
if (test_bit(ALSA_PLAYBACK_RUNNING, &ua->states)) {
snd_pcm_stream_lock_irqsave(ua->playback.substream, flags);
snd_pcm_stop(ua->playback.substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irqrestore(ua->playback.substream, flags);
}
}
示例6: bcm947xx_dma_abort
static void bcm947xx_dma_abort(struct snd_pcm_substream *substream)
{
if (snd_pcm_running(substream)) {
unsigned long flags;
DBG("%s XRUN\n", __FUNCTION__);
snd_pcm_stream_lock_irqsave(substream, flags);
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irqrestore(substream, flags);
}
}
示例7: snd_atiixp_xrun_dma
/*
* XRUN detected, and stop the PCM substream
*/
static void snd_atiixp_xrun_dma(struct atiixp_modem *chip,
struct atiixp_dma *dma)
{
if (! dma->substream || ! dma->running)
return;
snd_printdd("atiixp-modem: XRUN detected (DMA %d)\n", dma->ops->type);
snd_pcm_stream_lock(dma->substream);
snd_pcm_stop(dma->substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock(dma->substream);
}
示例8: abort_alsa_capture
static void abort_alsa_capture(struct ua101 *ua)
{
unsigned long flags;
if (test_bit(ALSA_CAPTURE_RUNNING, &ua->states)) {
snd_pcm_stream_lock_irqsave(ua->capture.substream, flags);
snd_pcm_stop(ua->capture.substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock_irqrestore(ua->capture.substream, flags);
}
}
示例9: hdmi_audio_abort_stream
static void hdmi_audio_abort_stream(struct snd_pcm_substream *substream)
{
unsigned long flags;
snd_pcm_stream_lock_irqsave(substream, flags);
if (snd_pcm_running(substream))
snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
snd_pcm_stream_unlock_irqrestore(substream, flags);
}
示例10: pcm_timeout_func
static void pcm_timeout_func(unsigned long data)
{
struct tegra_runtime_data *prtd = (struct tegra_runtime_data*)data;
struct snd_pcm_substream *substream = prtd->substream;
struct snd_pcm_runtime *runtime = substream->runtime;
unsigned long current_tick = jiffies;
if( jiffies_to_msecs(current_tick - prtd->pcm_timeout_tick) >= (runtime->period_size/(runtime->rate/1000))*runtime->periods*2){
dev_err(substream->pcm->dev, "pcm_timeout_func!!! time : %d\n", jiffies_to_msecs(current_tick - prtd->pcm_timeout_tick));
snd_pcm_stop(prtd->substream, SNDRV_PCM_STATE_XRUN);
}
}
示例11: stm32_sai_isr
static irqreturn_t stm32_sai_isr(int irq, void *devid)
{
struct stm32_sai_sub_data *sai = (struct stm32_sai_sub_data *)devid;
struct snd_pcm_substream *substream = sai->substream;
struct platform_device *pdev = sai->pdev;
unsigned int sr, imr, flags;
snd_pcm_state_t status = SNDRV_PCM_STATE_RUNNING;
regmap_read(sai->regmap, STM_SAI_IMR_REGX, &imr);
regmap_read(sai->regmap, STM_SAI_SR_REGX, &sr);
flags = sr & imr;
if (!flags)
return IRQ_NONE;
regmap_update_bits(sai->regmap, STM_SAI_CLRFR_REGX, SAI_XCLRFR_MASK,
SAI_XCLRFR_MASK);
if (flags & SAI_XIMR_OVRUDRIE) {
dev_err(&pdev->dev, "IT %s\n",
STM_SAI_IS_PLAYBACK(sai) ? "underrun" : "overrun");
status = SNDRV_PCM_STATE_XRUN;
}
if (flags & SAI_XIMR_MUTEDETIE)
dev_dbg(&pdev->dev, "IT mute detected\n");
if (flags & SAI_XIMR_WCKCFGIE) {
dev_err(&pdev->dev, "IT wrong clock configuration\n");
status = SNDRV_PCM_STATE_DISCONNECTED;
}
if (flags & SAI_XIMR_CNRDYIE)
dev_warn(&pdev->dev, "IT Codec not ready\n");
if (flags & SAI_XIMR_AFSDETIE) {
dev_warn(&pdev->dev, "IT Anticipated frame synchro\n");
status = SNDRV_PCM_STATE_XRUN;
}
if (flags & SAI_XIMR_LFSDETIE) {
dev_warn(&pdev->dev, "IT Late frame synchro\n");
status = SNDRV_PCM_STATE_XRUN;
}
if (status != SNDRV_PCM_STATE_RUNNING) {
snd_pcm_stream_lock(substream);
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
snd_pcm_stream_unlock(substream);
}
return IRQ_HANDLED;
}
示例12: hdmi_dai_abort
static void hdmi_dai_abort(struct device *dev)
{
struct hdmi_audio_data *ad = dev_get_drvdata(dev);
mutex_lock(&ad->current_stream_lock);
if (ad->current_stream && ad->current_stream->runtime &&
snd_pcm_running(ad->current_stream)) {
dev_err(dev, "HDMI display disabled, aborting playback\n");
snd_pcm_stream_lock_irq(ad->current_stream);
snd_pcm_stop(ad->current_stream, SNDRV_PCM_STATE_DISCONNECTED);
snd_pcm_stream_unlock_irq(ad->current_stream);
}
mutex_unlock(&ad->current_stream_lock);
}
示例13: ipq_mi2s_irq
static irqreturn_t ipq_mi2s_irq(int intrsrc, void *data)
{
int dma_ch;
uint32_t ret = IRQ_NONE;
uint32_t has_xrun, pending;
struct snd_pcm_substream *substream = data;
struct snd_pcm_runtime *runtime = substream->runtime;
struct ipq_lpass_runtime_data_t *prtd =
(struct ipq_lpass_runtime_data_t *)runtime->private_data;
if (prtd)
dma_ch = prtd->lpaif_info.dma_ch;
else
return IRQ_NONE;
pending = (intrsrc
& (UNDER_CH(dma_ch) | PER_CH(dma_ch) | ERR_CH(dma_ch)));
has_xrun = (pending & UNDER_CH(dma_ch));
if (unlikely(has_xrun) && substream->runtime &&
snd_pcm_running(substream)) {
pr_debug("%s %d: xrun warning\n", __func__, __LINE__);
snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
pending &= ~UNDER_CH(dma_ch);
ret = IRQ_HANDLED;
}
if (pending & PER_CH(dma_ch)) {
if (++prtd->pcm_stream_info.period_index >= runtime->periods)
prtd->pcm_stream_info.period_index = 0;
snd_pcm_period_elapsed(substream);
pending &= ~PER_CH(dma_ch);
ret = IRQ_HANDLED;
}
if (pending & UNDER_CH(dma_ch)) {
snd_pcm_period_elapsed(substream);
pr_debug("%s %d: xrun warning\n", __func__, __LINE__);
ret = IRQ_HANDLED;
}
if (pending & ERR_CH(dma_ch)) {
pr_debug("%s %d: Bus access warning\n", __func__, __LINE__);
ret = IRQ_HANDLED;
}
return ret;
}
示例14: loopback_check_format
static int loopback_check_format(struct loopback_cable *cable, int stream)
{
struct snd_pcm_runtime *runtime, *cruntime;
struct loopback_setup *setup;
struct snd_card *card;
int check;
if (cable->valid != CABLE_VALID_BOTH) {
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
goto __notify;
return 0;
}
runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->
substream->runtime;
cruntime = cable->streams[SNDRV_PCM_STREAM_CAPTURE]->
substream->runtime;
check = runtime->format != cruntime->format ||
runtime->rate != cruntime->rate ||
runtime->channels != cruntime->channels;
if (!check)
return 0;
if (stream == SNDRV_PCM_STREAM_CAPTURE) {
return -EIO;
} else {
snd_pcm_stop(cable->streams[SNDRV_PCM_STREAM_CAPTURE]->
substream, SNDRV_PCM_STATE_DRAINING);
__notify:
runtime = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->
substream->runtime;
setup = get_setup(cable->streams[SNDRV_PCM_STREAM_PLAYBACK]);
card = cable->streams[SNDRV_PCM_STREAM_PLAYBACK]->loopback->card;
if (setup->format != runtime->format) {
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
&setup->format_id);
setup->format = runtime->format;
}
if (setup->rate != runtime->rate) {
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
&setup->rate_id);
setup->rate = runtime->rate;
}
if (setup->channels != runtime->channels) {
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
&setup->channels_id);
setup->channels = runtime->channels;
}
}
return 0;
}
示例15: had_process_hot_unplug
int had_process_hot_unplug(struct snd_intelhad *intelhaddata)
{
int caps, retval = 0;
enum intel_had_aud_buf_type buf_id;
struct had_pvt_data *had_stream;
unsigned long flag_irqs;
pr_debug("Enter:%s", __func__);
had_stream = intelhaddata->private_data;
buf_id = intelhaddata->curr_buf;
spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs);
if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
pr_debug("Device already disconnected\n");
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
return retval;
} else {
/* Disable Audio */
caps = HDMI_AUDIO_BUFFER_DONE;
retval = had_set_caps(HAD_SET_DISABLE_AUDIO_INT, &caps);
retval = had_set_caps(HAD_SET_DISABLE_AUDIO, NULL);
intelhaddata->ops->enable_audio(intelhaddata->stream_info.had_substream, 0);
}
intelhaddata->drv_status = HAD_DRV_DISCONNECTED;
/* Report to above ALSA layer */
if (intelhaddata->stream_info.had_substream != NULL) {
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
pr_debug("%s: unlock -> sending pcm_stop -> lock\n", __func__);
mutex_lock(&had_mutex);
if (intelhaddata->stream_info.had_substream != NULL)
snd_pcm_stop(intelhaddata->stream_info.had_substream,
SNDRV_PCM_STATE_DISCONNECTED);
mutex_unlock(&had_mutex);
spin_lock_irqsave(&intelhaddata->had_spinlock, flag_irqs);
}
had_stream->stream_type = HAD_INIT;
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
kfree(intelhaddata->chmap->chmap);
intelhaddata->chmap->chmap = NULL;
pr_debug("%s: unlocked -> returned\n", __func__);
return retval;
}