Lines Matching defs:d
99 struct snddev_info *d;
103 d = device_get_softc(dev);
104 if (d != NULL && (flags & INTR_MPSAFE))
105 d->flags |= SD_F_MPSAFE;
111 pcm_chnalloc(struct snddev_info *d, struct pcm_channel **ch, int direction,
118 KASSERT(d != NULL && ch != NULL &&
120 ("%s(): invalid d=%p ch=%p direction=%d pid=%d",
121 __func__, d, ch, direction, pid));
122 PCM_BUSYASSERT(d);
125 vchancount = (direction == PCMDIR_PLAY) ? d->pvchancount :
126 d->rvchancount;
131 CHN_FOREACH(c, d, channels.pcm) {
157 err = vchan_setnew(d, direction, vchancount + 1);
169 struct snddev_info *d;
175 d = devclass_get_softc(pcm_devclass, unit);
176 if (!PCM_REGISTERED(d) || CHN_EMPTY(d, channels.pcm))
192 struct snddev_info *d = device_get_softc(dev);
195 PCM_BUSYASSERT(d);
197 PCM_LOCK(d);
198 ch = chn_init(d, NULL, cls, dir, devinfo);
200 device_printf(d->dev, "chn_init(%s, %d, %p) failed\n",
202 PCM_UNLOCK(d);
205 PCM_UNLOCK(d);
211 pcm_killchans(struct snddev_info *d)
216 PCM_BUSYASSERT(d);
217 KASSERT(!PCM_REGISTERED(d), ("%s(): still registered\n", __func__));
222 CHN_FOREACH(ch, d, channels.pcm) {
248 while (!CHN_EMPTY(d, channels.pcm)) {
249 ch = CHN_FIRST(d, channels.pcm);
253 if (d->p_unr != NULL)
254 delete_unrhdr(d->p_unr);
255 if (d->vp_unr != NULL)
256 delete_unrhdr(d->vp_unr);
257 if (d->r_unr != NULL)
258 delete_unrhdr(d->r_unr);
259 if (d->vr_unr != NULL)
260 delete_unrhdr(d->vr_unr);
266 struct snddev_info *d;
273 d = devclass_get_softc(pcm_devclass, i);
274 if (!PCM_REGISTERED(d))
277 if (d->playcount == 0)
279 if (d->reccount == 0)
292 struct snddev_info *d = device_get_softc(dev);
294 return d->flags;
300 struct snddev_info *d = device_get_softc(dev);
302 d->flags = val;
308 struct snddev_info *d = device_get_softc(dev);
310 return d->devinfo;
316 struct snddev_info *d = device_get_softc(dev);
324 device_printf(dev, "'buffersize=%d' hint is out of range (%d-%d), using %d\n", x, minbufsz, maxbufsz, sz);
331 device_printf(dev, "'buffersize=%d' hint is not a power of 2, using %d\n", sz, x);
338 d->bufsz = sz;
346 struct snddev_info *d;
349 d = oidp->oid_arg1;
350 if (!PCM_REGISTERED(d))
353 PCM_LOCK(d);
354 PCM_WAIT(d);
355 val = (d->flags & SD_F_BITPERFECT) ? 1 : 0;
356 PCM_ACQUIRE(d);
357 PCM_UNLOCK(d);
363 PCM_RELEASE_QUICK(d);
367 PCM_LOCK(d);
369 d->flags &= ~SD_F_BITPERFECT;
370 d->flags |= (val != 0) ? SD_F_BITPERFECT : 0;
372 PCM_RELEASE(d);
373 PCM_UNLOCK(d);
375 PCM_RELEASE_QUICK(d);
381 pcm_mode_init(struct snddev_info *d)
385 if (d->playcount > 0)
387 if (d->reccount > 0)
389 if (d->mixer_dev != NULL)
398 struct snddev_info *d = device_get_softc(dev);
401 mode = pcm_mode_init(d);
403 sysctl_ctx_init(&d->play_sysctl_ctx);
404 d->play_sysctl_tree = SYSCTL_ADD_NODE(&d->play_sysctl_ctx,
407 sysctl_ctx_init(&d->rec_sysctl_ctx);
408 d->rec_sysctl_tree = SYSCTL_ADD_NODE(&d->rec_sysctl_ctx,
416 OID_AUTO, "buffersize", CTLFLAG_RD, &d->bufsz, 0, "allocated buffer size");
419 "bitperfect", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, d,
420 sizeof(d), sysctl_dev_pcm_bitperfect, "I",
427 if (d->flags & SD_F_AUTOVCHAN)
429 if (d->flags & SD_F_EQ)
440 struct snddev_info *d;
443 d = device_get_softc(dev);
444 d->dev = dev;
445 d->lock = snd_mtxcreate(device_get_nameunit(dev), "sound cdev");
446 cv_init(&d->cv, device_get_nameunit(dev));
447 PCM_ACQUIRE_QUICK(d);
452 d->flags |= SD_F_VPC;
456 d->flags |= SD_F_BITPERFECT;
458 d->devinfo = devinfo;
459 d->reccount = 0;
460 d->playcount = 0;
461 d->pvchancount = 0;
462 d->rvchancount = 0;
463 d->pvchanrate = 0;
464 d->pvchanformat = 0;
465 d->rvchanrate = 0;
466 d->rvchanformat = 0;
467 d->p_unr = new_unrhdr(0, INT_MAX, NULL);
468 d->vp_unr = new_unrhdr(0, INT_MAX, NULL);
469 d->r_unr = new_unrhdr(0, INT_MAX, NULL);
470 d->vr_unr = new_unrhdr(0, INT_MAX, NULL);
472 CHN_INIT(d, channels.pcm);
473 CHN_INIT(d, channels.pcm.busy);
474 CHN_INIT(d, channels.pcm.opened);
480 struct snddev_info *d = device_get_softc(dev);
483 if (d->flags & SD_F_REGISTERED)
486 PCM_BUSYASSERT(d);
488 if (d->playcount == 0 || d->reccount == 0)
489 d->flags |= SD_F_SIMPLEX;
491 if (d->playcount > 0 || d->reccount > 0)
492 d->flags |= SD_F_AUTOVCHAN;
494 vchan_setmaxauto(d, snd_maxautovchans);
496 strlcpy(d->status, str, SND_STATUSLEN);
497 sndstat_register(dev, d->status);
499 PCM_LOCK(d);
502 d->flags |= SD_F_REGISTERED;
504 PCM_RELEASE(d);
506 PCM_UNLOCK(d);
527 struct snddev_info *d;
529 d = device_get_softc(dev);
531 if (!PCM_ALIVE(d)) {
536 PCM_LOCK(d);
537 PCM_WAIT(d);
539 d->flags &= ~SD_F_REGISTERED;
541 PCM_ACQUIRE(d);
542 PCM_UNLOCK(d);
544 pcm_killchans(d);
546 PCM_RELEASE_QUICK(d);
548 if (d->play_sysctl_tree != NULL) {
549 sysctl_ctx_free(&d->play_sysctl_ctx);
550 d->play_sysctl_tree = NULL;
552 if (d->rec_sysctl_tree != NULL) {
553 sysctl_ctx_free(&d->rec_sysctl_ctx);
554 d->rec_sysctl_tree = NULL;
561 cv_destroy(&d->cv);
562 snd_mtxfree(d->lock);
600 struct snddev_info *d;
621 d = devclass_get_softc(pcm_devclass, i);
622 if (!PCM_REGISTERED(d))
628 PCM_UNLOCKASSERT(d);
629 PCM_LOCK(d);
631 si->numaudioengines += PCM_CHANCOUNT(d);
633 CHN_FOREACH(c, d, channels.pcm) {
643 PCM_UNLOCK(d);
690 struct snddev_info *d;
695 d = devclass_get_softc(pcm_devclass, i);
699 if (!PCM_REGISTERED(d)) {
701 "pcm%d (n/a)", i);
707 PCM_UNLOCKASSERT(d);
708 PCM_LOCK(d);
710 strlcpy(si->shortname, device_get_nameunit(d->dev),
712 strlcpy(si->longname, device_get_desc(d->dev),
714 strlcpy(si->hw_info, d->status, sizeof(si->hw_info));
717 PCM_UNLOCK(d);
762 printf("%s: snd_unit=%d snd_maxautovchans=%d "
763 "latency=%d "
764 "feeder_rate_min=%d feeder_rate_max=%d "
765 "feeder_rate_round=%d\n",