Deleted Added
sdiff udiff text old ( 9330:4a3269a11230 ) new ( 9394:e88cf95d33d3 )
full compact
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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 48 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 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);

--- 360 unchanged lines hidden (view full) ---

435 startAddr = lcdUpbase;
436
437 // Updating base address, interrupt if we're supposed to
438 lcdRis.baseaddr = 1;
439 if (!intEvent.scheduled())
440 schedule(intEvent, nextCycle());
441
442 curAddr = 0;
443 startTime = curCycle();
444
445 maxAddr = static_cast<Addr>(length * bytesPerPixel);
446
447 DPRINTF(PL111, " lcd frame buffer size of %d bytes \n", maxAddr);
448
449 dmaPendingNum = 0;
450
451 fillFifo();
452}
453
454void
455Pl111::fillFifo()
456{
457 while ((dmaPendingNum < maxOutstandingDma) && (maxAddr >= curAddr + dmaSize )) {
458 // concurrent dma reads need different dma done events

--- 11 unchanged lines hidden (view full) ---

470 0, Request::UNCACHEABLE);
471 curAddr += dmaSize;
472 }
473}
474
475void
476Pl111::dmaDone()
477{
478 Cycles maxFrameTime(lcdTiming2.cpl * height);
479
480 --dmaPendingNum;
481
482 if (maxAddr == curAddr && !dmaPendingNum) {
483 if ((curCycle() - startTime) > maxFrameTime) {
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 (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
502 // and the desired fps (i.e. maxFrameTime), we turn the
503 // argument into a relative number of cycles in the future by
504 // subtracting curCycle()
505 if (lcdControl.lcden)
506 // @todo: This is a terrible way of doing the time
507 // keeping, make it all relative
508 schedule(readEvent,
509 clockEdge(Cycles(startTime - curCycle() +
510 maxFrameTime)));
511 }
512
513 if (dmaPendingNum > (maxOutstandingDma - waterMark))
514 return;
515
516 if (!fillFifoEvent.scheduled())
517 schedule(fillFifoEvent, nextCycle());
518}

--- 227 unchanged lines hidden ---