mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hw/char: QOMify sifive_uart
This QOMifies the SiFive UART model. Migration and reset have been implemented. Signed-off-by: Lukas Jünger <lukas.juenger@greensocs.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-id: 20210616092326.59639-3-lukas.juenger@greensocs.com Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
244a9fcb31
commit
6ee7ba1b8a
2 changed files with 109 additions and 16 deletions
|
@ -21,6 +21,7 @@
|
|||
#define HW_SIFIVE_UART_H
|
||||
|
||||
#include "chardev/char-fe.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
|
@ -49,12 +50,10 @@ enum {
|
|||
|
||||
#define SIFIVE_UART_GET_TXCNT(txctrl) ((txctrl >> 16) & 0x7)
|
||||
#define SIFIVE_UART_GET_RXCNT(rxctrl) ((rxctrl >> 16) & 0x7)
|
||||
#define SIFIVE_UART_RX_FIFO_SIZE 8
|
||||
|
||||
#define TYPE_SIFIVE_UART "riscv.sifive.uart"
|
||||
|
||||
typedef struct SiFiveUARTState SiFiveUARTState;
|
||||
DECLARE_INSTANCE_CHECKER(SiFiveUARTState, SIFIVE_UART,
|
||||
TYPE_SIFIVE_UART)
|
||||
OBJECT_DECLARE_SIMPLE_TYPE(SiFiveUARTState, SIFIVE_UART)
|
||||
|
||||
struct SiFiveUARTState {
|
||||
/*< private >*/
|
||||
|
@ -64,8 +63,8 @@ struct SiFiveUARTState {
|
|||
qemu_irq irq;
|
||||
MemoryRegion mmio;
|
||||
CharBackend chr;
|
||||
uint8_t rx_fifo[8];
|
||||
unsigned int rx_fifo_len;
|
||||
uint8_t rx_fifo[SIFIVE_UART_RX_FIFO_SIZE];
|
||||
uint8_t rx_fifo_len;
|
||||
uint32_t ie;
|
||||
uint32_t ip;
|
||||
uint32_t txctrl;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue