import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / Documentation / DocBook / kernel-api.tmpl
1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
2 <book id="LinuxKernelAPI">
3  <bookinfo>
4   <title>The Linux Kernel API</title>
5   
6   <legalnotice>
7    <para>
8      This documentation is free software; you can redistribute
9      it and/or modify it under the terms of the GNU General Public
10      License as published by the Free Software Foundation; either
11      version 2 of the License, or (at your option) any later
12      version.
13    </para>
14       
15    <para>
16      This program is distributed in the hope that it will be
17      useful, but WITHOUT ANY WARRANTY; without even the implied
18      warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19      See the GNU General Public License for more details.
20    </para>
21       
22    <para>
23      You should have received a copy of the GNU General Public
24      License along with this program; if not, write to the Free
25      Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
26      MA 02111-1307 USA
27    </para>
28       
29    <para>
30      For more details see the file COPYING in the source
31      distribution of Linux.
32    </para>
33   </legalnotice>
34  </bookinfo>
35
36 <toc></toc>
37
38   <chapter id="Basics">
39      <title>Driver Basics</title>
40      <sect1><title>Driver Entry and Exit points</title>
41 !Iinclude/linux/init.h
42      </sect1>
43
44      <sect1><title>Atomic and pointer manipulation</title>
45 !Iinclude/asm-i386/atomic.h
46 !Iinclude/asm-i386/unaligned.h
47      </sect1>
48
49      <sect1><title>Delaying, scheduling, and timer routines</title>
50 !Ekernel/sched.c
51      </sect1>
52   </chapter>
53
54   <chapter id="adt">
55      <title>Data Types</title>
56      <sect1><title>Doubly Linked Lists</title>
57 !Iinclude/linux/list.h
58      </sect1>
59   </chapter>
60
61   <chapter id="libc">
62      <title>Basic C Library Functions</title>
63
64      <para>
65        When writing drivers, you cannot in general use routines which are
66        from the C Library.  Some of the functions have been found generally
67        useful and they are listed below.  The behaviour of these functions
68        may vary slightly from those defined by ANSI, and these deviations
69        are noted in the text.
70      </para>
71
72      <sect1><title>String Conversions</title>
73 !Ilib/vsprintf.c
74 !Elib/vsprintf.c
75      </sect1>
76      <sect1><title>String Manipulation</title>
77 !Ilib/string.c
78      </sect1>
79      <sect1><title>Bit Operations</title>
80 !Iinclude/asm-i386/bitops.h
81      </sect1>
82   </chapter>
83
84   <chapter id="mm">
85      <title>Memory Management in Linux</title>
86      <sect1><title>The Slab Cache</title>
87 !Emm/slab.c
88      </sect1>
89      <sect1><title>User Space Memory Access</title>
90 !Iinclude/asm-i386/uaccess.h
91 !Iarch/i386/lib/usercopy.c
92      </sect1>
93   </chapter>
94
95   <chapter id="proc">
96      <title>The proc filesystem</title>
97  
98      <sect1><title>sysctl interface</title>
99 !Ekernel/sysctl.c
100      </sect1>
101   </chapter>
102
103   <chapter id="vfs">
104      <title>The Linux VFS</title>
105      <sect1><title>The Directory Cache</title>
106 !Efs/dcache.c
107 !Iinclude/linux/dcache.h
108      </sect1>
109      <sect1><title>Inode Handling</title>
110 !Efs/inode.c
111 !Efs/bad_inode.c
112      </sect1>
113      <sect1><title>Registration and Superblocks</title>
114 !Efs/super.c
115      </sect1>
116      <sect1><title>File Locks</title>
117 !Efs/locks.c
118 !Ifs/locks.c
119      </sect1>
120   </chapter>
121
122   <chapter id="netcore">
123      <title>Linux Networking</title>
124      <sect1><title>Socket Buffer Functions</title>
125 !Iinclude/linux/skbuff.h
126 !Enet/core/skbuff.c
127      </sect1>
128      <sect1><title>Socket Filter</title>
129 !Enet/core/filter.c
130      </sect1>
131   </chapter>
132
133   <chapter id="netdev">
134      <title>Network device support</title>
135      <sect1><title>Driver Support</title>
136 !Edrivers/net/net_init.c
137 !Enet/core/dev.c
138      </sect1>
139      <sect1><title>8390 Based Network Cards</title>
140 !Edrivers/net/8390.c
141      </sect1>
142      <sect1><title>Synchronous PPP</title>
143 !Edrivers/net/wan/syncppp.c
144      </sect1>
145   </chapter>
146
147   <chapter id="modload">
148      <title>Module Support</title>
149      <sect1><title>Module Loading</title>
150 !Ekernel/kmod.c
151      </sect1>
152      <sect1><title>Inter Module support</title>
153 !Ekernel/module.c
154      </sect1>
155   </chapter>
156
157   <chapter id="hardware">
158      <title>Hardware Interfaces</title>
159      <sect1><title>Interrupt Handling</title>
160 !Iarch/i386/kernel/irq.c
161      </sect1>
162
163      <sect1><title>MTRR Handling</title>
164 !Earch/i386/kernel/mtrr.c
165      </sect1>
166      <sect1><title>PCI Support Library</title>
167 !Edrivers/pci/pci.c
168      </sect1>
169      <sect1><title>PCI Hotplug Support Library</title>
170 !Edrivers/hotplug/pci_hotplug_core.c
171 !Edrivers/hotplug/pci_hotplug_util.c
172      </sect1>
173      <sect1><title>MCA Architecture</title>
174         <sect2><title>MCA Device Functions</title>
175 !Earch/i386/kernel/mca.c
176         </sect2>
177         <sect2><title>MCA Bus DMA</title>
178 !Iinclude/asm-i386/mca_dma.h
179         </sect2>
180      </sect1>
181   </chapter>
182
183   <chapter id="devfs">
184      <title>The Device File System</title>
185 !Efs/devfs/base.c
186   </chapter>
187
188   <chapter id="pmfuncs">
189      <title>Power Management</title>
190 !Ekernel/pm.c
191   </chapter>
192
193   <chapter id="blkdev">
194      <title>Block Devices</title>
195 !Edrivers/block/ll_rw_blk.c
196   </chapter>
197
198   <chapter id="miscdev">
199      <title>Miscellaneous Devices</title>
200 !Edrivers/char/misc.c
201   </chapter>
202
203   <chapter id="viddev">
204      <title>Video4Linux</title>
205 !Edrivers/media/video/videodev.c
206   </chapter>
207
208   <chapter id="snddev">
209      <title>Sound Devices</title>
210 !Edrivers/sound/sound_core.c
211 !Idrivers/sound/sound_firmware.c
212   </chapter>
213
214   <chapter id="usb">
215      <title>USB Devices</title>
216 !Edrivers/usb/usb.c
217   </chapter>
218
219   <chapter id="uart16x50">
220      <title>16x50 UART Driver</title>
221 !Edrivers/char/serial.c
222   </chapter>
223
224   <chapter id="z85230">
225      <title>Z85230 Support Library</title>
226 !Edrivers/net/wan/z85230.c
227   </chapter>
228
229   <chapter id="fbdev">
230      <title>Frame Buffer Library</title>
231
232      <para>
233        The frame buffer drivers depend heavily on four data structures.  
234        These structures are declared in include/linux/fb.h.  They are 
235        fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. 
236        The last three can be made available to and from userland. 
237      </para>
238
239      <para>
240        fb_info defines the current state of a particular video card. 
241        Inside fb_info, there exists a fb_ops structure which is a 
242        collection of needed functions to make fbdev and fbcon work.
243        fb_info is only visible to the kernel.
244      </para>
245
246      <para>
247        fb_var_screeninfo is used to describe the features of a video card 
248        that are user defined.  With fb_var_screeninfo, things such as
249        depth and the resolution may be defined.
250      </para>
251
252      <para>
253        The next structure is fb_fix_screeninfo. This defines the 
254        properties of a card that are created when a mode is set and can't 
255        be changed otherwise.  A good example of this is the start of the 
256        frame buffer memory.  This "locks" the address of the frame buffer
257        memory, so that it cannot be changed or moved.
258      </para>
259
260      <para>
261        The last structure is fb_monospecs. In the old API, there was 
262        little importance for fb_monospecs. This allowed for forbidden things 
263        such as setting a mode of 800x600 on a fix frequency monitor. With 
264        the new API, fb_monospecs prevents such things, and if used 
265        correctly, can prevent a monitor from being cooked.  fb_monospecs
266        will not be useful until kernels 2.5.x.
267      </para>
268
269      <sect1><title>Frame Buffer Memory</title>
270 !Edrivers/video/fbmem.c
271      </sect1>
272      <sect1><title>Frame Buffer Console</title>
273 !Edrivers/video/fbcon.c
274      </sect1>
275      <sect1><title>Frame Buffer Colormap</title>
276 !Edrivers/video/fbcmap.c
277      </sect1>
278      <sect1><title>Frame Buffer Generic Functions</title>
279 !Edrivers/video/fbgen.c
280      </sect1>
281      <sect1><title>Frame Buffer Video Mode Database</title>
282 !Idrivers/video/modedb.c
283 !Edrivers/video/modedb.c
284      </sect1>
285      <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
286 !Idrivers/video/macmodes.c
287      </sect1>
288      <sect1><title>Frame Buffer Fonts</title>
289 !Idrivers/video/fonts.c
290      </sect1>
291   </chapter>
292
293 </book>