• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snd_card_create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中snd_card_create函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_card_create函数的具体用法?C++ snd_card_create怎么用?C++ snd_card_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了snd_card_create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pxa2xx_ac97_probe

static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
{
	struct snd_card *card;
	struct snd_ac97_bus *ac97_bus;
	struct snd_ac97_template ac97_template;
	int ret;
	pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;

	if (dev->id >= 0) {
		dev_err(&dev->dev, "PXA2xx has only one AC97 port.\n");
		ret = -ENXIO;
		goto err_dev;
	}

	ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
			      THIS_MODULE, 0, &card);
	if (ret < 0)
		goto err;

	card->dev = &dev->dev;
	strncpy(card->driver, dev->dev.driver->name, sizeof(card->driver));

	ret = pxa2xx_pcm_new(card, &pxa2xx_ac97_pcm_client, &pxa2xx_ac97_pcm);
	if (ret)
		goto err;

	ret = pxa2xx_ac97_hw_probe(dev);
	if (ret)
		goto err;

	ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus);
	if (ret)
		goto err_remove;
	memset(&ac97_template, 0, sizeof(ac97_template));
	ret = snd_ac97_mixer(ac97_bus, &ac97_template, &pxa2xx_ac97_ac97);
	if (ret)
		goto err_remove;

	snprintf(card->shortname, sizeof(card->shortname),
		 "%s", snd_ac97_get_short_name(pxa2xx_ac97_ac97));
	snprintf(card->longname, sizeof(card->longname),
		 "%s (%s)", dev->dev.driver->name, card->mixername);

	if (pdata && pdata->codec_pdata[0])
		snd_ac97_dev_add_pdata(ac97_bus->codec[0], pdata->codec_pdata[0]);
	snd_card_set_dev(card, &dev->dev);
	ret = snd_card_register(card);
	if (ret == 0) {
		platform_set_drvdata(dev, card);
		return 0;
	}

err_remove:
	pxa2xx_ac97_hw_remove(dev);
err:
	if (card)
		snd_card_free(card);
err_dev:
	return ret;
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:60,代码来源:pxa2xx-ac97.c


示例2: snd_sscape_probe

static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev)
{
	struct snd_card *card;
	struct soundscape *sscape;
	int ret;

	ret = snd_card_create(index[dev], id[dev], THIS_MODULE,
			      sizeof(struct soundscape), &card);
	if (ret < 0)
		return ret;

	sscape = get_card_soundscape(card);
	sscape->type = SSCAPE;

	dma[dev] &= 0x03;
	ret = create_sscape(dev, card);
	if (ret < 0)
		goto _release_card;

	snd_card_set_dev(card, pdev);
	if ((ret = snd_card_register(card)) < 0) {
		printk(KERN_ERR "sscape: Failed to register sound card\n");
		goto _release_card;
	}
	dev_set_drvdata(pdev, card);
	return 0;

_release_card:
	snd_card_free(card);
	return ret;
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:31,代码来源:sscape.c


示例3: snd_mpu401_create

static int snd_mpu401_create(int dev, struct snd_card **rcard)
{
	struct snd_card *card;
	int err;

	if (!uart_enter[dev])
		snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n");

	*rcard = NULL;
	err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
	if (err < 0)
		return err;
	strcpy(card->driver, "MPU-401 UART");
	strcpy(card->shortname, card->driver);
	sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);
	if (irq[dev] >= 0) {
		sprintf(card->longname + strlen(card->longname), "irq %d", irq[dev]);
	} else {
		strcat(card->longname, "polled");
	}

	err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port[dev], 0,
				  irq[dev], NULL);
	if (err < 0) {
		printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
		goto _err;
	}

	*rcard = card;
	return 0;

 _err:
	snd_card_free(card);
	return err;
}
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:35,代码来源:mpu401.c


示例4: init_midi

