rx_icu.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * RX Interrupt Control Unit
  3. *
  4. * Copyright (c) 2019 Yoshinori Sato
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms and conditions of the GNU General Public License,
  10. * version 2 or later, as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef HW_INTC_RX_ICU_H
  21. #define HW_INTC_RX_ICU_H
  22. #include "hw/sysbus.h"
  23. #include "qom/object.h"
  24. enum TRG_MODE {
  25. TRG_LEVEL = 0,
  26. TRG_NEDGE = 1, /* Falling */
  27. TRG_PEDGE = 2, /* Raising */
  28. TRG_BEDGE = 3, /* Both */
  29. };
  30. struct IRQSource {
  31. enum TRG_MODE sense;
  32. int level;
  33. };
  34. enum {
  35. /* Software interrupt request */
  36. SWI = 27,
  37. NR_IRQS = 256
  38. };
  39. struct RXICUState {
  40. /*< private >*/
  41. SysBusDevice parent_obj;
  42. /*< public >*/
  43. MemoryRegion memory;
  44. struct IRQSource src[NR_IRQS];
  45. uint32_t nr_irqs;
  46. uint8_t *map;
  47. uint32_t nr_sense;
  48. uint8_t *init_sense;
  49. uint8_t ir[NR_IRQS];
  50. uint8_t dtcer[NR_IRQS];
  51. uint8_t ier[NR_IRQS / 8];
  52. uint8_t ipr[142];
  53. uint8_t dmasr[4];
  54. uint16_t fir;
  55. uint8_t nmisr;
  56. uint8_t nmier;
  57. uint8_t nmiclr;
  58. uint8_t nmicr;
  59. int16_t req_irq;
  60. qemu_irq _irq;
  61. qemu_irq _fir;
  62. qemu_irq _swi;
  63. };
  64. #define TYPE_RX_ICU "rx-icu"
  65. OBJECT_DECLARE_SIMPLE_TYPE(RXICUState, RX_ICU)
  66. #endif /* HW_INTC_RX_ICU_H */