Projektarbeit Line Following Robot bei Prof. Chowanetz im WS22/23
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mmal_component.h 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. Copyright (c) 2012, Broadcom Europe Ltd
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright
  7. notice, this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright
  9. notice, this list of conditions and the following disclaimer in the
  10. documentation and/or other materials provided with the distribution.
  11. * Neither the name of the copyright holder nor the
  12. names of its contributors may be used to endorse or promote products
  13. derived from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
  18. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef MMAL_COMPONENT_H
  26. #define MMAL_COMPONENT_H
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /** \defgroup MmalComponent Components
  31. * Definition of a MMAL component and its associated API. A component will always expose ports
  32. * which it uses to send and receive data in the form of buffer headers
  33. * (\ref MMAL_BUFFER_HEADER_T) */
  34. /* @{ */
  35. #include "mmal_types.h"
  36. #include "mmal_port.h"
  37. struct MMAL_COMPONENT_PRIVATE_T;
  38. typedef struct MMAL_COMPONENT_PRIVATE_T MMAL_COMPONENT_PRIVATE_T;
  39. /** Definition of a component. */
  40. typedef struct MMAL_COMPONENT_T
  41. {
  42. /** Pointer to the private data of the module in use */
  43. struct MMAL_COMPONENT_PRIVATE_T *priv;
  44. /** Pointer to private data of the client */
  45. struct MMAL_COMPONENT_USERDATA_T *userdata;
  46. /** Component name */
  47. const char *name;
  48. /** Specifies whether the component is enabled or not */
  49. uint32_t is_enabled;
  50. /** All components expose a control port.
  51. * The control port is used by clients to set / get parameters that are global to the
  52. * component. It is also used to receive events, which again are global to the component.
  53. * To be able to receive events, the client needs to enable and register a callback on the
  54. * control port. */
  55. MMAL_PORT_T *control;
  56. uint32_t input_num; /**< Number of input ports */
  57. MMAL_PORT_T **input; /**< Array of input ports */
  58. uint32_t output_num; /**< Number of output ports */
  59. MMAL_PORT_T **output; /**< Array of output ports */
  60. uint32_t clock_num; /**< Number of clock ports */
  61. MMAL_PORT_T **clock; /**< Array of clock ports */
  62. uint32_t port_num; /**< Total number of ports */
  63. MMAL_PORT_T **port; /**< Array of all the ports (control/input/output/clock) */
  64. /** Uniquely identifies the component's instance within the MMAL
  65. * context / process. For debugging. */
  66. uint32_t id;
  67. } MMAL_COMPONENT_T;
  68. /** Create an instance of a component.
  69. * The newly created component will expose ports to the client. All the exposed ports are
  70. * disabled by default.
  71. * Note that components are reference counted and creating a component automatically
  72. * acquires a reference to it (released when \ref mmal_component_destroy is called).
  73. *
  74. * @param name name of the component to create, e.g. "video_decode"
  75. * @param component returned component
  76. * @return MMAL_SUCCESS on success
  77. */
  78. MMAL_STATUS_T mmal_component_create(const char *name,
  79. MMAL_COMPONENT_T **component);
  80. /** Acquire a reference on a component.
  81. * Acquiring a reference on a component will prevent a component from being destroyed until
  82. * the acquired reference is released (by a call to \ref mmal_component_destroy).
  83. * References are internally counted so all acquired references need a matching call to
  84. * release them.
  85. *
  86. * @param component component to acquire
  87. */
  88. void mmal_component_acquire(MMAL_COMPONENT_T *component);
  89. /** Release a reference on a component
  90. * Release an acquired reference on a component. Triggers the destruction of the component when
  91. * the last reference is being released.
  92. * \note This is in fact an alias of \ref mmal_component_destroy which is added to make client
  93. * code clearer.
  94. *
  95. * @param component component to release
  96. * @return MMAL_SUCCESS on success
  97. */
  98. MMAL_STATUS_T mmal_component_release(MMAL_COMPONENT_T *component);
  99. /** Destroy a previously created component
  100. * Release an acquired reference on a component. Only actually destroys the component when
  101. * the last reference is being released.
  102. *
  103. * @param component component to destroy
  104. * @return MMAL_SUCCESS on success
  105. */
  106. MMAL_STATUS_T mmal_component_destroy(MMAL_COMPONENT_T *component);
  107. /** Enable processing on a component
  108. * @param component component to enable
  109. * @return MMAL_SUCCESS on success
  110. */
  111. MMAL_STATUS_T mmal_component_enable(MMAL_COMPONENT_T *component);
  112. /** Disable processing on a component
  113. * @param component component to disable
  114. * @return MMAL_SUCCESS on success
  115. */
  116. MMAL_STATUS_T mmal_component_disable(MMAL_COMPONENT_T *component);
  117. /* @} */
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif /* MMAL_COMPONENT_H */