]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []> | |
4 | ||
5 | <book id="LinuxKernelAPI"> | |
6 | <bookinfo> | |
7 | <title>The Linux Kernel API</title> | |
8 | ||
9 | <legalnotice> | |
10 | <para> | |
11 | This documentation is free software; you can redistribute | |
12 | it and/or modify it under the terms of the GNU General Public | |
13 | License as published by the Free Software Foundation; either | |
14 | version 2 of the License, or (at your option) any later | |
15 | version. | |
16 | </para> | |
17 | ||
18 | <para> | |
19 | This program is distributed in the hope that it will be | |
20 | useful, but WITHOUT ANY WARRANTY; without even the implied | |
21 | warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
22 | See the GNU General Public License for more details. | |
23 | </para> | |
24 | ||
25 | <para> | |
26 | You should have received a copy of the GNU General Public | |
27 | License along with this program; if not, write to the Free | |
28 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, | |
29 | MA 02111-1307 USA | |
30 | </para> | |
31 | ||
32 | <para> | |
33 | For more details see the file COPYING in the source | |
34 | distribution of Linux. | |
35 | </para> | |
36 | </legalnotice> | |
37 | </bookinfo> | |
38 | ||
39 | <toc></toc> | |
40 | ||
41 | <chapter id="Basics"> | |
42 | <title>Driver Basics</title> | |
43 | <sect1><title>Driver Entry and Exit points</title> | |
44 | !Iinclude/linux/init.h | |
45 | </sect1> | |
46 | ||
47 | <sect1><title>Atomic and pointer manipulation</title> | |
48 | !Iinclude/asm-i386/atomic.h | |
49 | !Iinclude/asm-i386/unaligned.h | |
50 | </sect1> | |
51 | ||
1da177e4 | 52 | <sect1><title>Delaying, scheduling, and timer routines</title> |
4dc3b16b PP |
53 | !Iinclude/linux/sched.h |
54 | !Ekernel/sched.c | |
55 | !Ekernel/timer.c | |
df78488d TG |
56 | </sect1> |
57 | <sect1><title>High-resolution timers</title> | |
58 | !Iinclude/linux/ktime.h | |
59 | !Iinclude/linux/hrtimer.h | |
60 | !Ekernel/hrtimer.c | |
1da177e4 | 61 | </sect1> |
4dc3b16b PP |
62 | <sect1><title>Internal Functions</title> |
63 | !Ikernel/exit.c | |
64 | !Ikernel/signal.c | |
65 | </sect1> | |
66 | ||
67 | <sect1><title>Kernel objects manipulation</title> | |
68 | <!-- | |
69 | X!Iinclude/linux/kobject.h | |
70 | --> | |
71 | !Elib/kobject.c | |
72 | </sect1> | |
73 | ||
74 | <sect1><title>Kernel utility functions</title> | |
75 | !Iinclude/linux/kernel.h | |
ddad86c2 | 76 | !Ekernel/printk.c |
4dc3b16b PP |
77 | !Ekernel/panic.c |
78 | !Ekernel/sys.c | |
79 | !Ekernel/rcupdate.c | |
80 | </sect1> | |
81 | ||
1da177e4 LT |
82 | </chapter> |
83 | ||
84 | <chapter id="adt"> | |
85 | <title>Data Types</title> | |
86 | <sect1><title>Doubly Linked Lists</title> | |
87 | !Iinclude/linux/list.h | |
88 | </sect1> | |
89 | </chapter> | |
90 | ||
91 | <chapter id="libc"> | |
92 | <title>Basic C Library Functions</title> | |
93 | ||
94 | <para> | |
95 | When writing drivers, you cannot in general use routines which are | |
96 | from the C Library. Some of the functions have been found generally | |
97 | useful and they are listed below. The behaviour of these functions | |
98 | may vary slightly from those defined by ANSI, and these deviations | |
99 | are noted in the text. | |
100 | </para> | |
101 | ||
102 | <sect1><title>String Conversions</title> | |
103 | !Ilib/vsprintf.c | |
104 | !Elib/vsprintf.c | |
105 | </sect1> | |
106 | <sect1><title>String Manipulation</title> | |
4dc3b16b PP |
107 | <!-- All functions are exported at now |
108 | X!Ilib/string.c | |
109 | --> | |
1da177e4 LT |
110 | !Elib/string.c |
111 | </sect1> | |
112 | <sect1><title>Bit Operations</title> | |
113 | !Iinclude/asm-i386/bitops.h | |
114 | </sect1> | |
115 | </chapter> | |
116 | ||
117 | <chapter id="mm"> | |
118 | <title>Memory Management in Linux</title> | |
119 | <sect1><title>The Slab Cache</title> | |
120 | !Emm/slab.c | |
121 | </sect1> | |
122 | <sect1><title>User Space Memory Access</title> | |
123 | !Iinclude/asm-i386/uaccess.h | |
8f2709b5 | 124 | !Earch/i386/lib/usercopy.c |
1da177e4 | 125 | </sect1> |
4dc3b16b PP |
126 | <sect1><title>More Memory Management Functions</title> |
127 | !Iinclude/linux/rmap.h | |
128 | !Emm/readahead.c | |
129 | !Emm/filemap.c | |
130 | !Emm/memory.c | |
131 | !Emm/vmalloc.c | |
132 | !Emm/mempool.c | |
133 | !Emm/page-writeback.c | |
134 | !Emm/truncate.c | |
135 | </sect1> | |
136 | </chapter> | |
137 | ||
138 | ||
139 | <chapter id="ipc"> | |
140 | <title>Kernel IPC facilities</title> | |
141 | ||
142 | <sect1><title>IPC utilities</title> | |
143 | !Iipc/util.c | |
144 | </sect1> | |
1da177e4 LT |
145 | </chapter> |
146 | ||
147 | <chapter id="kfifo"> | |
148 | <title>FIFO Buffer</title> | |
149 | <sect1><title>kfifo interface</title> | |
150 | !Iinclude/linux/kfifo.h | |
151 | !Ekernel/kfifo.c | |
152 | </sect1> | |
153 | </chapter> | |
154 | ||
155 | <chapter id="proc"> | |
156 | <title>The proc filesystem</title> | |
157 | ||
158 | <sect1><title>sysctl interface</title> | |
159 | !Ekernel/sysctl.c | |
160 | </sect1> | |
4dc3b16b PP |
161 | |
162 | <sect1><title>proc filesystem interface</title> | |
163 | !Ifs/proc/base.c | |
164 | </sect1> | |
1da177e4 LT |
165 | </chapter> |
166 | ||
167 | <chapter id="debugfs"> | |
168 | <title>The debugfs filesystem</title> | |
169 | ||
170 | <sect1><title>debugfs interface</title> | |
171 | !Efs/debugfs/inode.c | |
172 | !Efs/debugfs/file.c | |
173 | </sect1> | |
174 | </chapter> | |
175 | ||
176 | <chapter id="vfs"> | |
177 | <title>The Linux VFS</title> | |
4dc3b16b PP |
178 | <sect1><title>The Filesystem types</title> |
179 | !Iinclude/linux/fs.h | |
4dc3b16b | 180 | </sect1> |
1da177e4 LT |
181 | <sect1><title>The Directory Cache</title> |
182 | !Efs/dcache.c | |
183 | !Iinclude/linux/dcache.h | |
184 | </sect1> | |
185 | <sect1><title>Inode Handling</title> | |
186 | !Efs/inode.c | |
187 | !Efs/bad_inode.c | |
188 | </sect1> | |
189 | <sect1><title>Registration and Superblocks</title> | |
190 | !Efs/super.c | |
191 | </sect1> | |
192 | <sect1><title>File Locks</title> | |
193 | !Efs/locks.c | |
194 | !Ifs/locks.c | |
195 | </sect1> | |
4dc3b16b PP |
196 | <sect1><title>Other Functions</title> |
197 | !Efs/mpage.c | |
198 | !Efs/namei.c | |
199 | !Efs/buffer.c | |
200 | !Efs/bio.c | |
201 | !Efs/seq_file.c | |
202 | !Efs/filesystems.c | |
203 | !Efs/fs-writeback.c | |
204 | !Efs/block_dev.c | |
205 | </sect1> | |
1da177e4 LT |
206 | </chapter> |
207 | ||
208 | <chapter id="netcore"> | |
209 | <title>Linux Networking</title> | |
4dc3b16b PP |
210 | <sect1><title>Networking Base Types</title> |
211 | !Iinclude/linux/net.h | |
212 | </sect1> | |
1da177e4 LT |
213 | <sect1><title>Socket Buffer Functions</title> |
214 | !Iinclude/linux/skbuff.h | |
4dc3b16b PP |
215 | !Iinclude/net/sock.h |
216 | !Enet/socket.c | |
1da177e4 | 217 | !Enet/core/skbuff.c |
4dc3b16b PP |
218 | !Enet/core/sock.c |
219 | !Enet/core/datagram.c | |
220 | !Enet/core/stream.c | |
1da177e4 LT |
221 | </sect1> |
222 | <sect1><title>Socket Filter</title> | |
223 | !Enet/core/filter.c | |
224 | </sect1> | |
225 | <sect1><title>Generic Network Statistics</title> | |
226 | !Iinclude/linux/gen_stats.h | |
227 | !Enet/core/gen_stats.c | |
228 | !Enet/core/gen_estimator.c | |
229 | </sect1> | |
4dc3b16b PP |
230 | <sect1><title>SUN RPC subsystem</title> |
231 | <!-- The !D functionality is not perfect, garbage has to be protected by comments | |
232 | !Dnet/sunrpc/sunrpc_syms.c | |
233 | --> | |
234 | !Enet/sunrpc/xdr.c | |
235 | !Enet/sunrpc/svcsock.c | |
236 | !Enet/sunrpc/sched.c | |
237 | </sect1> | |
1da177e4 LT |
238 | </chapter> |
239 | ||
240 | <chapter id="netdev"> | |
241 | <title>Network device support</title> | |
242 | <sect1><title>Driver Support</title> | |
243 | !Enet/core/dev.c | |
c2da8aca | 244 | !Enet/ethernet/eth.c |
461ddf3b RD |
245 | !Iinclude/linux/etherdevice.h |
246 | <!-- FIXME: Removed for now since no structured comments in source | |
247 | X!Enet/core/wireless.c | |
248 | --> | |
1da177e4 LT |
249 | </sect1> |
250 | <sect1><title>Synchronous PPP</title> | |
251 | !Edrivers/net/wan/syncppp.c | |
252 | </sect1> | |
253 | </chapter> | |
254 | ||
255 | <chapter id="modload"> | |
256 | <title>Module Support</title> | |
257 | <sect1><title>Module Loading</title> | |
258 | !Ekernel/kmod.c | |
259 | </sect1> | |
260 | <sect1><title>Inter Module support</title> | |
261 | <para> | |
262 | Refer to the file kernel/module.c for more information. | |
263 | </para> | |
264 | <!-- FIXME: Removed for now since no structured comments in source | |
265 | X!Ekernel/module.c | |
266 | --> | |
267 | </sect1> | |
268 | </chapter> | |
269 | ||
270 | <chapter id="hardware"> | |
271 | <title>Hardware Interfaces</title> | |
272 | <sect1><title>Interrupt Handling</title> | |
8f2709b5 | 273 | !Ekernel/irq/manage.c |
1da177e4 LT |
274 | </sect1> |
275 | ||
4dc3b16b PP |
276 | <sect1><title>Resources Management</title> |
277 | !Ekernel/resource.c | |
278 | </sect1> | |
279 | ||
1da177e4 LT |
280 | <sect1><title>MTRR Handling</title> |
281 | !Earch/i386/kernel/cpu/mtrr/main.c | |
282 | </sect1> | |
283 | <sect1><title>PCI Support Library</title> | |
284 | !Edrivers/pci/pci.c | |
4dc3b16b PP |
285 | !Edrivers/pci/pci-driver.c |
286 | !Edrivers/pci/remove.c | |
287 | !Edrivers/pci/pci-acpi.c | |
288 | <!-- kerneldoc does not understand to __devinit | |
289 | X!Edrivers/pci/search.c | |
290 | --> | |
291 | !Edrivers/pci/msi.c | |
292 | !Edrivers/pci/bus.c | |
f05aab8e RD |
293 | <!-- FIXME: Removed for now since no structured comments in source |
294 | X!Edrivers/pci/hotplug.c | |
295 | --> | |
4dc3b16b PP |
296 | !Edrivers/pci/probe.c |
297 | !Edrivers/pci/rom.c | |
1da177e4 LT |
298 | </sect1> |
299 | <sect1><title>PCI Hotplug Support Library</title> | |
300 | !Edrivers/pci/hotplug/pci_hotplug_core.c | |
301 | </sect1> | |
302 | <sect1><title>MCA Architecture</title> | |
303 | <sect2><title>MCA Device Functions</title> | |
304 | <para> | |
305 | Refer to the file arch/i386/kernel/mca.c for more information. | |
306 | </para> | |
307 | <!-- FIXME: Removed for now since no structured comments in source | |
308 | X!Earch/i386/kernel/mca.c | |
309 | --> | |
310 | </sect2> | |
311 | <sect2><title>MCA Bus DMA</title> | |
312 | !Iinclude/asm-i386/mca_dma.h | |
313 | </sect2> | |
314 | </sect1> | |
315 | </chapter> | |
316 | ||
317 | <chapter id="devfs"> | |
318 | <title>The Device File System</title> | |
319 | !Efs/devfs/base.c | |
320 | </chapter> | |
321 | ||
4dc3b16b PP |
322 | <chapter id="sysfs"> |
323 | <title>The Filesystem for Exporting Kernel Objects</title> | |
324 | !Efs/sysfs/file.c | |
4dc3b16b PP |
325 | !Efs/sysfs/symlink.c |
326 | !Efs/sysfs/bin.c | |
327 | </chapter> | |
328 | ||
1da177e4 LT |
329 | <chapter id="security"> |
330 | <title>Security Framework</title> | |
331 | !Esecurity/security.c | |
332 | </chapter> | |
333 | ||
334 | <chapter id="pmfuncs"> | |
335 | <title>Power Management</title> | |
336 | !Ekernel/power/pm.c | |
337 | </chapter> | |
338 | ||
4dc3b16b PP |
339 | <chapter id="devdrivers"> |
340 | <title>Device drivers infrastructure</title> | |
341 | <sect1><title>Device Drivers Base</title> | |
342 | <!-- | |
343 | X!Iinclude/linux/device.h | |
344 | --> | |
345 | !Edrivers/base/driver.c | |
4dc3b16b PP |
346 | !Edrivers/base/core.c |
347 | !Edrivers/base/firmware_class.c | |
348 | !Edrivers/base/transport_class.c | |
349 | !Edrivers/base/dmapool.c | |
350 | <!-- Cannot be included, because | |
351 | attribute_container_add_class_device_adapter | |
352 | and attribute_container_classdev_to_container | |
353 | exceed allowed 44 characters maximum | |
354 | X!Edrivers/base/attribute_container.c | |
355 | --> | |
356 | !Edrivers/base/sys.c | |
357 | <!-- | |
358 | X!Edrivers/base/interface.c | |
359 | --> | |
360 | !Edrivers/base/platform.c | |
361 | !Edrivers/base/bus.c | |
362 | </sect1> | |
363 | <sect1><title>Device Drivers Power Management</title> | |
364 | !Edrivers/base/power/main.c | |
365 | !Edrivers/base/power/resume.c | |
366 | !Edrivers/base/power/suspend.c | |
367 | </sect1> | |
368 | <sect1><title>Device Drivers ACPI Support</title> | |
369 | <!-- Internal functions only | |
370 | X!Edrivers/acpi/sleep/main.c | |
371 | X!Edrivers/acpi/sleep/wakeup.c | |
372 | X!Edrivers/acpi/motherboard.c | |
373 | X!Edrivers/acpi/bus.c | |
374 | --> | |
375 | !Edrivers/acpi/scan.c | |
d758a8fa | 376 | !Idrivers/acpi/scan.c |
4dc3b16b PP |
377 | <!-- No correct structured comments |
378 | X!Edrivers/acpi/pci_bind.c | |
379 | --> | |
380 | </sect1> | |
381 | <sect1><title>Device drivers PnP support</title> | |
382 | !Edrivers/pnp/core.c | |
383 | <!-- No correct structured comments | |
384 | X!Edrivers/pnp/system.c | |
385 | --> | |
386 | !Edrivers/pnp/card.c | |
387 | !Edrivers/pnp/driver.c | |
388 | !Edrivers/pnp/manager.c | |
389 | !Edrivers/pnp/support.c | |
390 | </sect1> | |
391 | </chapter> | |
392 | ||
393 | ||
1da177e4 LT |
394 | <chapter id="blkdev"> |
395 | <title>Block Devices</title> | |
1d193f4f | 396 | !Eblock/ll_rw_blk.c |
1da177e4 LT |
397 | </chapter> |
398 | ||
399 | <chapter id="miscdev"> | |
400 | <title>Miscellaneous Devices</title> | |
401 | !Edrivers/char/misc.c | |
402 | </chapter> | |
403 | ||
404 | <chapter id="viddev"> | |
405 | <title>Video4Linux</title> | |
406 | !Edrivers/media/video/videodev.c | |
407 | </chapter> | |
408 | ||
409 | <chapter id="snddev"> | |
410 | <title>Sound Devices</title> | |
4dc3b16b | 411 | !Iinclude/sound/core.h |
1da177e4 | 412 | !Esound/sound_core.c |
4dc3b16b PP |
413 | !Iinclude/sound/pcm.h |
414 | !Esound/core/pcm.c | |
415 | !Esound/core/device.c | |
416 | !Esound/core/info.c | |
417 | !Esound/core/rawmidi.c | |
418 | !Esound/core/sound.c | |
419 | !Esound/core/memory.c | |
420 | !Esound/core/pcm_memory.c | |
421 | !Esound/core/init.c | |
422 | !Esound/core/isadma.c | |
423 | !Esound/core/control.c | |
424 | !Esound/core/pcm_lib.c | |
425 | !Esound/core/hwdep.c | |
426 | !Esound/core/pcm_native.c | |
427 | !Esound/core/memalloc.c | |
1da177e4 LT |
428 | <!-- FIXME: Removed for now since no structured comments in source |
429 | X!Isound/sound_firmware.c | |
430 | --> | |
431 | </chapter> | |
432 | ||
433 | <chapter id="uart16x50"> | |
434 | <title>16x50 UART Driver</title> | |
4dc3b16b | 435 | !Iinclude/linux/serial_core.h |
1da177e4 LT |
436 | !Edrivers/serial/serial_core.c |
437 | !Edrivers/serial/8250.c | |
438 | </chapter> | |
439 | ||
440 | <chapter id="z85230"> | |
441 | <title>Z85230 Support Library</title> | |
442 | !Edrivers/net/wan/z85230.c | |
443 | </chapter> | |
444 | ||
445 | <chapter id="fbdev"> | |
446 | <title>Frame Buffer Library</title> | |
447 | ||
448 | <para> | |
449 | The frame buffer drivers depend heavily on four data structures. | |
450 | These structures are declared in include/linux/fb.h. They are | |
451 | fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. | |
452 | The last three can be made available to and from userland. | |
453 | </para> | |
454 | ||
455 | <para> | |
456 | fb_info defines the current state of a particular video card. | |
457 | Inside fb_info, there exists a fb_ops structure which is a | |
458 | collection of needed functions to make fbdev and fbcon work. | |
459 | fb_info is only visible to the kernel. | |
460 | </para> | |
461 | ||
462 | <para> | |
463 | fb_var_screeninfo is used to describe the features of a video card | |
464 | that are user defined. With fb_var_screeninfo, things such as | |
465 | depth and the resolution may be defined. | |
466 | </para> | |
467 | ||
468 | <para> | |
469 | The next structure is fb_fix_screeninfo. This defines the | |
470 | properties of a card that are created when a mode is set and can't | |
471 | be changed otherwise. A good example of this is the start of the | |
472 | frame buffer memory. This "locks" the address of the frame buffer | |
473 | memory, so that it cannot be changed or moved. | |
474 | </para> | |
475 | ||
476 | <para> | |
477 | The last structure is fb_monospecs. In the old API, there was | |
478 | little importance for fb_monospecs. This allowed for forbidden things | |
479 | such as setting a mode of 800x600 on a fix frequency monitor. With | |
480 | the new API, fb_monospecs prevents such things, and if used | |
481 | correctly, can prevent a monitor from being cooked. fb_monospecs | |
482 | will not be useful until kernels 2.5.x. | |
483 | </para> | |
484 | ||
485 | <sect1><title>Frame Buffer Memory</title> | |
486 | !Edrivers/video/fbmem.c | |
487 | </sect1> | |
4dc3b16b | 488 | <!-- |
1da177e4 | 489 | <sect1><title>Frame Buffer Console</title> |
4dc3b16b | 490 | X!Edrivers/video/console/fbcon.c |
1da177e4 | 491 | </sect1> |
4dc3b16b | 492 | --> |
1da177e4 LT |
493 | <sect1><title>Frame Buffer Colormap</title> |
494 | !Edrivers/video/fbcmap.c | |
495 | </sect1> | |
496 | <!-- FIXME: | |
497 | drivers/video/fbgen.c has no docs, which stuffs up the sgml. Comment | |
498 | out until somebody adds docs. KAO | |
499 | <sect1><title>Frame Buffer Generic Functions</title> | |
500 | X!Idrivers/video/fbgen.c | |
501 | </sect1> | |
502 | KAO --> | |
503 | <sect1><title>Frame Buffer Video Mode Database</title> | |
504 | !Idrivers/video/modedb.c | |
505 | !Edrivers/video/modedb.c | |
506 | </sect1> | |
507 | <sect1><title>Frame Buffer Macintosh Video Mode Database</title> | |
8f2709b5 | 508 | !Edrivers/video/macmodes.c |
1da177e4 LT |
509 | </sect1> |
510 | <sect1><title>Frame Buffer Fonts</title> | |
511 | <para> | |
512 | Refer to the file drivers/video/console/fonts.c for more information. | |
513 | </para> | |
514 | <!-- FIXME: Removed for now since no structured comments in source | |
515 | X!Idrivers/video/console/fonts.c | |
516 | --> | |
517 | </sect1> | |
518 | </chapter> | |
519 | </book> |