FreeBSD kernel sound device code
neomagic.c File Reference
Include dependency graph for neomagic.c:

Go to the source code of this file.

Data Structures

struct  sc_chinfo
 
struct  sc_info
 

Macros

#define NM_BUFFSIZE   16384
 
#define NM256AV_PCI_ID   0x800510c8
 
#define NM256ZX_PCI_ID   0x800610c8
 
#define NUM_BADCARDS   (sizeof(badcards) / sizeof(u_int32_t))
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
static int nm_loadcoeff (struct sc_info *sc, int dir, int num)
 
static int nm_setch (struct sc_chinfo *ch)
 
static int nm_init (struct sc_info *)
 
static void nm_intr (void *)
 
static u_int32_t nm_rd (struct sc_info *, int, int)
 
static void nm_wr (struct sc_info *, int, u_int32_t, int)
 
static u_int32_t nm_rdbuf (struct sc_info *, int, int)
 
static void nm_wrbuf (struct sc_info *, int, u_int32_t, int)
 
static int nm_waitcd (struct sc_info *sc)
 
static u_int32_t nm_initcd (kobj_t obj, void *devinfo)
 
static int nm_rdcd (kobj_t obj, void *devinfo, int regno)
 
static int nm_wrcd (kobj_t obj, void *devinfo, int regno, u_int32_t data)
 
 AC97_DECLARE (nm_ac97)
 
static void nm_ackint (struct sc_info *sc, u_int32_t num)
 