static int init_midi(void) {
    int err;
    struct snd_seq_port_info *pinfo;

    err = snd_card_create(-1, NULL, THIS_MODULE, sizeof(struct snd_card), &card);
    if (err < 0) {
        printk(KERN_INFO LOGPREFIX "error creating card: %d\n", err);
        return err;
    }

    client = snd_seq_create_kernel_client(card, 0, "new_midi-client");
    if (client < 0) {
        printk(KERN_INFO LOGPREFIX "error creating client: %d\n", err);
        return err;
    }

    pinfo = kzalloc(sizeof(struct snd_seq_port_info), GFP_KERNEL);
    if (!pinfo) {
        err = -ENOMEM;
        return err;
    }
    pinfo->addr.client = client;
    //pinfo->capability |= SNDRV_SEQ_PORT_CAP_WRITE | SNDRV_SEQ_PORT_CAP_SYNC_WRITE | SNDRV_SEQ_PORT_CAP_SUBS_WRITE;
    pinfo->capability |= SNDRV_SEQ_PORT_CAP_READ | SNDRV_SEQ_PORT_CAP_SYNC_READ | SNDRV_SEQ_PORT_CAP_SUBS_READ;

    err = snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_CREATE_PORT, pinfo);
    if (err < 0) {
        printk(KERN_INFO LOGPREFIX "error creating port: %d\n", err);
        return err;
    }

    return 0;
}
开发者ID:prgtrdr,项目名称:cmidid-kerneldriver,代码行数:33,代码来源:new_midi.c


示例5: aoa_alsa_init

int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
{
	struct snd_card *alsa_card;
	int err;

	if (aoa_card)
		/* cannot be EEXIST due to usage in aoa_fabric_register */
		return -EBUSY;

	err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
			      &alsa_card);
	if (err < 0)
		return err;
	aoa_card = alsa_card->private_data;
	aoa_card->alsa_card = alsa_card;
	alsa_card->dev = dev;
	strlcpy(alsa_card->driver, "AppleOnbdAudio", sizeof(alsa_card->driver));
	strlcpy(alsa_card->shortname, name, sizeof(alsa_card->shortname));
	strlcpy(alsa_card->longname, name, sizeof(alsa_card->longname));
	strlcpy(alsa_card->mixername, name, sizeof(alsa_card->mixername));
	err = snd_card_register(aoa_card->alsa_card);
	if (err < 0) {
		printk(KERN_ERR "snd-aoa: couldn't register alsa card\n");
		snd_card_free(aoa_card->alsa_card);
		aoa_card = NULL;
		return err;
	}
	return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:29,代码来源:alsa.c


示例6: poseidon_audio_init

int poseidon_audio_init(struct poseidon *p)
{
	struct poseidon_audio *pa = &p->audio;
	struct snd_card *card;
	struct snd_pcm *pcm;
	int ret;

	ret = snd_card_create(-1, "Telegent", THIS_MODULE, 0, &card);
	if (ret != 0)
		return ret;

	ret = snd_pcm_new(card, "poseidon audio", 0, 0, 1, &pcm);
	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_capture_ops);
	pcm->info_flags   = 0;
	pcm->private_data = p;
	strcpy(pcm->name, "poseidon audio capture");

	strcpy(card->driver, "ALSA driver");
	strcpy(card->shortname, "poseidon Audio");
	strcpy(card->longname, "poseidon ALSA Audio");

	if (snd_card_register(card)) {
		snd_card_free(card);
		return -ENOMEM;
	}
	pa->card = card;
	return 0;
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:28,代码来源:pd-alsa.c


示例7: snd_pdacf_probe

/*
 * snd_pdacf_attach - attach callback for cs
 */
static int snd_pdacf_probe(struct pcmcia_device *link)
{
	int i, err;
	struct snd_pdacf *pdacf;
	struct snd_card *card;
	static struct snd_device_ops ops = {
		.dev_free =	snd_pdacf_dev_free,
	};

	snd_printdd(KERN_DEBUG "pdacf_attach called\n");
	/* find an empty slot from the card list */
	for (i = 0; i < SNDRV_CARDS; i++) {
		if (! card_list[i])
			break;
	}
	if (i >= SNDRV_CARDS) {
		snd_printk(KERN_ERR "pdacf: too many cards found\n");
		return -EINVAL;
	}
	if (! enable[i])
		return -ENODEV; /* disabled explicitly */

	/* ok, create a card instance */
	err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
	if (err < 0) {
		snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
		return err;
	}

	pdacf = snd_pdacf_create(card);
	if (!pdacf) {
		snd_card_free(card);
		return -ENOMEM;
	}

	err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops);
	if (err < 0) {
		kfree(pdacf);
		snd_card_free(card);
		return err;
	}

	snd_card_set_dev(card, &link->dev);

	pdacf->index = i;
	card_list[i] = card;

	pdacf->p_dev = link;
	link->priv = pdacf;

	link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
	link->resource[0]->end = 16;

	link->conf.Attributes = CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
	link->conf.IntType = INT_MEMORY_AND_IO;
	link->conf.ConfigIndex = 1;
	link->conf.Present = PRESENT_OPTION;

	return pdacf_config(link);
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:63,代码来源:pdaudiocf.c


