xref: /openbmc/qemu/include/hw/char/xilinx_uartlite.h (revision 3440a4a9)
11b6d0781Sxiaoqiang zhao /*
21b6d0781Sxiaoqiang zhao  * This program is free software; you can redistribute it and/or modify it
31b6d0781Sxiaoqiang zhao  * under the terms and conditions of the GNU General Public License,
41b6d0781Sxiaoqiang zhao  * version 2 or later, as published by the Free Software Foundation.
51b6d0781Sxiaoqiang zhao  *
61b6d0781Sxiaoqiang zhao  * This program is distributed in the hope it will be useful, but WITHOUT
71b6d0781Sxiaoqiang zhao  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
81b6d0781Sxiaoqiang zhao  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
91b6d0781Sxiaoqiang zhao  * more details.
101b6d0781Sxiaoqiang zhao  *
111b6d0781Sxiaoqiang zhao  * You should have received a copy of the GNU General Public License along with
121b6d0781Sxiaoqiang zhao  * this program.  If not, see <http://www.gnu.org/licenses/>.
131b6d0781Sxiaoqiang zhao  */
141b6d0781Sxiaoqiang zhao 
151b6d0781Sxiaoqiang zhao #ifndef XILINX_UARTLITE_H
161b6d0781Sxiaoqiang zhao #define XILINX_UARTLITE_H
171b6d0781Sxiaoqiang zhao 
18a27bd6c7SMarkus Armbruster #include "hw/qdev-properties.h"
19ec150c7eSMarkus Armbruster #include "hw/sysbus.h"
207a5951f6SMarkus Armbruster #include "qapi/error.h"
21*3440a4a9SPhilippe Mathieu-Daudé #include "qom/object.h"
22*3440a4a9SPhilippe Mathieu-Daudé 
23*3440a4a9SPhilippe Mathieu-Daudé #define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
24*3440a4a9SPhilippe Mathieu-Daudé OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
25ec150c7eSMarkus Armbruster 
261b6d0781Sxiaoqiang zhao static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
271b6d0781Sxiaoqiang zhao                                         qemu_irq irq,
280ec7b3e7SMarc-André Lureau                                         Chardev *chr)
291b6d0781Sxiaoqiang zhao {
301b6d0781Sxiaoqiang zhao     DeviceState *dev;
311b6d0781Sxiaoqiang zhao     SysBusDevice *s;
321b6d0781Sxiaoqiang zhao 
33*3440a4a9SPhilippe Mathieu-Daudé     dev = qdev_new(TYPE_XILINX_UARTLITE);
341b6d0781Sxiaoqiang zhao     s = SYS_BUS_DEVICE(dev);
351b6d0781Sxiaoqiang zhao     qdev_prop_set_chr(dev, "chardev", chr);
363c6ef471SMarkus Armbruster     sysbus_realize_and_unref(s, &error_fatal);
371b6d0781Sxiaoqiang zhao     sysbus_mmio_map(s, 0, addr);
381b6d0781Sxiaoqiang zhao     sysbus_connect_irq(s, 0, irq);
391b6d0781Sxiaoqiang zhao 
401b6d0781Sxiaoqiang zhao     return dev;
411b6d0781Sxiaoqiang zhao }
421b6d0781Sxiaoqiang zhao 
431b6d0781Sxiaoqiang zhao #endif
44