1 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN"[]>
2 <book id="LinuxKernelAPI">
4 <title>The Linux Kernel API</title>
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
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.
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,
30 For more details see the file COPYING in the source
31 distribution of Linux.
39 <title>Driver Basics</title>
40 <sect1><title>Driver Entry and Exit points</title>
41 !Iinclude/linux/init.h
44 <sect1><title>Atomic and pointer manipulation</title>
45 !Iinclude/asm-i386/atomic.h
46 !Iinclude/asm-i386/unaligned.h
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>
59 <title>Data Types</title>
60 <sect1><title>Doubly Linked Lists</title>
61 !Iinclude/linux/list.h
66 <title>Basic C Library Functions</title>
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.
76 <sect1><title>String Conversions</title>
80 <sect1><title>String Manipulation</title>
84 <sect1><title>Bit Operations</title>
85 !Iinclude/asm-i386/bitops.h
90 <title>Memory Management in Linux</title>
91 <sect1><title>The Slab Cache</title>
94 <sect1><title>User Space Memory Access</title>
95 !Iinclude/asm-i386/uaccess.h
96 !Iarch/i386/lib/usercopy.c
101 <title>The proc filesystem</title>
103 <sect1><title>sysctl interface</title>
109 <title>The Linux VFS</title>
110 <sect1><title>The Directory Cache</title>
112 !Iinclude/linux/dcache.h
114 <sect1><title>Inode Handling</title>
118 <sect1><title>Registration and Superblocks</title>
121 <sect1><title>File Locks</title>
127 <chapter id="netcore">
128 <title>Linux Networking</title>
129 <sect1><title>Socket Buffer Functions</title>
130 !Iinclude/linux/skbuff.h
133 <sect1><title>Socket Filter</title>
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
143 <chapter id="netdev">
144 <title>Network device support</title>
145 <sect1><title>Driver Support</title>
146 !Edrivers/net/net_init.c
149 <sect1><title>8390 Based Network Cards</title>
152 <sect1><title>Synchronous PPP</title>
153 !Edrivers/net/wan/syncppp.c
157 <chapter id="modload">
158 <title>Module Support</title>
159 <sect1><title>Module Loading</title>
162 <sect1><title>Inter Module support</title>
164 Refer to the file kernel/module.c for more information.
166 <!-- FIXME: Removed for now since no structured comments in source
172 <chapter id="hardware">
173 <title>Hardware Interfaces</title>
174 <sect1><title>Interrupt Handling</title>
175 !Iarch/i386/kernel/irq.c
178 <sect1><title>MTRR Handling</title>
179 !Earch/i386/kernel/cpu/mtrr/main.c
181 <sect1><title>PCI Support Library</title>
184 <sect1><title>PCI Hotplug Support Library</title>
185 !Edrivers/pci/hotplug/pci_hotplug_core.c
187 <sect1><title>MCA Architecture</title>
188 <sect2><title>MCA Device Functions</title>
190 Refer to the file arch/i386/kernel/mca.c for more information.
192 <!-- FIXME: Removed for now since no structured comments in source
193 X!Earch/i386/kernel/mca.c
196 <sect2><title>MCA Bus DMA</title>
197 !Iinclude/asm-i386/mca_dma.h
203 <title>The Device File System</title>
207 <chapter id="security">
208 <title>Security Framework</title>
209 !Esecurity/security.c
212 <chapter id="pmfuncs">
213 <title>Power Management</title>
217 <chapter id="blkdev">
218 <title>Block Devices</title>
219 !Edrivers/block/ll_rw_blk.c
222 <chapter id="miscdev">
223 <title>Miscellaneous Devices</title>
224 !Edrivers/char/misc.c
227 <chapter id="viddev">
228 <title>Video4Linux</title>
229 !Edrivers/media/video/videodev.c
232 <chapter id="snddev">
233 <title>Sound Devices</title>
235 <!-- FIXME: Removed for now since no structured comments in source
236 X!Isound/sound_firmware.c
240 <chapter id="uart16x50">
241 <title>16x50 UART Driver</title>
242 !Edrivers/serial/serial_core.c
243 !Edrivers/serial/8250.c
246 <chapter id="z85230">
247 <title>Z85230 Support Library</title>
248 !Edrivers/net/wan/z85230.c
252 <title>Frame Buffer Library</title>
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.
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.
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.
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.
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.
291 <sect1><title>Frame Buffer Memory</title>
292 !Edrivers/video/fbmem.c
294 <sect1><title>Frame Buffer Console</title>
295 !Edrivers/video/console/fbcon.c
297 <sect1><title>Frame Buffer Colormap</title>
298 !Edrivers/video/fbcmap.c
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
307 <sect1><title>Frame Buffer Video Mode Database</title>
308 !Idrivers/video/modedb.c
309 !Edrivers/video/modedb.c
311 <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
312 !Idrivers/video/macmodes.c
314 <sect1><title>Frame Buffer Fonts</title>
316 Refer to the file drivers/video/console/fonts.c for more information.
318 <!-- FIXME: Removed for now since no structured comments in source
319 X!Idrivers/video/console/fonts.c