pl111.cc (7753:d3e613312953) pl111.cc (7823:dac01f14f20f)
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

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

350Pl111::readFramebuffer()
351{
352 // initialization for dma read from frame buffer to dma buffer
353 uint32_t length = height*width;
354 if (startAddr != lcdUpbase) {
355 startAddr = lcdUpbase;
356 }
357 curAddr = 0;
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

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

350Pl111::readFramebuffer()
351{
352 // initialization for dma read from frame buffer to dma buffer
353 uint32_t length = height*width;
354 if (startAddr != lcdUpbase) {
355 startAddr = lcdUpbase;
356 }
357 curAddr = 0;
358 startTime = curTick;
358 startTime = curTick();
359 maxAddr = static_cast<Addr>(length*sizeof(uint32_t));
360 dmaPendingNum =0 ;
361
362 fillFifo();
363}
364
365void
366Pl111::fillFifo()

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

383{
384 Tick maxFrameTime = lcdTiming2.cpl*height*clock;
385
386 --dmaPendingNum;
387
388 DPRINTF(PL111, " -- DMA pending number %d\n", dmaPendingNum);
389
390 if (maxAddr == curAddr && !dmaPendingNum) {
359 maxAddr = static_cast<Addr>(length*sizeof(uint32_t));
360 dmaPendingNum =0 ;
361
362 fillFifo();
363}
364
365void
366Pl111::fillFifo()

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

383{
384 Tick maxFrameTime = lcdTiming2.cpl*height*clock;
385
386 --dmaPendingNum;
387
388 DPRINTF(PL111, " -- DMA pending number %d\n", dmaPendingNum);
389
390 if (maxAddr == curAddr && !dmaPendingNum) {
391 if ((curTick - startTime) > maxFrameTime)
391 if ((curTick() - startTime) > maxFrameTime)
392 warn("CLCD controller buffer underrun, took %d cycles when should"
392 warn("CLCD controller buffer underrun, took %d cycles when should"
393 " have taken %d\n", curTick - startTime, maxFrameTime);
393 " have taken %d\n", curTick() - startTime, maxFrameTime);
394
395 // double buffering so the vnc server doesn't see a tear in the screen
396 memcpy(frameBuffer, dmaBuffer, maxAddr);
397 assert(!readEvent.scheduled());
398
399 DPRINTF(PL111, "-- write out frame buffer into bmp\n");
400 writeBMP(frameBuffer);
401
402 DPRINTF(PL111, "-- schedule next dma read event at %d tick \n",
394
395 // double buffering so the vnc server doesn't see a tear in the screen
396 memcpy(frameBuffer, dmaBuffer, maxAddr);
397 assert(!readEvent.scheduled());
398
399 DPRINTF(PL111, "-- write out frame buffer into bmp\n");
400 writeBMP(frameBuffer);
401
402 DPRINTF(PL111, "-- schedule next dma read event at %d tick \n",
403 maxFrameTime + curTick);
403 maxFrameTime + curTick());
404 schedule(readEvent, nextCycle(startTime + maxFrameTime));
405 }
406
407 if (dmaPendingNum > (maxOutstandingDma - waterMark))
408 return;
409
410 if (!fillFifoEvent.scheduled())
411 schedule(fillFifoEvent, nextCycle());
412
413}
414
415Tick
416Pl111::nextCycle()
417{
404 schedule(readEvent, nextCycle(startTime + maxFrameTime));
405 }
406
407 if (dmaPendingNum > (maxOutstandingDma - waterMark))
408 return;
409
410 if (!fillFifoEvent.scheduled())
411 schedule(fillFifoEvent, nextCycle());
412
413}
414
415Tick
416Pl111::nextCycle()
417{
418 Tick nextTick = curTick + clock - 1;
418 Tick nextTick = curTick() + clock - 1;
419 nextTick -= nextTick%clock;
420 return nextTick;
421}
422
423Tick
424Pl111::nextCycle(Tick beginTick)
425{
426 Tick nextTick = beginTick;
427 if (nextTick%clock!=0)
428 nextTick = nextTick - (nextTick%clock) + clock;
429
419 nextTick -= nextTick%clock;
420 return nextTick;
421}
422
423Tick
424Pl111::nextCycle(Tick beginTick)
425{
426 Tick nextTick = beginTick;
427 if (nextTick%clock!=0)
428 nextTick = nextTick - (nextTick%clock) + clock;
429
430 assert(nextTick >= curTick);
430 assert(nextTick >= curTick());
431 return nextTick;
432}
433
434// write out the frame buffer into a bitmap file
435void
436Pl111::writeBMP(uint32_t* frameBuffer)
437{
438 fstream pic;

--- 215 unchanged lines hidden ---
431 return nextTick;
432}
433
434// write out the frame buffer into a bitmap file
435void
436Pl111::writeBMP(uint32_t* frameBuffer)
437{
438 fstream pic;

--- 215 unchanged lines hidden ---