44#include "debug/Checkpoint.hh"
45#include "debug/HDLcd.hh"
48#include "enums/ImageFormat.hh"
51#include "params/HDLcd.hh"
64 workaroundSwapRB(
p.workaround_swap_rb),
65 workaroundDmaLineCount(
p.workaround_dma_line_count),
67 enableCapture(
p.enable_capture),
68 pixelBufferSize(
p.pixel_buffer_size),
69 virtRefreshRate(
p.virt_refresh_rate),
73 imgFormat(
p.frame_format),
74 pixelPump(*
this, *
p.pxl_clk,
p.pixel_chunk),
78 vnc->setFrameBuffer(&pixelPump.fb);
84 : statistics::
Group(parent,
"HDLcd"),
85 ADD_STAT(underruns, statistics::units::Count::get(),
86 "Number of buffer underruns")
88 using namespace statistics;
96 DPRINTF(Checkpoint,
"Serializing ARM HDLCD\n");
127 dmaEngine->serializeSection(cp,
"dmaEngine");
133 DPRINTF(Checkpoint,
"Unserializing ARM HDLCD\n");
175 dmaEngine->unserializeSection(cp,
"dmaEngine");
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",
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 =
514 const size_t byte_count = line_length *
conv.
length;
522 for (
size_t i = 0;
i < line_length;
i++) {
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",
603 unsigned request_size,
unsigned max_pending,
604 size_t line_size, ssize_t line_pitch,
unsigned num_lines)
609 lineSize(line_size), linePitch(line_pitch), numLines(num_lines),
636 frameEnd =
fb_base + numLines * linePitch;
638 startFill(nextLineAddr, lineSize);
644 nextLineAddr = frameEnd;
653 inform(
"DMA line size: %u bytes", lineSize);
654 inform(
"DMA line pitch: %i bytes", linePitch);
655 inform(
"DMA num lines: %u", numLines);
661 if (nextLineAddr == frameEnd)
666 nextLineAddr += linePitch;
667 if (nextLineAddr != frameEnd)
668 startFill(nextLineAddr, lineSize);
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
virtual void clear()=0
Clear a signalled interrupt.
virtual void raise()=0
Signal an interrupt.
void stop()
Immediately stop pushing pixels.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool active() const
Is the pixel pump active and refreshing the display?
void updateTimings(const DisplayTimings &timings)
Update frame size using display timing.
void start()
Starting pushing pixels in timing mode.
void renderFrame()
Render an entire frame in non-caching mode.
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, uint32_t sid, uint32_t ssid, Tick delay=0)
Buffered DMA engine helper class.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
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
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.
Bitfield< 11, 8 > max_outstanding
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)
virtual std::string name() const
OutputStream * create(const std::string &name, bool binary=false, bool no_gz=false)
Creates a file in this directory (optionally compressed).
std::ostream * stream() const
Get the output underlying output stream.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
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.
Pixel toPixel(uint32_t word) const
Get the Pixel representation of a color word.
unsigned length
Bytes per pixel when stored in memory (including padding)
bool bypassCaches() const
Should caches be bypassed?
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
#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)
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.
#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.
bool sectionExists(const std::string §ion)
Implementiation of the ARM HDLcd controller.
const FlagsType nozero
Don't print if this is zero.
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.
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()