interrupt.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-05-20 bigmagic The first version
  9. */
  10. #ifndef INTERRUPT_H__
  11. #define INTERRUPT_H__
  12. #define MAX_HANDLERS 128
  13. #include <rthw.h>
  14. #include "stack.h"
  15. enum
  16. {
  17. EP_INSTRUCTION_ADDRESS_MISALIGNED = 0,
  18. EP_INSTRUCTION_ACCESS_FAULT,
  19. EP_ILLEGAL_INSTRUCTION,
  20. EP_BREAKPOINT,
  21. EP_LOAD_ADDRESS_MISALIGNED,
  22. EP_LOAD_ACCESS_FAULT,
  23. EP_STORE_ADDRESS_MISALIGNED,
  24. EP_STORE_ACCESS_FAULT,
  25. EP_ENVIRONMENT_CALL_U_MODE,
  26. EP_ENVIRONMENT_CALL_S_MODE,
  27. EP_RESERVED10,
  28. EP_ENVIRONMENT_CALL_M_MODE,
  29. EP_INSTRUCTION_PAGE_FAULT, /* page attr */
  30. EP_LOAD_PAGE_FAULT, /* read data */
  31. EP_RESERVED14,
  32. EP_STORE_PAGE_FAULT, /* write data */
  33. };
  34. int rt_hw_plic_irq_enable(int irq_number);
  35. int rt_hw_plic_irq_disable(int irq_number);
  36. void rt_hw_interrupt_init(void);
  37. void rt_hw_interrupt_mask(int vector);
  38. rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, void *param, const char *name);
  39. void handle_trap(rt_ubase_t xcause, rt_ubase_t xtval, rt_ubase_t xepc, struct rt_hw_stack_frame *sp);
  40. #ifdef RT_USING_SMP
  41. void rt_hw_interrupt_set_priority(int vector, unsigned int priority);
  42. unsigned int rt_hw_interrupt_get_priority(int vector);
  43. void rt_hw_ipi_handler(void);
  44. void rt_hw_ipi_handler_install(int ipi_vector, rt_isr_handler_t ipi_isr_handler);
  45. void rt_hw_ipi_init(void);
  46. void rt_hw_ipi_send(int ipi_vector, unsigned int cpu_mask);
  47. #endif /* RT_USING_SMP */
  48. #endif