hv_vos_Irq.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * @file hv_vos_Irq.h
  3. * @brief Header file of irq.
  4. *
  5. * @verbatim
  6. * ==============================================================================
  7. * ##### How to use #####
  8. * ==============================================================================
  9. * (+) Use ()
  10. *
  11. * @endverbatim
  12. * @author HiView SoC Software Team
  13. * @version 1.0.0
  14. * @date 2023-03-01
  15. */
  16. #ifndef _HV_VOS_IRQ_H
  17. #define _HV_VOS_IRQ_H
  18. #include "hv_vos_Types.h"
  19. VOS_EXTERN_C_BEGIN
  20. /** @defgroup VOS_IRQ VOS_IRQ
  21. * VOS Interrupt handler routines
  22. * @{
  23. */
  24. void Hv_Vos_InterruptRecord(UINT32 dwIntFlag,UINT32 dwAddr);
  25. /// Initialize IRQ data structure
  26. void Hv_Vos_InitIrq(void);
  27. /// Configure IRQ channel enable/disable
  28. /// @param irqNum irq number
  29. /// @param enable disable/enable
  30. /// @param channel peripheral channel
  31. void Hv_Vos_ConfigIrq(UINT32 irqNum, BOOL enable, UINT32 channel);
  32. /// Cleanup IRQ data structure
  33. void Hv_Vos_CleanupIrq(void);
  34. /// Enable one interrupt
  35. /// @param irqNum irq number
  36. void Hv_Vos_MaskIrq(UINT32 irqNum);
  37. /// Disable one interrupt
  38. /// @param irqNum irq number
  39. void Hv_Vos_UnmaskIrq(UINT32 irqNum);
  40. /// disable all interrupt, save interrupt state before disable
  41. void Hv_Vos_DisableIrq(HV_VOS_IRQ_T *mask);
  42. /// restore interrupt by saved state
  43. void Hv_Vos_RestoreIrq(const HV_VOS_IRQ_T *mask);
  44. /// get interrupt mask status
  45. HV_VOS_IRQ_T Hv_Vos_GetIrqMask();
  46. /// trigger interrupt manually, for test only
  47. BOOL Hv_Vos_TriggerIrq(UINT32 irqNum);
  48. /// result of ISR handler function
  49. typedef enum _HV_VOS_ISR_RESULT_E {
  50. HV_VOS_ISR_HANDLED, //!< Handled
  51. HV_VOS_ISR_NOT_HANDLED, //!< Not handled
  52. } HV_VOS_ISR_RESULT_E;
  53. /// Interrupt function handler
  54. /// @param irqNum IRQ number
  55. /// @param param handler parameter
  56. /// @return operation after ISR processing
  57. typedef HV_VOS_ISR_RESULT_E (*HV_VOS_ISR_HANDLER)(UINT32 irqNum, void *arg);
  58. /// Attached IRQ handler
  59. /// @param irqNum IRQ number
  60. /// @param handler callback function
  61. /// @param arg callback function parameter
  62. void Hv_Vos_AttachIsr(UINT32 irqNum, HV_VOS_ISR_HANDLER handler, void *arg);
  63. /// Detach IRQ handler
  64. void Hv_Vos_ISR_Detach(UINT32 irqNum, HV_VOS_ISR_HANDLER handler);
  65. void Hv_Vos_DetachIsr(UINT32 irqNum, HV_VOS_ISR_HANDLER handler);
  66. void Hv_Vos_SetIrqPrio(UINT32 IRQn, UINT32 priority);
  67. void Hv_Vos_IRQ_SetThreshold(UINT32 VectThreshold, UINT32 PrioThreshold);
  68. void Hv_Vos_IRQ_SetWakeup(UINT32 IRQn);
  69. void Hv_Vos_IRQ_ClearWakeup(UINT32 IRQn);
  70. /// Misc int clear interrupt function
  71. void Hv_Vos_WClrMiscInt(UINT32 irqNum);
  72. /** @} */
  73. VOS_EXTERN_C_END
  74. #endif