README.pvrusb2 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. $Id$
  2. Mike Isely <isely@pobox.com>
  3. pvrusb2 driver
  4. Background:
  5. This driver is intended for the "Hauppauge WinTV PVR USB 2.0", which
  6. is a USB 2.0 hosted TV Tuner. This driver is a work in progress.
  7. Its history started with the reverse-engineering effort by Björn
  8. Danielsson <pvrusb2@dax.nu> whose web page can be found here:
  9. http://pvrusb2.dax.nu/
  10. From there Aurelien Alleaume <slts@free.fr> began an effort to
  11. create a video4linux compatible driver. I began with Aurelien's
  12. last known snapshot and evolved the driver to the state it is in
  13. here.
  14. More information on this driver can be found at:
  15. http://www.isely.net/pvrusb2.html
  16. This driver has a strong separation of layers. They are very
  17. roughly:
  18. 1a. Low level wire-protocol implementation with the device.
  19. 1b. I2C adaptor implementation and corresponding I2C client drivers
  20. implemented elsewhere in V4L.
  21. 1c. High level hardware driver implementation which coordinates all
  22. activities that ensure correct operation of the device.
  23. 2. A "context" layer which manages instancing of driver, setup,
  24. tear-down, arbitration, and interaction with high level
  25. interfaces appropriately as devices are hotplugged in the
  26. system.
  27. 3. High level interfaces which glue the driver to various published
  28. Linux APIs (V4L, sysfs, maybe DVB in the future).
  29. The most important shearing layer is between the top 2 layers. A
  30. lot of work went into the driver to ensure that any kind of
  31. conceivable API can be laid on top of the core driver. (Yes, the
  32. driver internally leverages V4L to do its work but that really has
  33. nothing to do with the API published by the driver to the outside
  34. world.) The architecture allows for different APIs to
  35. simultaneously access the driver. I have a strong sense of fairness
  36. about APIs and also feel that it is a good design principle to keep
  37. implementation and interface isolated from each other. Thus while
  38. right now the V4L high level interface is the most complete, the
  39. sysfs high level interface will work equally well for similar
  40. functions, and there's no reason I see right now why it shouldn't be
  41. possible to produce a DVB high level interface that can sit right
  42. alongside V4L.
  43. NOTE: Complete documentation on the pvrusb2 driver is contained in
  44. the html files within the doc directory; these are exactly the same
  45. as what is on the web site at the time. Browse those files
  46. (especially the FAQ) before asking questions.
  47. Building
  48. To build these modules essentially amounts to just running "Make",
  49. but you need the kernel source tree nearby and you will likely also
  50. want to set a few controlling environment variables first in order
  51. to link things up with that source tree. Please see the Makefile
  52. here for comments that explain how to do that.
  53. Source file list / functional overview:
  54. (Note: The term "module" used below generally refers to loosely
  55. defined functional units within the pvrusb2 driver and bears no
  56. relation to the Linux kernel's concept of a loadable module.)
  57. pvrusb2-audio.[ch] - This is glue logic that resides between this
  58. driver and the msp3400.ko I2C client driver (which is found
  59. elsewhere in V4L).
  60. pvrusb2-context.[ch] - This module implements the context for an
  61. instance of the driver. Everything else eventually ties back to
  62. or is otherwise instanced within the data structures implemented
  63. here. Hotplugging is ultimately coordinated here. All high level
  64. interfaces tie into the driver through this module. This module
  65. helps arbitrate each interface's access to the actual driver core,
  66. and is designed to allow concurrent access through multiple
  67. instances of multiple interfaces (thus you can for example change
  68. the tuner's frequency through sysfs while simultaneously streaming
  69. video through V4L out to an instance of mplayer).
  70. pvrusb2-debug.h - This header defines a printk() wrapper and a mask
  71. of debugging bit definitions for the various kinds of debug
  72. messages that can be enabled within the driver.
  73. pvrusb2-debugifc.[ch] - This module implements a crude command line
  74. oriented debug interface into the driver. Aside from being part
  75. of the process for implementing manual firmware extraction (see
  76. the pvrusb2 web site mentioned earlier), probably I'm the only one
  77. who has ever used this. It is mainly a debugging aid.
  78. pvrusb2-eeprom.[ch] - This is glue logic that resides between this
  79. driver the tveeprom.ko module, which is itself implemented
  80. elsewhere in V4L.
  81. pvrusb2-encoder.[ch] - This module implements all protocol needed to
  82. interact with the Conexant mpeg2 encoder chip within the pvrusb2
  83. device. It is a crude echo of corresponding logic in ivtv,
  84. however the design goals (strict isolation) and physical layer
  85. (proxy through USB instead of PCI) are enough different that this
  86. implementation had to be completely different.
  87. pvrusb2-hdw-internal.h - This header defines the core data structure
  88. in the driver used to track ALL internal state related to control
  89. of the hardware. Nobody outside of the core hardware-handling
  90. modules should have any business using this header. All external
  91. access to the driver should be through one of the high level
  92. interfaces (e.g. V4L, sysfs, etc), and in fact even those high
  93. level interfaces are restricted to the API defined in
  94. pvrusb2-hdw.h and NOT this header.
  95. pvrusb2-hdw.h - This header defines the full internal API for
  96. controlling the hardware. High level interfaces (e.g. V4L, sysfs)
  97. will work through here.
  98. pvrusb2-hdw.c - This module implements all the various bits of logic
  99. that handle overall control of a specific pvrusb2 device.
  100. (Policy, instantiation, and arbitration of pvrusb2 devices fall
  101. within the jurisdiction of pvrusb-context not here).
  102. pvrusb2-i2c-chips-*.c - These modules implement the glue logic to
  103. tie together and configure various I2C modules as they attach to
  104. the I2C bus. There are two versions of this file. The "v4l2"
  105. version is intended to be used in-tree alongside V4L, where we
  106. implement just the logic that makes sense for a pure V4L
  107. environment. The "all" version is intended for use outside of
  108. V4L, where we might encounter other possibly "challenging" modules
  109. from ivtv or older kernel snapshots (or even the support modules
  110. in the standalone snapshot).
  111. pvrusb2-i2c-cmd-v4l1.[ch] - This module implements generic V4L1
  112. compatible commands to the I2C modules. It is here where state
  113. changes inside the pvrusb2 driver are translated into V4L1
  114. commands that are in turn send to the various I2C modules.
  115. pvrusb2-i2c-cmd-v4l2.[ch] - This module implements generic V4L2
  116. compatible commands to the I2C modules. It is here where state
  117. changes inside the pvrusb2 driver are translated into V4L2
  118. commands that are in turn send to the various I2C modules.
  119. pvrusb2-i2c-core.[ch] - This module provides an implementation of a
  120. kernel-friendly I2C adaptor driver, through which other external
  121. I2C client drivers (e.g. msp3400, tuner, lirc) may connect and
  122. operate corresponding chips within the pvrusb2 device. It is
  123. through here that other V4L modules can reach into this driver to
  124. operate specific pieces (and those modules are in turn driven by
  125. glue logic which is coordinated by pvrusb2-hdw, doled out by
  126. pvrusb2-context, and then ultimately made available to users
  127. through one of the high level interfaces).
  128. pvrusb2-io.[ch] - This module implements a very low level ring of
  129. transfer buffers, required in order to stream data from the
  130. device. This module is *very* low level. It only operates the
  131. buffers and makes no attempt to define any policy or mechanism for
  132. how such buffers might be used.
  133. pvrusb2-ioread.[ch] - This module layers on top of pvrusb2-io.[ch]
  134. to provide a streaming API usable by a read() system call style of
  135. I/O. Right now this is the only layer on top of pvrusb2-io.[ch],
  136. however the underlying architecture here was intended to allow for
  137. other styles of I/O to be implemented with additional modules, like
  138. mmap()'ed buffers or something even more exotic.
  139. pvrusb2-main.c - This is the top level of the driver. Module level
  140. and USB core entry points are here. This is our "main".
  141. pvrusb2-sysfs.[ch] - This is the high level interface which ties the
  142. pvrusb2 driver into sysfs. Through this interface you can do
  143. everything with the driver except actually stream data.
  144. pvrusb2-tuner.[ch] - This is glue logic that resides between this
  145. driver and the tuner.ko I2C client driver (which is found
  146. elsewhere in V4L).
  147. pvrusb2-util.h - This header defines some common macros used
  148. throughout the driver. These macros are not really specific to
  149. the driver, but they had to go somewhere.
  150. pvrusb2-v4l2.[ch] - This is the high level interface which ties the
  151. pvrusb2 driver into video4linux. It is through here that V4L
  152. applications can open and operate the driver in the usual V4L
  153. ways. Note that **ALL** V4L functionality is published only
  154. through here and nowhere else.
  155. pvrusb2-video-*.[ch] - This is glue logic that resides between this
  156. driver and the saa711x.ko I2C client driver (which is found
  157. elsewhere in V4L). Note that saa711x.ko used to be known as
  158. saa7115.ko in ivtv. There are two versions of this; one is
  159. selected depending on the particular saa711[5x].ko that is found.
  160. pvrusb2.h - This header contains compile time tunable parameters
  161. (and at the moment the driver has very little that needs to be
  162. tuned).
  163. -Mike Isely
  164. isely@pobox.com