driver_usage.txt 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. Section 1 Overview
  2. The Media Oriented Systems Transport (MOST) driver gives Linux applications
  3. access a MOST network: The Automotive Information Backbone and the de-facto
  4. standard for high-bandwidth automotive multimedia networking.
  5. MOST defines the protocol, hardware and software layers necessary to allow
  6. for the efficient and low-cost transport of control, real-time and packet
  7. data using a single medium (physical layer). Media currently in use are
  8. fiber optics, unshielded twisted pair cables (UTP) and coax cables. MOST
  9. also supports various speed grades up to 150 Mbps.
  10. For more information on MOST, visit the MOST Cooperation website:
  11. www.mostcooperation.com.
  12. Cars continue to evolve into sophisticated consumer electronics platforms,
  13. increasing the demand for reliable and simple solutions to support audio,
  14. video and data communications. MOST can be used to connect multiple
  15. consumer devices via optical or electrical physical layers directly to one
  16. another or in a network configuration. As a synchronous network, MOST
  17. provides excellent Quality of Service and seamless connectivity for
  18. audio/video streaming. Therefore, the driver perfectly fits to the mission
  19. of Automotive Grade Linux to create open source software solutions for
  20. automotive applications.
  21. The driver consists basically of three layers. The hardware layer, the
  22. core layer and the application layer. The core layer consists of the core
  23. module only. This module handles the communication flow through all three
  24. layers, the configuration of the driver, the configuration interface
  25. representation in sysfs, and the buffer management.
  26. For each of the other two layers a selection of modules is provided. These
  27. modules can arbitrarily be combined to meet the needs of the desired
  28. system architecture. A module of the hardware layer is referred to as an
  29. HDM (hardware dependent module). Each module of this layer handles exactly
  30. one of the peripheral interfaces of a network interface controller (e.g.
  31. USB, MediaLB, I2C). A module of the application layer is referred to as an
  32. AIM (application interfacing module). The modules of this layer give access
  33. to MOST via one the following ways: character devices, ALSA, Networking or
  34. V4L2.
  35. To physically access MOST, an Intelligent Network Interface Controller
  36. (INIC) is needed. For more information on available controllers visit:
  37. www.microchip.com
  38. Section 1.1 Hardware Layer
  39. The hardware layer contains so called hardware dependent modules (HDM). For each
  40. peripheral interface the hardware supports the driver has a suitable module
  41. that handles the interface.
  42. The HDMs encapsulate the peripheral interface specific knowledge of the driver
  43. and provides an easy way of extending the number of supported interfaces.
  44. Currently the following HDMs are available:
  45. 1) MediaLB (DIM2)
  46. Host wants to communicate with hardware via MediaLB.
  47. 2) I2C
  48. Host wants to communicate with the hardware via I2C.
  49. 3) USB
  50. Host wants to communicate with the hardware via USB.
  51. Section 1.2 Core Layer
  52. The core layer contains the mostcore module only, which processes the driver
  53. configuration via sysfs, buffer management and data forwarding.
  54. Section 1.2 Application Layer
  55. The application layer contains so called application interfacing modules (AIM).
  56. Depending on how the driver should interface to the application, one or more
  57. suitable modules can be selected.
  58. The AIMs encapsulate the application interface specific knowledge of the driver
  59. and provides access to user space or other kernel subsystems.
  60. Currently the following AIMs are available
  61. 1) Character Device
  62. Applications can access the driver by means of character devices.
  63. 2) Networking
  64. Standard networking applications (e.g. iperf) can by used to access
  65. the driver via the networking subsystem.
  66. 3) Video4Linux (v4l2)
  67. Standard video applications (e.g. VLC) can by used to access the
  68. driver via the V4L subsystem.
  69. 4) Advanced Linux Sound Architecture (ALSA)
  70. Standard sound applications (e.g. aplay, arecord, audacity) can by
  71. used to access the driver via the ALSA subsystem.
  72. Section 2 Configuration
  73. See ABI/sysfs-class-most.txt
  74. Section 3 USB Padding
  75. When transceiving synchronous or isochronous data, the number of packets per USB
  76. transaction and the sub-buffer size need to be configured. These values
  77. are needed for the driver to process buffer padding, as expected by hardware,
  78. which is for performance optimization purposes of the USB transmission.
  79. When transmitting synchronous data the allocated channel width needs to be
  80. written to 'set_subbuffer_size'. Additionally, the number of MOST frames that
  81. should travel to the host within one USB transaction need to be written to
  82. 'packets_per_xact'.
  83. Internally the synchronous threshold is calculated as follows:
  84. frame_size = set_subbuffer_size * packets_per_xact
  85. In case 'packets_per_xact' is set to 0xFF the maximum number of packets,
  86. allocated within one MOST frame, is calculated that fit into _one_ 512 byte
  87. USB full packet.
  88. frame_size = floor(MTU_USB / bandwidth_sync) * bandwidth_sync
  89. This frame_size is the number of synchronous data within an USB transaction,
  90. which renders MTU_USB - frame_size bytes for padding.
  91. When transmitting isochronous AVP data the desired packet size needs to be
  92. written to 'set_subbuffer_size' and hardware will always expect two isochronous
  93. packets within one USB transaction. This renders
  94. MTU_USB - (2 * set_subbuffer_size)
  95. bytes for padding.
  96. Note that at least 2 times set_subbuffer_size bytes for isochronous data or
  97. set_subbuffer_size times packts_per_xact bytes for synchronous data need to be
  98. put in the transmission buffer and passed to the driver.
  99. Since HDMs are allowed to change a chosen configuration to best fit its
  100. constraints, it is recommended to always double check the configuration and read
  101. back the previously written files.
  102. Section 4 Routing Channels
  103. To connect a channel that has been configured as outlined above to an AIM and
  104. make it accessible to user space applications, the attribute file 'add_link' is
  105. used. To actually bind a channel to the AIM a string needs to be written to the
  106. file that complies with the following syntax:
  107. "most_device:channel_name:link_name[.param]"
  108. The example above links the channel "channel_name" of the device "most_device"
  109. to the AIM. In case the AIM interfaces the VFS this would also create a device
  110. node "link_name" in the /dev directory. The parameter "param" is an AIM dependent
  111. string, which can be omitted in case the used AIM does not make any use of it.
  112. Cdev AIM example:
  113. $ echo "mdev0:ep_81:my_rx_channel" >add_link
  114. $ echo "mdev0:ep_81" >add_link
  115. Sound/ALSA AIM example:
  116. The sound/ALSA AIM needs an additional parameter to determine the audio resolution
  117. that is going to be used. The following strings can be used:
  118. - "1x8" (Mono)
  119. - "2x16" (16-bit stereo)
  120. - "2x24" (24-bit stereo)
  121. - "2x32" (32-bit stereo)
  122. $ echo "mdev0:ep_81:audio_rx.2x16" >add_link
  123. $ echo "mdev0:ep_81" >add_link