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