本文整理汇总了C++中snd_pcm_lib_preallocate_pages_for_all函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_pcm_lib_preallocate_pages_for_all函数的具体用法?C++ snd_pcm_lib_preallocate_pages_for_all怎么用?C++ snd_pcm_lib_preallocate_pages_for_all使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_pcm_lib_preallocate_pages_for_all函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: snd_aicapcmchip
/* TO DO: set up to handle more than one pcm instance */
static int __init snd_aicapcmchip(struct snd_card_aica
*dreamcastcard, int pcm_index)
{
struct snd_pcm *pcm;
int err;
/* AICA has no capture ability */
err =
snd_pcm_new(dreamcastcard->card, "AICA PCM", pcm_index, 1, 0,
&pcm);
if (unlikely(err < 0))
return err;
pcm->private_data = dreamcastcard;
strcpy(pcm->name, "AICA PCM");
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_aicapcm_playback_ops);
/* Allocate the DMA buffers */
err =
snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data
(GFP_KERNEL),
AICA_BUFFER_SIZE,
AICA_BUFFER_SIZE);
return err;
}
开发者ID:AK101111,项目名称:linux,代码行数:26,代码来源:aica.c
示例2: snd_card_capture_allocate
static int __devinit snd_card_capture_allocate(pcm_hw_t *snd_card, int device,char* name)
{
int err;
snd_pcm_t *pcm;
err = snd_pcm_new(snd_card->card,name,device, 0, 1, &pcm);
if (err < 0)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_capture_ops_pcm);
pcm->private_data = snd_card;
pcm->private_free = snd_card_pcm_free;
pcm->info_flags = 0;
snd_card->pcm = pcm;
strcpy(pcm->name, name);
snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL),
PCM_PREALLOC_SIZE,
PCM_PREALLOC_MAX);
return 0;
}
开发者ID:henrryhe,项目名称:beijing-7101,代码行数:26,代码来源:st_pcm_core.c
示例3: snd_line6_new_pcm
/* create a PCM device */
static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm)
{
struct snd_pcm *pcm;
int err;
err = snd_pcm_new(line6pcm->line6->card,
(char *)line6pcm->line6->properties->name,
0, 1, 1, &pcm);
if (err < 0)
return err;
pcm->private_data = line6pcm;
pcm->private_free = line6_cleanup_pcm;
line6pcm->pcm = pcm;
strcpy(pcm->name, line6pcm->line6->properties->name);
/* set operators */
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_line6_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops);
/* pre-allocation of buffers */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data
(GFP_KERNEL), 64 * 1024,
128 * 1024);
return 0;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:30,代码来源:pcm.c
示例4: snd_cs5535audio_pcm
int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
{
struct snd_pcm *pcm;
int err;
err = snd_pcm_new(cs5535au->card, "CS5535 Audio", 0, 1, 1, &pcm);
if (err < 0)
return err;
cs5535au->dmas[CS5535AUDIO_DMA_PLAYBACK].ops =
&snd_cs5535audio_playback_dma_ops;
cs5535au->dmas[CS5535AUDIO_DMA_CAPTURE].ops =
&snd_cs5535audio_capture_dma_ops;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_cs5535audio_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
&snd_cs5535audio_capture_ops);
pcm->private_data = cs5535au;
pcm->info_flags = 0;
strcpy(pcm->name, "CS5535 Audio");
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(cs5535au->pci),
64*1024, 128*1024);
cs5535au->pcm = pcm;
return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:29,代码来源:cs5535audio_pcm.c
示例5: skl_pcm_new
static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_dai *dai = rtd->cpu_dai;
struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
struct snd_pcm *pcm = rtd->pcm;
unsigned int size;
int retval = 0;
struct skl *skl = ebus_to_skl(ebus);
if (dai->driver->playback.channels_min ||
dai->driver->capture.channels_min) {
/* buffer pre-allocation */
size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024;
if (size > MAX_PREALLOC_SIZE)
size = MAX_PREALLOC_SIZE;
retval = snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(skl->pci),
size, MAX_PREALLOC_SIZE);
if (retval) {
dev_err(dai->dev, "dma buffer allocationf fail\n");
return retval;
}
}
return retval;
}
开发者ID:AK101111,项目名称:linux,代码行数:27,代码来源:skl-pcm.c
示例6: hi3620_digital_new
static int hi3620_digital_new(struct snd_card *card,
struct snd_soc_dai *dai, struct snd_pcm *pcm)
{
int ret = 0;
IN_FUNCTION;
if (!card->dev->dma_mask) {
logi("%s : dev->dma_mask not set\n", __FUNCTION__);
card->dev->dma_mask = &hi3620_digital_dmamask;
}
if (!card->dev->coherent_dma_mask) {
logi("%s : dev->coherent_dma_mask not set\n", __FUNCTION__);
card->dev->coherent_dma_mask = hi3620_digital_dmamask;
}
ret = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
pcm->card->dev, HI3620_MAX_BUFFER_SIZE, HI3620_MAX_BUFFER_SIZE);
if (ret) {
loge("snd_pcm_lib_preallocate_pages_for_all error : %d\n", ret);
return ret;
}
logi("%s: pcm->device = 0\n", __FUNCTION__);
ret = request_irq(g_hi3620_asp_irq_line, hi3620_intr_handle_digital,
IRQF_SHARED, "ASP", pcm);
if (ret) {
loge("request_irq error : %d\n", ret);
snd_pcm_lib_preallocate_free_for_all(pcm);
}
OUT_FUNCTION;
return ret;
}
开发者ID:serrvius,项目名称:Kernel-3.0.8,代码行数:35,代码来源:hi3620-digital.c
示例7: snd_ad1816a_pcm
int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm)
{
int error;
struct snd_pcm *pcm;
if ((error = snd_pcm_new(chip->card, "AD1816A", device, 1, 1, &pcm)))
return error;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ad1816a_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ad1816a_capture_ops);
pcm->private_data = chip;
pcm->info_flags = (chip->dma1 == chip->dma2 ) ? SNDRV_PCM_INFO_JOINT_DUPLEX : 0;
strcpy(pcm->name, snd_ad1816a_chip_id(chip));
snd_ad1816a_init(chip);
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_isa_data(),
64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024);
chip->pcm = pcm;
if (rpcm)
*rpcm = pcm;
return 0;
}
开发者ID:adis1313,项目名称:android_kernel_samsung_msm8974,代码行数:26,代码来源:ad1816a_lib.c
示例8: snd_em8300_pcm_digital
static int snd_em8300_pcm_digital(em8300_alsa_t *em8300_alsa)
{
struct em8300_s *em = em8300_alsa->em;
struct snd_pcm *pcm;
int ret;
ret = snd_pcm_new(em8300_alsa->card, "EM8300 PCM Digital",
EM8300_ALSA_DIGITAL_DEVICENUM,
1, /* 1 playback substream */
0, /* 0 capture substream */
&pcm);
if (ret) {
printk(KERN_ERR "em8300-alsa: snd_em8300_pcm_digital failed with err %d\n", ret);
return ret;
}
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_em8300_playback_ops);
pcm->private_data = em8300_alsa;
pcm->private_free = snd_em8300_pcm_digital_free;
pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX;
strcpy(pcm->name, "EM8300 IEC958");
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(em->pci_dev),
0,
EM8300_MID_BUFFER_SIZE);
return 0;
}
开发者ID:austriancoder,项目名称:v4l2-em8300-old,代码行数:32,代码来源:em8300_alsa.c
示例9: snd_ad1889_pcm_init
static int
snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device)
{
int err;
struct snd_pcm *pcm;
err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm);
if (err < 0)
return err;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_ad1889_playback_ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
&snd_ad1889_capture_ops);
pcm->private_data = chip;
pcm->info_flags = 0;
strcpy(pcm->name, chip->card->shortname);
chip->pcm = pcm;
chip->psubs = NULL;
chip->csubs = NULL;
err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
BUFFER_BYTES_MAX / 2,
BUFFER_BYTES_MAX);
if (err < 0) {
dev_err(chip->card->dev, "buffer allocation error: %d\n", err);
return err;
}
return 0;
}
开发者ID:19Dan01,项目名称:linux,代码行数:35,代码来源:ad1889.c
示例10: ssp_platform_pcm_new
/*
* SSP Platform functions
*/
static int ssp_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
{
int retval = 0;
struct snd_soc_dai *dai;
struct snd_pcm *pcm;
pr_debug("SSP DAI: FCT %s enters\n",
__func__);
/*
* Do pre-allocation to all substreams of the given pcm for the
* specified DMA type.
*
*/
dai = soc_runtime->cpu_dai;
pcm = soc_runtime->pcm;
if (dai->driver->playback.channels_min ||
dai->driver->capture.channels_min) {
retval = snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL),
SSP_MIN_BUFFER, SSP_MAX_BUFFER);
if (retval) {
pr_err("DMA buffer allocation fail\n");
return retval;
}
}
return retval;
} /* ssp_platform_pcm_new */
开发者ID:kamarush,项目名称:ZTE_GXIn_Kernel-3.0.8,代码行数:33,代码来源:mid_ssp.c
示例11: lola_create_pcm
int __devinit lola_create_pcm(struct lola *chip)
{
struct snd_pcm *pcm;
int i, err;
for (i = 0; i < 2; i++) {
err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
snd_dma_pci_data(chip->pci),
PAGE_SIZE, &chip->pcm[i].bdl);
if (err < 0)
return err;
}
err = snd_pcm_new(chip->card, "Digigram Lola", 0,
chip->pcm[SNDRV_PCM_STREAM_PLAYBACK].num_streams,
chip->pcm[SNDRV_PCM_STREAM_CAPTURE].num_streams,
&pcm);
if (err < 0)
return err;
strlcpy(pcm->name, "Digigram Lola", sizeof(pcm->name));
pcm->private_data = chip;
for (i = 0; i < 2; i++) {
if (chip->pcm[i].num_streams)
snd_pcm_set_ops(pcm, i, &lola_pcm_ops);
}
/* buffer pre-allocation */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(chip->pci),
1024 * 64, 32 * 1024 * 1024);
return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:31,代码来源:lola_pcm.c
示例12: hsw_pcm_new
static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_pcm *pcm = rtd->pcm;
int ret = 0;
ret = dma_coerce_mask_and_coherent(rtd->card->dev, DMA_BIT_MASK(32));
if (ret)
return ret;
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_DEV,
rtd->card->dev,
hsw_pcm_hardware.buffer_bytes_max,
hsw_pcm_hardware.buffer_bytes_max);
if (ret) {
dev_err(rtd->dev, "dma buffer allocation failed %d\n",
ret);
return ret;
}
}
return ret;
}
开发者ID:908626950,项目名称:linux,代码行数:25,代码来源:sst-haswell-pcm.c
示例13: snd_bcm2835_new_spdif_pcm
int snd_bcm2835_new_spdif_pcm(struct bcm2835_chip *chip)
{
struct snd_pcm *pcm;
int err;
audio_info(" .. IN\n");
if (mutex_lock_interruptible(&chip->audio_mutex)) {
audio_error("Interrupted whilst waiting for lock\n");
return -EINTR;
}
err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm);
if (err < 0)
goto out;
pcm->private_data = chip;
strcpy(pcm->name, "bcm2835 IEC958/HDMI");
chip->pcm_spdif = pcm;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_bcm2835_playback_spdif_ops);
/* pre-allocation of buffers */
/* NOTE: this may fail */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL),
snd_bcm2835_playback_spdif_hw.buffer_bytes_max, snd_bcm2835_playback_spdif_hw.buffer_bytes_max);
out:
mutex_unlock(&chip->audio_mutex);
audio_info(" .. OUT\n");
return 0;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:31,代码来源:bcm2835-pcm.c
示例14: snd_bcm2835_new_pcm
/* create a pcm device */
int __devinit snd_bcm2835_new_pcm(bcm2835_chip_t * chip)
{
struct snd_pcm *pcm;
int err;
audio_info(" .. IN\n");
err =
snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm);
if (err < 0)
return err;
pcm->private_data = chip;
strcpy(pcm->name, "bcm2835 ALSA");
chip->pcm = pcm;
chip->dest = AUDIO_DEST_AUTO;
chip->volume = 100;
/* set operators */
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
&snd_bcm2835_playback_ops);
/* pre-allocation of buffers */
/* NOTE: this may fail */
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data
(GFP_KERNEL), 64 * 1024,
64 * 1024);
audio_info(" .. OUT\n");
return 0;
}
开发者ID:eyecatchup,项目名称:razdroid-kernel,代码行数:31,代码来源:bcm2835-pcm.c
示例15: snd_card_dummy_pcm
static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
int substreams)
{
struct snd_pcm *pcm;
struct snd_pcm_ops *ops;
int err;
err = snd_pcm_new(dummy->card, "Dummy PCM", device,
substreams, substreams, &pcm);
if (err < 0)
return err;
dummy->pcm = pcm;
if (fake_buffer)
ops = &dummy_pcm_ops_no_buf;
else
ops = &dummy_pcm_ops;
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, ops);
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, ops);
pcm->private_data = dummy;
pcm->info_flags = 0;
strcpy(pcm->name, "Dummy PCM");
if (!fake_buffer) {
snd_pcm_lib_preallocate_pages_for_all(pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL),
0, 64*1024);
}
return 0;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:29,代码来源:dummy.c
示例16: rsnd_pcm_new
static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
return snd_pcm_lib_preallocate_pages_for_all(
rtd->pcm,
SNDRV_DMA_TYPE_DEV,
rtd->card->snd_card->dev,
PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
}
开发者ID:Master-Traders,项目名称:linux,代码行数:8,代码来源:core.c
示例17: dw_pcm_new
static int dw_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
size_t size = dw_pcm_hardware.buffer_bytes_max;
return snd_pcm_lib_preallocate_pages_for_all(rtd->pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data(GFP_KERNEL), size, size);
}
开发者ID:mhei,项目名称:linux,代码行数:8,代码来源:designware_pcm.c
示例18: intel_alsa_create_pcm_device
/*
* intel_alsa_create_pcm_device : to setup pcm for the card
*
* Input parameters
* @card : pointer to the sound card structure
* @p_alsa_ssp_snd_card : pointer to internal context
*
* Output parameters
* @ret_val : status, 0 ==> OK
*
*/
static int intel_alsa_create_pcm_device(struct snd_card *card,
struct intel_alsa_ssp_card_info *p_alsa_ssp_snd_card)
{
struct snd_pcm *pl_pcm;
int i, ret_val = 0;
WARN(!card, "ALSA_SSP: ERROR NULL card\n");
if (!card)
return -EINVAL;
WARN(!p_alsa_ssp_snd_card,
"ALSA_SSP: ERROR NULL p_alsa_ssp_snd_card\n");
if (!p_alsa_ssp_snd_card)
return -EINVAL;
/*
* The alsa_ssp driver handles provide 2 PCM devices :
* device 0 ==> BT with 1 capture sub-stream + 1 play sub-stream
* device 1 ==> FM with 1 capture sub-stream + 0 play sub-stream
* These 2 devices are exclusive
*/
for (i = 0; i < INTEL_ALSA_SSP_SND_CARD_MAX_DEVICES; i++) {
ret_val = snd_pcm_new(card, s_dev_info[i].dev_name, i,
s_dev_info[i].nb_play_stream,
s_dev_info[i].nb_capt_stream,
&pl_pcm);
if (ret_val)
return ret_val;
/* setup the ops for playback and capture streams */
snd_pcm_set_ops(pl_pcm, SNDRV_PCM_STREAM_PLAYBACK,
&s_alsa_ssp_playback_ops);
snd_pcm_set_ops(pl_pcm, SNDRV_PCM_STREAM_CAPTURE,
&s_alsa_ssp_capture_ops);
/* setup private data which can be retrieved when required */
pl_pcm->private_data = p_alsa_ssp_snd_card;
pl_pcm->info_flags = 0;
strncpy(pl_pcm->name, card->shortname, strlen(card->shortname));
/*
* allocate DMA pages for ALSA stream operations pre-allocation
* to all substreams of the given pcm for the specified DMA type
*/
snd_pcm_lib_preallocate_pages_for_all(pl_pcm,
SNDRV_DMA_TYPE_CONTINUOUS,
snd_dma_continuous_data
(GFP_KERNEL),
s_dev_info[i].stream_hw_param->buffer_bytes_max,
s_dev_info[i].stream_hw_param->buffer_bytes_max);
}
return ret_val;
}
开发者ID:kamarush,项目名称:ZTE_GXIn_Kernel-3.0.8,代码行数:68,代码来源:intel_alsa_ssp_snd_card.c
示例19: mtk_afe_pcm_new
static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
size_t size;
struct snd_card *card = rtd->card->snd_card;
struct snd_pcm *pcm = rtd->pcm;
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
size = afe->mtk_afe_hardware->buffer_bytes_max;
return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
card->dev, size, size);
}
开发者ID:AK101111,项目名称:linux,代码行数:11,代码来源:mtk-afe-platform-driver.c
示例20: mtk_afe_pcm_new
static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
{
size_t size;
struct snd_card *card = rtd->card->snd_card;
struct snd_pcm *pcm = rtd->pcm;
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
size = afe->mtk_afe_hardware->buffer_bytes_max;
return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
card->dev, size, size);
}
开发者ID:the-snowwhite,项目名称:linux-socfpga,代码行数:12,代码来源:mtk-afe-platform-driver.c
注:本文中的snd_pcm_lib_preallocate_pages_for_all函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论