kernel-api.tmpl 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. <book id="LinuxKernelAPI">
  5. <bookinfo>
  6. <title>The Linux Kernel API</title>
  7. <legalnotice>
  8. <para>
  9. This documentation is free software; you can redistribute
  10. it and/or modify it under the terms of the GNU General Public
  11. License as published by the Free Software Foundation; either
  12. version 2 of the License, or (at your option) any later
  13. version.
  14. </para>
  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. <para>
  22. You should have received a copy of the GNU General Public
  23. License along with this program; if not, write to the Free
  24. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  25. MA 02111-1307 USA
  26. </para>
  27. <para>
  28. For more details see the file COPYING in the source
  29. distribution of Linux.
  30. </para>
  31. </legalnotice>
  32. </bookinfo>
  33. <toc></toc>
  34. <chapter id="adt">
  35. <title>Data Types</title>
  36. <sect1><title>Doubly Linked Lists</title>
  37. !Iinclude/linux/list.h
  38. </sect1>
  39. </chapter>
  40. <chapter id="libc">
  41. <title>Basic C Library Functions</title>
  42. <para>
  43. When writing drivers, you cannot in general use routines which are
  44. from the C Library. Some of the functions have been found generally
  45. useful and they are listed below. The behaviour of these functions
  46. may vary slightly from those defined by ANSI, and these deviations
  47. are noted in the text.
  48. </para>
  49. <sect1><title>String Conversions</title>
  50. !Ilib/vsprintf.c
  51. !Elib/vsprintf.c
  52. </sect1>
  53. <sect1><title>String Manipulation</title>
  54. <!-- All functions are exported at now
  55. X!Ilib/string.c
  56. -->
  57. !Elib/string.c
  58. </sect1>
  59. <sect1><title>Bit Operations</title>
  60. !Iarch/x86/include/asm/bitops.h
  61. </sect1>
  62. </chapter>
  63. <chapter id="kernel-lib">
  64. <title>Basic Kernel Library Functions</title>
  65. <para>
  66. The Linux kernel provides more basic utility functions.
  67. </para>
  68. <sect1><title>Bitmap Operations</title>
  69. !Elib/bitmap.c
  70. !Ilib/bitmap.c
  71. </sect1>
  72. <sect1><title>Command-line Parsing</title>
  73. !Elib/cmdline.c
  74. </sect1>
  75. <sect1 id="crc"><title>CRC Functions</title>
  76. !Elib/crc7.c
  77. !Elib/crc16.c
  78. !Elib/crc-itu-t.c
  79. !Elib/crc32.c
  80. !Elib/crc-ccitt.c
  81. </sect1>
  82. </chapter>
  83. <chapter id="mm">
  84. <title>Memory Management in Linux</title>
  85. <sect1><title>The Slab Cache</title>
  86. !Iinclude/linux/slab.h
  87. !Emm/slab.c
  88. </sect1>
  89. <sect1><title>User Space Memory Access</title>
  90. !Iarch/x86/include/asm/uaccess_32.h
  91. !Earch/x86/lib/usercopy_32.c
  92. </sect1>
  93. <sect1><title>More Memory Management Functions</title>
  94. !Emm/readahead.c
  95. !Emm/filemap.c
  96. !Emm/memory.c
  97. !Emm/vmalloc.c
  98. !Imm/page_alloc.c
  99. !Emm/mempool.c
  100. !Emm/dmapool.c
  101. !Emm/page-writeback.c
  102. !Emm/truncate.c
  103. </sect1>
  104. </chapter>
  105. <chapter id="ipc">
  106. <title>Kernel IPC facilities</title>
  107. <sect1><title>IPC utilities</title>
  108. !Iipc/util.c
  109. </sect1>
  110. </chapter>
  111. <chapter id="kfifo">
  112. <title>FIFO Buffer</title>
  113. <sect1><title>kfifo interface</title>
  114. !Iinclude/linux/kfifo.h
  115. !Ekernel/kfifo.c
  116. </sect1>
  117. </chapter>
  118. <chapter id="relayfs">
  119. <title>relay interface support</title>
  120. <para>
  121. Relay interface support
  122. is designed to provide an efficient mechanism for tools and
  123. facilities to relay large amounts of data from kernel space to
  124. user space.
  125. </para>
  126. <sect1><title>relay interface</title>
  127. !Ekernel/relay.c
  128. !Ikernel/relay.c
  129. </sect1>
  130. </chapter>
  131. <chapter id="modload">
  132. <title>Module Support</title>
  133. <sect1><title>Module Loading</title>
  134. !Ekernel/kmod.c
  135. </sect1>
  136. <sect1><title>Inter Module support</title>
  137. <para>
  138. Refer to the file kernel/module.c for more information.
  139. </para>
  140. <!-- FIXME: Removed for now since no structured comments in source
  141. X!Ekernel/module.c
  142. -->
  143. </sect1>
  144. </chapter>
  145. <chapter id="hardware">
  146. <title>Hardware Interfaces</title>
  147. <sect1><title>Interrupt Handling</title>
  148. !Ekernel/irq/manage.c
  149. </sect1>
  150. <sect1><title>DMA Channels</title>
  151. !Ekernel/dma.c
  152. </sect1>
  153. <sect1><title>Resources Management</title>
  154. !Ikernel/resource.c
  155. !Ekernel/resource.c
  156. </sect1>
  157. <sect1><title>MTRR Handling</title>
  158. !Earch/x86/kernel/cpu/mtrr/main.c
  159. </sect1>
  160. <sect1><title>PCI Support Library</title>
  161. !Edrivers/pci/pci.c
  162. !Edrivers/pci/pci-driver.c
  163. !Edrivers/pci/remove.c
  164. !Edrivers/pci/search.c
  165. !Edrivers/pci/msi.c
  166. !Edrivers/pci/bus.c
  167. !Edrivers/pci/access.c
  168. !Edrivers/pci/irq.c
  169. !Edrivers/pci/htirq.c
  170. <!-- FIXME: Removed for now since no structured comments in source
  171. X!Edrivers/pci/hotplug.c
  172. -->
  173. !Edrivers/pci/probe.c
  174. !Edrivers/pci/slot.c
  175. !Edrivers/pci/rom.c
  176. !Edrivers/pci/iov.c
  177. !Idrivers/pci/pci-sysfs.c
  178. </sect1>
  179. <sect1><title>PCI Hotplug Support Library</title>
  180. !Edrivers/pci/hotplug/pci_hotplug_core.c
  181. </sect1>
  182. <sect1><title>MCA Architecture</title>
  183. <sect2><title>MCA Device Functions</title>
  184. <para>
  185. Refer to the file arch/x86/kernel/mca_32.c for more information.
  186. </para>
  187. <!-- FIXME: Removed for now since no structured comments in source
  188. X!Earch/x86/kernel/mca_32.c
  189. -->
  190. </sect2>
  191. <sect2><title>MCA Bus DMA</title>
  192. !Iarch/x86/include/asm/mca_dma.h
  193. </sect2>
  194. </sect1>
  195. </chapter>
  196. <chapter id="firmware">
  197. <title>Firmware Interfaces</title>
  198. <sect1><title>DMI Interfaces</title>
  199. !Edrivers/firmware/dmi_scan.c
  200. </sect1>
  201. <sect1><title>EDD Interfaces</title>
  202. !Idrivers/firmware/edd.c
  203. </sect1>
  204. </chapter>
  205. <chapter id="security">
  206. <title>Security Framework</title>
  207. !Isecurity/security.c
  208. !Esecurity/inode.c
  209. </chapter>
  210. <chapter id="audit">
  211. <title>Audit Interfaces</title>
  212. !Ekernel/audit.c
  213. !Ikernel/auditsc.c
  214. !Ikernel/auditfilter.c
  215. </chapter>
  216. <chapter id="accounting">
  217. <title>Accounting Framework</title>
  218. !Ikernel/acct.c
  219. </chapter>
  220. <chapter id="blkdev">
  221. <title>Block Devices</title>
  222. !Eblock/blk-core.c
  223. !Iblock/blk-core.c
  224. !Eblock/blk-map.c
  225. !Iblock/blk-sysfs.c
  226. !Eblock/blk-settings.c
  227. !Eblock/blk-exec.c
  228. !Eblock/blk-barrier.c
  229. !Eblock/blk-tag.c
  230. !Iblock/blk-tag.c
  231. !Eblock/blk-integrity.c
  232. !Ikernel/trace/blktrace.c
  233. !Iblock/genhd.c
  234. !Eblock/genhd.c
  235. </chapter>
  236. <chapter id="chrdev">
  237. <title>Char devices</title>
  238. !Efs/char_dev.c
  239. </chapter>
  240. <chapter id="miscdev">
  241. <title>Miscellaneous Devices</title>
  242. !Edrivers/char/misc.c
  243. </chapter>
  244. <chapter id="clk">
  245. <title>Clock Framework</title>
  246. <para>
  247. The clock framework defines programming interfaces to support
  248. software management of the system clock tree.
  249. This framework is widely used with System-On-Chip (SOC) platforms
  250. to support power management and various devices which may need
  251. custom clock rates.
  252. Note that these "clocks" don't relate to timekeeping or real
  253. time clocks (RTCs), each of which have separate frameworks.
  254. These <structname>struct clk</structname> instances may be used
  255. to manage for example a 96 MHz signal that is used to shift bits
  256. into and out of peripherals or busses, or otherwise trigger
  257. synchronous state machine transitions in system hardware.
  258. </para>
  259. <para>
  260. Power management is supported by explicit software clock gating:
  261. unused clocks are disabled, so the system doesn't waste power
  262. changing the state of transistors that aren't in active use.
  263. On some systems this may be backed by hardware clock gating,
  264. where clocks are gated without being disabled in software.
  265. Sections of chips that are powered but not clocked may be able
  266. to retain their last state.
  267. This low power state is often called a <emphasis>retention
  268. mode</emphasis>.
  269. This mode still incurs leakage currents, especially with finer
  270. circuit geometries, but for CMOS circuits power is mostly used
  271. by clocked state changes.
  272. </para>
  273. <para>
  274. Power-aware drivers only enable their clocks when the device
  275. they manage is in active use. Also, system sleep states often
  276. differ according to which clock domains are active: while a
  277. "standby" state may allow wakeup from several active domains, a
  278. "mem" (suspend-to-RAM) state may require a more wholesale shutdown
  279. of clocks derived from higher speed PLLs and oscillators, limiting
  280. the number of possible wakeup event sources. A driver's suspend
  281. method may need to be aware of system-specific clock constraints
  282. on the target sleep state.
  283. </para>
  284. <para>
  285. Some platforms support programmable clock generators. These
  286. can be used by external chips of various kinds, such as other
  287. CPUs, multimedia codecs, and devices with strict requirements
  288. for interface clocking.
  289. </para>
  290. !Iinclude/linux/clk.h
  291. </chapter>
  292. </book>