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