NetBSD/sys/dev/spkrvar.h
pgoyette d020b0ddde Implement a common spkr_detach() function and call it from the
attachment-specific detach functions.  Returns EBUSY if the
device instance is busy, based on whether or not a sc->sc_inbuf
is allocated.  The buffer is malloc()d at spkropen time, and is
free()d in spkrclose().

Now we can actually implement the MODULE_CMD_FINI command and
unload the driver at will.

Addresses my PR kern/51785
2017-01-06 09:32:08 +00:00

29 lines
808 B
C

/* $NetBSD: spkrvar.h,v 1.6 2017/01/06 09:32:08 pgoyette Exp $ */
#ifndef _SYS_DEV_SPKRVAR_H
#define _SYS_DEV_SPKRVAR_H
#include <sys/module.h>
struct spkr_softc {
device_t sc_dev;
int sc_octave; /* currently selected octave */
int sc_whole; /* whole-note time at current tempo, in ticks */
int sc_value; /* whole divisor for note time, quarter note = 1 */
int sc_fill; /* controls spacing of notes */
bool sc_octtrack; /* octave-tracking on? */
bool sc_octprefix; /* override current octave-tracking state? */
char *sc_inbuf;
/* attachment-specific hooks */
void (*sc_tone)(device_t, u_int, u_int);
void (*sc_rest)(device_t, int);
};
void spkr_attach(device_t,
void (*)(device_t, u_int, u_int), void (*)(device_t, int));
int spkr_detach(device_t, int);
#endif /* _SYS_DEV_SPKRVAR_H */