44#include "debug/Checkpoint.hh"
45#include "debug/HDLcd.hh"
48#include "enums/ImageFormat.hh"
51#include "params/HDLcd.hh"
73 imgFormat(
p.frame_format),
74 pixelPump(*
this, *
p.pxl_clk,
p.pixel_chunk),
78 vnc->setFrameBuffer(&pixelPump.fb);
86 "Number of buffer underruns")
96 DPRINTF(Checkpoint,
"Serializing ARM HDLCD\n");
133 DPRINTF(Checkpoint,
"Unserializing ARM HDLCD\n");
187 if (
sys->bypassCaches()) {
222 "Unhandled read size (address: 0x.4x, size: %u)",
242 "Unhandled read size (address: 0x.4x, size: %u)",
244 const uint32_t
data = pkt->
getLE<uint32_t>();
261 panic(
"HDLCD INT_CLEAR register is Write-Only\n");
288 panic(
"Tried to read HDLCD register that doesn't exist\n",
offset);
297 panic(
"HDLCD VERSION register is read-Only\n");
309 panic(
"HDLCD INT_STATUS register is read-Only\n");
332 if (
bus_options.max_outstanding != old_bus_options.max_outstanding) {
334 "Changing HDLcd outstanding DMA transactions: %d -> %d\n",
335 old_bus_options.max_outstanding,
340 if (
bus_options.burst_len != old_bus_options.burst_len) {
342 "Changing HDLcd DMA burst flags: 0x%x -> 0x%x\n",
378 const CommandReg new_command(value);
380 if (new_command.enable !=
command.enable) {
382 new_command.enable ?
"on" :
"off");
384 if (new_command.enable) {
408 panic(
"Tried to write HDLCD register that doesn't exist\n",
offset);
416 ByteOrder byte_order =
417 pixel_format.big_endian ? ByteOrder::big : ByteOrder::little;
449 warn(
"Maximum number of outstanding DMA transfers set to 0.");
453 const uint32_t dma_burst_flags =
bus_options.burst_len;
454 const uint32_t dma_burst_len = dma_burst_flags ?
460 const uint32_t dma_lines =
479 if (
sys->bypassCaches()) {
492 assert(
sys->bypassCaches());
502 assert(
conv.length <=
sizeof(pixel_data));
504 p =
conv.toPixel(pixel_data);
514 const size_t byte_count = line_length *
conv.length;
522 for (
size_t i = 0;
i < line_length;
i++) {
523 *pixel_it++ =
conv.toPixel(bufPtr);
524 bufPtr +=
conv.length;
541 if (
sys->bypassCaches()) {
551 DPRINTF(
HDLcd,
"Buffer underrun, stopping DMA fill.\n");
563 warn(
"HDLCD %u bytes still in FIFO after frame: Ensure that DMA "
564 "and PixelPump configuration is consistent\n",
582 pic->stream()->seekp(0);
603 unsigned request_size,
unsigned max_pending,
604 size_t line_size, ssize_t line_pitch,
unsigned num_lines)
674 parent.intRaise(INT_DMA_END);
682 inform(
"PixelPump width: %u",
t.width);
683 inform(
"PixelPump height: %u",
t.height);
685 inform(
"PixelPump horizontal back porch: %u",
t.hBackPorch);
686 inform(
"PixelPump horizontal fron porch: %u",
t.hFrontPorch);
687 inform(
"PixelPump horizontal fron porch: %u",
t.hSync);
689 inform(
"PixelPump vertical back porch: %u",
t.vBackPorch);
690 inform(
"PixelPump vertical fron porch: %u",
t.vFrontPorch);
691 inform(
"PixelPump vertical fron porch: %u",
t.vSync);
This is a base class for AMBA devices that have to respond to Device and Implementer ID calls.
Base class for ARM GIC implementations.
ArmInterruptPin *const interrupt
AmbaDmaDevice(const Params &p, Addr pio_size=0)
const DisplayTimings & timings() const
Get a constant reference of the current display timings.
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void dmaRead(Addr addr, int size, Event *event, uint8_t *data, std::optional< uint32_t > sid, std::optional< uint32_t > ssid, Tick delay=0)
void serialize(CheckpointOut &cp) const override
Serialize an object.
size_t size() const
Get the amount of data stored in the FIFO.
void startFill(Addr start, size_t size)
Start filling the FIFO.
DmaReadFifo(DmaPort &port, size_t size, unsigned max_req_size, unsigned max_pending, Request::Flags flags=0)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void flush()
Flush the FIFO.
void stopFill()
Stop the DMA engine.
void startFrame(Addr fb_base)
DmaEngine(HDLcd &_parent, size_t size, unsigned request_size, unsigned max_pending, size_t line_size, ssize_t line_pitch, unsigned num_lines)
void onIdle() override
Last response received callback.
void onEndOfBlock() override
End of block callback.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
EventFunctionWrapper virtRefreshEvent
PolaritiesReg polarities
Polarities register.
std::unique_ptr< ImgWriter > imgWriter
Helper to write out bitmaps.
void drainResume() override
Resume execution after a successful drain.
TimingReg v_sync
Vertical sync width register.
TimingReg v_data
Vertical data width register.
BusOptsReg bus_options
Bus options register.
void writeReg(Addr offset, uint32_t value)
OutputStream * pic
Picture of what the current frame buffer looks like.
std::unique_ptr< DmaEngine > dmaEngine
uint32_t int_rawstat
Interrupt raw status register.
ColorSelectReg blue_select
Blue color select register.
const Addr pixelBufferSize
static constexpr size_t MAX_PIXEL_SIZE
Maximum number of bytes per pixel.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
gem5::HDLcd::HDLcdStats stats
const AddrRangeList addrRanges
std::vector< uint8_t > lineBuffer
void intMask(uint32_t mask)
Convenience function to update the interrupt mask.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
TimingReg v_back_porch
Vertical back porch width register.
uint32_t fb_line_length
Frame buffer Line length register.
const bool workaroundSwapRB
CommandReg command
Command register.
ColorSelectReg red_select
Red color select register.
void serialize(CheckpointOut &cp) const override
Serialize an object.
TimingReg h_data
Horizontal data width register.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void intRaise(uint32_t ints)
Convenience function to raise a new interrupt.
TimingReg h_sync
Horizontal sync width register.
size_t lineNext(std::vector< Pixel >::iterator pixel_it, size_t line_length)
PixelConverter conv
Cached pixel converter, set when the converter is enabled.
DisplayTimings displayTimings() const
TimingReg v_front_porch
Vertical front porch width register.
uint32_t fb_base
Frame buffer base address register.
TimingReg h_front_porch
Horizontal front porch width reg.
TimingReg h_back_porch
Horizontal back porch width reg.
const bool workaroundDmaLineCount
void virtRefresh()
Handler for fast frame refresh in KVM-mode.
int32_t fb_line_pitch
Frame buffer Line pitch register.
uint32_t readReg(Addr offset)
uint32_t intStatus() const
Masked interrupt status register.
void setInterrupts(uint32_t ints, uint32_t mask)
Assign new interrupt values and update interrupt signals.
static constexpr size_t AXI_PORT_WIDTH
AXI port width in bytes.
static constexpr uint32_t INT_VSYNC
static constexpr size_t MAX_BURST_LEN
max number of beats delivered in one dma burst
const Tick virtRefreshRate
uint32_t int_mask
Interrupt mask register.
PixelConverter pixelConverter() const
void intClear(uint32_t ints)
Convenience function to clear interrupts.
PixelFormatReg pixel_format
Pixel format register.
ColorSelectReg green_select
Green color select register.
static constexpr uint32_t INT_UNDERRUN
HDLcd(const HDLcdParams &p)
void setLE(T v)
Set the value in the data pointer to v as little endian.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Configurable RGB pixel converter.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
AddrRange RangeSize(Addr start, Addr size)
constexpr int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
virtual void drainResume()
Resume execution after a successful drain.
void deschedule(Event &event)
void schedule(Event &event, Tick when)
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
static const std::string & currentSection()
Gets the fully-qualified name of the active section.
#define SERIALIZE_OBJ(obj)
This macro serializes an object into its own section.
Implementiation of the ARM HDLcd controller.
const FlagsType nozero
Don't print if this is zero.
Copyright (c) 2024 Arm Limited 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.
uint64_t Tick
Tick count type.
std::unique_ptr< ImgWriter > createImgWriter(enums::ImageFormat type, const FrameBuffer *fb)
Factory Function which allocates a ImgWriter object and returns a smart pointer to it.
std::string csprintf(const char *format, const Args &...args)
Declaration of the Packet class.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
HDLcdStats(statistics::Group *parent)
statistics::Scalar underruns
Internal gem5 representation of a Pixel.
const std::string & name()