47 #include "debug/Checkpoint.hh"
48 #include "debug/Uart.hh"
54 #include "params/Pl011.hh"
60 control(0x300), fbrd(0), ibrd(0), lcrh(0), ifls(0x12),
62 gic(p->gic), endOnEOT(p->end_on_eot), intNum(p->int_num),
63 intDelay(p->int_delay)
90 DPRINTF(
Uart,
"Re-raising interrupt due to more data "
91 "after UART_DR read\n");
104 "Reading FR register as %#x rawInt=0x%x "
105 "imsc=0x%x maskInt=0x%x\n",
137 data = pkt->
get<uint32_t>();
141 panic(
"Tried to read PL011 at offset %#x that doesn't exist\n", daddr);
156 panic(
"Uart read size too big?\n");
173 DPRINTF(
Uart,
" write register %#x value %#x size=%d\n", daddr,
183 data = pkt->
get<uint8_t>();
186 data = pkt->
get<uint16_t>();
189 data = pkt->
get<uint32_t>();
192 panic(
"Uart write size too big?\n");
199 if ((data & 0xFF) == 0x04 &&
endOnEOT)
225 DPRINTF(
Uart,
"Setting interrupt mask 0x%x\n", data);
233 DPRINTF(
Uart,
"Re-raising interrupt due to more data after "
239 panic(
"Tried to write PL011 at offset %#x that doesn't exist\n", daddr);
251 DPRINTF(
Uart,
"Data available, scheduling interrupt\n");
258 DPRINTF(
Uart,
"Generate Interrupt: imsc=0x%x rawInt=0x%x maskInt=0x%x\n",
270 const bool old_ints(!!
maskInt());
278 }
else if (old_ints && !
maskInt()) {
288 DPRINTF(Checkpoint,
"Serializing Arm PL011\n");
303 DPRINTF(Checkpoint,
"Unserializing Arm PL011\n");
317 Pl011Params::create()
319 return new Pl011(
this);
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
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
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.
static const int UART_IBRD
static const uint16_t UART_RTINTR
uint16_t ifls
interrupt fifo level register.
static const int UART_FR_CTS
bool scheduled() const
Determine if the current event is scheduled.
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.
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void clearInterrupts(uint16_t ints)
Convenience function to clear interrupts.
static const uint16_t UART_RXINTR
#define UNSERIALIZE_SCALAR(scalar)
static const int UART_ICR
Tick curTick()
The current simulated tick.
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
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.
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.
Tick pioDelay
Delay that the device experinces on an access.
void schedule(Event &event, Tick when)
EventWrapper< Pl011,&Pl011::generateInterrupt > intEvent
Wrapper to create an event out of the thing.
uint16_t maskInt() const
Masked interrupt status register.
static const int UART_FR_RXFF
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
static const int UART_MIS
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void dataAvailable() override
Inform the uart that there is data available.
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.
static const int UART_LCRH