示例8: snd_es1688_isa_probe

static int __devinit snd_es1688_isa_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	int error;

	error = snd_card_create(index[n], id[n], THIS_MODULE,
				sizeof(struct snd_es1688), &card);
	if (error < 0)
		return error;

	error = snd_es1688_legacy_create(card, dev, n);
	if (error < 0)
		goto out;

	snd_card_set_dev(card, dev);

	error = snd_es1688_probe(card, n);
	if (error < 0)
		goto out;

	dev_set_drvdata(dev, card);

	return 0;
out:
	snd_card_free(card);
	return error;
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:27,代码来源:es1688.c


示例9: create_card

static int create_card(struct usb_device *usb_dev,
		       struct usb_interface *intf,
		       struct snd_card **cardp)
{
	int devnum;
	int err;
	struct snd_card *card;
	struct snd_usb_caiaqdev *dev;

	for (devnum = 0; devnum < SNDRV_CARDS; devnum++)
		if (enable[devnum] && !snd_card_used[devnum])
			break;

	if (devnum >= SNDRV_CARDS)
		return -ENODEV;

	err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
			      sizeof(struct snd_usb_caiaqdev), &card);
	if (err < 0)
		return err;

	dev = caiaqdev(card);
	dev->chip.dev = usb_dev;
	dev->chip.card = card;
	dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor),
				  le16_to_cpu(usb_dev->descriptor.idProduct));
	spin_lock_init(&dev->spinlock);
	snd_card_set_dev(card, &intf->dev);

	*cardp = card;
	return 0;
}
开发者ID:mft-dev,项目名称:msm8974_OPO_render_kernel,代码行数:32,代码来源:device.c


示例10: snd_cs4231_probe

static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	struct snd_wss *chip;
	struct snd_pcm *pcm;
	int error;

	error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
	if (error < 0)
		return error;

	error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
			WSS_HW_DETECT, 0, &chip);
	if (error < 0)
		goto out;

	card->private_data = chip;

	error = snd_wss_pcm(chip, 0, &pcm);
	if (error < 0)
		goto out;

	strcpy(card->driver, "CS4231");
	strcpy(card->shortname, pcm->name);

	sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
		pcm->name, chip->port, irq[n], dma1[n]);
	if (dma2[n] >= 0)
		sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]);

	error = snd_wss_mixer(chip);
	if (error < 0)
		goto out;

	error = snd_wss_timer(chip, 0, NULL);
	if (error < 0)
		goto out;

	if (mpu_port[n] > 0 && mpu_port[n] != SNDRV_AUTO_PORT) {
		if (mpu_irq[n] == SNDRV_AUTO_IRQ)
			mpu_irq[n] = -1;
		if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
					mpu_port[n], 0, mpu_irq[n],
					NULL) < 0)
			dev_warn(dev, "MPU401 not detected\n");
	}

	snd_card_set_dev(card, dev);

	error = snd_card_register(card);
	if (error < 0)
		goto out;

	dev_set_drvdata(dev, card);
	return 0;

out:	snd_card_free(card);
	return error;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:59,代码来源:cs4231.c


示例11: rtx_ac97_probe

/*
 * The ALSA drivers guide says to use __dev{init,exit} because PCI devices can
 * be hot-plugged.
 *
 * If you look into linux/init.h you can see that __dev{init,exit} place the
 * code in a different ELF section.
 */
static int __devinit	rtx_ac97_probe(struct pci_dev *pdev,
				       const struct pci_device_id *pdev_id)
{
	static int	dev_idx = 0;
	struct snd_card	*card;
	int		err;

	/* 1. check and increment the device index. XXX What is this? */
	if (dev_idx >= SNDRV_CARDS)
		return (-ENODEV);
	if (!rtx_ac97_enable[dev_idx]) {
		dev_idx++;
		return (-ENOENT);
	}

	/* 2. create a card instance. */
	err = snd_card_create(rtx_ac97_index[dev_idx], rtx_ac97_id[dev_idx], THIS_MODULE, 0, &card);
	if (err < 0)
		return (err);

	/* 3. create our stuff. */
	err = rtx_ac97_create(card, pdev);
	if (err < 0)
		goto fail;

	/* 4. set driver id and name strings. Visible in /proc/asound/cards */
	strlcpy(card->driver, "rtx_ac97", sizeof(card->driver));
	strlcpy(card->shortname, "My first AC'97 driver", sizeof(card->shortname));
	strlcpy(card->longname, "My first AC'97 driver", sizeof(card->longname));

	/* 5. create other components mixer. midi. etc. */

	/* 6. register the card instance. */
	err = snd_card_register(card);
	if (err < 0)
		goto fail;

	/*
	 * 7. Finally set the card instance private data in the struct pci_dev
	 * and return.
	 */
	pci_set_drvdata(pdev, card);
	dev_idx++;

	printk(KERN_INFO "rtx_ac97: probe successful: chip=0x%p.\n", card->private_data);
	return (0);

fail:
	printk(KERN_WARNING "rtx_ac97: probe failed.\n");

	snd_card_free(card);

	return (err);
}
开发者ID:npalix,项目名称:rathaxes,代码行数:61,代码来源:rtx_ac97.c


示例12: lola_probe

