xref: /openbmc/qemu/include/hw/char/pl011.h (revision f186d64d)
1 /*
2  * This program is free software; you can redistribute it and/or modify it
3  * under the terms and conditions of the GNU General Public License,
4  * version 2 or later, as published by the Free Software Foundation.
5  *
6  * This program is distributed in the hope it will be useful, but WITHOUT
7  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
9  * more details.
10  *
11  * You should have received a copy of the GNU General Public License along with
12  * this program.  If not, see <http://www.gnu.org/licenses/>.
13  */
14 
15 #ifndef HW_PL011_H
16 #define HW_PL011_H
17 
18 static inline DeviceState *pl011_create(hwaddr addr,
19                                         qemu_irq irq,
20                                         CharDriverState *chr)
21 {
22     DeviceState *dev;
23     SysBusDevice *s;
24 
25     dev = qdev_create(NULL, "pl011");
26     s = SYS_BUS_DEVICE(dev);
27     qdev_prop_set_chr(dev, "chardev", chr);
28     qdev_init_nofail(dev);
29     sysbus_mmio_map(s, 0, addr);
30     sysbus_connect_irq(s, 0, irq);
31 
32     return dev;
33 }
34 
35 static inline DeviceState *pl011_luminary_create(hwaddr addr,
36                                                  qemu_irq irq,
37                                                  CharDriverState *chr)
38 {
39     DeviceState *dev;
40     SysBusDevice *s;
41 
42     dev = qdev_create(NULL, "pl011_luminary");
43     s = SYS_BUS_DEVICE(dev);
44     qdev_prop_set_chr(dev, "chardev", chr);
45     qdev_init_nofail(dev);
46     sysbus_mmio_map(s, 0, addr);
47     sysbus_connect_irq(s, 0, irq);
48 
49     return dev;
50 }
51 
52 #endif
53