本文整理汇总了C++中snd_pcm_set_runtime_buffer函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_pcm_set_runtime_buffer函数的具体用法?C++ snd_pcm_set_runtime_buffer怎么用?C++ snd_pcm_set_runtime_buffer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_pcm_set_runtime_buffer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: omap_pcm_hw_free
static int omap_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct omap_runtime_data *prtd = runtime->private_data;
if (prtd->dma_data == NULL)
return 0;
omap_dma_unlink_lch(prtd->dma_ch, prtd->dma_ch);
omap_free_dma(prtd->dma_ch);
prtd->dma_data = NULL;
snd_pcm_set_runtime_buffer(substream, NULL);
return 0;
}
开发者ID:Kra1o5,项目名称:android_kernel_huawei_u8815-gb,代码行数:16,代码来源:omap-pcm.c
示例2: s3c24xx_pcm_hw_free
static int s3c24xx_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
s3cdbg("Entered %s\n", __FUNCTION__);
/* TODO - do we need to ensure DMA flushed */
snd_pcm_set_runtime_buffer(substream, NULL);
if (prtd->params) {
s3c2410_dma_free(prtd->params->channel, prtd->params->client);
prtd->params = NULL;
}
return 0;
}
开发者ID:Astinj,项目名称:I5700-kernel-2.6.32.9,代码行数:16,代码来源:s3c-pcm.c
示例3: snd_imx_pcm_hw_params
static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
int i;
unsigned long dma_addr;
imx_ssi_dma_alloc(substream);
iprtd->size = params_buffer_bytes(params);
iprtd->periods = params_periods(params);
iprtd->period = params_period_bytes(params);
iprtd->offset = 0;
iprtd->period_time = HZ / (params_rate(params) /
params_period_size(params));
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
if (iprtd->sg_count != iprtd->periods) {
kfree(iprtd->sg_list);
iprtd->sg_list = kcalloc(iprtd->periods + 1,
sizeof(struct scatterlist), GFP_KERNEL);
if (!iprtd->sg_list)
return -ENOMEM;
iprtd->sg_count = iprtd->periods + 1;
}
sg_init_table(iprtd->sg_list, iprtd->sg_count);
dma_addr = runtime->dma_addr;
for (i = 0; i < iprtd->periods; i++) {
iprtd->sg_list[i].page_link = 0;
iprtd->sg_list[i].offset = 0;
iprtd->sg_list[i].dma_address = dma_addr;
iprtd->sg_list[i].length = iprtd->period;
dma_addr += iprtd->period;
}
/* close the loop */
iprtd->sg_list[iprtd->sg_count - 1].offset = 0;
iprtd->sg_list[iprtd->sg_count - 1].length = 0;
iprtd->sg_list[iprtd->sg_count - 1].page_link =
((unsigned long) iprtd->sg_list | 0x01) & ~0x02;
return 0;
}
开发者ID:AdiPat,项目名称:android_kernel_tegra_n1,代码行数:47,代码来源:imx-pcm-dma-mx2.c
示例4: snd_imx_pcm_hw_params
static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct imx_pcm_runtime_data *iprtd = runtime->private_data;
iprtd->size = params_buffer_bytes(params);
iprtd->periods = params_periods(params);
iprtd->period = params_period_bytes(params) ;
iprtd->offset = 0;
iprtd->last_offset = 0;
iprtd->poll_time = HZ / (params_rate(params) / params_period_size(params));
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
return 0;
}
开发者ID:mbanana,项目名称:linux-2.6,代码行数:17,代码来源:imx-pcm-fiq.c
示例5: rockchip_pcm_hw_free
static int rockchip_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct rockchip_runtime_data *prtd = substream->runtime->private_data;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
/* TODO - do we need to ensure DMA flushed */
snd_pcm_set_runtime_buffer(substream, NULL);
if (prtd->params) {
#ifdef CONFIG_SND_I2S_DMA_EVENT_DYNAMIC
rk29_dma_free(prtd->params->channel, prtd->params->client);
prtd->params = NULL;
#endif
}
return 0;
}
开发者ID:markyzq,项目名称:px2-android-kernel-3.0,代码行数:17,代码来源:rk29_pcm.c
示例6: hi3630_srcup_normal_hw_free
static int hi3630_srcup_normal_hw_free(struct snd_pcm_substream *substream)
{
struct hi3630_srcup_runtime_data *prtd = substream->runtime->private_data;
struct hi3630_srcup_data *pdata = prtd->pdata;
int ret = 0;
if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
/* clear interrupt */
hi3630_srcup_reg_write(pdata, HI3630_SRCUP_CH_INT_FLAG_REG, SRCUP_CH0_MASK);
ret = snd_pcm_lib_free_pages(substream);
}
snd_pcm_set_runtime_buffer(substream, NULL);
return ret;
}
开发者ID:HuaweiHonor4C,项目名称:kernel_hi6210sft_mm,代码行数:17,代码来源:hi3630_srcup_normal.c
示例7: snd_pcm_lib_free_pages
/**
* snd_pcm_lib_free_pages - release the allocated DMA buffer.
* @substream: the substream to release the DMA buffer
*
* Releases the DMA buffer allocated via snd_pcm_lib_malloc_pages().
*
* Returns zero if successful, or a negative error code on failure.
*/
int snd_pcm_lib_free_pages(snd_pcm_substream_t *substream)
{
snd_pcm_runtime_t *runtime;
snd_assert(substream != NULL, return -EINVAL);
runtime = substream->runtime;
snd_assert(runtime != NULL, return -EINVAL);
if (runtime->dma_area == NULL)
return 0;
if (runtime->dma_buffer_p != &substream->dma_buffer) {
/* it's a newly allocated buffer. release it now. */
snd_dma_free_pages(runtime->dma_buffer_p);
kfree(runtime->dma_buffer_p);
}
snd_pcm_set_runtime_buffer(substream, NULL);
return 0;
}
开发者ID:Dronevery,项目名称:JetsonTK1-kernel,代码行数:25,代码来源:pcm_memory.c
示例8: snd_pcm_lib_free_pages
/**
* snd_pcm_lib_free_pages - release the allocated DMA buffer.
* @substream: the substream to release the DMA buffer
*
* Releases the DMA buffer allocated via snd_pcm_lib_malloc_pages().
*
* Return: Zero if successful, or a negative error code on failure.
*/
int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime;
if (PCM_RUNTIME_CHECK(substream))
return -EINVAL;
runtime = substream->runtime;
if (runtime->dma_area == NULL)
return 0;
if (runtime->dma_buffer_p != &substream->dma_buffer) {
/* it's a newly allocated buffer. release it now. */
snd_dma_free_pages(runtime->dma_buffer_p);
kfree(runtime->dma_buffer_p);
}
snd_pcm_set_runtime_buffer(substream, NULL);
return 0;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:25,代码来源:pcm_memory.c
示例9: sun4i_pcm_hw_free
static int sun4i_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct sun4i_runtime_data *prtd = substream->runtime->private_data;
/* TODO - do we need to ensure DMA flushed */
if(prtd->params)
sw_dma_ctrl(prtd->params->channel, SW_DMAOP_FLUSH);
snd_pcm_set_runtime_buffer(substream, NULL);
if (prtd->params) {
sw_dma_free(prtd->params->channel, prtd->params->client);
prtd->params = NULL;
}
return 0;
}
开发者ID:panlinbing,项目名称:lichee_linux-3.0,代码行数:17,代码来源:sun4i-i2sdma.c
示例10: sunxi_pcm_hw_params
static int sunxi_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct sunxi_dma_params *dmap;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct device *dev = rtd->platform->dev;
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
struct dma_slave_config slave_config;
int ret;
dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
ret = snd_hwparams_to_dma_slave_config(substream, params, &slave_config);
if (ret) {
dev_err(dev, "hw params config failed with err %d\n", ret);
return ret;
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
if (SNDRV_PCM_FORMAT_S16_LE == params_format(params)) {
slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
} else {
slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
}
slave_config.dst_addr = dmap->dma_addr;
slave_config.dst_maxburst = 4;
slave_config.src_maxburst = 4;
slave_config.slave_id = sunxi_slave_id(DRQDST_DAUDIO_1_TX, DRQSRC_SDRAM);
} else {
slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
slave_config.src_addr = dmap->dma_addr;
slave_config.dst_maxburst = 4;
slave_config.src_maxburst = 4;
slave_config.slave_id = sunxi_slave_id(DRQDST_SDRAM, DRQSRC_DAUDIO_1_RX);
}
ret = dmaengine_slave_config(chan, &slave_config);
if (ret < 0) {
dev_err(dev, "dma slave config failed with err %d\n", ret);
return ret;
}
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
return 0;
}
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:46,代码来源:sunxi-daudiodma1.c
示例11: printk
/* Release all dynamiclly allocated resources.
*/
static int i2sirx_i2so_mix_hw_free
(
struct snd_pcm_substream *substream
)
{
struct i2sirx_i2so_mix_info *mix;
printk("%s,%d\n", __FUNCTION__, __LINE__);
mix = substream->runtime->private_data;
snd_pcm_set_runtime_buffer(substream, NULL);
//printk("%s,%d\n", __FUNCTION__, __LINE__);
return(0);
}
开发者ID:qttest1,项目名称:PDK_GoBian,代码行数:19,代码来源:ali_alsa_i2sirx_i2so_mix.c
示例12: ux500_pcm_dma_hw_free
static void ux500_pcm_dma_hw_free(struct device *dev,
struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dma_buffer *buf = runtime->dma_buffer_p;
if (runtime->dma_area == NULL)
return;
if (buf != &substream->dma_buffer) {
dma_free_coherent(buf->dev.dev, buf->bytes, buf->area,
buf->addr);
kfree(runtime->dma_buffer_p);
}
snd_pcm_set_runtime_buffer(substream, NULL);
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:17,代码来源:ux500_pcm.c
示例13: tegra_pcm_hw_params
int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct device *dev = rtd->platform->dev;
struct dma_chan *chan;
struct tegra_pcm_dma_params *dmap;
struct dma_slave_config slave_config;
int ret;
if (rtd->dai_link->no_pcm)
return 0;
chan = snd_dmaengine_pcm_get_chan(substream);
dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
if (!dmap)
return 0;
ret = snd_hwparams_to_dma_slave_config(substream, params,
&slave_config);
if (ret) {
dev_err(dev, "hw params config failed with err %d\n", ret);
return ret;
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
slave_config.dst_addr = dmap->addr;
slave_config.dst_maxburst = 4;
} else {
slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
slave_config.src_addr = dmap->addr;
slave_config.src_maxburst = 4;
}
slave_config.slave_id = dmap->req_sel;
ret = dmaengine_slave_config(chan, &slave_config);
if (ret < 0) {
dev_err(dev, "dma slave config failed with err %d\n", ret);
return ret;
}
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
return 0;
}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:45,代码来源:tegra_pcm.c
示例14: lpc3xxx_pcm_hw_params
/*
* PCM operations
*/
static int lpc3xxx_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct lpc3xxx_dma_data *prtd = runtime->private_data;
/* this may get called several times by oss emulation
* with different params
*/
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
runtime->dma_bytes = params_buffer_bytes(params);
prtd->dma_buffer = runtime->dma_addr;
prtd->dma_buffer_end = runtime->dma_addr + runtime->dma_bytes;
prtd->period_size = params_period_bytes(params);
return 0;
}
开发者ID:AdrianHuang,项目名称:uclinux-robutest,代码行数:21,代码来源:lpc3xxx-pcm.c
示例15: bcm947xx_pcm_hw_free
static int bcm947xx_pcm_hw_free(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
bcm947xx_i2s_info_t *snd_bcm = rtd->dai->cpu_dai->private_data;
DBG("%s %s\n", __FUNCTION__, bcm947xx_direction_str(substream));
snd_pcm_set_runtime_buffer(substream, NULL);
/* This stream is no longer consider in-use. */
snd_bcm->in_use &= ~(1 << substream->stream);
if (!snd_bcm->in_use)
{ /* All streams are not used. */
bcm947xx_pcm_clear_joint_duplex_settings(snd_bcm);
}
return 0;
}
开发者ID:Antares84,项目名称:asuswrt-merlin,代码行数:19,代码来源:bcm947xx-pcm.c
示例16: mt76xx_pcm_free_dma_buffer
static int mt76xx_pcm_free_dma_buffer(struct snd_pcm_substream *substream,
int stream)
{
//struct snd_pcm_substream *substream = pcm->streams[stream].substream;
struct snd_dma_buffer *buf = &substream->dma_buffer;
i2s_config_type* rtd = (i2s_config_type*)substream->runtime->private_data;
//printk("******* %s *******\n", __func__);
if (!buf->area)
return 0;
if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
i2s_memPool_free(rtd,STREAM_PLAYBACK);
else
i2s_memPool_free(rtd,STREAM_CAPTURE);
buf->area = NULL;
snd_pcm_set_runtime_buffer(substream, NULL);
return 0;
}
开发者ID:openspeaker,项目名称:os-wrt-cc,代码行数:19,代码来源:mt76xx_pcm.c
示例17: hi3630_pcm_hdmi_hw_free
static int hi3630_pcm_hdmi_hw_free(struct snd_pcm_substream *substream)
{
struct hi3630_hdmi_runtime_data *prtd = substream->runtime->private_data;
struct hi3630_hdmi_data *pdata = prtd->pdata;
int ret = 0;
if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) {
wait_hdmi_dma_stop(prtd);
/*clear interrupt*/
hi3630_hdmi_reg_write(pdata, HI3630_ASP_INT_CLR, HDMI_INT_MASK);
ret = snd_pcm_lib_free_pages(substream);
}
snd_pcm_set_runtime_buffer(substream, NULL);
return ret;
}
开发者ID:magnusjjj,项目名称:android_kernel_huawei_rle,代码行数:19,代码来源:hi3630_pcm_hdmi.c
示例18: dma_hw_params
static int dma_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct nusmart_runtime_data *prtd = runtime->private_data;
//struct nusmart_pcm_dma_data *dma_data = rtd->cpu_dai->dma_data;
struct nusmart_pcm_dma_data *dma_data;
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
/* return if this is a bufferless transfer e.g.
* codec <--> BT codec or GSM modem -- lg FIXME */
if (!dma_data)
return 0;
switch(params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
dma_data->i2s_width = 0;
break;
case SNDRV_PCM_FORMAT_S16_LE:
dma_data->i2s_width = 1;
break;
case SNDRV_PCM_FORMAT_S24_LE:
dma_data->i2s_width = 2;
break;
}
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
runtime->dma_bytes = params_buffer_bytes(params);
if (prtd->dma_data)
return 0;
prtd->dma_data = dma_data;
return 0;
}
开发者ID:alessandroste,项目名称:testBSP,代码行数:41,代码来源:dma.c
示例19: snd_pcm_lib_malloc_pages
/**
* snd_pcm_lib_malloc_pages - allocate the DMA buffer
* @substream: the substream to allocate the DMA buffer to
* @size: the requested buffer size in bytes
*
* Allocates the DMA buffer on the BUS type given earlier to
* snd_pcm_lib_preallocate_xxx_pages().
*
* Return: 1 if the buffer is changed, 0 if not changed, or a negative
* code on failure.
*/
int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size)
{
struct snd_pcm_runtime *runtime;
struct snd_dma_buffer *dmab = NULL;
if (PCM_RUNTIME_CHECK(substream))
return -EINVAL;
if (snd_BUG_ON(substream->dma_buffer.dev.type ==
SNDRV_DMA_TYPE_UNKNOWN))
return -EINVAL;
runtime = substream->runtime;
if (runtime->dma_buffer_p) {
/* perphaps, we might free the large DMA memory region
to save some space here, but the actual solution
costs us less time */
if (runtime->dma_buffer_p->bytes >= size) {
runtime->dma_bytes = size;
return 0; /* ok, do not change */
}
snd_pcm_lib_free_pages(substream);
}
if (substream->dma_buffer.area != NULL &&
substream->dma_buffer.bytes >= size) {
dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
} else {
dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
if (! dmab)
return -ENOMEM;
dmab->dev = substream->dma_buffer.dev;
if (snd_dma_alloc_pages(substream->dma_buffer.dev.type,
substream->dma_buffer.dev.dev,
size, dmab) < 0) {
kfree(dmab);
return -ENOMEM;
}
}
snd_pcm_set_runtime_buffer(substream, dmab);
runtime->dma_bytes = size;
return 1; /* area was changed */
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:52,代码来源:pcm_memory.c
示例20: msm_afe_hw_params
static int msm_afe_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dma_buffer *dma_buf = &substream->dma_buffer;
struct pcm_afe_info *prtd = runtime->private_data;
int rc;
pr_debug("%s:\n", __func__);
mutex_lock(&prtd->lock);
dma_buf->dev.type = SNDRV_DMA_TYPE_DEV;
dma_buf->dev.dev = substream->pcm->card->dev;
dma_buf->private_data = NULL;
dma_buf->area = dma_alloc_coherent(dma_buf->dev.dev,
runtime->hw.buffer_bytes_max,
&dma_buf->addr, GFP_KERNEL);
pr_debug("%s: dma_buf->area: 0x%p, dma_buf->addr: 0x%x", __func__,
(unsigned int *) dma_buf->area, dma_buf->addr);
if (!dma_buf->area) {
pr_err("%s:MSM AFE memory allocation failed\n", __func__);
mutex_unlock(&prtd->lock);
return -ENOMEM;
}
dma_buf->bytes = runtime->hw.buffer_bytes_max;
memset(dma_buf->area, 0, runtime->hw.buffer_bytes_max);
prtd->dma_addr = (u32) dma_buf->addr;
mutex_unlock(&prtd->lock);
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
rc = afe_cmd_memory_map(dma_buf->addr, dma_buf->bytes);
if (rc < 0)
pr_err("fail to map memory to DSP\n");
return rc;
}
开发者ID:F4uzan,项目名称:skernel_u0,代码行数:40,代码来源:msm-pcm-afe-v2.c
注:本文中的snd_pcm_set_runtime_buffer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论