44#include "debug/Checkpoint.hh"
45#include "debug/Uart.hh"
50#include "params/Pl011.hh"
59 control(0x300), fbrd(0), ibrd(0), lcrh(0), ifls(0x12),
61 endOnEOT(
p.end_on_eot), interrupt(
p.interrupt->get()),
90 DPRINTF(
Uart,
"Re-raising interrupt due to more data "
91 "after UART_DR read\n");
107 "Reading FR register as %#x rawInt=0x%x "
108 "imsc=0x%x maskInt=0x%x\n",
138 warn(
"PL011: DMA not supported\n");
148 panic(
"Tried to read PL011 at offset %#x that doesn't exist\n", daddr);
166 DPRINTF(
Uart,
" write register %#x value %#x size=%d\n", daddr,
212 DPRINTF(
Uart,
"Re-raising interrupt due to more data after "
221 panic(
"Tried to enable DMA on PL011\n");
223 warn(
"PL011: DMA not supported\n");
226 panic(
"Tried to write PL011 at offset %#x that doesn't exist\n", daddr);
238 DPRINTF(
Uart,
"Data available, scheduling interrupt\n");
245 DPRINTF(
Uart,
"Generate Interrupt: imsc=0x%x rawInt=0x%x maskInt=0x%x\n",
257 const bool old_ints(!!
maskInt());
265 }
else if (old_ints && !
maskInt()) {
275 DPRINTF(Checkpoint,
"Serializing Arm PL011\n");
290 DPRINTF(Checkpoint,
"Unserializing Arm PL011\n");
This is a base class for AMBA devices that have to respond to Device and Implementer ID calls.
Base class for ARM GIC implementations.
bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
virtual void clear()=0
Clear a signalled interrupt.
virtual void raise()=0
Signal an interrupt.
Addr pioAddr
Address that the device listens to.
Tick pioDelay
Delay that the device experinces on an access.
Addr pioSize
Size that the device's address range.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setUintX(uint64_t w, ByteOrder endian)
Set the value in the word w after truncating it to the length of the packet and then byteswapping it ...
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
static const int UART_RSR
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const int UART_FR_CTS
Pl011(const Pl011Params &p)
static const int UART_RIS
static const uint64_t AMBA_ID
static const int UART_IFLS
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setInterruptMask(uint16_t mask)
Convenience function to update the interrupt mask.
const bool endOnEOT
Should the simulation end on an EOT.
static const uint16_t UART_RTINTR
static const int UART_FR_RXFF
uint16_t maskInt() const
Masked interrupt status register.
static const uint16_t UART_RXINTR
static const int UART_DMACR
uint16_t ifls
interrupt fifo level register.
uint16_t imsc
interrupt mask register.
static const int UART_FR_TXFE
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
static const int UART_IBRD
void clearInterrupts(uint16_t ints)
Convenience function to clear interrupts.
static const int UART_IMSC
static const int UART_ICR
EventFunctionWrapper intEvent
Wrapper to create an event out of the thing.
void generateInterrupt()
Function to generate interrupt.
uint16_t ibrd
integer baud rate divisor.
static const int UART_MIS
void dataAvailable() override
Inform the uart that there is data available.
static const int UART_ECR
void raiseInterrupts(uint16_t ints)
Convenience function to raise a new interrupt.
uint16_t rawInt
raw interrupt status register
const Tick intDelay
Delay before interrupting.
uint16_t lcrh
Line control register.
static const int UART_LCRH
uint16_t fbrd
fractional baud rate divisor.
static const uint16_t UART_TXINTR
static const int UART_FBRD
void setInterrupts(uint16_t ints, uint16_t mask)
Assign new interrupt values and update interrupt signals.
ArmInterruptPin *const interrupt
static const int UART_FR_RXFE
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual uint8_t readData()=0
Read a character from the device.
virtual void writeData(uint8_t c)=0
Transmit a character from the host interface to the device.
virtual bool dataAvailable() const =0
Check if there is pending data from the serial device.
bool scheduled() const
Determine if the current event is scheduled.
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
uint64_t Tick
Tick count type.
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 (...
Declaration of the Packet class.
Implementiation of a PL011 UART.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
const std::string & name()