| 1 | /* |
| 2 | * ARM CMSDK APB UART emulation |
| 3 | * |
| 4 | * Copyright (c) 2017 Linaro Limited |
| 5 | * Written by Peter Maydell |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 or |
| 9 | * (at your option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #ifndef CMSDK_APB_UART_H |
| 13 | #define CMSDK_APB_UART_H |
| 14 | |
| 15 | #include "hw/core/sysbus.h" |
| 16 | #include "chardev/char-fe.h" |
| 17 | #include "qom/object.h" |
| 18 | |
| 19 | #define TYPE_CMSDK_APB_UART "cmsdk-apb-uart" |
| 20 | OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBUART, CMSDK_APB_UART) |
| 21 | |
| 22 | struct CMSDKAPBUART { |
| 23 | /*< private >*/ |
| 24 | SysBusDevice parent_obj; |
| 25 | |
| 26 | /*< public >*/ |
| 27 | MemoryRegion iomem; |
| 28 | CharFrontend chr; |
| 29 | qemu_irq txint; |
| 30 | qemu_irq rxint; |
| 31 | qemu_irq txovrint; |
| 32 | qemu_irq rxovrint; |
| 33 | qemu_irq uartint; |
| 34 | guint watch_tag; |
| 35 | uint32_t pclk_frq; |
| 36 | |
| 37 | uint32_t state; |
| 38 | uint32_t ctrl; |
| 39 | uint32_t intstatus; |
| 40 | uint32_t bauddiv; |
| 41 | /* This UART has no FIFO, only a 1-character buffer for each of Tx and Rx */ |
| 42 | uint8_t txbuf; |
| 43 | uint8_t rxbuf; |
| 44 | }; |
| 45 | |
| 46 | #endif |