FreeBSD kernel sound device code
gusc.c File Reference
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <machine/resource.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <dev/sound/pcm/sound.h>
#include <dev/sound/chip.h>
#include "bus_if.h"
#include <isa/isavar.h>
#include <isa/isa_common.h>
Include dependency graph for gusc.c:

Go to the source code of this file.

Data Structures

struct  gusc_ihandler
 
struct  gusc_softc
 

Macros

#define LOGICALID_NOPNP   0
 
#define LOGICALID_PCM   0x0000561e
 
#define LOGICALID_OPL   0x0300561e
 
#define LOGICALID_MIDI   0x0400561e
 

Typedefs

typedef struct gusc_softcsc_p
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static int gusc_probe (device_t dev)
 
static int gusc_attach (device_t dev)
 
static int gusisa_probe (device_t dev)
 
static void gusc_intr (void *)
 
static struct resource * gusc_alloc_resource (device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
 
static int gusc_release_resource (device_t bus, device_t child, int type, int rid, struct resource *r)
 
static device_t find_masterdev (sc_p scp)
 
static int alloc_resource (sc_p scp)
 
static int release_resource (sc_p scp)
 
static void port_wr (struct resource *r, int i, unsigned char v)
 
static int port_rd (struct resource *r, int i)
 
static int gusc_setup_intr (device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
 
 DRIVER_MODULE (snd_gusc, isa, gusc_driver, gusc_devclass, 0, 0)
 
 DRIVER_MODULE (snd_gusc, acpi, gusc_driver, gusc_devclass, 0, 0)
 
 MODULE_DEPEND (snd_gusc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_gusc, 1)
 
 ISA_PNP_INFO (gusc_ids)
 

Variables

static struct isa_pnp_id gusc_ids []
 
static devclass_t gusc_devclass
 
static int io_range [3] = {0x10, 0x8 , 0x4 }
 
static int io_offset [3] = {0x0 , 0x100, 0x10c}
 
static device_method_t gusc_methods []
 
static driver_t gusc_driver
 

Macro Definition Documentation

◆ LOGICALID_MIDI

#define LOGICALID_MIDI   0x0400561e

Definition at line 56 of file gusc.c.

◆ LOGICALID_NOPNP

#define LOGICALID_NOPNP   0

Definition at line 53 of file gusc.c.

◆ LOGICALID_OPL

#define LOGICALID_OPL   0x0300561e

Definition at line 55 of file gusc.c.

◆ LOGICALID_PCM

#define LOGICALID_PCM   0x0000561e

Definition at line 54 of file gusc.c.

Typedef Documentation

◆ sc_p

typedef struct gusc_softc* sc_p

Definition at line 89 of file gusc.c.

Function Documentation

◆ alloc_resource()

static int alloc_resource ( sc_p  scp)
static

◆ DRIVER_MODULE() [1/2]

DRIVER_MODULE ( snd_gusc  ,
acpi  ,
gusc_driver  ,
gusc_devclass  ,
,
 
)

◆ DRIVER_MODULE() [2/2]

DRIVER_MODULE ( snd_gusc  ,
isa  ,
gusc_driver  ,
gusc_devclass  ,
,
 
)

◆ find_masterdev()

static device_t find_masterdev ( sc_p  scp)
static

Definition at line 452 of file gusc.c.

References gusc_softc::dev, dev, and LOGICALID_PCM.

Referenced by alloc_resource(), and release_resource().

Here is the caller graph for this function:

◆ gusc_alloc_resource()

static struct resource * gusc_alloc_resource ( device_t  bus,
device_t  child,
int  type,
int *  rid,
rman_res_t  start,
rman_res_t  end,
rman_res_t  count,
u_int  flags 
)
static

◆ gusc_attach()

static int gusc_attach ( device_t  dev)
static

Definition at line 306 of file gusc.c.

References alloc_resource(), gusc_softc::dev, dev, gusc_intr(), gusc_softc::irq, release_resource(), and snd_setup_intr().

Here is the call graph for this function:

◆ gusc_intr()

static void gusc_intr ( void *  arg)
static

Definition at line 333 of file gusc.c.

References gusc_ihandler::arg, gusc_ihandler::intr, gusc_softc::io, gusc_softc::midi_intr, gusc_softc::pcm_intr, and port_rd().

Referenced by gusc_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gusc_probe()

static int gusc_probe ( device_t  dev)
static

Definition at line 107 of file gusc.c.

References child, dev, sndcard_func::func, gusc_ids, gusisa_probe(), LOGICALID_MIDI, LOGICALID_OPL, LOGICALID_PCM, SCF_MIDI, SCF_PCM, and SCF_SYNTH.

Here is the call graph for this function:

◆ gusc_release_resource()

static int gusc_release_resource ( device_t  bus,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)
static

Definition at line 393 of file gusc.c.

References bus, gusc_softc::drq_alloced, gusc_softc::io_alloced, gusc_softc::irq_alloced, rid, and type.

◆ gusc_setup_intr()

static int gusc_setup_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
int  flags,
driver_filter_t *  filter,
driver_intr_t *  intr,
void *  arg,
void **  cookiep 
)
static

◆ gusisa_probe()

static int gusisa_probe ( device_t  dev)
static

Definition at line 181 of file gusc.c.

References base, child, dev, DV_F_DRQ_MASK, DV_F_DUAL_DMA, fail, sndcard_func::func, port_rd(), port_wr(), rid, SCF_MIDI, SCF_PCM, and val.

Referenced by gusc_probe().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ISA_PNP_INFO()

ISA_PNP_INFO ( gusc_ids  )

◆ MODULE_DEPEND()

MODULE_DEPEND ( snd_gusc  ,
sound  ,
SOUND_MINVER  ,
SOUND_PREFVER  ,
SOUND_MAXVER   
)

◆ MODULE_VERSION()

MODULE_VERSION ( snd_gusc  ,
 
)

◆ port_rd()

static int port_rd ( struct resource *  r,
int  i 
)
static

Definition at line 171 of file gusc.c.

References r.

Referenced by gusc_intr(), and gusisa_probe().

Here is the caller graph for this function:

◆ port_wr()

static void port_wr ( struct resource *  r,
int  i,
unsigned char  v 
)
static

Definition at line 165 of file gusc.c.

References r.

Referenced by gusisa_probe().

Here is the caller graph for this function:

◆ release_resource()

static int release_resource ( sc_p  scp)
static

Definition at line 589 of file gusc.c.

References gusc_softc::dev, dev, gusc_softc::drq, gusc_softc::drq_rid, find_masterdev(), gusc_softc::io, gusc_softc::io_rid, gusc_softc::irq, gusc_softc::irq_rid, LOGICALID_MIDI, LOGICALID_NOPNP, LOGICALID_OPL, and LOGICALID_PCM.

Referenced by gusc_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ gusc_devclass

devclass_t gusc_devclass
static

Definition at line 104 of file gusc.c.

◆ gusc_driver

driver_t gusc_driver
static
Initial value:
= {
"gusc",
sizeof(struct gusc_softc),
}
static device_method_t gusc_methods[]
Definition: gusc.c:643

Definition at line 663 of file gusc.c.

◆ gusc_ids

struct isa_pnp_id gusc_ids[]
static
Initial value:
= {
{LOGICALID_PCM, "GRV0000 Gravis UltraSound PnP PCM"},
{LOGICALID_OPL, "GRV0003 Gravis UltraSound PnP OPL"},
{LOGICALID_MIDI, "GRV0004 Gravis UltraSound PnP MIDI"},
}
#define LOGICALID_PCM
Definition: gusc.c:54
#define LOGICALID_MIDI
Definition: gusc.c:56
#define LOGICALID_OPL
Definition: gusc.c:55

Definition at line 59 of file gusc.c.

Referenced by gusc_probe().

◆ gusc_methods

device_method_t gusc_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, gusc_probe),
DEVMETHOD(device_attach, gusc_attach),
DEVMETHOD(device_detach, bus_generic_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
DEVMETHOD(bus_alloc_resource, gusc_alloc_resource),
DEVMETHOD(bus_release_resource, gusc_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(bus_setup_intr, gusc_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD_END
}
static int gusc_probe(device_t dev)
Definition: gusc.c:107
static int gusc_attach(device_t dev)
Definition: gusc.c:306
static int gusc_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
Definition: gusc.c:425
static int gusc_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r)
Definition: gusc.c:393
static struct resource * gusc_alloc_resource(device_t bus, device_t child, int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
Definition: gusc.c:354

Definition at line 643 of file gusc.c.

◆ io_offset

int io_offset[3] = {0x0 , 0x100, 0x10c}
static

Definition at line 475 of file gusc.c.

Referenced by alloc_resource().

◆ io_range

int io_range[3] = {0x10, 0x8 , 0x4 }
static

Definition at line 474 of file gusc.c.

Referenced by alloc_resource().