本文整理汇总了C++中params_buffer_bytes函数的典型用法代码示例。如果您正苦于以下问题:C++ params_buffer_bytes函数的具体用法?C++ params_buffer_bytes怎么用?C++ params_buffer_bytes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了params_buffer_bytes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: nx_pcm_ops_hw_params
static int nx_pcm_ops_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
unsigned int totbytes = params_buffer_bytes(params);
DBGOUT("%s\n", __func__);
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
/* used DMA bytes by application */
runtime->dma_bytes = totbytes;
return 0;
}
开发者ID:vlasenko,项目名称:kernel.rk,代码行数:14,代码来源:nexell-pcm.c
示例2: bf5xx_pcm_hw_params
static int bf5xx_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
unsigned int buffer_size = params_buffer_bytes(params);
struct bf5xx_i2s_pcm_data *dma_data;
dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
if (dma_data->tdm_mode)
buffer_size = buffer_size / params_channels(params) * 8;
return snd_pcm_lib_malloc_pages(substream, buffer_size);
}
开发者ID:AnadoluPanteri,项目名称:kernel-plus-harmattan,代码行数:14,代码来源:bf5xx-i2s-pcm.c
示例3: snd_atiixp_pcm_hw_params
/*
* hw_params - allocate the buffer and set up buffer descriptors
*/
static int snd_atiixp_pcm_hw_params(snd_pcm_substream_t *substream,
snd_pcm_hw_params_t *hw_params)
{
atiixp_t *chip = snd_pcm_substream_chip(substream);
atiixp_dma_t *dma = (atiixp_dma_t *)substream->runtime->private_data;
int err;
err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
if (err < 0)
return err;
dma->buf_addr = substream->runtime->dma_addr;
dma->buf_bytes = params_buffer_bytes(hw_params);
err = atiixp_build_dma_packets(chip, dma, substream,
params_periods(hw_params),
params_period_bytes(hw_params));
if (err < 0)
return err;
if (dma->ac97_pcm_type >= 0) {
struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type];
/* PCM is bound to AC97 codec(s)
* set up the AC97 codecs
*/
if (dma->pcm_open_flag) {
snd_ac97_pcm_close(pcm);
dma->pcm_open_flag = 0;
}
err = snd_ac97_pcm_open(pcm, params_rate(hw_params),
params_channels(hw_params),
pcm->r[0].slots);
if (err >= 0)
dma->pcm_open_flag = 1;
}
return err;
}
开发者ID:idtek,项目名称:linux-2.6.11,代码行数:40,代码来源:atiixp.c
示例4: adonisuniv_wm5102_aif1_hw_params
static int adonisuniv_wm5102_aif1_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_codec *codec = rtd->codec;
struct wm5102_machine_priv *priv =
snd_soc_card_get_drvdata(codec->card);
int ret;
dev_info(codec_dai->dev, "aif1: %dch, %dHz, %dbytes\n",
params_channels(params),
params_rate(params),
params_buffer_bytes(params));
priv->aif1rate = params_rate(params);
adonisuniv_set_media_clocking(priv);
ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) {
dev_err(codec_dai->dev,
"Failed to set audio format in codec: %d\n", ret);
return ret;
}
/* Set the cpu DAI configuration */
ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM);
if (ret < 0) {
dev_err(codec_dai->dev,
"Failed to set audio format in cpu: %d\n", ret);
return ret;
}
ret = snd_soc_dai_set_sysclk(cpu_dai, SAMSUNG_I2S_OPCLK,
0, MOD_OPCLK_PCLK);
if (ret < 0) {
dev_err(codec_dai->dev,
"Failed to set system clock in cpu: %d\n", ret);
return ret;
}
return 0;
}
开发者ID:halaszk,项目名称:android_kernel_samsung_lt03,代码行数:49,代码来源:adonisuniv_wm5102.c
示例5: ath79_pcm_hw_params
static int ath79_pcm_hw_params(struct snd_pcm_substream *ss,
struct snd_pcm_hw_params *hw_params)
{
struct snd_pcm_runtime *runtime = ss->runtime;
struct ath79_pcm_rt_priv *rtpriv;
int ret;
unsigned int period_size, sample_size, sample_rate, frames, channels;
// Does this routine need to handle new clock changes in the hw_params?
rtpriv = runtime->private_data;
ret = ath79_mbox_dma_map(rtpriv, ss->dma_buffer.addr,
params_period_bytes(hw_params), params_buffer_bytes(hw_params));
if(ret < 0)
return ret;
period_size = params_period_bytes(hw_params);
sample_size = snd_pcm_format_size(params_format(hw_params), 1);
sample_rate = params_rate(hw_params);
channels = params_channels(hw_params);
frames = period_size / (sample_size * channels);
/* When we disbale the DMA engine, it could be just at the start of a descriptor.
Hence calculate the longest time the DMA engine could be grabbing bytes for to
Make sure we do not unmap the memory before the DMA is complete.
Add 10 mSec of margin. This value will be used in ath79_mbox_dma_stop */
rtpriv->delay_time = (frames * 1000)/sample_rate + 10;
snd_pcm_set_runtime_buffer(ss, &ss->dma_buffer);
runtime->dma_bytes = params_buffer_bytes(hw_params);
return 1;
}
开发者ID:ConorOG,项目名称:openwrt-misc,代码行数:36,代码来源:ath79-pcm.c
示例6: mtk_bt_dai_pcm_hw_params
static int mtk_bt_dai_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dma_buffer *dma_buf = &substream->dma_buffer;
int ret = 0;
printk("mtk_bt_dai_pcm_hw_params \n");
dma_buf->dev.type = SNDRV_DMA_TYPE_DEV;
dma_buf->dev.dev = substream->pcm->card->dev;
dma_buf->private_data = NULL;
if (Bt_Dai_Capture_dma_buf->area)
{
printk("mtk_bt_dai_pcm_hw_params Bt_Dai_Capture_dma_buf->area\n");
runtime->dma_bytes = params_buffer_bytes(hw_params);
runtime->dma_area = Bt_Dai_Capture_dma_buf->area;
runtime->dma_addr = Bt_Dai_Capture_dma_buf->addr;
SetHighAddr(Soc_Aud_Digital_Block_MEM_DAI,true);
}
else
{
printk("mtk_bt_dai_pcm_hw_params snd_pcm_lib_malloc_pages\n");
ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
}
printk("mtk_bt_dai_pcm_hw_params dma_bytes = %zu dma_area = %p dma_addr = 0x%lx\n",
runtime->dma_bytes, runtime->dma_area, (long)runtime->dma_addr);
printk("runtime->hw.buffer_bytes_max = %zu \n", runtime->hw.buffer_bytes_max);
SetDAIBuffer(substream, hw_params);
printk("dma_bytes = %zu dma_area = %p dma_addr = 0x%lx\n",
substream->runtime->dma_bytes, substream->runtime->dma_area, (long)substream->runtime->dma_addr);
return ret;
}
开发者ID:John677,项目名称:Kernal_k3note,代码行数:36,代码来源:mt_soc_pcm_bt_dai.c
示例7: capture_pcm_hw_params
static int capture_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct ua101 *ua = substream->private_data;
int err;
mutex_lock(&ua->mutex);
err = start_usb_capture(ua);
mutex_unlock(&ua->mutex);
if (err < 0)
return err;
return snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
}
开发者ID:454053205,项目名称:linux,代码行数:15,代码来源:ua101.c
示例8: ct_pcm_hw_params
static int ct_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct ct_atc *atc = snd_pcm_substream_chip(substream);
struct ct_atc_pcm *apcm = substream->runtime->private_data;
int err;
err = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
if (err < 0)
return err;
/* clear previous resources */
atc->pcm_release_resources(atc, apcm);
return err;
}
开发者ID:1yankeedt,项目名称:D710BST_FL24_Kernel,代码行数:15,代码来源:ctpcm.c
示例9: ux500_pcm_hw_params
static int ux500_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_dma_buffer *buf = runtime->dma_buffer_p;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
int ret = 0;
int size;
dev_dbg(rtd->platform->dev, "%s: Enter\n", __func__);
size = params_buffer_bytes(hw_params);
if (buf) {
if (buf->bytes >= size)
goto out;
ux500_pcm_dma_hw_free(NULL, substream);
}
if (substream->dma_buffer.area != NULL &&
substream->dma_buffer.bytes >= size) {
buf = &substream->dma_buffer;
} else {
buf = kmalloc(sizeof(struct snd_dma_buffer), GFP_KERNEL);
if (!buf)
goto nomem;
buf->dev.type = SNDRV_DMA_TYPE_DEV;
buf->dev.dev = NULL;
buf->area = dma_alloc_coherent(NULL, size, &buf->addr,
GFP_KERNEL);
buf->bytes = size;
buf->private_data = NULL;
if (!buf->area)
goto free;
}
snd_pcm_set_runtime_buffer(substream, buf);
ret = 1;
out:
runtime->dma_bytes = size;
return ret;
free:
kfree(buf);
nomem:
return -ENOMEM;
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:48,代码来源:ux500_pcm.c
示例10: cygnus_pcm_hw_params
static int cygnus_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_pcm_runtime *runtime = substream->runtime;
struct cygnus_aio_port *aio;
int ret = 0;
aio = cygnus_dai_get_dma_data(substream);
dev_dbg(rtd->cpu_dai->dev, "%s port %d\n", __func__, aio->portnum);
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
runtime->dma_bytes = params_buffer_bytes(params);
return ret;
}
开发者ID:AK101111,项目名称:linux,代码行数:16,代码来源:cygnus-pcm.c
示例11: 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
示例12: 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
示例13: snd_usbtv_hw_params
static int snd_usbtv_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
int rv;
struct usbtv *chip = snd_pcm_substream_chip(substream);
rv = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
if (rv < 0) {
dev_warn(chip->dev, "pcm audio buffer allocation failure %i\n",
rv);
return rv;
}
return 0;
}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:17,代码来源:usbtv-audio.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: snd_pd_hw_capture_params
static int snd_pd_hw_capture_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
unsigned int size;
size = params_buffer_bytes(hw_params);
if (runtime->dma_area) {
if (runtime->dma_bytes > size)
return 0;
vfree(runtime->dma_area);
}
runtime->dma_area = vmalloc(size);
if (!runtime->dma_area)
return -ENOMEM;
else
runtime->dma_bytes = size;
return 0;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:19,代码来源:pd-alsa.c
示例16: pcm_playback_hw_params
static int
pcm_playback_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_bebob *bebob = substream->private_data;
int err;
err = snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
if (err < 0)
return err;
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
atomic_inc(&bebob->substreams_counter);
amdtp_stream_set_pcm_format(&bebob->rx_stream,
params_format(hw_params));
return 0;
}
开发者ID:DenisLug,项目名称:mptcp,代码行数:19,代码来源:bebob_pcm.c
示例17: mtk_pcm_dl1bt_hw_params
static int mtk_pcm_dl1bt_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
int ret = 0;
PRINTK_AUDDRV("mtk_pcm_dl1bt_hw_params\n");
/* runtime->dma_bytes has to be set manually to allow mmap */
substream->runtime->dma_bytes = params_buffer_bytes(hw_params);
/* here to allcoate sram to hardware --------------------------- */
AudDrv_Allocate_mem_Buffer(mDev, Soc_Aud_Digital_Block_MEM_DL1, substream->runtime->dma_bytes);
/* substream->runtime->dma_bytes = AFE_INTERNAL_SRAM_SIZE; */
substream->runtime->dma_area = (unsigned char *)Get_Afe_SramBase_Pointer();
substream->runtime->dma_addr = AFE_INTERNAL_SRAM_PHY_BASE;
PRINTK_AUDDRV(" dma_bytes = %zu dma_area = %p dma_addr = 0x%lx\n",
substream->runtime->dma_bytes, substream->runtime->dma_area, (long)substream->runtime->dma_addr);
return ret;
}
开发者ID:John677,项目名称:Kernal_k3note,代码行数:19,代码来源:mt_soc_pcm_dl1_bt.c
示例18: playback_hw_params
static int playback_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{
struct snd_dice *dice = substream->private_data;
int err;
err = snd_pcm_lib_alloc_vmalloc_buffer(substream,
params_buffer_bytes(hw_params));
if (err < 0)
return err;
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
mutex_lock(&dice->mutex);
dice->substreams_counter++;
mutex_unlock(&dice->mutex);
}
return 0;
}
开发者ID:ReneNyffenegger,项目名称:linux,代码行数:19,代码来源:dice-pcm.c
示例19: 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
示例20: sun4i_pcm_hw_params
static int sun4i_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_pcm_runtime *runtime = substream->runtime;
struct sun4i_runtime_data *prtd = runtime->private_data;
struct snd_soc_pcm_runtime *rtd = substream->private_data;
unsigned long totbytes = params_buffer_bytes(params);
struct sun4i_dma_params *dma =
snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
int ret = 0;
if (!dma)
return 0;
if (prtd->params == NULL) {
prtd->params = dma;
ret = sw_dma_request(prtd->params->channel,
prtd->params->client, NULL);
if (ret < 0) {
return ret;
}
}
sw_dma_set_buffdone_fn(prtd->params->channel,
sun4i_audio_buffdone);
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
runtime->dma_bytes = totbytes;
spin_lock_irq(&prtd->lock);
prtd->dma_loaded = 0;
prtd->dma_limit = runtime->hw.periods_min;
prtd->dma_period = params_period_bytes(params);
prtd->dma_start = runtime->dma_addr;
prtd->dma_pos = prtd->dma_start;
prtd->dma_end = prtd->dma_start + totbytes;
spin_unlock_irq(&prtd->lock);
return 0;
}
开发者ID:panlinbing,项目名称:lichee_linux-3.0,代码行数:40,代码来源:sun4i-i2sdma.c
注:本文中的params_buffer_bytes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论