xref: /openbmc/qemu/include/hw/char/renesas_sci.h (revision c5a58398)
1 /*
2  * Renesas Serial Communication Interface
3  *
4  * Copyright (c) 2018 Yoshinori Sato
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef HW_CHAR_RENESAS_SCI_H
10 #define HW_CHAR_RENESAS_SCI_H
11 
12 #include "chardev/char-fe.h"
13 #include "hw/sysbus.h"
14 
15 #define TYPE_RENESAS_SCI "renesas-sci"
16 #define RSCI(obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI)
17 
18 enum {
19     ERI = 0,
20     RXI = 1,
21     TXI = 2,
22     TEI = 3,
23     SCI_NR_IRQ = 4
24 };
25 
26 typedef struct {
27     /*< private >*/
28     SysBusDevice parent_obj;
29     /*< public >*/
30 
31     MemoryRegion memory;
32     QEMUTimer timer;
33     CharBackend chr;
34     qemu_irq irq[SCI_NR_IRQ];
35 
36     uint8_t smr;
37     uint8_t brr;
38     uint8_t scr;
39     uint8_t tdr;
40     uint8_t ssr;
41     uint8_t rdr;
42     uint8_t scmr;
43     uint8_t semr;
44 
45     uint8_t read_ssr;
46     int64_t trtime;
47     int64_t rx_next;
48     uint64_t input_freq;
49 } RSCIState;
50 
51 #endif
52