pl111.cc (9180:ee8d7a51651d) | pl111.cc (9330:4a3269a11230) |
---|---|
1/* 2 * Copyright (c) 2010 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 24 unchanged lines hidden (view full) --- 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 * 37 * Authors: William Wang 38 * Ali Saidi 39 */ 40 | 1/* 2 * Copyright (c) 2010 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 24 unchanged lines hidden (view full) --- 33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 * 37 * Authors: William Wang 38 * Ali Saidi 39 */ 40 |
41#include "base/vnc/vncserver.hh" | 41#include "base/vnc/vncinput.hh" |
42#include "base/bitmap.hh" 43#include "base/output.hh" 44#include "base/trace.hh" 45#include "debug/PL111.hh" 46#include "debug/Uart.hh" 47#include "dev/arm/amba_device.hh" 48#include "dev/arm/gic.hh" 49#include "dev/arm/pl111.hh" --- 9 unchanged lines hidden (view full) --- 59// initialize clcd registers 60Pl111::Pl111(const Params *p) 61 : AmbaDmaDevice(p), lcdTiming0(0), lcdTiming1(0), lcdTiming2(0), 62 lcdTiming3(0), lcdUpbase(0), lcdLpbase(0), lcdControl(0), lcdImsc(0), 63 lcdRis(0), lcdMis(0), 64 clcdCrsrCtrl(0), clcdCrsrConfig(0), clcdCrsrPalette0(0), 65 clcdCrsrPalette1(0), clcdCrsrXY(0), clcdCrsrClip(0), clcdCrsrImsc(0), 66 clcdCrsrIcr(0), clcdCrsrRis(0), clcdCrsrMis(0), | 42#include "base/bitmap.hh" 43#include "base/output.hh" 44#include "base/trace.hh" 45#include "debug/PL111.hh" 46#include "debug/Uart.hh" 47#include "dev/arm/amba_device.hh" 48#include "dev/arm/gic.hh" 49#include "dev/arm/pl111.hh" --- 9 unchanged lines hidden (view full) --- 59// initialize clcd registers 60Pl111::Pl111(const Params *p) 61 : AmbaDmaDevice(p), lcdTiming0(0), lcdTiming1(0), lcdTiming2(0), 62 lcdTiming3(0), lcdUpbase(0), lcdLpbase(0), lcdControl(0), lcdImsc(0), 63 lcdRis(0), lcdMis(0), 64 clcdCrsrCtrl(0), clcdCrsrConfig(0), clcdCrsrPalette0(0), 65 clcdCrsrPalette1(0), clcdCrsrXY(0), clcdCrsrClip(0), clcdCrsrImsc(0), 66 clcdCrsrIcr(0), clcdCrsrRis(0), clcdCrsrMis(0), |
67 vncserver(p->vnc), bmp(NULL), width(LcdMaxWidth), height(LcdMaxHeight), | 67 vnc(p->vnc), bmp(NULL), width(LcdMaxWidth), height(LcdMaxHeight), |
68 bytesPerPixel(4), startTime(0), startAddr(0), maxAddr(0), curAddr(0), 69 waterMark(0), dmaPendingNum(0), readEvent(this), fillFifoEvent(this), 70 dmaDoneEvent(maxOutstandingDma, this), intEvent(this) 71{ 72 pioSize = 0xFFFF; 73 74 pic = simout.create(csprintf("%s.framebuffer.bmp", sys->name()), true); 75 76 const int buffer_size = LcdMaxWidth * LcdMaxHeight * sizeof(uint32_t); 77 dmaBuffer = new uint8_t[buffer_size]; 78 79 memset(lcdPalette, 0, sizeof(lcdPalette)); 80 memset(cursorImage, 0, sizeof(cursorImage)); 81 memset(dmaBuffer, 0, buffer_size); 82 | 68 bytesPerPixel(4), startTime(0), startAddr(0), maxAddr(0), curAddr(0), 69 waterMark(0), dmaPendingNum(0), readEvent(this), fillFifoEvent(this), 70 dmaDoneEvent(maxOutstandingDma, this), intEvent(this) 71{ 72 pioSize = 0xFFFF; 73 74 pic = simout.create(csprintf("%s.framebuffer.bmp", sys->name()), true); 75 76 const int buffer_size = LcdMaxWidth * LcdMaxHeight * sizeof(uint32_t); 77 dmaBuffer = new uint8_t[buffer_size]; 78 79 memset(lcdPalette, 0, sizeof(lcdPalette)); 80 memset(cursorImage, 0, sizeof(cursorImage)); 81 memset(dmaBuffer, 0, buffer_size); 82 |
83 if (vncserver) 84 vncserver->setFramebufferAddr(dmaBuffer); | 83 if (vnc) 84 vnc->setFramebufferAddr(dmaBuffer); |
85} 86 87Pl111::~Pl111() 88{ 89 delete[] dmaBuffer; 90} 91 92// read registers and frame buffer --- 288 unchanged lines hidden (view full) --- 381Pl111::updateVideoParams() 382{ 383 if (lcdControl.lcdbpp == bpp24) { 384 bytesPerPixel = 4; 385 } else if (lcdControl.lcdbpp == bpp16m565) { 386 bytesPerPixel = 2; 387 } 388 | 85} 86 87Pl111::~Pl111() 88{ 89 delete[] dmaBuffer; 90} 91 92// read registers and frame buffer --- 288 unchanged lines hidden (view full) --- 381Pl111::updateVideoParams() 382{ 383 if (lcdControl.lcdbpp == bpp24) { 384 bytesPerPixel = 4; 385 } else if (lcdControl.lcdbpp == bpp16m565) { 386 bytesPerPixel = 2; 387 } 388 |
389 if (vncserver) { | 389 if (vnc) { |
390 if (lcdControl.lcdbpp == bpp24 && lcdControl.bgr) | 390 if (lcdControl.lcdbpp == bpp24 && lcdControl.bgr) |
391 vncserver->setFrameBufferParams(VideoConvert::bgr8888, width, | 391 vnc->setFrameBufferParams(VideoConvert::bgr8888, width, |
392 height); 393 else if (lcdControl.lcdbpp == bpp24 && !lcdControl.bgr) | 392 height); 393 else if (lcdControl.lcdbpp == bpp24 && !lcdControl.bgr) |
394 vncserver->setFrameBufferParams(VideoConvert::rgb8888, width, | 394 vnc->setFrameBufferParams(VideoConvert::rgb8888, width, |
395 height); 396 else if (lcdControl.lcdbpp == bpp16m565 && lcdControl.bgr) | 395 height); 396 else if (lcdControl.lcdbpp == bpp16m565 && lcdControl.bgr) |
397 vncserver->setFrameBufferParams(VideoConvert::bgr565, width, | 397 vnc->setFrameBufferParams(VideoConvert::bgr565, width, |
398 height); 399 else if (lcdControl.lcdbpp == bpp16m565 && !lcdControl.bgr) | 398 height); 399 else if (lcdControl.lcdbpp == bpp16m565 && !lcdControl.bgr) |
400 vncserver->setFrameBufferParams(VideoConvert::rgb565, width, | 400 vnc->setFrameBufferParams(VideoConvert::rgb565, width, |
401 height); 402 else 403 panic("Unimplemented video mode\n"); 404 } 405 406 if (bmp) 407 delete bmp; 408 --- 75 unchanged lines hidden (view full) --- 484 warn("CLCD controller buffer underrun, took %d cycles when should" 485 " have taken %d\n", curTick() - startTime, maxFrameTime); 486 lcdRis.underflow = 1; 487 if (!intEvent.scheduled()) 488 schedule(intEvent, nextCycle()); 489 } 490 491 assert(!readEvent.scheduled()); | 401 height); 402 else 403 panic("Unimplemented video mode\n"); 404 } 405 406 if (bmp) 407 delete bmp; 408 --- 75 unchanged lines hidden (view full) --- 484 warn("CLCD controller buffer underrun, took %d cycles when should" 485 " have taken %d\n", curTick() - startTime, maxFrameTime); 486 lcdRis.underflow = 1; 487 if (!intEvent.scheduled()) 488 schedule(intEvent, nextCycle()); 489 } 490 491 assert(!readEvent.scheduled()); |
492 if (vncserver) 493 vncserver->setDirty(); | 492 if (vnc) 493 vnc->setDirty(); |
494 495 DPRINTF(PL111, "-- write out frame buffer into bmp\n"); 496 497 assert(bmp); 498 pic->seekp(0); 499 bmp->write(pic); 500 501 // schedule the next read based on when the last frame started --- 203 unchanged lines hidden (view full) --- 705 arrayParamIn(cp, section, "dma_done_event_tick", dma_done_event_tick); 706 for (int x = 0; x < maxOutstandingDma; x++) { 707 if (dma_done_event_tick[x]) 708 schedule(dmaDoneEvent[x], dma_done_event_tick[x]); 709 } 710 711 if (lcdControl.lcdpwr) { 712 updateVideoParams(); | 494 495 DPRINTF(PL111, "-- write out frame buffer into bmp\n"); 496 497 assert(bmp); 498 pic->seekp(0); 499 bmp->write(pic); 500 501 // schedule the next read based on when the last frame started --- 203 unchanged lines hidden (view full) --- 705 arrayParamIn(cp, section, "dma_done_event_tick", dma_done_event_tick); 706 for (int x = 0; x < maxOutstandingDma; x++) { 707 if (dma_done_event_tick[x]) 708 schedule(dmaDoneEvent[x], dma_done_event_tick[x]); 709 } 710 711 if (lcdControl.lcdpwr) { 712 updateVideoParams(); |
713 if (vncserver) 714 vncserver->setDirty(); | 713 if (vnc) 714 vnc->setDirty(); |
715 } 716} 717 718void 719Pl111::generateInterrupt() 720{ 721 DPRINTF(PL111, "Generate Interrupt: lcdImsc=0x%x lcdRis=0x%x lcdMis=0x%x\n", 722 (uint32_t)lcdImsc, (uint32_t)lcdRis, (uint32_t)lcdMis); --- 23 unchanged lines hidden --- | 715 } 716} 717 718void 719Pl111::generateInterrupt() 720{ 721 DPRINTF(PL111, "Generate Interrupt: lcdImsc=0x%x lcdRis=0x%x lcdMis=0x%x\n", 722 (uint32_t)lcdImsc, (uint32_t)lcdRis, (uint32_t)lcdMis); --- 23 unchanged lines hidden --- |