40#include "debug/Uart.hh"
58 DPRINTF(
Uart,
"UART InterEvent, not interrupting\n");
78 DPRINTF(
Uart,
"Scheduling IER interrupt for %s, at cycle %lld\n",
80 if (!
event->scheduled()) {
90 if ((
status & intrBit) == 0) {
102 :
Uart(
p,
p.pio_size), registers(this,
name() +
".registers"),
105 rxIntrEvent([
this]{ processIntrEvent(
RX_INT); },
"RX")
110 RegisterBankLE(new_name, 0), rbrThr(rbr, thr), rbrThrDll(rbrThr, dll),
111 ierDlh(ier, dlh), iirFcr(iir, fcr)
118 lcr.writer([
this](
auto &
reg,
const auto &value) {
124 mcr.writer([](
auto &
reg,
const auto &value) {
132 if (device->dataAvailable())
187 iir.id = (uint8_t)InterruptIds::Rx;
189 iir.id = (uint8_t)InterruptIds::Tx;
207 DPRINTF(
Uart,
"IER: IER_THRI set, scheduling TX intrrupt\n");
209 DPRINTF(
Uart,
"-- Interrupting Immediately... %d,%d\n",
218 DPRINTF(
Uart,
"IER: IER_THRI cleared, descheduling TX intrrupt\n");
226 DPRINTF(
Uart,
"IER: IER_RDI set, scheduling RX intrrupt\n");
229 DPRINTF(
Uart,
"IER: IER_RDI cleared, descheduling RX intrrupt\n");
255 DPRINTF(
Uart,
"Write register %#x value %#x\n", daddr,
316 if (rxintrwhen != 0) {
319 if (txintrwhen != 0) {
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.
virtual std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
T * getPtr()
get a pointer to the data ptr.
T getRaw() const
Get the data in the packet without byte swapping.
void makeAtomicResponse()
void addRegisters(std::initializer_list< RegisterAdder > adders)
virtual void read(Addr addr, void *buf, Addr bytes)
virtual void write(Addr addr, const void *buf, Addr bytes)
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.
Registers(Uart8250 *uart, const std::string &new_name)
RWSwitchedRegister iirFcr
void clearIntr(int intrBit)
Iir readIir(Register< Iir > ®)
EventFunctionWrapper txIntrEvent
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void writeThr(Register8 ®, const uint8_t &data)
EventFunctionWrapper rxIntrEvent
void dataAvailable() override
Inform the uart that there is data available.
Uart8250(const Params &p)
AddrRangeList getAddrRanges() const override
Determine the address ranges that this device responds to.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void scheduleIntr(Event *event)
Registers::Register< T > Register
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Registers::Register8 Register8
uint8_t readRbr(Register8 ®)
void processIntrEvent(int intrBit)
void writeIer(Register< Ier > ®, const Ier &ier)
AddrRange RangeSize(Addr start, Addr size)
void deschedule(Event &event)
bool scheduled() const
Determine if the current event is scheduled.
void schedule(Event &event, Tick when)
void reschedule(Event &event, Tick when, bool always=false)
Tick when() const
Get the time that the event is scheduled.
Declaration of IniFile object.
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.
const uint8_t UART_MCR_LOOP
Declaration of the Packet class.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
const std::string & name()