static void * nmchan_init (kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
 
static int nmchan_free (kobj_t obj, void *data)
 
static int nmchan_setformat (kobj_t obj, void *data, u_int32_t format)
 
static u_int32_t nmchan_setspeed (kobj_t obj, void *data, u_int32_t speed)
 
static u_int32_t nmchan_setblocksize (kobj_t obj, void *data, u_int32_t blocksize)
 
static int nmchan_trigger (kobj_t obj, void *data, int go)
 
static u_int32_t nmchan_getptr (kobj_t obj, void *data)
 
static struct pcmchan_capsnmchan_getcaps (kobj_t obj, void *data)
 
 CHANNEL_DECLARE (nmchan)
 
static int nm_pci_probe (device_t dev)
 
static int nm_pci_attach (device_t dev)
 
static int nm_pci_detach (device_t dev)
 
static int nm_pci_suspend (device_t dev)
 
static int nm_pci_resume (device_t dev)
 
 DRIVER_MODULE (snd_neomagic, pci, nm_driver, pcm_devclass, 0, 0)
 
 MODULE_DEPEND (snd_neomagic, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
 
 MODULE_VERSION (snd_neomagic, 1)
 

Variables

static u_int32_t badcards []
 
static int samplerates [9]
 
static u_int32_t nm_fmt []
 
static struct pcmchan_caps nm_caps = {4000, 48000, nm_fmt, 0}
 
static kobj_method_t nm_ac97_methods []
 
static kobj_method_t nmchan_methods []
 
static device_method_t nm_methods []
 
static driver_t nm_driver
 

Macro Definition Documentation

◆ NM256AV_PCI_ID

#define NM256AV_PCI_ID   0x800510c8

Definition at line 49 of file neomagic.c.

◆ NM256ZX_PCI_ID

#define NM256ZX_PCI_ID   0x800610c8

Definition at line 50 of file neomagic.c.

◆ NM_BUFFSIZE

#define NM_BUFFSIZE   16384

Definition at line 47 of file neomagic.c.

◆ NUM_BADCARDS

#define NUM_BADCARDS   (sizeof(badcards) / sizeof(u_int32_t))

Definition at line 104 of file neomagic.c.

Function Documentation

◆ AC97_DECLARE()

AC97_DECLARE ( nm_ac97  )

◆ CHANNEL_DECLARE()

CHANNEL_DECLARE ( nmchan  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( snd_neomagic  ,
pci  ,
nm_driver  ,
pcm_devclass  ,
,
 
)

◆ MODULE_DEPEND()

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

◆ MODULE_VERSION()

MODULE_VERSION ( snd_neomagic  ,
 
)

◆ nm_ackint()

static void nm_ackint ( struct sc_info sc,
u_int32_t  num 
)
static

Definition at line 293 of file neomagic.c.

References NM256AV_PCI_ID, NM256ZX_PCI_ID, NM_INT_REG, nm_wr(), and sc_info::type.

Referenced by nm_intr().

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

◆ nm_init()

◆ nm_initcd()

static u_int32_t nm_initcd ( kobj_t  obj,
void *  devinfo 
)
static

Definition at line 227 of file neomagic.c.

References devinfo, and nm_wr().

Here is the call graph for this function:

◆ nm_intr()

static void nm_intr ( void *  p)
static

◆ nm_loadcoeff()

static int nm_loadcoeff ( struct sc_info sc,
int  dir,
int  num 
)
static

Definition at line 303 of file neomagic.c.

References addr, sc_info::cbuf, coefficients, coefficientSizes, dir, nm_wr(), nm_wrbuf(), PCMDIR_PLAY, and PCMDIR_REC.

Referenced by nm_setch().

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

◆ nm_pci_attach()

◆ nm_pci_detach()

static int nm_pci_detach ( device_t  dev)
static

Definition at line 729 of file neomagic.c.

References sc_info::buf, sc_info::bufid, dev, free, sc_info::ih, sc_info::irq, sc_info::irqid, pcm_getdevinfo(), pcm_unregister(), r, sc_info::reg, and sc_info::regid.

Here is the call graph for this function:

◆ nm_pci_probe()

static int nm_pci_probe ( device_t  dev)
static

Definition at line 600 of file neomagic.c.

References badcards, DEB, dev, free, NM256AV_PCI_ID, NM256ZX_PCI_ID, NM_MIXER_PRESENCE, NM_PRESENCE_MASK, NM_PRESENCE_VALUE, nm_rd(), nm_wr(), NUM_BADCARDS, PCIR_BAR, sc_info::reg, and sc_info::regid.

Here is the call graph for this function:

◆ nm_pci_resume()

static int nm_pci_resume ( device_t  dev)
static

◆ nm_pci_suspend()

static int nm_pci_suspend ( device_t  dev)
static

Definition at line 749 of file neomagic.c.

References sc_chinfo::active, dev, NM_AUDIO_MUTE_BOTH, NM_AUDIO_MUTE_REG, NM_PLAYBACK_ENABLE_REG, NM_RECORD_ENABLE_REG, nm_wr(), sc_info::pch, pcm_getdevinfo(), and sc_info::rch.

Here is the call graph for this function:

◆ nm_rd()

static u_int32_t nm_rd ( struct sc_info sc,
int  regno,
int  size 
)
static

Definition at line 134 of file neomagic.c.

References sc_info::reg, regno, and size.

Referenced by nm_init(), nm_intr(), nm_pci_probe(), nm_rdcd(), nm_waitcd(), and nmchan_getptr().

Here is the caller graph for this function:

◆ nm_rdbuf()

static u_int32_t nm_rdbuf ( struct sc_info sc,
int  regno,
int  size 
)
static

Definition at line 171 of file neomagic.c.

References sc_info::buf, regno, and size.

Referenced by nm_init().

Here is the caller graph for this function:

◆ nm_rdcd()

static int nm_rdcd ( kobj_t  obj,
void *  devinfo,
int  regno 
)
static

Definition at line 248 of file neomagic.c.

References sc_info::ac97_base, sc_info::dev, devinfo, nm_rd(), nm_waitcd(), and regno.

Here is the call graph for this function:

◆ nm_setch()

static int nm_setch ( struct sc_chinfo ch)
static

◆ nm_waitcd()

static int nm_waitcd ( struct sc_info sc)
static

Definition at line 210 of file neomagic.c.

References sc_info::ac97_busy, sc_info::ac97_status, fail, and nm_rd().

Referenced by nm_rdcd(), and nm_wrcd().

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

◆ nm_wr()

static void nm_wr ( struct sc_info sc,
int  regno,
u_int32_t  data,
int  size 
)
static

Definition at line 152 of file neomagic.c.

References data, sc_info::reg, regno, and size.

Referenced by nm_ackint(), nm_init(), nm_initcd(), nm_intr(), nm_loadcoeff(), nm_pci_probe(), nm_pci_resume(), nm_pci_suspend(), nm_setch(), nm_wrcd(), and nmchan_trigger().

Here is the caller graph for this function:

◆ nm_wrbuf()

static void nm_wrbuf ( struct sc_info sc,
int  regno,
u_int32_t  data,
int  size 
)
static

Definition at line 189 of file neomagic.c.

References sc_info::buf, data, regno, and size.

Referenced by nm_loadcoeff().

Here is the caller graph for this function:

◆ nm_wrcd()

static int nm_wrcd ( kobj_t  obj,
void *  devinfo,
int  regno,
u_int32_t  data 
)
static

Definition at line 264 of file neomagic.c.

References sc_info::ac97_base, data, sc_info::dev, devinfo, nm_waitcd(), nm_wr(), and regno.

Here is the call graph for this function:

◆ nmchan_free()

static int nmchan_free ( kobj_t  obj,
void *  data 
)
static

Definition at line 375 of file neomagic.c.

◆ nmchan_getcaps()

static struct pcmchan_caps * nmchan_getcaps ( kobj_t  obj,
void *  data 
)
static

Definition at line 469 of file neomagic.c.

References nm_caps.

◆ nmchan_getptr()

static u_int32_t nmchan_getptr ( kobj_t  obj,
void *  data 
)
static

Definition at line 457 of file neomagic.c.

References sc_info::ch, data, sc_chinfo::dir, NM_PBUFFER_CURRP, NM_RBUFFER_CURRP, nm_rd(), sc_chinfo::parent, sc_info::pbuf, PCMDIR_PLAY, and sc_info::rbuf.

Here is the call graph for this function:

◆ nmchan_init()

static void * nmchan_init ( kobj_t  obj,
void *  devinfo,
struct snd_dbuf b,
struct pcm_channel c,
int  dir 
)
static

◆ nmchan_setblocksize()

static u_int32_t nmchan_setblocksize ( kobj_t  obj,
void *  data,
u_int32_t  blocksize 
)
static

Definition at line 399 of file neomagic.c.

References sc_chinfo::blksize, blocksize, and data.

◆ nmchan_setformat()

static int nmchan_setformat ( kobj_t  obj,
void *  data,
u_int32_t  format 
)
static

Definition at line 381 of file neomagic.c.

References data, sc_chinfo::fmt, format, and nm_setch().

Here is the call graph for this function:

◆ nmchan_setspeed()

static u_int32_t nmchan_setspeed ( kobj_t  obj,
void *  data,
u_int32_t  speed 
)
static

Definition at line 390 of file neomagic.c.

References data, nm_setch(), sc_chinfo::spd, and speed.

Here is the call graph for this function:

◆ nmchan_trigger()

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

Variable Documentation

◆ badcards

u_int32_t badcards[]
static
Initial value:
= {
0x0007103c,
0x008f1028,
0x00dd1014,
0x8005110a,
}

Definition at line 98 of file neomagic.c.

Referenced by nm_pci_probe().

◆ nm_ac97_methods

kobj_method_t nm_ac97_methods[]
static
Initial value:
= {
KOBJMETHOD(ac97_init, nm_initcd),
KOBJMETHOD(ac97_read, nm_rdcd),
KOBJMETHOD(ac97_write, nm_wrcd),
}
#define KOBJMETHOD_END
Definition: midi.c:76
static int nm_wrcd(kobj_t obj, void *devinfo, int regno, u_int32_t data)
Definition: neomagic.c:264
static u_int32_t nm_initcd(kobj_t obj, void *devinfo)
Definition: neomagic.c:227
static int nm_rdcd(kobj_t obj, void *devinfo, int regno)
Definition: neomagic.c:248

Definition at line 282 of file neomagic.c.

◆ nm_caps

struct pcmchan_caps nm_caps = {4000, 48000, nm_fmt, 0}
static

Definition at line 128 of file neomagic.c.

Referenced by nmchan_getcaps().

◆ nm_driver

driver_t nm_driver
static
Initial value:
= {
"pcm",
}
static device_method_t nm_methods[]
Definition: neomagic.c:804
#define PCM_SOFTC_SIZE
Definition: sound.h:96

Definition at line 814 of file neomagic.c.

◆ nm_fmt

u_int32_t nm_fmt[]
static
Initial value:
= {
SND_FORMAT(AFMT_U8, 1, 0),
SND_FORMAT(AFMT_U8, 2, 0),
SND_FORMAT(AFMT_S16_LE, 1, 0),
SND_FORMAT(AFMT_S16_LE, 2, 0),
0
}
#define SND_FORMAT(f, c, e)
Definition: sound.h:238

Definition at line 121 of file neomagic.c.

◆ nm_methods

device_method_t nm_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, nm_pci_probe),
DEVMETHOD(device_attach, nm_pci_attach),
DEVMETHOD(device_detach, nm_pci_detach),
DEVMETHOD(device_suspend, nm_pci_suspend),
DEVMETHOD(device_resume, nm_pci_resume),
{ 0, 0 }
}
static int nm_pci_resume(device_t dev)
Definition: neomagic.c:768
static int nm_pci_attach(device_t dev)
Definition: neomagic.c:666
static int nm_pci_suspend(device_t dev)
Definition: neomagic.c:749
static int nm_pci_detach(device_t dev)
Definition: neomagic.c:729
static int nm_pci_probe(device_t dev)
Definition: neomagic.c:600

Definition at line 804 of file neomagic.c.

◆ nmchan_methods

kobj_method_t nmchan_methods[]
static
Initial value:
= {
KOBJMETHOD(channel_init, nmchan_init),
KOBJMETHOD(channel_free, nmchan_free),
KOBJMETHOD(channel_setformat, nmchan_setformat),
KOBJMETHOD(channel_setspeed, nmchan_setspeed),
KOBJMETHOD(channel_setblocksize, nmchan_setblocksize),
KOBJMETHOD(channel_trigger, nmchan_trigger),
KOBJMETHOD(channel_getptr, nmchan_getptr),
KOBJMETHOD(channel_getcaps, nmchan_getcaps),
}
static u_int32_t nmchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
Definition: neomagic.c:390
static int nmchan_trigger(kobj_t obj, void *data, int go)
Definition: neomagic.c:409
static int nmchan_setformat(kobj_t obj, void *data, u_int32_t format)
Definition: neomagic.c:381
static struct pcmchan_caps * nmchan_getcaps(kobj_t obj, void *data)
Definition: neomagic.c:469
static int nmchan_free(kobj_t obj, void *data)
Definition: neomagic.c:375
static u_int32_t nmchan_getptr(kobj_t obj, void *data)
Definition: neomagic.c:457
static u_int32_t nmchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
Definition: neomagic.c:399
static void * nmchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c, int dir)
Definition: neomagic.c:352

Definition at line 474 of file neomagic.c.

◆ samplerates

int samplerates[9]
static
Initial value:
= {
8000,
11025,
16000,
22050,
24000,
32000,
44100,
48000,
99999999
}

Definition at line 107 of file neomagic.c.

Referenced by nm_setch().