xrp_dsp_interrupt.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Copyright (c) 2018 Cadence Design Systems Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining
  5. * a copy of this software and associated documentation files (the
  6. * "Software"), to deal in the Software without restriction, including
  7. * without limitation the rights to use, copy, modify, merge, publish,
  8. * distribute, sublicense, and/or sell copies of the Software, and to
  9. * permit persons to whom the Software is furnished to do so, subject to
  10. * the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included
  13. * in all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  18. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  19. * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  20. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  21. * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #ifndef XRP_DSP_INTERRUPT_H
  24. #define XRP_DSP_INTERRUPT_H
  25. #include <xtensa/config/core.h>
  26. #if XCHAL_HAVE_INTERRUPTS
  27. #include <xtensa/tie/xt_interrupt.h>
  28. #include <xtensa/xtruntime.h>
  29. #ifdef HAVE_XTOS_SET_INTERRUPT_HANDLER
  30. static inline int32_t xrp_set_interrupt_handler(uint32_t intnum,
  31. void (*fn)(void))
  32. {
  33. return xtos_set_interrupt_handler(intnum, (void (*)(void *))fn,
  34. NULL, NULL);
  35. }
  36. #else
  37. static inline int32_t xrp_set_interrupt_handler(uint32_t intnum,
  38. void (*fn)(void))
  39. {
  40. _xtos_set_interrupt_handler(intnum, fn);
  41. return 0;
  42. }
  43. #endif
  44. #ifdef HAVE_XTOS_INTERRUPT_ENABLE
  45. static inline void xrp_interrupt_enable(uint32_t intnum)
  46. {
  47. xtos_interrupt_enable(intnum);
  48. }
  49. #else
  50. static inline void xrp_interrupt_enable(uint32_t intnum)
  51. {
  52. _xtos_interrupt_enable(intnum);
  53. }
  54. #endif
  55. #ifdef HAVE_XTOS_INTERRUPT_DISABLE
  56. static inline void xrp_interrupt_disable(uint32_t intnum)
  57. {
  58. xtos_interrupt_disable(intnum);
  59. }
  60. #else
  61. static inline void xrp_interrupt_disable(uint32_t intnum)
  62. {
  63. _xtos_interrupt_disable(intnum);
  64. }
  65. #endif
  66. #endif
  67. #endif