dmx-reqbufs.rst 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .. _DMX_REQBUFS:
  2. *****************
  3. ioctl DMX_REQBUFS
  4. *****************
  5. Name
  6. ====
  7. DMX_REQBUFS - Initiate Memory Mapping and/or DMA buffer I/O
  8. .. warning:: this API is still experimental
  9. Synopsis
  10. ========
  11. .. c:function:: int ioctl( int fd, DMX_REQBUFS, struct dmx_requestbuffers *argp )
  12. :name: DMX_REQBUFS
  13. Arguments
  14. =========
  15. ``fd``
  16. File descriptor returned by :ref:`open() <dmx_fopen>`.
  17. ``argp``
  18. Pointer to struct :c:type:`dmx_requestbuffers`.
  19. Description
  20. ===========
  21. This ioctl is used to initiate a memory mapped or DMABUF based demux I/O.
  22. Memory mapped buffers are located in device memory and must be allocated
  23. with this ioctl before they can be mapped into the application's address
  24. space. User buffers are allocated by applications themselves, and this
  25. ioctl is merely used to switch the driver into user pointer I/O mode and
  26. to setup some internal structures. Similarly, DMABUF buffers are
  27. allocated by applications through a device driver, and this ioctl only
  28. configures the driver into DMABUF I/O mode without performing any direct
  29. allocation.
  30. To allocate device buffers applications initialize all fields of the
  31. struct :c:type:`dmx_requestbuffers` structure. They set the ``count`` field
  32. to the desired number of buffers, and ``size`` to the size of each
  33. buffer.
  34. When the ioctl is called with a pointer to this structure, the driver will
  35. attempt to allocate the requested number of buffers and it stores the actual
  36. number allocated in the ``count`` field. The ``count`` can be smaller than the number requested, even zero, when the driver runs out of free memory. A larger
  37. number is also possible when the driver requires more buffers to
  38. function correctly. The actual allocated buffer size can is returned
  39. at ``size``, and can be smaller than what's requested.
  40. When this I/O method is not supported, the ioctl returns an ``EOPNOTSUPP``
  41. error code.
  42. Applications can call :ref:`DMX_REQBUFS` again to change the number of
  43. buffers, however this cannot succeed when any buffers are still mapped.
  44. A ``count`` value of zero frees all buffers, after aborting or finishing
  45. any DMA in progress.
  46. Return Value
  47. ============
  48. On success 0 is returned, on error -1 and the ``errno`` variable is set
  49. appropriately. The generic error codes are described at the
  50. :ref:`Generic Error Codes <gen-errors>` chapter.
  51. EOPNOTSUPP
  52. The the requested I/O method is not supported.