1 |
1626 |
jcastillo |
Building a loadable sound driver
|
2 |
|
|
================================
|
3 |
|
|
|
4 |
|
|
Loadable module support in version 3.5 of the driver is mostly rewritten since
|
5 |
|
|
the previous version (3.0.1). This means that some things have changed.
|
6 |
|
|
|
7 |
|
|
To compile the sound driver as a loadable module you have to perform
|
8 |
|
|
the following steps:
|
9 |
|
|
|
10 |
|
|
1) Install modules-1.2.8.tar.gz package (or later if available).
|
11 |
|
|
2a) Check that symbol remap_page_range is defined in linux/init/ksyms.c.
|
12 |
|
|
Insert a line containing "X(remap_page_range)," if required. The driver will
|
13 |
|
|
not load if this line is missing.
|
14 |
|
|
2b) Recompile kernel with soundcard support disabled.
|
15 |
|
|
3) Boot the new kernel.
|
16 |
|
|
4) cd to the sound driver source directory (this directory). It's no
|
17 |
|
|
longer required that the sound driver sources are installed in the
|
18 |
|
|
kernel source tree (linux/drivers/sound). When installing a separately
|
19 |
|
|
distributed sound driver you may install the sources for example to
|
20 |
|
|
/usr/src/sound.
|
21 |
|
|
5) Execute make in the sound driver source directory. Enter
|
22 |
|
|
configuration parameters as described in Readme.cards. Then just wait until
|
23 |
|
|
the driver is compiled OK.
|
24 |
|
|
6) Copy sound.o to the directory where insmod expects to find it.
|
25 |
|
|
("make install" copies it to /lib/modules/misc).
|
26 |
|
|
7) Use command "insmod sound" to load the driver.
|
27 |
|
|
|
28 |
|
|
8) The sound driver can be removed using command "rmmod sound".
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
Parameters accepted by the loadable sound driver
|
32 |
|
|
================================================
|
33 |
|
|
|
34 |
|
|
Setting DMA buffer size
|
35 |
|
|
-----------------------
|
36 |
|
|
|
37 |
|
|
The driver allocates a DMA buffer (or two for full duplex devices)
|
38 |
|
|
every time the audio device (/dev/dsp or /dev/audio) is opened
|
39 |
|
|
and frees it when the device is closed. Size of this buffer is defined
|
40 |
|
|
when the driver is configured (the last question). The buffer size
|
41 |
|
|
can be redefined when loading the driver if required (note that this is
|
42 |
|
|
an optional feature which is not normally required). The buffer size
|
43 |
|
|
is redefined by adding dma_pagesize= parameter to the insmod command line.
|
44 |
|
|
For example:
|
45 |
|
|
|
46 |
|
|
insmod sound dma_buffsize=32768
|
47 |
|
|
|
48 |
|
|
Minimum buffer size is 4096 and the maximum depends on the DMA channel.
|
49 |
|
|
For 8 bit channels (0 to 3) the limit is 64k and for 16 bit ones (5 to 7)
|
50 |
|
|
it's 128k. Driver selects a suitable buffer size automatically in case
|
51 |
|
|
you try to specify an invalid size.
|
52 |
|
|
|
53 |
|
|
Q: What is the right DMA buffer size?
|
54 |
|
|
|
55 |
|
|
A: It depends on the sampling rate, machine speed and the load of the system.
|
56 |
|
|
Large buffers are required on slow machines, when recording/playing CD-quality
|
57 |
|
|
audio or when there are other processes running on the same system. Also
|
58 |
|
|
recording to hard disk is likely to require large buffers.
|
59 |
|
|
|
60 |
|
|
Very small buffers are sufficient when you are just playing 8kHz audio files
|
61 |
|
|
on an empty P133 system. Using a 128k buffer just wastes 120k (or 250k)
|
62 |
|
|
of valuable physical RAM memory.
|
63 |
|
|
|
64 |
|
|
The right buffer size can be easily found by making some experiments
|
65 |
|
|
with the dma_buffsize= parameter. I use usually 16k buffers on a DX4/100 system
|
66 |
|
|
and 64k on an old 386 system.
|
67 |
|
|
|
68 |
|
|
NOTE! DMA buffers are used only by /dev/audio# and /dev/dsp# devices.
|
69 |
|
|
Other device files don't use them but there are two exceptions:
|
70 |
|
|
GUS driver uses DMA buffers when loading samples to the card.
|
71 |
|
|
Ensoniq SoundScape driver uses them when downloading the microcode
|
72 |
|
|
file (sndscape.co[012]) to the card. Using large buffers doesn't
|
73 |
|
|
increase performance in these cases.
|
74 |
|
|
|
75 |
|
|
Debugging and tracing
|
76 |
|
|
---------------------
|
77 |
|
|
|
78 |
|
|
Modularized sound driver doesn't display messages during initialization as
|
79 |
|
|
the kernel compiled one does. This feature can be turned on by adding
|
80 |
|
|
trace_init=1 to the insmod command line.
|
81 |
|
|
|
82 |
|
|
For example:
|
83 |
|
|
|
84 |
|
|
insmod sound trace_init=1
|