2018-08-24 15:17:44 +03:00
|
|
|
/*
|
|
|
|
* ARM PrimeCell PL022 Synchronous Serial Port
|
|
|
|
*
|
|
|
|
* Copyright (c) 2007 CodeSourcery.
|
|
|
|
* Written by Paul Brook
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
2021-02-05 20:14:56 +03:00
|
|
|
/*
|
|
|
|
* This is a model of the Arm PrimeCell PL022 synchronous serial port.
|
2018-08-24 15:17:44 +03:00
|
|
|
* The PL022 TRM is:
|
2021-02-05 20:14:56 +03:00
|
|
|
* https://developer.arm.com/documentation/ddi0194/latest
|
2018-08-24 15:17:44 +03:00
|
|
|
*
|
|
|
|
* QEMU interface:
|
|
|
|
* + sysbus IRQ: SSPINTR combined interrupt line
|
|
|
|
* + sysbus MMIO region 0: MemoryRegion for the device's registers
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HW_SSI_PL022_H
|
|
|
|
#define HW_SSI_PL022_H
|
|
|
|
|
|
|
|
#include "hw/sysbus.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2018-08-24 15:17:44 +03:00
|
|
|
|
|
|
|
#define TYPE_PL022 "pl022"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(PL022State, PL022)
|
2018-08-24 15:17:44 +03:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct PL022State {
|
2018-08-24 15:17:44 +03:00
|
|
|
SysBusDevice parent_obj;
|
|
|
|
|
|
|
|
MemoryRegion iomem;
|
|
|
|
uint32_t cr0;
|
|
|
|
uint32_t cr1;
|
|
|
|
uint32_t bitmask;
|
|
|
|
uint32_t sr;
|
|
|
|
uint32_t cpsr;
|
|
|
|
uint32_t is;
|
|
|
|
uint32_t im;
|
|
|
|
/* The FIFO head points to the next empty entry. */
|
|
|
|
int tx_fifo_head;
|
|
|
|
int rx_fifo_head;
|
|
|
|
int tx_fifo_len;
|
|
|
|
int rx_fifo_len;
|
|
|
|
uint16_t tx_fifo[8];
|
|
|
|
uint16_t rx_fifo[8];
|
|
|
|
qemu_irq irq;
|
|
|
|
SSIBus *ssi;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2018-08-24 15:17:44 +03:00
|
|
|
|
|
|
|
#endif
|