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_common.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 - common postamble code
  27. =============================================================================*/
  28. /** \file
  29. *
  30. * Postamble code included by the platform-specific header files
  31. */
  32. #define VCOS_THREAD_PRI_DEFAULT VCOS_THREAD_PRI_NORMAL
  33. #if !defined(VCOS_THREAD_PRI_INCREASE)
  34. #error Which way to thread priorities go?
  35. #endif
  36. #if VCOS_THREAD_PRI_INCREASE < 0
  37. /* smaller numbers are higher priority */
  38. #define VCOS_THREAD_PRI_LESS(x) ((x)<VCOS_THREAD_PRI_MAX?(x)+1:VCOS_THREAD_PRI_MAX)
  39. #define VCOS_THREAD_PRI_MORE(x) ((x)>VCOS_THREAD_PRI_MIN?(x)-1:VCOS_THREAD_PRI_MIN)
  40. #else
  41. /* bigger numbers are lower priority */
  42. #define VCOS_THREAD_PRI_MORE(x) ((x)<VCOS_THREAD_PRI_MAX?(x)+1:VCOS_THREAD_PRI_MAX)
  43. #define VCOS_THREAD_PRI_LESS(x) ((x)>VCOS_THREAD_PRI_MIN?(x)-1:VCOS_THREAD_PRI_MIN)
  44. #endif
  45. /* Convenience for Brits: */
  46. #define VCOS_APPLICATION_INITIALISE VCOS_APPLICATION_INITIALIZE
  47. /*
  48. * Check for constant definitions
  49. */
  50. #ifndef VCOS_TICKS_PER_SECOND
  51. #error VCOS_TICKS_PER_SECOND not defined
  52. #endif
  53. #if !defined(VCOS_THREAD_PRI_MIN) || !defined(VCOS_THREAD_PRI_MAX)
  54. #error Priority range not defined
  55. #endif
  56. #if !defined(VCOS_THREAD_PRI_HIGHEST) || !defined(VCOS_THREAD_PRI_LOWEST) || !defined(VCOS_THREAD_PRI_NORMAL)
  57. #error Priority ordering not defined
  58. #endif
  59. #if !defined(VCOS_CAN_SET_STACK_ADDR)
  60. #error Can stack addresses be set on this platform? Please set this macro to either 0 or 1.
  61. #endif
  62. #if (_VCOS_AFFINITY_CPU0|_VCOS_AFFINITY_CPU1) & (~_VCOS_AFFINITY_MASK)
  63. #error _VCOS_AFFINITY_CPUxxx values are not consistent with _VCOS_AFFINITY_MASK
  64. #endif
  65. /** Append to the end of a singly-linked queue, O(1). Works with
  66. * any structure where list has members 'head' and 'tail' and
  67. * item has a 'next' pointer.
  68. */
  69. #define VCOS_QUEUE_APPEND_TAIL(list, item) {\
  70. (item)->next = NULL;\
  71. if (!(list)->head) {\
  72. (list)->head = (list)->tail = (item); \
  73. } else {\
  74. (list)->tail->next = (item); \
  75. (list)->tail = (item); \
  76. } \
  77. }
  78. #ifndef VCOS_HAVE_TIMER
  79. VCOSPRE_ void VCOSPOST_ vcos_timer_init(void);
  80. #endif