static int __devinit lola_probe(struct pci_dev *pci,
				const struct pci_device_id *pci_id)
{
	static int dev;
	struct snd_card *card;
	struct lola *chip;
	int err;

	if (dev >= SNDRV_CARDS)
		return -ENODEV;
	if (!enable[dev]) {
		dev++;
		return -ENOENT;
	}

	err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
	if (err < 0) {
		snd_printk(KERN_ERR SFX "Error creating card!\n");
		return err;
	}

	snd_card_set_dev(card, &pci->dev);

	err = lola_create(card, pci, dev, &chip);
	if (err < 0)
		goto out_free;
	card->private_data = chip;

	err = lola_parse_tree(chip);
	if (err < 0)
		goto out_free;

	err = lola_create_pcm(chip);
	if (err < 0)
		goto out_free;

	err = lola_create_mixer(chip);
	if (err < 0)
		goto out_free;

	lola_proc_debug_new(chip);

	err = snd_card_register(card);
	if (err < 0)
		goto out_free;

	pci_set_drvdata(pci, card);
	dev++;
	return err;
out_free:
	snd_card_free(card);
	return err;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:53,代码来源:lola.c


示例13: printk

struct cx23885_audio_dev *cx23885_audio_register(struct cx23885_dev *dev)
{
	struct snd_card *card;
	struct cx23885_audio_dev *chip;
	int err;

	if (disable_analog_audio)
		return NULL;

	if (dev->sram_channels[AUDIO_SRAM_CHANNEL].cmds_start == 0) {
		printk(KERN_WARNING "%s(): Missing SRAM channel configuration "
			"for analog TV Audio\n", __func__);
		return NULL;
	}

	err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
			THIS_MODULE, sizeof(struct cx23885_audio_dev), &card);
	if (err < 0)
		goto error;

	chip = (struct cx23885_audio_dev *) card->private_data;
	chip->dev = dev;
	chip->pci = dev->pci;
	chip->card = card;
	spin_lock_init(&chip->lock);

	snd_card_set_dev(card, &dev->pci->dev);

	err = snd_cx23885_pcm(chip, 0, "CX23885 Digital");
	if (err < 0)
		goto error;

	strcpy(card->driver, "CX23885");
	sprintf(card->shortname, "Conexant CX23885");
	sprintf(card->longname, "%s at %s", card->shortname, dev->name);

	err = snd_card_register(card);
	if (err < 0)
		goto error;

	dprintk(0, "registered ALSA audio device\n");

	return chip;

error:
	snd_card_free(card);
	printk(KERN_ERR "%s(): Failed to register analog "
			"audio adapter\n", __func__);

	return NULL;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:51,代码来源:cx23885-alsa.c


示例14: snd_adlib_probe

static int __devinit snd_adlib_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	struct snd_opl3 *opl3;
	int error;

	error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
	if (error < 0) {
		dev_err(dev, "could not create card\n");
		return error;
	}

	card->private_data = request_region(port[n], 4, CRD_NAME);
	if (!card->private_data) {
		dev_err(dev, "could not grab ports\n");
		error = -EBUSY;
		goto out;
	}
	card->private_free = snd_adlib_free;

	strcpy(card->driver, DEV_NAME);
	strcpy(card->shortname, CRD_NAME);
	sprintf(card->longname, CRD_NAME " at %#lx", port[n]);

	error = snd_opl3_create(card, port[n], port[n] + 2, OPL3_HW_AUTO, 1, &opl3);
	if (error < 0) {
		dev_err(dev, "could not create OPL\n");
		goto out;
	}

	error = snd_opl3_hwdep_new(opl3, 0, 0, NULL);
	if (error < 0) {
		dev_err(dev, "could not create FM\n");
		goto out;
	}

	snd_card_set_dev(card, dev);

	error = snd_card_register(card);
	if (error < 0) {
		dev_err(dev, "could not register card\n");
		goto out;
	}

	dev_set_drvdata(dev, card);
	return 0;

out:	snd_card_free(card);
	return error;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:50,代码来源:adlib.c


示例15: snd_card_pcsp_probe

static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
{
	struct snd_card *card;
	int err;

	if (devnum != 0)
		return -EINVAL;

	hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	pcsp_chip.timer.function = pcsp_do_timer;

	err = snd_card_create(index, id, THIS_MODULE, 0, &card);
	if (err < 0)
		return err;

	err = snd_pcsp_create(card);
	if (err < 0) {
		snd_card_free(card);
		return err;
	}
	if (!nopcm) {
		err = snd_pcsp_new_pcm(&pcsp_chip);
		if (err < 0) {
			snd_card_free(card);
			return err;
		}
	}
	err = snd_pcsp_new_mixer(&pcsp_chip, nopcm);
	if (err < 0) {
		snd_card_free(card);
		return err;
	}

	snd_card_set_dev(pcsp_chip.card, dev);

	strcpy(card->driver, "PC-Speaker");
	strcpy(card->shortname, "pcsp");
	sprintf(card->longname, "Internal PC-Speaker at port 0x%x",
		pcsp_chip.port);

	err = snd_card_register(card);
	if (err < 0) {
		snd_card_free(card);
		return err;
	}

	return 0;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:48,代码来源:pcsp.c


示例16: snd_ad1848_probe

static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
{
	struct snd_card *card;
	struct snd_wss *chip;
	struct snd_pcm *pcm;
	int error;

	error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
	if (error < 0)
		return error;

	error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1,
			thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT,
			0, &chip);
	if (error < 0)
		goto out;

	card->private_data = chip;

	error = snd_wss_pcm(chip, 0, &pcm);
	if (error < 0)
		goto out;

	error = snd_wss_mixer(chip);
	if (error < 0)
		goto out;

	strcpy(card->driver, "AD1848");
	strcpy(card->shortname, pcm->name);

	sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
		pcm->name, chip->port, irq[n], dma1[n]);
	if (thinkpad[n])
		strcat(card->longname, " [Thinkpad]");

	snd_card_set_dev(card, dev);

	error = snd_card_register(card);
	if (error < 0)
		goto out;

	dev_set_drvdata(dev, card);
	return 0;

out:	snd_card_free(card);
	return error;
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:47,代码来源:ad1848.c


示例17: snd_aica_probe

static int __devinit snd_aica_probe(struct platform_device *devptr)
{
	int err;
	struct snd_card_aica *dreamcastcard;
	dreamcastcard = kmalloc(sizeof(struct snd_card_aica), GFP_KERNEL);
	if (unlikely(!dreamcastcard))
		return -ENOMEM;
	err = snd_card_create(index, SND_AICA_DRIVER, THIS_MODULE, 0,
			      &dreamcastcard->card);
	if (unlikely(err < 0)) {
		kfree(dreamcastcard);
		return err;
	}
	strcpy(dreamcastcard->card->driver, "snd_aica");
	strcpy(dreamcastcard->card->shortname, SND_AICA_DRIVER);
	strcpy(dreamcastcard->card->longname,
	       "Yamaha AICA Super Intelligent Sound Processor for SEGA Dreamcast");
	/* Prepare to use the queue */
	INIT_WORK(&(dreamcastcard->spu_dma_work), run_spu_dma);
	/* Load the PCM 'chip' */
	err = snd_aicapcmchip(dreamcastcard, 0);
	if (unlikely(err < 0))
		goto freedreamcast;
	snd_card_set_dev(dreamcastcard->card, &devptr->dev);
	dreamcastcard->timer.data = 0;
	dreamcastcard->channel = NULL;
	/* Add basic controls */
	err = add_aicamixer_controls(dreamcastcard);
	if (unlikely(err < 0))
		goto freedreamcast;
	/* Register the card with ALSA subsystem */
	err = snd_card_register(dreamcastcard->card);
	if (unlikely(err < 0))
		goto freedreamcast;
	platform_set_drvdata(devptr, dreamcastcard);
	aica_queue = create_workqueue(CARD_NAME);
	if (unlikely(!aica_queue))
		goto freedreamcast;
	snd_printk
	    ("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n");
	return 0;
      freedreamcast:
	snd_card_free(dreamcastcard->card);
	kfree(dreamcastcard);
	return err;
}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:46,代码来源:aica.c


示例18: vxpocket_attach

static int vxpocket_attach(struct pcmcia_device *p_dev)
{
	struct snd_card *card;
	struct snd_vxpocket *vxp;
	int i, err;

	/* find an empty slot from the card list */
	for (i = 0; i < SNDRV_CARDS; i++) {
		if (!(card_alloc & (1 << i)))
			break;
	}
	if (i >= SNDRV_CARDS) {
		snd_printk(KERN_ERR "vxpocket: too many cards found\n");
		return -EINVAL;
	}
	if (! enable[i])
		return -ENODEV; /* disabled explicitly */

	/* ok, create a card instance */
	err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
	if (err < 0) {
		snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
		return err;
	}

	vxp = snd_vxpocket_new(card, ibl[i]);
	if (! vxp) {
		snd_card_free(card);
		return -ENODEV;
	}
	card->private_data = vxp;

	vxp->index = i;
	card_alloc |= 1 << i;

	/* Chain drivers */
	vxp->link.next = NULL;

	vxp->link.handle = p_dev;
	vxp->link.state |= DEV_PRESENT | DEV_CONFIG_PENDING;
	p_dev->instance = &vxp->link;
	vxpocket_config(&vxp->link);

	return 0;
}
开发者ID:plbossart,项目名称:alsa-driver-build,代码行数:45,代码来源:vxpocket-2.6.16.c


示例19: loopback_probe

static int __devinit loopback_probe(struct platform_device *devptr)
{
	struct snd_card *card;
	struct loopback *loopback;
	int dev = devptr->id;
	int err;

	err = snd_card_create(index[dev], id[dev], THIS_MODULE,
			      sizeof(struct loopback), &card);
	if (err < 0)
		return err;
	loopback = card->private_data;

	if (pcm_substreams[dev] < 1)
		pcm_substreams[dev] = 1;
	if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS)
		pcm_substreams[dev] = MAX_PCM_SUBSTREAMS;
	
	loopback->card = card;
	mutex_init(&loopback->cable_lock);

	err = loopback_pcm_new(loopback, 0, pcm_substreams[dev]);
	if (err < 0)
		goto __nodev;
	err = loopback_pcm_new(loopback, 1, pcm_substreams[dev]);
	if (err < 0)
		goto __nodev;
	err = loopback_mixer_new(loopback, pcm_notify[dev] ? 1 : 0);
	if (err < 0)
		goto __nodev;
	loopback_proc_new(loopback, 0);
	loopback_proc_new(loopback, 1);
	strcpy(card->driver, "Loopback");
	strcpy(card->shortname, "Loopback");
	sprintf(card->longname, "Loopback %i", dev + 1);
	err = snd_card_register(card);
	if (!err) {
		platform_set_drvdata(devptr, card);
		return 0;
	}
      __nodev:
	snd_card_free(card);
	return err;
}
开发者ID:mjduddin,项目名称:B14CKB1RD_kernel_m8,代码行数:44,代码来源:aloop.c


示例20: line6_init_audio

/*
	Initialize the Line6 USB audio system.
*/
int line6_init_audio(struct usb_line6 *line6)
{
	static int dev;
	struct snd_card *card;
	int err;

	err = snd_card_create(line6_index[dev], line6_id[dev], THIS_MODULE, 0,
			      &card);
	if (err < 0)
		return err;

	line6->card = card;

	strcpy(card->driver, DRIVER_NAME);
	strcpy(card->shortname, "Line6-USB");
	sprintf(card->longname, "Line6 %s at USB %s", line6->properties->name,
		dev_name(line6->ifcdev));  /* 80 chars - see asound.h */
	return 0;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:22,代码来源:audio.c



注:本文中的snd_card_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snd_card_disconnect函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_BUG_ON函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap