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_atomic_flags.h 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_ATOMIC_FLAGS_H
  29. #define VCOS_ATOMIC_FLAGS_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "vcos_types.h"
  34. #include "pthreads/vcos_platform.h"
  35. /**
  36. * \file vcos_atomic_flags.h
  37. *
  38. * Defines atomic flags API.
  39. *
  40. * 32 flags. Atomic "or" and "get and clear" operations
  41. */
  42. /**
  43. * Create an atomic flags instance.
  44. *
  45. * @param atomic_flags Pointer to atomic flags instance, filled in on return
  46. *
  47. * @return VCOS_SUCCESS if succeeded.
  48. */
  49. VCOS_INLINE_DECL
  50. VCOS_STATUS_T vcos_atomic_flags_create(VCOS_ATOMIC_FLAGS_T *atomic_flags);
  51. /**
  52. * Atomically set the specified flags.
  53. *
  54. * @param atomic_flags Instance to set flags on
  55. * @param flags Mask of flags to set
  56. */
  57. VCOS_INLINE_DECL
  58. void vcos_atomic_flags_or(VCOS_ATOMIC_FLAGS_T *atomic_flags, uint32_t flags);
  59. /**
  60. * Retrieve the current flags and then clear them. The entire operation is
  61. * atomic.
  62. *
  63. * @param atomic_flags Instance to get/clear flags from/on
  64. *
  65. * @return Mask of flags which were set (and we cleared)
  66. */
  67. VCOS_INLINE_DECL
  68. uint32_t vcos_atomic_flags_get_and_clear(VCOS_ATOMIC_FLAGS_T *atomic_flags);
  69. /**
  70. * Delete an atomic flags instance.
  71. *
  72. * @param atomic_flags Instance to delete
  73. */
  74. VCOS_INLINE_DECL
  75. void vcos_atomic_flags_delete(VCOS_ATOMIC_FLAGS_T *atomic_flags);
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif