diff options
author | cg <cg@FreeBSD.org> | 2000-12-18 01:36:41 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2000-12-18 01:36:41 +0000 |
commit | 2fae4aec24ea4529882b3ec4cda45661ccd48ea8 (patch) | |
tree | e7e32573ed48df98bed54daa386c3520e959e951 /sys/dev/sound/pcm/ac97.h | |
parent | 1fd2c926a884cc824e7da7ee1a51dad72b1dec5b (diff) | |
download | FreeBSD-src-2fae4aec24ea4529882b3ec4cda45661ccd48ea8.zip FreeBSD-src-2fae4aec24ea4529882b3ec4cda45661ccd48ea8.tar.gz |
kobjify.
this gives us several benefits, including:
* easier extensibility- new optional methods can be added to
ac97/mixer/channel classes without having to fixup every driver.
* forward compatibility for drivers, provided no new mandatory methods are
added.
Diffstat (limited to 'sys/dev/sound/pcm/ac97.h')
-rw-r--r-- | sys/dev/sound/pcm/ac97.h | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/sys/dev/sound/pcm/ac97.h b/sys/dev/sound/pcm/ac97.h index 1305424..6f36761 100644 --- a/sys/dev/sound/pcm/ac97.h +++ b/sys/dev/sound/pcm/ac97.h @@ -63,15 +63,35 @@ #define AC97_REG_ID1 0x7c #define AC97_REG_ID2 0x7e -typedef u_int32_t (ac97_init)(void *devinfo); -typedef u_int32_t (ac97_read)(void *devinfo, int regno); -typedef void (ac97_write)(void *devinfo, int regno, u_int32_t data); +struct ac97mixtable_entry { + int reg:8; + unsigned bits:4; + unsigned ofs:4; + unsigned stereo:1; + unsigned mute:1; + unsigned recidx:4; + unsigned mask:1; + unsigned enable:1; +}; -extern snd_mixer ac97_mixer; -struct ac97_info; +#define AC97_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) +#define AC97_CREATE(dev, devinfo, cls) ac97_create(dev, devinfo, &cls ## _class) -struct ac97_info *ac97_create(device_t dev, void *devinfo, ac97_init *init, - ac97_read *rd, ac97_write *wr); +struct ac97_info { + kobj_t methods; + device_t dev; + void *devinfo; + char *name; + char rev; + unsigned count, caps, se, extcaps, extid, extstat, noext:1; + struct ac97mixtable_entry mix[32]; +}; + +#include "ac97_if.h" + +extern kobj_class_t ac97_getmixerclass(void); + +struct ac97_info *ac97_create(device_t dev, void *devinfo, kobj_class_t cls); void ac97_destroy(struct ac97_info *codec); int ac97_setrate(struct ac97_info *codec, int which, int rate); int ac97_setextmode(struct ac97_info *codec, u_int16_t mode); |