interrupt_support.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*************************************************************************/ /*!
  2. @File
  3. @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
  4. @License Dual MIT/GPLv2
  5. The contents of this file are subject to the MIT license as set out below.
  6. Permission is hereby granted, free of charge, to any person obtaining a copy
  7. of this software and associated documentation files (the "Software"), to deal
  8. in the Software without restriction, including without limitation the rights
  9. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  10. copies of the Software, and to permit persons to whom the Software is
  11. furnished to do so, subject to the following conditions:
  12. The above copyright notice and this permission notice shall be included in
  13. all copies or substantial portions of the Software.
  14. Alternatively, the contents of this file may be used under the terms of
  15. the GNU General Public License Version 2 ("GPL") in which case the provisions
  16. of GPL are applicable instead of those above.
  17. If you wish to allow use of your version of this file only under the terms of
  18. GPL, and not to allow others to use your version of this file under the terms
  19. of the MIT license, indicate your decision by deleting the provisions above
  20. and replace them with the notice and other provisions required by GPL as set
  21. out in the file called "GPL-COPYING" included in this distribution. If you do
  22. not delete the provisions above, a recipient may use your version of this file
  23. under the terms of either the MIT license or GPL.
  24. This License is also included in this distribution in the file called
  25. "MIT-COPYING".
  26. EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
  27. PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  28. BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  29. PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
  30. COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  31. IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  32. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  33. */ /**************************************************************************/
  34. #if !defined(INTERRUPT_SUPPORT_H)
  35. #define INTERRUPT_SUPPORT_H
  36. #include "img_types.h"
  37. #include "pvrsrv_error.h"
  38. #include "pvrsrv_device.h"
  39. /*! Default trigger type for the interrupt line. */
  40. #define SYS_IRQ_FLAG_TRIGGER_DEFAULT (0x0 << 0)
  41. /*! Interrupt triggered when interrupt line is low. */
  42. #define SYS_IRQ_FLAG_TRIGGER_LOW (0x1 << 0)
  43. /*! Interrupt triggered when interrupt line is high. */
  44. #define SYS_IRQ_FLAG_TRIGGER_HIGH (0x2 << 0)
  45. /*! Interrupt trigger mask. */
  46. #define SYS_IRQ_FLAG_TRIGGER_MASK (SYS_IRQ_FLAG_TRIGGER_DEFAULT | \
  47. SYS_IRQ_FLAG_TRIGGER_LOW | \
  48. SYS_IRQ_FLAG_TRIGGER_HIGH)
  49. /*! The irq is allowed to be shared among several devices. */
  50. #define SYS_IRQ_FLAG_SHARED (0x1 << 8)
  51. /*! Interrupt flags mask. */
  52. #define SYS_IRQ_FLAG_MASK (SYS_IRQ_FLAG_TRIGGER_MASK | \
  53. SYS_IRQ_FLAG_SHARED)
  54. /*************************************************************************/ /*!
  55. @Description Pointer to a system Low-level Interrupt Service Routine (LISR).
  56. @Input pvData Private data provided to the LISR.
  57. @Return IMG_TRUE if interrupt handled, IMG_FALSE otherwise.
  58. */ /**************************************************************************/
  59. typedef IMG_BOOL (*PFN_SYS_LISR)(void *pvData);
  60. /*************************************************************************/ /*!
  61. @Function OSInstallSystemLISR
  62. @Description Installs a system low-level interrupt handler
  63. @Output phLISR On return, contains a handle to the
  64. installed LISR
  65. @Input ui32IRQ The IRQ number for which the
  66. interrupt handler should be installed
  67. @Input pszDevName Name of the device for which the handler
  68. is being installed
  69. @Input pfnLISR A pointer to an interrupt handler
  70. function
  71. @Input pvData A pointer to data that should be passed
  72. to pfnLISR when it is called
  73. @Input ui32Flags Interrupt flags
  74. @Return PVRSRV_OK on success, a failure code otherwise
  75. */ /**************************************************************************/
  76. PVRSRV_ERROR OSInstallSystemLISR(IMG_HANDLE *phLISR,
  77. IMG_UINT32 ui32IRQ,
  78. const IMG_CHAR *pszDevName,
  79. PFN_SYS_LISR pfnLISR,
  80. void *pvData,
  81. IMG_UINT32 ui32Flags);
  82. /*************************************************************************/ /*!
  83. @Function OSUninstallSystemLISR
  84. @Description Uninstalls a system low-level interrupt handler
  85. @Input hLISRData The handle to the LISR to uninstall
  86. @Return PVRSRV_OK on success, a failure code otherwise
  87. */ /**************************************************************************/
  88. PVRSRV_ERROR OSUninstallSystemLISR(IMG_HANDLE hLISRData);
  89. #endif /* !defined(INTERRUPT_SUPPORT_H) */