kernel-api.tmpl 8.6 KB

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