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.

vcos_event_flags.h 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. /*=============================================================================
  26. VideoCore OS Abstraction Layer - public header file
  27. =============================================================================*/
  28. #ifndef VCOS_EVENT_FLAGS_H
  29. #define VCOS_EVENT_FLAGS_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "vcos_types.h"
  34. #include "pthreads/vcos_platform.h"
  35. #define VCOS_EVENT_FLAGS_SUSPEND VCOS_SUSPEND
  36. #define VCOS_EVENT_FLAGS_NO_SUSPEND VCOS_NO_SUSPEND
  37. typedef VCOS_OPTION VCOS_EVENTGROUP_OPERATION_T;
  38. /**
  39. * \file vcos_event_flags.h
  40. *
  41. * Defines event flags API.
  42. *
  43. * Similar to Nucleus event groups.
  44. *
  45. * These have the same semantics as Nucleus event groups and ThreadX event
  46. * flags. As such, they are quite complex internally; if speed is important
  47. * they might not be your best choice.
  48. *
  49. */
  50. /**
  51. * Create an event flags instance.
  52. *
  53. * @param flags Pointer to event flags instance, filled in on return.
  54. * @param name Name for the event flags, used for debug.
  55. *
  56. * @return VCOS_SUCCESS if succeeded.
  57. */
  58. VCOS_INLINE_DECL
  59. VCOS_STATUS_T vcos_event_flags_create(VCOS_EVENT_FLAGS_T *flags, const char *name);
  60. /**
  61. * Set some events.
  62. *
  63. * @param flags Instance to set flags on
  64. * @param events Bitmask of the flags to actually set
  65. * @param op How the flags should be set. VCOS_OR will OR in the flags; VCOS_AND
  66. * will AND them in, possibly clearing existing flags.
  67. */
  68. VCOS_INLINE_DECL
  69. void vcos_event_flags_set(VCOS_EVENT_FLAGS_T *flags,
  70. VCOS_UNSIGNED events,
  71. VCOS_OPTION op);
  72. /**
  73. * Retrieve some events.
  74. *
  75. * Waits until the specified events have been set.
  76. *
  77. * @param flags Instance to wait on
  78. * @param requested_events The bitmask to wait for
  79. * @param op VCOS_OR - get any; VCOS_AND - get all.
  80. * @param ms_suspend How long to wait, in milliseconds
  81. * @param retrieved_events the events actually retrieved.
  82. *
  83. * @return VCOS_SUCCESS if events were retrieved. VCOS_EAGAIN if the
  84. * timeout expired.
  85. */
  86. VCOS_INLINE_DECL
  87. VCOS_STATUS_T vcos_event_flags_get(VCOS_EVENT_FLAGS_T *flags,
  88. VCOS_UNSIGNED requested_events,
  89. VCOS_OPTION op,
  90. VCOS_UNSIGNED ms_suspend,
  91. VCOS_UNSIGNED *retrieved_events);
  92. /**
  93. * Delete an event flags instance.
  94. */
  95. VCOS_INLINE_DECL
  96. void vcos_event_flags_delete(VCOS_EVENT_FLAGS_T *);
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100. #endif