aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pcm/sound.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sound/pcm/sound.h')
-rw-r--r--sys/dev/sound/pcm/sound.h136
1 files changed, 10 insertions, 126 deletions
diff --git a/sys/dev/sound/pcm/sound.h b/sys/dev/sound/pcm/sound.h
index 6bd435d0ea25..3ba6eb3692ee 100644
--- a/sys/dev/sound/pcm/sound.h
+++ b/sys/dev/sound/pcm/sound.h
@@ -76,10 +76,6 @@
#include <sys/mutex.h>
#include <sys/condvar.h>
-#ifndef KOBJMETHOD_END
-#define KOBJMETHOD_END { NULL, NULL }
-#endif
-
struct pcm_channel;
struct pcm_feeder;
struct snd_dbuf;
@@ -137,8 +133,8 @@ struct snd_mixer;
"\015PVCHANS" \
"\016RVCHANS"
-#define PCM_ALIVE(x) ((x) != NULL && (x)->lock != NULL)
-#define PCM_REGISTERED(x) (PCM_ALIVE(x) && ((x)->flags & SD_F_REGISTERED))
+#define PCM_REGISTERED(x) \
+ ((x) != NULL && ((x)->flags & SD_F_REGISTERED))
#define PCM_MAXCHANS 10000
#define PCM_CHANCOUNT(d) \
@@ -148,8 +144,6 @@ struct snd_mixer;
#define RANGE(var, low, high) (var) = \
(((var)<(low))? (low) : ((var)>(high))? (high) : (var))
-#define DSP_DEFAULT_SPEED 8000
-
extern int snd_unit;
extern int snd_verbose;
extern devclass_t pcm_devclass;
@@ -173,12 +167,6 @@ void *pcm_getdevinfo(device_t dev);
int snd_setup_intr(device_t dev, struct resource *res, int flags,
driver_intr_t hand, void *param, void **cookiep);
-void *snd_mtxcreate(const char *desc, const char *type);
-void snd_mtxfree(void *m);
-void snd_mtxassert(void *m);
-#define snd_mtxlock(m) mtx_lock(m)
-#define snd_mtxunlock(m) mtx_unlock(m)
-
int sndstat_register(device_t dev, char *str);
int sndstat_unregister(device_t dev);
@@ -186,7 +174,6 @@ int sndstat_unregister(device_t dev);
enum {
SCF_PCM,
SCF_MIDI,
- SCF_SYNTH,
};
/*
@@ -225,7 +212,7 @@ struct snddev_info {
void *devinfo;
device_t dev;
char status[SND_STATUSLEN];
- struct mtx *lock;
+ struct mtx lock;
struct cdev *mixer_dev;
struct cdev *dsp_dev;
uint32_t pvchanrate, pvchanformat, pvchanmode;
@@ -247,123 +234,21 @@ int sound_oss_card_info(oss_card_info *);
#define PCM_MODE_PLAY 0x02
#define PCM_MODE_REC 0x04
-#define PCM_LOCKOWNED(d) mtx_owned((d)->lock)
-#define PCM_LOCK(d) mtx_lock((d)->lock)
-#define PCM_UNLOCK(d) mtx_unlock((d)->lock)
-#define PCM_TRYLOCK(d) mtx_trylock((d)->lock)
-#define PCM_LOCKASSERT(d) mtx_assert((d)->lock, MA_OWNED)
-#define PCM_UNLOCKASSERT(d) mtx_assert((d)->lock, MA_NOTOWNED)
+#define PCM_LOCKOWNED(d) mtx_owned(&(d)->lock)
+#define PCM_LOCK(d) mtx_lock(&(d)->lock)
+#define PCM_UNLOCK(d) mtx_unlock(&(d)->lock)
+#define PCM_TRYLOCK(d) mtx_trylock(&(d)->lock)
+#define PCM_LOCKASSERT(d) mtx_assert(&(d)->lock, MA_OWNED)
+#define PCM_UNLOCKASSERT(d) mtx_assert(&(d)->lock, MA_NOTOWNED)
/*
* For PCM_[WAIT | ACQUIRE | RELEASE], be sure to surround these
* with PCM_LOCK/UNLOCK() sequence, or I'll come to gnaw upon you!
*/
-#ifdef SND_DIAGNOSTIC
-#define PCM_WAIT(x) do { \
- if (!PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM WAIT] Mutex not owned!", \
- __func__, __LINE__); \
- while ((x)->flags & SD_F_BUSY) { \
- if (snd_verbose > 3) \
- device_printf((x)->dev, \
- "%s(%d): [PCM WAIT] calling cv_wait().\n", \
- __func__, __LINE__); \
- cv_wait(&(x)->cv, (x)->lock); \
- } \
-} while (0)
-
-#define PCM_ACQUIRE(x) do { \
- if (!PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM ACQUIRE] Mutex not owned!", \
- __func__, __LINE__); \
- if ((x)->flags & SD_F_BUSY) \
- panic("%s(%d): [PCM ACQUIRE] " \
- "Trying to acquire BUSY cv!", __func__, __LINE__); \
- (x)->flags |= SD_F_BUSY; \
-} while (0)
-
-#define PCM_RELEASE(x) do { \
- if (!PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM RELEASE] Mutex not owned!", \
- __func__, __LINE__); \
- if ((x)->flags & SD_F_BUSY) { \
- (x)->flags &= ~SD_F_BUSY; \
- cv_broadcast(&(x)->cv); \
- } else \
- panic("%s(%d): [PCM RELEASE] Releasing non-BUSY cv!", \
- __func__, __LINE__); \
-} while (0)
-
-/* Quick version, for shorter path. */
-#define PCM_ACQUIRE_QUICK(x) do { \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM ACQUIRE QUICK] Mutex owned!", \
- __func__, __LINE__); \
- PCM_LOCK(x); \
- PCM_WAIT(x); \
- PCM_ACQUIRE(x); \
- PCM_UNLOCK(x); \
-} while (0)
-
-#define PCM_RELEASE_QUICK(x) do { \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [PCM RELEASE QUICK] Mutex owned!", \
- __func__, __LINE__); \
- PCM_LOCK(x); \
- PCM_RELEASE(x); \
- PCM_UNLOCK(x); \
-} while (0)
-
-#define PCM_BUSYASSERT(x) do { \
- if (!((x) != NULL && ((x)->flags & SD_F_BUSY))) \
- panic("%s(%d): [PCM BUSYASSERT] " \
- "Failed, snddev_info=%p", __func__, __LINE__, x); \
-} while (0)
-
-#define PCM_GIANT_ENTER(x) do { \
- int _pcm_giant = 0; \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [GIANT ENTER] PCM lock owned!", \
- __func__, __LINE__); \
- if (mtx_owned(&Giant) != 0 && snd_verbose > 3) \
- device_printf((x)->dev, \
- "%s(%d): [GIANT ENTER] Giant owned!\n", \
- __func__, __LINE__); \
- if (!((x)->flags & SD_F_MPSAFE) && mtx_owned(&Giant) == 0) \
- do { \
- mtx_lock(&Giant); \
- _pcm_giant = 1; \
- } while (0)
-
-#define PCM_GIANT_EXIT(x) do { \
- if (PCM_LOCKOWNED(x)) \
- panic("%s(%d): [GIANT EXIT] PCM lock owned!", \
- __func__, __LINE__); \
- if (!(_pcm_giant == 0 || _pcm_giant == 1)) \
- panic("%s(%d): [GIANT EXIT] _pcm_giant screwed!", \
- __func__, __LINE__); \
- if ((x)->flags & SD_F_MPSAFE) { \
- if (_pcm_giant == 1) \
- panic("%s(%d): [GIANT EXIT] MPSAFE Giant?", \
- __func__, __LINE__); \
- if (mtx_owned(&Giant) != 0 && snd_verbose > 3) \
- device_printf((x)->dev, \
- "%s(%d): [GIANT EXIT] Giant owned!\n", \
- __func__, __LINE__); \
- } \
- if (_pcm_giant != 0) { \
- if (mtx_owned(&Giant) == 0) \
- panic("%s(%d): [GIANT EXIT] Giant not owned!", \
- __func__, __LINE__); \
- _pcm_giant = 0; \
- mtx_unlock(&Giant); \
- } \
-} while (0)
-#else /* !SND_DIAGNOSTIC */
#define PCM_WAIT(x) do { \
PCM_LOCKASSERT(x); \
while ((x)->flags & SD_F_BUSY) \
- cv_wait(&(x)->cv, (x)->lock); \
+ cv_wait(&(x)->cv, &(x)->lock); \
} while (0)
#define PCM_ACQUIRE(x) do { \
@@ -429,7 +314,6 @@ int sound_oss_card_info(oss_card_info *);
mtx_unlock(&Giant); \
} \
} while (0)
-#endif /* SND_DIAGNOSTIC */
#define PCM_GIANT_LEAVE(x) \
PCM_GIANT_EXIT(x); \