本文整理汇总了C++中snd_device_free函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_device_free函数的具体用法?C++ snd_device_free怎么用?C++ snd_device_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了snd_device_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: snd_opl3_create
int snd_opl3_create(struct snd_card *card,
unsigned long l_port,
unsigned long r_port,
unsigned short hardware,
int integrated,
struct snd_opl3 ** ropl3)
{
struct snd_opl3 *opl3;
int err;
*ropl3 = NULL;
if ((err = snd_opl3_new(card, hardware, &opl3)) < 0)
return err;
if (! integrated) {
if ((opl3->res_l_port = request_region(l_port, 2, "OPL2/3 (left)")) == NULL) {
snd_mprintk(KERN_ERR "opl3: can't grab left port 0x%lx\n", l_port); // MJR
snd_device_free(card, opl3);
return -EBUSY;
}
if (r_port != 0 &&
(opl3->res_r_port = request_region(r_port, 2, "OPL2/3 (right)")) == NULL) {
snd_mprintk(KERN_ERR "opl3: can't grab right port 0x%lx\n", r_port); // MJR
snd_device_free(card, opl3);
return -EBUSY;
}
}
opl3->l_port = l_port;
opl3->r_port = r_port;
switch (opl3->hardware) {
/* some hardware doesn't support timers */
case OPL3_HW_OPL3_SV:
case OPL3_HW_OPL3_CS:
case OPL3_HW_OPL3_FM801:
opl3->command = &snd_opl3_command;
break;
default:
opl3->command = &snd_opl2_command;
if ((err = snd_opl3_detect(opl3)) < 0) {
snd_printd("OPL2/3 chip not detected at 0x%lx/0x%lx\n",
opl3->l_port, opl3->r_port);
snd_device_free(card, opl3);
return err;
}
/* detect routine returns correct hardware type */
switch (opl3->hardware & OPL3_HW_MASK) {
case OPL3_HW_OPL3:
case OPL3_HW_OPL4:
opl3->command = &snd_opl3_command;
}
}
snd_opl3_init(opl3);
*ropl3 = opl3;
return 0;
}
示例2: snd_gf1_timers_done
void snd_gf1_timers_done(snd_gus_card_t * gus)
{
snd_gf1_set_default_handlers(gus, SNDRV_GF1_HANDLER_TIMER1 | SNDRV_GF1_HANDLER_TIMER2);
if (gus->gf1.timer1) {
snd_device_free(gus->card, gus->gf1.timer1);
gus->gf1.timer1 = NULL;
}
if (gus->gf1.timer2) {
snd_device_free(gus->card, gus->gf1.timer2);
gus->gf1.timer2 = NULL;
}
}
示例3: snd_gus_free
static int snd_gus_free(struct snd_gus_card *gus)
{
if (gus->gf1.res_port2 == NULL)
goto __hw_end;
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
if (gus->seq_dev) {
snd_device_free(gus->card, gus->seq_dev);
gus->seq_dev = NULL;
}
#endif
snd_gf1_stop(gus);
snd_gus_init_dma_irq(gus, 0);
__hw_end:
release_and_free_resource(gus->gf1.res_port1);
release_and_free_resource(gus->gf1.res_port2);
if (gus->gf1.irq >= 0)
free_irq(gus->gf1.irq, (void *) gus);
if (gus->gf1.dma1 >= 0) {
disable_dma(gus->gf1.dma1);
free_dma(gus->gf1.dma1);
}
if (!gus->equal_dma && gus->gf1.dma2 >= 0) {
disable_dma(gus->gf1.dma2);
free_dma(gus->gf1.dma2);
}
kfree(gus);
return 0;
}
示例4: snd_pcm_timer_init
void snd_pcm_timer_init(struct snd_pcm_substream *substream)
{
struct snd_timer_id tid;
struct snd_timer *timer;
tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE;
tid.dev_class = SNDRV_TIMER_CLASS_PCM;
tid.card = substream->pcm->card->number;
tid.device = substream->pcm->device;
tid.subdevice = (substream->number << 1) | (substream->stream & 1);
if (snd_timer_new(substream->pcm->card, "PCM", &tid, &timer) < 0)
return;
sprintf(timer->name, "PCM %s %i-%i-%i",
substream->stream == SNDRV_PCM_STREAM_CAPTURE ?
"capture" : "playback",
tid.card, tid.device, tid.subdevice);
timer->hw = snd_pcm_timer;
if (snd_device_register(timer->card, timer) < 0) {
snd_device_free(timer->card, timer);
return;
}
timer->private_data = substream;
timer->private_free = snd_pcm_timer_free;
substream->timer = timer;
}
示例5: snd_hda_eld_proc_free
void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld)
{
if (!codec->bus->shutdown && eld->proc_entry) {
snd_device_free(codec->bus->card, eld->proc_entry);
eld->proc_entry = NULL;
}
}
示例6: snd_opl3_hwdep_new
int snd_opl3_hwdep_new(struct snd_opl3 * opl3,
int device, int seq_device,
struct snd_hwdep ** rhwdep)
{
struct snd_hwdep *hw;
struct snd_card *card = opl3->card;
int err;
if (rhwdep)
*rhwdep = NULL;
/* create hardware dependent device (direct FM) */
if ((err = snd_hwdep_new(card, "OPL2/OPL3", device, &hw)) < 0) {
snd_device_free(card, opl3);
return err;
}
hw->private_data = opl3;
hw->exclusive = 1;
#ifdef CONFIG_SND_OSSEMUL
if (device == 0) {
hw->oss_type = SNDRV_OSS_DEVICE_TYPE_DMFM;
sprintf(hw->oss_dev, "dmfm%i", card->number);
}
#endif
strcpy(hw->name, hw->id);
switch (opl3->hardware & OPL3_HW_MASK) {
case OPL3_HW_OPL2:
strcpy(hw->name, "OPL2 FM");
hw->iface = SNDRV_HWDEP_IFACE_OPL2;
break;
case OPL3_HW_OPL3:
strcpy(hw->name, "OPL3 FM");
hw->iface = SNDRV_HWDEP_IFACE_OPL3;
break;
case OPL3_HW_OPL4:
strcpy(hw->name, "OPL4 FM");
hw->iface = SNDRV_HWDEP_IFACE_OPL4;
break;
}
/* operators - only ioctl */
hw->ops.open = snd_opl3_open;
hw->ops.ioctl = snd_opl3_ioctl;
hw->ops.write = snd_opl3_write;
hw->ops.release = snd_opl3_release;
opl3->hwdep = hw;
opl3->seq_dev_num = seq_device;
#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
if (snd_seq_device_new(card, seq_device, SNDRV_SEQ_DEV_ID_OPL3,
sizeof(struct snd_opl3 *), &opl3->seq_dev) >= 0) {
strcpy(opl3->seq_dev->name, hw->name);
*(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(opl3->seq_dev) = opl3;
}
#endif
if (rhwdep)
*rhwdep = hw;
return 0;
}
示例7: snd_pcm_timer_done
void snd_pcm_timer_done(struct snd_pcm_substream *substream)
{
if (substream->timer) {
snd_device_free(substream->pcm->card, substream->timer);
substream->timer = NULL;
}
}
示例8: snd_emux_detach_seq_oss
/*
* unregister
*/
void
snd_emux_detach_seq_oss(struct snd_emux *emu)
{
if (emu->oss_synth) {
snd_device_free(emu->card, emu->oss_synth);
emu->oss_synth = NULL;
}
}
示例9: snd_emux_delete_hwdep
/*
* unregister
*/
void
snd_emux_delete_hwdep(struct snd_emux *emu)
{
if (emu->hwdep) {
snd_device_free(emu->card, emu->hwdep);
emu->hwdep = NULL;
}
}
示例10: snd_bcm2835_dev_free
/* component-destructor
* (see "Management of Cards and Components")
*/
static int snd_bcm2835_dev_free(struct snd_device *device)
{
struct bcm2835_chip *chip = device->device_data;
struct snd_card *card = chip->card;
/* TODO: free pcm, ctl */
snd_device_free(card, chip);
return 0;
}
示例11: snd_emux_delete_virmidi
int snd_emux_delete_virmidi(snd_emux_t *emu)
{
int i;
if (emu->vmidi == NULL)
return 0;
for (i = 0; i < emu->midi_ports; i++) {
if (emu->vmidi[i])
snd_device_free(emu->card, emu->vmidi[i]);
}
kfree(emu->vmidi);
emu->vmidi = NULL;
return 0;
}
示例12: snd_hda_jack_tbl_clear
void snd_hda_jack_tbl_clear(struct hda_codec *codec)
{
#ifdef CONFIG_SND_HDA_INPUT_JACK
/* free jack instances manually when clearing/reconfiguring */
if (!codec->bus->shutdown && codec->jacktbl.list) {
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i;
for (i = 0; i < codec->jacktbl.used; i++, jack++) {
if (jack->jack)
snd_device_free(codec->bus->card, jack->jack);
}
}
#endif
snd_array_free(&codec->jacktbl);
}
示例13: snd_opl3_timer_new
int snd_opl3_timer_new(struct snd_opl3 * opl3, int timer1_dev, int timer2_dev)
{
int err;
if (timer1_dev >= 0)
if ((err = snd_opl3_timer1_init(opl3, timer1_dev)) < 0)
return err;
if (timer2_dev >= 0) {
if ((err = snd_opl3_timer2_init(opl3, timer2_dev)) < 0) {
snd_device_free(opl3->card, opl3->timer1);
opl3->timer1 = NULL;
return err;
}
}
return 0;
}
示例14: snd_emu8000_delete_device
/*
* free all resources
*/
static int snd_emu8000_delete_device(struct snd_seq_device *dev)
{
struct snd_emu8000 *hw;
if (dev->driver_data == NULL)
return 0; /* no synth was allocated actually */
hw = dev->driver_data;
if (hw->pcm)
snd_device_free(dev->card, hw->pcm);
if (hw->emu)
snd_emux_free(hw->emu);
if (hw->memhdr)
snd_util_memhdr_free(hw->memhdr);
hw->emu = NULL;
hw->memhdr = NULL;
return 0;
}
示例15: snd_hda_jack_tbl_clear
void snd_hda_jack_tbl_clear(struct hda_codec *codec)
{
struct hda_jack_tbl *jack = codec->jacktbl.list;
int i;
for (i = 0; i < codec->jacktbl.used; i++, jack++) {
struct hda_jack_callback *cb, *next;
#ifdef CONFIG_SND_HDA_INPUT_JACK
/* free jack instances manually when clearing/reconfiguring */
if (!codec->bus->shutdown && jack->jack)
snd_device_free(codec->bus->card, jack->jack);
#endif
for (cb = jack->callback; cb; cb = next) {
next = cb->next;
kfree(cb);
}
}
snd_array_free(&codec->jacktbl);
}