FreeBSD kernel sound device code
sbc.c File Reference
#include <dev/sound/chip.h>
#include <dev/sound/pcm/sound.h>
#include <dev/sound/isa/sb.h>
#include <isa/isavar.h>
Include dependency graph for sbc.c:

Go to the source code of this file.

Data Structures

struct  sbc_ihl
 
struct  sbc_softc
 

Macros

#define IO_MAX   3
 
#define IRQ_MAX   1
 
#define DRQ_MAX   2
 
#define INTR_MAX   2
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static int sbc_probe (device_t dev)
 
static int sbc_attach (device_t dev)
 
static void sbc_intr (void *p)
 
static struct resource * sbc_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 sbc_release_resource (device_t bus, device_t child, int type, int rid, struct resource *r)
 
static int sbc_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 int sbc_teardown_intr (device_t dev, device_t child, struct resource *irq, void *cookie)
 
static int alloc_resource (struct sbc_softc *scp)
 
static int release_resource (struct sbc_softc *scp)
 
static int sb_rd (struct resource *io, int reg)
 
static void sb_wr (struct resource *io, int reg, u_int8_t val)
 
static int sb_dspready (struct resource *io)
 
static int sb_cmd (struct resource *io, u_char val)
 
static u_int sb_get_byte (struct resource *io)
 
static void sb_setmixer (struct resource *io, u_int port, u_int value)
 
static void sbc_lockinit (struct sbc_softc *scp)
 
static void sbc_lockdestroy (struct sbc_softc *scp)
 
void sbc_lock (struct sbc_softc *scp)
 
void sbc_lockassert (struct sbc_softc *scp)
 
void sbc_unlock (struct sbc_softc *scp)
 
static int sb_dspwr (struct resource *io, u_char val)
 
static int sb_reset_dsp (struct resource *io)
 
static int sb_identify_board (struct resource *io)
 
static int sbc_detach (device_t dev)
 
static int sbc_read_ivar (device_t bus, device_t dev, int index, uintptr_t *result)
 
static int sbc_write_ivar (device_t bus, device_t dev, int index, uintptr_t value)
 
 DRIVER_MODULE (snd_sbc, isa, sbc_driver, sbc_devclass, 0, 0)
 
 DRIVER_MODULE (snd_sbc, acpi, sbc_driver, sbc_devclass, 0, 0)
 
 MODULE_DEPEND (snd_sbc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_sbc, 1)
 
 ISA_PNP_INFO (sbc_ids)
 

Variables

static devclass_t sbc_devclass
 
static int io_range [3] = {0x10, 0x2, 0x4}
 
static struct isa_pnp_id sbc_ids []
 
static device_method_t sbc_methods []
 
static driver_t sbc_driver
 

Macro Definition Documentation

◆ DRQ_MAX

#define DRQ_MAX   2

Definition at line 43 of file sbc.c.

◆ INTR_MAX

#define INTR_MAX   2

Definition at line 44 of file sbc.c.

◆ IO_MAX

#define IO_MAX   3

Definition at line 41 of file sbc.c.

◆ IRQ_MAX

#define IRQ_MAX   1

Definition at line 42 of file sbc.c.

Function Documentation

◆ alloc_resource()

static int alloc_resource ( struct sbc_softc scp)
static

◆ DRIVER_MODULE() [1/2]

DRIVER_MODULE ( snd_sbc  ,
acpi  ,
sbc_driver  ,
sbc_devclass  ,
,
 
)

◆ DRIVER_MODULE() [2/2]

DRIVER_MODULE ( snd_sbc  ,
isa  ,
sbc_driver  ,
sbc_devclass  ,
,
 
)

◆ ISA_PNP_INFO()

ISA_PNP_INFO ( sbc_ids  )

◆ MODULE_DEPEND()

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

◆ MODULE_VERSION()

MODULE_VERSION ( snd_sbc  ,
 
)

◆ release_resource()

static int release_resource ( struct sbc_softc scp)
static

Definition at line 693 of file sbc.c.

References sbc_softc::dev, sbc_softc::drq, DRQ_MAX, sbc_softc::drq_rid, sbc_softc::ih, sbc_softc::io, IO_MAX, sbc_softc::io_rid, sbc_softc::irq, IRQ_MAX, and sbc_softc::irq_rid.

Referenced by sbc_attach(), and sbc_detach().

Here is the caller graph for this function:

◆ sb_cmd()

static int sb_cmd ( struct resource *  io,
u_char  val 
)
static

Definition at line 180 of file sbc.c.

References sb_dspwr(), and val.

Referenced by sb_identify_board().

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

