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_isr.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 - IRQ support
  27. =============================================================================*/
  28. #ifndef VCOS_ISR_H
  29. #define VCOS_ISR_H
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #include "vcos_types.h"
  34. #include "pthreads/vcos_platform.h"
  35. /**
  36. * \file vcos_isr.h
  37. *
  38. * \section isr ISR support
  39. *
  40. * API for dispatching interrupts.
  41. */
  42. /**
  43. *
  44. * Register an interrupt handler. The old handler (if any) is returned in
  45. * old_handler. The old handler should be called if the interrupt was not
  46. * for you.
  47. *
  48. * The handler function will be called in a context with interrupts disabled,
  49. * so should be written to be as short as possible. If significant processing
  50. * is needed, the handler should delegate to a thread.
  51. *
  52. * The handler function can call any OS primitive that does not block (e.g.
  53. * post a semaphore or set an event flag). Blocking operations (including memory
  54. * allocation from the system heap) are not permitted.
  55. *
  56. * To deregister an ISR, pass in NULL.
  57. *
  58. * @param vec Vector to register for
  59. * @param handler Handler to be called
  60. * @param old_handler Updated with the old handler, or NULL.
  61. */
  62. VCOS_INLINE_DECL
  63. void vcos_register_isr(VCOS_UNSIGNED vec,
  64. VCOS_ISR_HANDLER_T handler,
  65. VCOS_ISR_HANDLER_T *old_handler);
  66. /** Disable interrupts, returning the old value (enabled/disabled) to the caller.
  67. */
  68. VCOS_INLINE_DECL
  69. VCOS_UNSIGNED vcos_int_disable(void);
  70. /** Restore the previous interrupt enable/disable state.
  71. */
  72. VCOS_INLINE_DECL
  73. void vcos_int_restore(VCOS_UNSIGNED previous);
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif