ef66fdda129f2a7eda2862bd2698395bdb137638
[linux-2.6.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 <!-- FIXME:
50   kernel/sched.c has no docs, which stuffs up the sgml.  Comment
51   out until somebody adds docs.  KAO
52      <sect1><title>Delaying, scheduling, and timer routines</title>
53 X!Ekernel/sched.c
54      </sect1>
55 KAO -->
56   </chapter>
57
58   <chapter id="adt">
59      <title>Data Types</title>
60      <sect1><title>Doubly Linked Lists</title>
61 !Iinclude/linux/list.h
62      </sect1>
63   </chapter>
64
65   <chapter id="libc">
66      <title>Basic C Library Functions</title>
67
68      <para>
69        When writing drivers, you cannot in general use routines which are
70        from the C Library.  Some of the functions have been found generally
71        useful and they are listed below.  The behaviour of these functions
72        may vary slightly from those defined by ANSI, and these deviations
73        are noted in the text.
74      </para>
75
76      <sect1><title>String Conversions</title>
77 !Ilib/vsprintf.c
78 !Elib/vsprintf.c
79      </sect1>
80      <sect1><title>String Manipulation</title>
81 !Ilib/string.c
82 !Elib/string.c
83      </sect1>
84      <sect1><title>Bit Operations</title>
85 !Iinclude/asm-i386/bitops.h
86      </sect1>
87   </chapter>
88
89   <chapter id="mm">
90      <title>Memory Management in Linux</title>
91      <sect1><title>The Slab Cache</title>
92 !Emm/slab.c
93      </sect1>
94      <sect1><title>User Space Memory Access</title>
95 !Iinclude/asm-i386/uaccess.h
96 !Iarch/i386/lib/usercopy.c
97      </sect1>
98   </chapter>
99
100   <chapter id="proc">
101      <title>The proc filesystem</title>
102  
103      <sect1><title>sysctl interface</title>
104 !Ekernel/sysctl.c
105      </sect1>
106   </chapter>
107
108   <chapter id="vfs">
109      <title>The Linux VFS</title>
110      <sect1><title>The Directory Cache</title>
111 !Efs/dcache.c
112 !Iinclude/linux/dcache.h
113      </sect1>
114      <sect1><title>Inode Handling</title>
115 !Efs/inode.c
116 !Efs/bad_inode.c
117      </sect1>
118      <sect1><title>Registration and Superblocks</title>
119 !Efs/super.c
120      </sect1>
121      <sect1><title>File Locks</title>
122 !Efs/locks.c
123 !Ifs/locks.c
124      </sect1>
125   </chapter>
126
127   <chapter id="netcore">
128      <title>Linux Networking</title>
129      <sect1><title>Socket Buffer Functions</title>
130 !Iinclude/linux/skbuff.h
131 !Enet/core/skbuff.c
132      </sect1>
133      <sect1><title>Socket Filter</title>
134 !Enet/core/filter.c
135      </sect1>
136      <sect1><title>Generic Network Statistics</title>
137 !Iinclude/linux/gen_stats.h
138 !Enet/core/gen_stats.c
139 !Enet/core/gen_estimator.c
140      </sect1>
141   </chapter>
142
143   <chapter id="netdev">
144      <title>Network device support</title>
145      <sect1><title>Driver Support</title>
146 !Edrivers/net/net_init.c
147 !Enet/core/dev.c
148      </sect1>
149      <sect1><title>8390 Based Network Cards</title>
150 !Edrivers/net/8390.c
151      </sect1>
152      <sect1><title>Synchronous PPP</title>
153 !Edrivers/net/wan/syncppp.c
154      </sect1>
155   </chapter>
156
157   <chapter id="modload">
158      <title>Module Support</title>
159      <sect1><title>Module Loading</title>
160 !Ekernel/kmod.c
161      </sect1>
162      <sect1><title>Inter Module support</title>
163         <para>
164            Refer to the file kernel/module.c for more information.
165         </para>
166 <!-- FIXME: Removed for now since no structured comments in source
167 X!Ekernel/module.c
168 -->
169      </sect1>
170   </chapter>
171
172   <chapter id="hardware">
173      <title>Hardware Interfaces</title>
174      <sect1><title>Interrupt Handling</title>
175 !Iarch/i386/kernel/irq.c
176      </sect1>
177
178      <sect1><title>MTRR Handling</title>
179 !Earch/i386/kernel/cpu/mtrr/main.c
180      </sect1>
181      <sect1><title>PCI Support Library</title>
182 !Edrivers/pci/pci.c
183      </sect1>
184      <sect1><title>PCI Hotplug Support Library</title>
185 !Edrivers/pci/hotplug/pci_hotplug_core.c
186      </sect1>
187      <sect1><title>MCA Architecture</title>
188         <sect2><title>MCA Device Functions</title>
189            <para>
190               Refer to the file arch/i386/kernel/mca.c for more information.
191            </para>
192 <!-- FIXME: Removed for now since no structured comments in source
193 X!Earch/i386/kernel/mca.c
194 -->
195         </sect2>
196         <sect2><title>MCA Bus DMA</title>
197 !Iinclude/asm-i386/mca_dma.h
198         </sect2>
199      </sect1>
200   </chapter>
201
202   <chapter id="devfs">
203      <title>The Device File System</title>
204 !Efs/devfs/base.c
205   </chapter>
206
207   <chapter id="security">
208      <title>Security Framework</title>
209 !Esecurity/security.c
210   </chapter>
211
212   <chapter id="pmfuncs">
213      <title>Power Management</title>
214 !Ekernel/power/pm.c
215   </chapter>
216
217   <chapter id="blkdev">
218      <title>Block Devices</title>
219 !Edrivers/block/ll_rw_blk.c
220   </chapter>
221
222   <chapter id="miscdev">
223      <title>Miscellaneous Devices</title>
224 !Edrivers/char/misc.c
225   </chapter>
226
227   <chapter id="viddev">
228      <title>Video4Linux</title>
229 !Edrivers/media/video/videodev.c
230   </chapter>
231
232   <chapter id="snddev">
233      <title>Sound Devices</title>
234 !Esound/sound_core.c
235 <!-- FIXME: Removed for now since no structured comments in source
236 X!Isound/sound_firmware.c
237 -->
238   </chapter>
239
240   <chapter id="uart16x50">
241      <title>16x50 UART Driver</title>
242 !Edrivers/serial/serial_core.c
243 !Edrivers/serial/8250.c
244   </chapter>
245
246   <chapter id="z85230">
247      <title>Z85230 Support Library</title>
248 !Edrivers/net/wan/z85230.c
249   </chapter>
250
251   <chapter id="fbdev">
252      <title>Frame Buffer Library</title>
253
254      <para>
255        The frame buffer drivers depend heavily on four data structures.  
256        These structures are declared in include/linux/fb.h.  They are 
257        fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. 
258        The last three can be made available to and from userland. 
259      </para>
260
261      <para>
262        fb_info defines the current state of a particular video card. 
263        Inside fb_info, there exists a fb_ops structure which is a 
264        collection of needed functions to make fbdev and fbcon work.
265        fb_info is only visible to the kernel.
266      </para>
267
268      <para>
269        fb_var_screeninfo is used to describe the features of a video card 
270        that are user defined.  With fb_var_screeninfo, things such as
271        depth and the resolution may be defined.
272      </para>
273
274      <para>
275        The next structure is fb_fix_screeninfo. This defines the 
276        properties of a card that are created when a mode is set and can't 
277        be changed otherwise.  A good example of this is the start of the 
278        frame buffer memory.  This "locks" the address of the frame buffer
279        memory, so that it cannot be changed or moved.
280      </para>
281
282      <para>
283        The last structure is fb_monospecs. In the old API, there was 
284        little importance for fb_monospecs. This allowed for forbidden things 
285        such as setting a mode of 800x600 on a fix frequency monitor. With 
286        the new API, fb_monospecs prevents such things, and if used 
287        correctly, can prevent a monitor from being cooked.  fb_monospecs
288        will not be useful until kernels 2.5.x.
289      </para>
290
291      <sect1><title>Frame Buffer Memory</title>
292 !Edrivers/video/fbmem.c
293      </sect1>
294      <sect1><title>Frame Buffer Console</title>
295 !Edrivers/video/console/fbcon.c
296      </sect1>
297      <sect1><title>Frame Buffer Colormap</title>
298 !Edrivers/video/fbcmap.c
299      </sect1>
300 <!-- FIXME:
301   drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
302   out until somebody adds docs.  KAO
303      <sect1><title>Frame Buffer Generic Functions</title>
304 X!Idrivers/video/fbgen.c
305      </sect1>
306 KAO -->
307      <sect1><title>Frame Buffer Video Mode Database</title>
308 !Idrivers/video/modedb.c
309 !Edrivers/video/modedb.c
310      </sect1>
311      <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
312 !Idrivers/video/macmodes.c
313      </sect1>
314      <sect1><title>Frame Buffer Fonts</title>
315         <para>
316            Refer to the file drivers/video/console/fonts.c for more information.
317         </para>
318 <!-- FIXME: Removed for now since no structured comments in source
319 X!Idrivers/video/console/fonts.c
320 -->
321      </sect1>
322   </chapter>
323 </book>