void snd_gf1_timers_init(snd_gus_card_t * gus) { snd_timer_t *timer; snd_timer_id_t tid; if (gus->gf1.timer1 != NULL || gus->gf1.timer2 != NULL) return; gus->gf1.interrupt_handler_timer1 = snd_gf1_interrupt_timer1; gus->gf1.interrupt_handler_timer2 = snd_gf1_interrupt_timer2; tid.dev_class = SNDRV_TIMER_CLASS_CARD; tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; tid.card = gus->card->number; tid.device = gus->timer_dev; tid.subdevice = 0; if (snd_timer_new(gus->card, "GF1 timer", &tid, &timer) >= 0) { strcpy(timer->name, "GF1 timer #1"); timer->private_data = gus; timer->private_free = snd_gf1_timer1_free; timer->hw = snd_gf1_timer1; } gus->gf1.timer1 = timer; tid.device++; if (snd_timer_new(gus->card, "GF1 timer", &tid, &timer) >= 0) { strcpy(timer->name, "GF1 timer #2"); timer->private_data = gus; timer->private_free = snd_gf1_timer2_free; timer->hw = snd_gf1_timer2; } gus->gf1.timer2 = timer; }
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; }
int __devinit snd_emu10k1_timer(struct snd_emu10k1 *emu, int device) { struct snd_timer *timer = NULL; struct snd_timer_id tid; int err; tid.dev_class = SNDRV_TIMER_CLASS_CARD; tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; tid.card = emu->card->number; tid.device = device; tid.subdevice = 0; if ((err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer)) >= 0) { strcpy(timer->name, "EMU10K1 timer"); timer->private_data = emu; timer->hw = snd_emu10k1_timer_hw; } emu->timer = timer; return err; }
/* static MJR */ int snd_opl3_timer2_init(struct snd_opl3 * opl3, int timer_no) { struct snd_timer *timer = NULL; struct snd_timer_id tid; int err; tid.dev_class = SNDRV_TIMER_CLASS_CARD; tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; tid.card = opl3->card->number; tid.device = timer_no; tid.subdevice = 0; if ((err = snd_timer_new(opl3->card, "AdLib timer #2", &tid, &timer)) >= 0) { strcpy(timer->name, "AdLib timer #2"); timer->private_data = opl3; timer->hw = snd_opl3_timer2; } opl3->timer2 = timer; return err; }
int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer) { struct snd_timer *timer; struct snd_timer_id tid; int error; tid.dev_class = SNDRV_TIMER_CLASS_CARD; tid.dev_sclass = SNDRV_TIMER_SCLASS_NONE; tid.card = chip->card->number; tid.device = device; tid.subdevice = 0; if ((error = snd_timer_new(chip->card, "AD1816A", &tid, &timer)) < 0) return error; strcpy(timer->name, snd_ad1816a_chip_id(chip)); timer->private_data = chip; chip->timer = timer; timer->hw = snd_ad1816a_timer_table; if (rtimer) *rtimer = timer; return 0; }