interrupt.c 699 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021/04/24 Juice The first version
  9. */
  10. #include <rthw.h>
  11. #include <board.h>
  12. typedef void (*irq_handler_t)(void);
  13. extern const irq_handler_t isrTable[];
  14. uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc, uintptr_t *sp)
  15. {
  16. uint32_t intNum;
  17. if (mcause & 0x80000000) /* For external interrupt. */
  18. {
  19. }
  20. else
  21. {
  22. intNum = mcause & 0x1FUL;
  23. /* Now call the real irq handler for intNum */
  24. if (intNum <= 24)
  25. {
  26. if (isrTable[intNum])isrTable[intNum]();
  27. }
  28. }
  29. }