irq.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /****************************************************************************
  2. * arch/risc-v/include/k210/irq.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __ARCH_RISCV_INCLUDE_K210_IRQ_H
  21. #define __ARCH_RISCV_INCLUDE_K210_IRQ_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <arch/irq.h>
  26. /****************************************************************************
  27. * Pre-processor Definitions
  28. ****************************************************************************/
  29. /* Map RISC-V exception code to NuttX IRQ */
  30. /* IRQ 0-15 : (exception:interrupt=0) */
  31. #define K210_IRQ_IAMISALIGNED (0) /* Instruction Address Misaligned */
  32. #define K210_IRQ_IAFAULT (1) /* Instruction Address Fault */
  33. #define K210_IRQ_IINSTRUCTION (2) /* Illegal Instruction */
  34. #define K210_IRQ_BPOINT (3) /* Break Point */
  35. #define K210_IRQ_LAMISALIGNED (4) /* Load Address Misaligned */
  36. #define K210_IRQ_LAFAULT (5) /* Load Access Fault */
  37. #define K210_IRQ_SAMISALIGNED (6) /* Store/AMO Address Misaligned */
  38. #define K210_IRQ_SAFAULT (7) /* Store/AMO Access Fault */
  39. #define K210_IRQ_ECALLU (8) /* Environment Call from U-mode */
  40. /* 9-10: Reserved */
  41. #define K210_IRQ_ECALLM (11) /* Environment Call from M-mode */
  42. /* 12-15: Reserved */
  43. /* IRQ 16- : (async event:interrupt=1) */
  44. #define K210_IRQ_ASYNC (16)
  45. #define K210_IRQ_MSOFT (K210_IRQ_ASYNC + 3) /* Machine Software Int */
  46. #define K210_IRQ_MTIMER (K210_IRQ_ASYNC + 7) /* Machine Timer Int */
  47. #define K210_IRQ_MEXT (K210_IRQ_ASYNC + 11) /* Machine External Int */
  48. /* Machine Global External Interrupt */
  49. #ifdef CONFIG_K210_WITH_QEMU
  50. #define K210_IRQ_UART0 (K210_IRQ_MEXT + 4)
  51. #else
  52. #define K210_IRQ_UART0 (K210_IRQ_MEXT + 33)
  53. #endif
  54. /* Total number of IRQs */
  55. #define NR_IRQS (K210_IRQ_UART0 + 1)
  56. #endif /* __ARCH_RISCV_INCLUDE_K210_IRQ_H */