47 #include "debug/Checkpoint.hh" 48 #include "debug/Uart.hh" 53 #include "params/Pl011.hh" 89 DPRINTF(
Uart,
"Re-raising interrupt due to more data " 90 "after UART_DR read\n");
106 "Reading FR register as %#x rawInt=0x%x " 107 "imsc=0x%x maskInt=0x%x\n",
137 warn(
"PL011: DMA not supported\n");
143 data = pkt->
getLE<uint32_t>();
147 panic(
"Tried to read PL011 at offset %#x that doesn't exist\n", daddr);
162 panic(
"Uart read size too big?\n");
179 DPRINTF(
Uart,
" write register %#x value %#x size=%d\n", daddr,
189 data = pkt->
getLE<uint8_t>();
192 data = pkt->
getLE<uint16_t>();
195 data = pkt->
getLE<uint32_t>();
198 panic(
"Uart write size too big?\n");
205 if ((data & 0xFF) == 0x04 &&
endOnEOT)
233 DPRINTF(
Uart,
"Setting interrupt mask 0x%x\n", data);
241 DPRINTF(
Uart,
"Re-raising interrupt due to more data after " 250 panic(
"Tried to enable DMA on PL011\n");
252 warn(
"PL011: DMA not supported\n");
255 panic(
"Tried to write PL011 at offset %#x that doesn't exist\n", daddr);
267 DPRINTF(
Uart,
"Data available, scheduling interrupt\n");
274 DPRINTF(
Uart,
"Generate Interrupt: imsc=0x%x rawInt=0x%x maskInt=0x%x\n",
286 const bool old_ints(!!
maskInt());
294 }
else if (old_ints && !
maskInt()) {
304 DPRINTF(Checkpoint,
"Serializing Arm PL011\n");
319 DPRINTF(Checkpoint,
"Unserializing Arm PL011\n");
333 Pl011Params::create()
335 return new Pl011(
this);
#define panic(...)
This implements a cprintf based panic() function.
static const int UART_IFLS
static const int UART_FBRD
static const int UART_FR_TXFE
uint16_t ibrd
integer baud rate divisor.
static const int UART_RIS
virtual void clearInt(uint32_t num)=0
Clear an interrupt from a device that is connected to the GIC.
uint16_t lcrh
Line control register.
virtual uint8_t readData()=0
Read a character from the device.
static const int UART_IBRD
static const uint16_t UART_RTINTR
uint16_t ifls
interrupt fifo level register.
static const int UART_FR_CTS
static const int UART_IMSC
void setInterruptMask(uint16_t mask)
Convenience function to update the interrupt mask.
static const uint64_t AMBA_ID
static const int UART_FR_RXFE
const int intNum
Interrupt number to generate.
void setLE(T v)
Set the value in the data pointer to v as little endian.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual void writeData(uint8_t c)=0
Transmit a character from the host interface to the device.
void clearInterrupts(uint16_t ints)
Convenience function to clear interrupts.
static const uint16_t UART_RXINTR
uint16_t maskInt() const
Masked interrupt status register.
#define UNSERIALIZE_SCALAR(scalar)
static const int UART_ICR
Tick curTick()
The current simulated tick.
bool scheduled() const
Determine if the current event is scheduled.
void setInterrupts(uint16_t ints, uint16_t mask)
Assign new interrupt values and update interrupt signals.
Addr pioSize
Size that the device's address range.
const Tick intDelay
Delay before interrupting.
This is a base class for AMBA devices that have to respond to Device and Implementer ID calls...
virtual void sendInt(uint32_t num)=0
Post an interrupt from a device that is connected to the GIC.
void makeAtomicResponse()
void serialize(CheckpointOut &cp) const override
Serialize an object.
uint64_t Tick
Tick count type.
uint16_t rawInt
raw interrupt status register
static const int UART_ECR
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
void raiseInterrupts(uint16_t ints)
Convenience function to raise a new interrupt.
Implementiation of a PL011 UART.
BaseGic *const gic
Gic to use for interrupting.
bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
#define SERIALIZE_SCALAR(scalar)
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
Base class for ARM GIC implementations.
static const uint16_t UART_TXINTR
Pl011(const Pl011Params *p)
Declaration of the Packet class.
uint16_t imsc
interrupt mask register.
std::ostream CheckpointOut
void generateInterrupt()
Function to generate interrupt.
EventFunctionWrapper intEvent
Wrapper to create an event out of the thing.
Tick pioDelay
Delay that the device experinces on an access.
void schedule(Event &event, Tick when)
static const int UART_FR_RXFF
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
static const int UART_MIS
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void dataAvailable() override
Inform the uart that there is data available.
static const int UART_RSR
static const int UART_DMACR
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
uint16_t fbrd
fractional baud rate divisor.
const bool endOnEOT
Should the simulation end on an EOT.
Addr pioAddr
Address that the device listens to.
virtual bool dataAvailable() const =0
Check if there is pending data from the serial device.
static const int UART_LCRH