◆ sb_dspready()

static int sb_dspready ( struct resource *  io)
static

Definition at line 158 of file sbc.c.

References sb_rd(), and SBDSP_STATUS.

Referenced by sb_dspwr().

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

◆ sb_dspwr()

static int sb_dspwr ( struct resource *  io,
u_char  val 
)
static

Definition at line 164 of file sbc.c.

References sb_dspready(), sb_wr(), SBDSP_CMD, and val.

Referenced by sb_cmd().

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

◆ sb_get_byte()

static u_int sb_get_byte ( struct resource *  io)
static

Definition at line 199 of file sbc.c.

References DSP_DATA_AVAIL, DSP_READ, and sb_rd().

Referenced by sb_identify_board(), and sb_reset_dsp().

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

◆ sb_identify_board()

static int sb_identify_board ( struct resource *  io)
static

Definition at line 222 of file sbc.c.

References DSP_CMD_GETID, DSP_CMD_GETVER, sb_cmd(), and sb_get_byte().

Referenced by sbc_attach(), and sbc_probe().

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

◆ sb_rd()

static int sb_rd ( struct resource *  io,
int  reg 
)
static

Definition at line 142 of file sbc.c.

References reg.

Referenced by sb_dspready(), and sb_get_byte().

Here is the caller graph for this function:

◆ sb_reset_dsp()

static int sb_reset_dsp ( struct resource *  io)
static

Definition at line 213 of file sbc.c.

References sb_get_byte(), sb_wr(), and SBDSP_RST.

Referenced by sbc_attach(), and sbc_probe().

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

◆ sb_setmixer()

static void sb_setmixer ( struct resource *  io,
u_int  port,
u_int  value 
)
static

Definition at line 186 of file sbc.c.

References SB_MIX_ADDR, SB_MIX_DATA, sb_wr(), and value.

Referenced by sbc_attach().

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

◆ sb_wr()

static void sb_wr ( struct resource *  io,
int  reg,
u_int8_t  val 
)
static

Definition at line 150 of file sbc.c.

References reg, and val.

Referenced by sb_dspwr(), sb_reset_dsp(), and sb_setmixer().

Here is the caller graph for this function:

◆ sbc_alloc_resource()

static struct resource * sbc_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

◆ sbc_attach()

◆ sbc_detach()

static int sbc_detach ( device_t  dev)
static

Definition at line 449 of file sbc.c.

References sbc_softc::child_midi1, sbc_softc::child_midi2, sbc_softc::child_pcm, dev, release_resource(), sbc_lock(), and sbc_lockdestroy().

Here is the call graph for this function:

◆ sbc_intr()

static void sbc_intr ( void *  p)
static

Definition at line 463 of file sbc.c.

References sbc_ihl::intr, sbc_ihl::intr_arg, and INTR_MAX.

Referenced by sbc_attach().

Here is the caller graph for this function:

◆ sbc_lock()

void sbc_lock ( struct sbc_softc scp)

Definition at line 124 of file sbc.c.

References sbc_softc::lock, and snd_mtxlock.

Referenced by ess_lock(), sb_lock(), sbc_detach(), sbc_setup_intr(), and sbc_teardown_intr().

Here is the caller graph for this function:

◆ sbc_lockassert()

void sbc_lockassert ( struct sbc_softc scp)

Definition at line 130 of file sbc.c.

References sbc_softc::lock, and snd_mtxassert().

Referenced by sb_lockassert().

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

◆ sbc_lockdestroy()

static void sbc_lockdestroy ( struct sbc_softc scp)
static

Definition at line 118 of file sbc.c.

References sbc_softc::lock, and snd_mtxfree().

Referenced by sbc_detach().

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

◆ sbc_lockinit()

static void sbc_lockinit ( struct sbc_softc scp)
static

Definition at line 111 of file sbc.c.

References sbc_softc::dev, sbc_softc::lock, and snd_mtxcreate().

Referenced by sbc_attach().

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

◆ sbc_probe()

static int sbc_probe ( device_t  dev)
static

Definition at line 272 of file sbc.c.

References dev, rid, sb_identify_board(), sb_reset_dsp(), sbc_ids, and vid.

Here is the call graph for this function:

◆ sbc_read_ivar()

static int sbc_read_ivar ( device_t  bus,
device_t  dev,
int  index,
uintptr_t *  result 
)
static

Definition at line 612 of file sbc.c.

References sbc_softc::bd_ver, bus, dev, sndcard_func::func, and index.

◆ sbc_release_resource()

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

◆ sbc_setup_intr()

static int sbc_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

Definition at line 478 of file sbc.c.

References dev, sbc_softc::ihl, intr, sbc_ihl::intr, sbc_ihl::intr_arg, INTR_MAX, sbc_softc::irq, irq, IRQ_MAX, sbc_lock(), and sbc_unlock().

Here is the call graph for this function:

◆ sbc_teardown_intr()

static int sbc_teardown_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
void *  cookie 
)
static

Definition at line 513 of file sbc.c.

References dev, sbc_softc::ihl, sbc_ihl::intr, sbc_ihl::intr_arg, INTR_MAX, sbc_softc::irq, irq, IRQ_MAX, sbc_lock(), and sbc_unlock().

Here is the call graph for this function:

◆ sbc_unlock()

void sbc_unlock ( struct sbc_softc scp)

Definition at line 136 of file sbc.c.

References sbc_softc::lock, and snd_mtxunlock.

Referenced by ess_unlock(), sb_unlock(), sbc_setup_intr(), and sbc_teardown_intr().

Here is the caller graph for this function:

◆ sbc_write_ivar()

static int sbc_write_ivar ( device_t  bus,
device_t  dev,
int  index,
uintptr_t  value 
)
static

Definition at line 634 of file sbc.c.

References index.

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ io_range

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

Definition at line 101 of file sbc.c.

Referenced by alloc_resource().

◆ sbc_devclass

devclass_t sbc_devclass
static

Definition at line 99 of file sbc.c.

◆ sbc_driver

driver_t sbc_driver
static
Initial value:
= {
"sbc",
sizeof(struct sbc_softc),
}
static device_method_t sbc_methods[]
Definition: sbc.c:721
Definition: sbc.c:55

Definition at line 743 of file sbc.c.

◆ sbc_ids

struct isa_pnp_id sbc_ids[]
static
Initial value:
= {
{0x01008c0e, "Creative ViBRA16C"},
{0x31008c0e, "Creative SB16/SB32"},
{0x41008c0e, "Creative SB16/SB32"},
{0x42008c0e, "Creative SB AWE64"},
{0x43008c0e, "Creative ViBRA16X"},
{0x44008c0e, "Creative SB AWE64 Gold"},
{0x45008c0e, "Creative SB AWE64"},
{0x46008c0e, "Creative SB AWE64"},
{0x01000000, "Avance Logic ALS100+"},
{0x01100000, "Avance Asound 110"},
{0x01200000, "Avance Logic ALS120"},
{0x81167316, "ESS ES1681"},
{0x02017316, "ESS ES1688"},
{0x68097316, "ESS ES1688"},
{0x68187316, "ESS ES1868"},
{0x03007316, "ESS ES1869"},
{0x69187316, "ESS ES1869"},
{0xabb0110e, "ESS ES1869 (Compaq OEM)"},
{0xacb0110e, "ESS ES1869 (Compaq OEM)"},
{0x78187316, "ESS ES1878"},
{0x79187316, "ESS ES1879"},
{0x88187316, "ESS ES1888"},
{0x07017316, "ESS ES1888 (DEC OEM)"},
{0x06017316, "ESS ES1888 (Dell OEM)"},
{0}
}

Definition at line 241 of file sbc.c.

Referenced by sbc_probe().

◆ sbc_methods

device_method_t sbc_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, sbc_probe),
DEVMETHOD(device_attach, sbc_attach),
DEVMETHOD(device_detach, sbc_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, bus_generic_resume),
DEVMETHOD(bus_read_ivar, sbc_read_ivar),
DEVMETHOD(bus_write_ivar, sbc_write_ivar),
DEVMETHOD(bus_alloc_resource, sbc_alloc_resource),
DEVMETHOD(bus_release_resource, sbc_release_resource),
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(bus_setup_intr, sbc_setup_intr),
DEVMETHOD(bus_teardown_intr, sbc_teardown_intr),
DEVMETHOD_END
}
static int sbc_write_ivar(device_t bus, device_t dev, int index, uintptr_t value)
Definition: sbc.c:634
static int sbc_read_ivar(device_t bus, device_t dev, int index, uintptr_t *result)
Definition: sbc.c:612
static struct resource * sbc_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: sbc.c:541
static int sbc_attach(device_t dev)
Definition: sbc.c:323
static int sbc_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie)
Definition: sbc.c:513
static int sbc_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r)
Definition: sbc.c:580
static int sbc_probe(device_t dev)
Definition: sbc.c:272
static int sbc_detach(device_t dev)
Definition: sbc.c:449
static int sbc_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: sbc.c:478

Definition at line 721 of file sbc.c.