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_lowlevel_thread.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 - low level thread support
  27. =============================================================================*/
  28. #ifndef VCOS_LOWLEVEL_THREAD_H
  29. #define VCOS_LOWLEVEL_THREAD_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "vcos_types.h"
  34. #ifndef VCOS_PLATFORM_H
  35. #include "pthreads/vcos_platform.h"
  36. #endif
  37. /**
  38. * \file
  39. *
  40. * This defines a low level thread API that is supported by *some* operating systems
  41. * and can be used to construct the regular "joinable thread" API on those operating
  42. * systems.
  43. *
  44. * Most clients will not need to use this code.
  45. *
  46. * \sa vcos_joinable_thread.h
  47. */
  48. /**
  49. * \brief Create a thread.
  50. *
  51. * This creates a thread which can be stopped either by returning from the
  52. * entry point function or by calling vcos_llthread_exit from within the entry
  53. * point function. The thread must be cleaned up by calling
  54. * vcos_llthread_delete. vcos_llthread_delete may or may not terminate the
  55. * thread.
  56. *
  57. * The preemptible parameter familiar from Nucleus is removed, as it is unused in
  58. * VideoCore code. Affinity is added, since we do use this.
  59. *
  60. * @param thread Filled in with thread instance
  61. * @param name An optional name for the thread. "" may be used (but
  62. * a name will aid in debugging).
  63. * @param entry Entry point
  64. * @param arg A single argument passed to the entry point function
  65. * @param stack Pointer to stack address
  66. * @param stacksz Size of stack in bytes
  67. * @param priority Priority of task, between VCOS_PRI_LOW and VCOS_PRI_HIGH
  68. * @param affinity CPU affinity
  69. *
  70. * @sa vcos_llthread_terminate vcos_llthread_delete
  71. */
  72. VCOSPRE_ VCOS_STATUS_T VCOSPOST_ vcos_llthread_create(VCOS_LLTHREAD_T *thread,
  73. const char *name,
  74. VCOS_LLTHREAD_ENTRY_FN_T entry,
  75. void *arg,
  76. void *stack,
  77. VCOS_UNSIGNED stacksz,
  78. VCOS_UNSIGNED priority,
  79. VCOS_UNSIGNED affinity,
  80. VCOS_UNSIGNED timeslice,
  81. VCOS_UNSIGNED autostart);
  82. /**
  83. * \brief Exits the current thread.
  84. */
  85. VCOSPRE_ void VCOSPOST_ vcos_llthread_exit(void);
  86. /**
  87. * \brief Delete a thread. This must be called to cleanup after
  88. * vcos_llthread_create. This may or may not terminate the thread.
  89. * It does not clean up any resources that may have been
  90. * allocated by the thread.
  91. */
  92. VCOSPRE_ void VCOSPOST_ vcos_llthread_delete(VCOS_LLTHREAD_T *thread);
  93. /**
  94. * \brief Return current lowlevel thread pointer.
  95. */
  96. VCOS_INLINE_DECL
  97. VCOS_LLTHREAD_T *vcos_llthread_current(void);
  98. /**
  99. * Resume a thread.
  100. */
  101. VCOS_INLINE_DECL
  102. void vcos_llthread_resume(VCOS_LLTHREAD_T *thread);
  103. VCOSPRE_ int VCOSPOST_ vcos_llthread_running(VCOS_LLTHREAD_T *thread);
  104. /**
  105. * \brief Create a VCOS_LLTHREAD_T for the current thread. This is so we can
  106. * have VCOS_LLTHREAD_Ts even for threads not originally created by VCOS (eg
  107. * the thread that calls vcos_init).
  108. */
  109. extern VCOS_STATUS_T _vcos_llthread_create_attach(VCOS_LLTHREAD_T *thread);
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif