pl111.cc revision 9086
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 11 * unmodified and in its entirety in all distributions of the software, 12 * modified or unmodified, in source code or in binary form. 13 * 14 * Redistribution and use in source and binary forms, with or without 15 * modification, are permitted provided that the following conditions are 16 * met: redistributions of source code must retain the above copyright 17 * notice, this list of conditions and the following disclaimer; 18 * redistributions in binary form must reproduce the above copyright 19 * notice, this list of conditions and the following disclaimer in the 20 * documentation and/or other materials provided with the distribution; 21 * neither the name of the copyright holders nor the names of its 22 * contributors may be used to endorse or promote products derived from 23 * this software without specific prior written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 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" 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" 50#include "mem/packet.hh" 51#include "mem/packet_access.hh" 52 53// clang complains about std::set being overloaded with Packet::set if 54// we open up the entire namespace std 55using std::vector; 56 57using namespace AmbaDev; 58 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), clock(p->clock), 67 vncserver(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 83 if (vncserver) 84 vncserver->setFramebufferAddr(dmaBuffer); 85} 86 87Pl111::~Pl111() 88{ 89 delete[] dmaBuffer; 90} 91 92// read registers and frame buffer 93Tick 94Pl111::read(PacketPtr pkt) 95{ 96 // use a temporary data since the LCD registers are read/written with 97 // different size operations 98 99 uint32_t data = 0; 100 101 assert(pkt->getAddr() >= pioAddr && 102 pkt->getAddr() < pioAddr + pioSize); 103 104 Addr daddr = pkt->getAddr() - pioAddr; 105 pkt->allocate(); 106 107 DPRINTF(PL111, " read register %#x size=%d\n", daddr, pkt->getSize()); 108 109 switch (daddr) { 110 case LcdTiming0: 111 data = lcdTiming0; 112 break; 113 case LcdTiming1: 114 data = lcdTiming1; 115 break; 116 case LcdTiming2: 117 data = lcdTiming2; 118 break; 119 case LcdTiming3: 120 data = lcdTiming3; 121 break; 122 case LcdUpBase: 123 data = lcdUpbase; 124 break; 125 case LcdLpBase: 126 data = lcdLpbase; 127 break; 128 case LcdControl: 129 data = lcdControl; 130 break; 131 case LcdImsc: 132 data = lcdImsc; 133 break; 134 case LcdRis: 135 data = lcdRis; 136 break; 137 case LcdMis: 138 data = lcdMis; 139 break; 140 case LcdIcr: 141 panic("LCD register at offset %#x is Write-Only\n", daddr); 142 break; 143 case LcdUpCurr: 144 data = curAddr; 145 break; 146 case LcdLpCurr: 147 data = curAddr; 148 break; 149 case ClcdCrsrCtrl: 150 data = clcdCrsrCtrl; 151 break; 152 case ClcdCrsrConfig: 153 data = clcdCrsrConfig; 154 break; 155 case ClcdCrsrPalette0: 156 data = clcdCrsrPalette0; 157 break; 158 case ClcdCrsrPalette1: 159 data = clcdCrsrPalette1; 160 break; 161 case ClcdCrsrXY: 162 data = clcdCrsrXY; 163 break; 164 case ClcdCrsrClip: 165 data = clcdCrsrClip; 166 break; 167 case ClcdCrsrImsc: 168 data = clcdCrsrImsc; 169 break; 170 case ClcdCrsrIcr: 171 panic("CLCD register at offset %#x is Write-Only\n", daddr); 172 break; 173 case ClcdCrsrRis: 174 data = clcdCrsrRis; 175 break; 176 case ClcdCrsrMis: 177 data = clcdCrsrMis; 178 break; 179 default: 180 if (AmbaDev::readId(pkt, AMBA_ID, pioAddr)) { 181 // Hack for variable size accesses 182 data = pkt->get<uint32_t>(); 183 break; 184 } else if (daddr >= CrsrImage && daddr <= 0xBFC) { 185 // CURSOR IMAGE 186 int index; 187 index = (daddr - CrsrImage) >> 2; 188 data= cursorImage[index]; 189 break; 190 } else if (daddr >= LcdPalette && daddr <= 0x3FC) { 191 // LCD Palette 192 int index; 193 index = (daddr - LcdPalette) >> 2; 194 data = lcdPalette[index]; 195 break; 196 } else { 197 panic("Tried to read CLCD register at offset %#x that \ 198 doesn't exist\n", daddr); 199 break; 200 } 201 } 202 203 switch(pkt->getSize()) { 204 case 1: 205 pkt->set<uint8_t>(data); 206 break; 207 case 2: 208 pkt->set<uint16_t>(data); 209 break; 210 case 4: 211 pkt->set<uint32_t>(data); 212 break; 213 default: 214 panic("CLCD controller read size too big?\n"); 215 break; 216 } 217 218 pkt->makeAtomicResponse(); 219 return pioDelay; 220} 221 222// write registers and frame buffer 223Tick 224Pl111::write(PacketPtr pkt) 225{ 226 // use a temporary data since the LCD registers are read/written with 227 // different size operations 228 // 229 uint32_t data = 0; 230 231 switch(pkt->getSize()) { 232 case 1: 233 data = pkt->get<uint8_t>(); 234 break; 235 case 2: 236 data = pkt->get<uint16_t>(); 237 break; 238 case 4: 239 data = pkt->get<uint32_t>(); 240 break; 241 default: 242 panic("PL111 CLCD controller write size too big?\n"); 243 break; 244 } 245 246 assert(pkt->getAddr() >= pioAddr && 247 pkt->getAddr() < pioAddr + pioSize); 248 249 Addr daddr = pkt->getAddr() - pioAddr; 250 251 DPRINTF(PL111, " write register %#x value %#x size=%d\n", daddr, 252 pkt->get<uint8_t>(), pkt->getSize()); 253 254 switch (daddr) { 255 case LcdTiming0: 256 lcdTiming0 = data; 257 // width = 16 * (PPL+1) 258 width = (lcdTiming0.ppl + 1) << 4; 259 break; 260 case LcdTiming1: 261 lcdTiming1 = data; 262 // height = LPP + 1 263 height = (lcdTiming1.lpp) + 1; 264 break; 265 case LcdTiming2: 266 lcdTiming2 = data; 267 break; 268 case LcdTiming3: 269 lcdTiming3 = data; 270 break; 271 case LcdUpBase: 272 lcdUpbase = data; 273 DPRINTF(PL111, "####### Upper panel base set to: %#x #######\n", lcdUpbase); 274 break; 275 case LcdLpBase: 276 warn_once("LCD dual screen mode not supported\n"); 277 lcdLpbase = data; 278 DPRINTF(PL111, "###### Lower panel base set to: %#x #######\n", lcdLpbase); 279 break; 280 case LcdControl: 281 int old_lcdpwr; 282 old_lcdpwr = lcdControl.lcdpwr; 283 lcdControl = data; 284 285 DPRINTF(PL111, "LCD power is:%d\n", lcdControl.lcdpwr); 286 287 // LCD power enable 288 if (lcdControl.lcdpwr && !old_lcdpwr) { 289 updateVideoParams(); 290 DPRINTF(PL111, " lcd size: height %d width %d\n", height, width); 291 waterMark = lcdControl.watermark ? 8 : 4; 292 startDma(); 293 } 294 break; 295 case LcdImsc: 296 lcdImsc = data; 297 if (lcdImsc.vcomp) 298 panic("Interrupting on vcomp not supported\n"); 299 300 lcdMis = lcdImsc & lcdRis; 301 302 if (!lcdMis) 303 gic->clearInt(intNum); 304 305 break; 306 case LcdRis: 307 panic("LCD register at offset %#x is Read-Only\n", daddr); 308 break; 309 case LcdMis: 310 panic("LCD register at offset %#x is Read-Only\n", daddr); 311 break; 312 case LcdIcr: 313 lcdRis = lcdRis & ~data; 314 lcdMis = lcdImsc & lcdRis; 315 316 if (!lcdMis) 317 gic->clearInt(intNum); 318 319 break; 320 case LcdUpCurr: 321 panic("LCD register at offset %#x is Read-Only\n", daddr); 322 break; 323 case LcdLpCurr: 324 panic("LCD register at offset %#x is Read-Only\n", daddr); 325 break; 326 case ClcdCrsrCtrl: 327 clcdCrsrCtrl = data; 328 break; 329 case ClcdCrsrConfig: 330 clcdCrsrConfig = data; 331 break; 332 case ClcdCrsrPalette0: 333 clcdCrsrPalette0 = data; 334 break; 335 case ClcdCrsrPalette1: 336 clcdCrsrPalette1 = data; 337 break; 338 case ClcdCrsrXY: 339 clcdCrsrXY = data; 340 break; 341 case ClcdCrsrClip: 342 clcdCrsrClip = data; 343 break; 344 case ClcdCrsrImsc: 345 clcdCrsrImsc = data; 346 break; 347 case ClcdCrsrIcr: 348 clcdCrsrIcr = data; 349 break; 350 case ClcdCrsrRis: 351 panic("CLCD register at offset %#x is Read-Only\n", daddr); 352 break; 353 case ClcdCrsrMis: 354 panic("CLCD register at offset %#x is Read-Only\n", daddr); 355 break; 356 default: 357 if (daddr >= CrsrImage && daddr <= 0xBFC) { 358 // CURSOR IMAGE 359 int index; 360 index = (daddr - CrsrImage) >> 2; 361 cursorImage[index] = data; 362 break; 363 } else if (daddr >= LcdPalette && daddr <= 0x3FC) { 364 // LCD Palette 365 int index; 366 index = (daddr - LcdPalette) >> 2; 367 lcdPalette[index] = data; 368 break; 369 } else { 370 panic("Tried to write PL111 register at offset %#x that \ 371 doesn't exist\n", daddr); 372 break; 373 } 374 } 375 376 pkt->makeAtomicResponse(); 377 return pioDelay; 378} 379 380void 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) { 390 if (lcdControl.lcdbpp == bpp24 && lcdControl.bgr) 391 vncserver->setFrameBufferParams(VideoConvert::bgr8888, width, 392 height); 393 else if (lcdControl.lcdbpp == bpp24 && !lcdControl.bgr) 394 vncserver->setFrameBufferParams(VideoConvert::rgb8888, width, 395 height); 396 else if (lcdControl.lcdbpp == bpp16m565 && lcdControl.bgr) 397 vncserver->setFrameBufferParams(VideoConvert::bgr565, width, 398 height); 399 else if (lcdControl.lcdbpp == bpp16m565 && !lcdControl.bgr) 400 vncserver->setFrameBufferParams(VideoConvert::rgb565, width, 401 height); 402 else 403 panic("Unimplemented video mode\n"); 404 } 405 406 if (bmp) 407 delete bmp; 408 409 if (lcdControl.lcdbpp == bpp24 && lcdControl.bgr) 410 bmp = new Bitmap(VideoConvert::bgr8888, width, height, dmaBuffer); 411 else if (lcdControl.lcdbpp == bpp24 && !lcdControl.bgr) 412 bmp = new Bitmap(VideoConvert::rgb8888, width, height, dmaBuffer); 413 else if (lcdControl.lcdbpp == bpp16m565 && lcdControl.bgr) 414 bmp = new Bitmap(VideoConvert::bgr565, width, height, dmaBuffer); 415 else if (lcdControl.lcdbpp == bpp16m565 && !lcdControl.bgr) 416 bmp = new Bitmap(VideoConvert::rgb565, width, height, dmaBuffer); 417 else 418 panic("Unimplemented video mode\n"); 419} 420 421void 422Pl111::startDma() 423{ 424 if (dmaPendingNum != 0 || readEvent.scheduled()) 425 return; 426 readFramebuffer(); 427} 428 429void 430Pl111::readFramebuffer() 431{ 432 // initialization for dma read from frame buffer to dma buffer 433 uint32_t length = height * width; 434 if (startAddr != lcdUpbase) 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 = curTick(); 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 459 // due to assertion in scheduling state 460 ++dmaPendingNum; 461 462 assert(!dmaDoneEvent[dmaPendingNum-1].scheduled()); 463 464 // We use a uncachable request here because the requests from the CPU 465 // will be uncacheable as well. If we have uncacheable and cacheable 466 // requests in the memory system for the same address it won't be 467 // pleased 468 dmaPort.dmaAction(MemCmd::ReadReq, curAddr + startAddr, dmaSize, 469 &dmaDoneEvent[dmaPendingNum-1], curAddr + dmaBuffer, 470 0, Request::UNCACHEABLE); 471 curAddr += dmaSize; 472 } 473} 474 475void 476Pl111::dmaDone() 477{ 478 Tick maxFrameTime = lcdTiming2.cpl * height * clock; 479 480 --dmaPendingNum; 481 482 if (maxAddr == curAddr && !dmaPendingNum) { 483 if ((curTick() - 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 (vncserver) 493 vncserver->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 DPRINTF(PL111, "-- schedule next dma read event at %d tick \n", 502 maxFrameTime + curTick()); 503 504 if (lcdControl.lcden) 505 schedule(readEvent, nextCycle(startTime + maxFrameTime)); 506 } 507 508 if (dmaPendingNum > (maxOutstandingDma - waterMark)) 509 return; 510 511 if (!fillFifoEvent.scheduled()) 512 schedule(fillFifoEvent, nextCycle()); 513} 514 515 516Tick 517Pl111::nextCycle() 518{ 519 Tick nextTick = curTick() + clock - 1; 520 nextTick -= nextTick%clock; 521 return nextTick; 522} 523 524Tick 525Pl111::nextCycle(Tick beginTick) 526{ 527 Tick nextTick = beginTick; 528 if (nextTick%clock!=0) 529 nextTick = nextTick - (nextTick%clock) + clock; 530 531 assert(nextTick >= curTick()); 532 return nextTick; 533} 534 535void 536Pl111::serialize(std::ostream &os) 537{ 538 DPRINTF(PL111, "Serializing ARM PL111\n"); 539 540 uint32_t lcdTiming0_serial = lcdTiming0; 541 SERIALIZE_SCALAR(lcdTiming0_serial); 542 543 uint32_t lcdTiming1_serial = lcdTiming1; 544 SERIALIZE_SCALAR(lcdTiming1_serial); 545 546 uint32_t lcdTiming2_serial = lcdTiming2; 547 SERIALIZE_SCALAR(lcdTiming2_serial); 548 549 uint32_t lcdTiming3_serial = lcdTiming3; 550 SERIALIZE_SCALAR(lcdTiming3_serial); 551 552 SERIALIZE_SCALAR(lcdUpbase); 553 SERIALIZE_SCALAR(lcdLpbase); 554 555 uint32_t lcdControl_serial = lcdControl; 556 SERIALIZE_SCALAR(lcdControl_serial); 557 558 uint8_t lcdImsc_serial = lcdImsc; 559 SERIALIZE_SCALAR(lcdImsc_serial); 560 561 uint8_t lcdRis_serial = lcdRis; 562 SERIALIZE_SCALAR(lcdRis_serial); 563 564 uint8_t lcdMis_serial = lcdMis; 565 SERIALIZE_SCALAR(lcdMis_serial); 566 567 SERIALIZE_ARRAY(lcdPalette, LcdPaletteSize); 568 SERIALIZE_ARRAY(cursorImage, CrsrImageSize); 569 570 SERIALIZE_SCALAR(clcdCrsrCtrl); 571 SERIALIZE_SCALAR(clcdCrsrConfig); 572 SERIALIZE_SCALAR(clcdCrsrPalette0); 573 SERIALIZE_SCALAR(clcdCrsrPalette1); 574 SERIALIZE_SCALAR(clcdCrsrXY); 575 SERIALIZE_SCALAR(clcdCrsrClip); 576 577 uint8_t clcdCrsrImsc_serial = clcdCrsrImsc; 578 SERIALIZE_SCALAR(clcdCrsrImsc_serial); 579 580 uint8_t clcdCrsrIcr_serial = clcdCrsrIcr; 581 SERIALIZE_SCALAR(clcdCrsrIcr_serial); 582 583 uint8_t clcdCrsrRis_serial = clcdCrsrRis; 584 SERIALIZE_SCALAR(clcdCrsrRis_serial); 585 586 uint8_t clcdCrsrMis_serial = clcdCrsrMis; 587 SERIALIZE_SCALAR(clcdCrsrMis_serial); 588 589 SERIALIZE_SCALAR(clock); 590 SERIALIZE_SCALAR(height); 591 SERIALIZE_SCALAR(width); 592 SERIALIZE_SCALAR(bytesPerPixel); 593 594 SERIALIZE_ARRAY(dmaBuffer, height * width); 595 SERIALIZE_SCALAR(startTime); 596 SERIALIZE_SCALAR(startAddr); 597 SERIALIZE_SCALAR(maxAddr); 598 SERIALIZE_SCALAR(curAddr); 599 SERIALIZE_SCALAR(waterMark); 600 SERIALIZE_SCALAR(dmaPendingNum); 601 602 Tick int_event_time = 0; 603 Tick read_event_time = 0; 604 Tick fill_fifo_event_time = 0; 605 606 if (readEvent.scheduled()) 607 read_event_time = readEvent.when(); 608 if (fillFifoEvent.scheduled()) 609 fill_fifo_event_time = fillFifoEvent.when(); 610 if (intEvent.scheduled()) 611 int_event_time = intEvent.when(); 612 613 SERIALIZE_SCALAR(read_event_time); 614 SERIALIZE_SCALAR(fill_fifo_event_time); 615 SERIALIZE_SCALAR(int_event_time); 616 617 vector<Tick> dma_done_event_tick; 618 dma_done_event_tick.resize(maxOutstandingDma); 619 for (int x = 0; x < maxOutstandingDma; x++) { 620 dma_done_event_tick[x] = dmaDoneEvent[x].scheduled() ? 621 dmaDoneEvent[x].when() : 0; 622 } 623 arrayParamOut(os, "dma_done_event_tick", dma_done_event_tick); 624} 625 626void 627Pl111::unserialize(Checkpoint *cp, const std::string §ion) 628{ 629 DPRINTF(PL111, "Unserializing ARM PL111\n"); 630 631 uint32_t lcdTiming0_serial; 632 UNSERIALIZE_SCALAR(lcdTiming0_serial); 633 lcdTiming0 = lcdTiming0_serial; 634 635 uint32_t lcdTiming1_serial; 636 UNSERIALIZE_SCALAR(lcdTiming1_serial); 637 lcdTiming1 = lcdTiming1_serial; 638 639 uint32_t lcdTiming2_serial; 640 UNSERIALIZE_SCALAR(lcdTiming2_serial); 641 lcdTiming2 = lcdTiming2_serial; 642 643 uint32_t lcdTiming3_serial; 644 UNSERIALIZE_SCALAR(lcdTiming3_serial); 645 lcdTiming3 = lcdTiming3_serial; 646 647 UNSERIALIZE_SCALAR(lcdUpbase); 648 UNSERIALIZE_SCALAR(lcdLpbase); 649 650 uint32_t lcdControl_serial; 651 UNSERIALIZE_SCALAR(lcdControl_serial); 652 lcdControl = lcdControl_serial; 653 654 uint8_t lcdImsc_serial; 655 UNSERIALIZE_SCALAR(lcdImsc_serial); 656 lcdImsc = lcdImsc_serial; 657 658 uint8_t lcdRis_serial; 659 UNSERIALIZE_SCALAR(lcdRis_serial); 660 lcdRis = lcdRis_serial; 661 662 uint8_t lcdMis_serial; 663 UNSERIALIZE_SCALAR(lcdMis_serial); 664 lcdMis = lcdMis_serial; 665 666 UNSERIALIZE_ARRAY(lcdPalette, LcdPaletteSize); 667 UNSERIALIZE_ARRAY(cursorImage, CrsrImageSize); 668 669 UNSERIALIZE_SCALAR(clcdCrsrCtrl); 670 UNSERIALIZE_SCALAR(clcdCrsrConfig); 671 UNSERIALIZE_SCALAR(clcdCrsrPalette0); 672 UNSERIALIZE_SCALAR(clcdCrsrPalette1); 673 UNSERIALIZE_SCALAR(clcdCrsrXY); 674 UNSERIALIZE_SCALAR(clcdCrsrClip); 675 676 uint8_t clcdCrsrImsc_serial; 677 UNSERIALIZE_SCALAR(clcdCrsrImsc_serial); 678 clcdCrsrImsc = clcdCrsrImsc_serial; 679 680 uint8_t clcdCrsrIcr_serial; 681 UNSERIALIZE_SCALAR(clcdCrsrIcr_serial); 682 clcdCrsrIcr = clcdCrsrIcr_serial; 683 684 uint8_t clcdCrsrRis_serial; 685 UNSERIALIZE_SCALAR(clcdCrsrRis_serial); 686 clcdCrsrRis = clcdCrsrRis_serial; 687 688 uint8_t clcdCrsrMis_serial; 689 UNSERIALIZE_SCALAR(clcdCrsrMis_serial); 690 clcdCrsrMis = clcdCrsrMis_serial; 691 692 UNSERIALIZE_SCALAR(clock); 693 UNSERIALIZE_SCALAR(height); 694 UNSERIALIZE_SCALAR(width); 695 UNSERIALIZE_SCALAR(bytesPerPixel); 696 697 UNSERIALIZE_ARRAY(dmaBuffer, height * width); 698 UNSERIALIZE_SCALAR(startTime); 699 UNSERIALIZE_SCALAR(startAddr); 700 UNSERIALIZE_SCALAR(maxAddr); 701 UNSERIALIZE_SCALAR(curAddr); 702 UNSERIALIZE_SCALAR(waterMark); 703 UNSERIALIZE_SCALAR(dmaPendingNum); 704 705 Tick int_event_time = 0; 706 Tick read_event_time = 0; 707 Tick fill_fifo_event_time = 0; 708 709 UNSERIALIZE_SCALAR(read_event_time); 710 UNSERIALIZE_SCALAR(fill_fifo_event_time); 711 UNSERIALIZE_SCALAR(int_event_time); 712 713 if (int_event_time) 714 schedule(intEvent, int_event_time); 715 if (read_event_time) 716 schedule(readEvent, read_event_time); 717 if (fill_fifo_event_time) 718 schedule(fillFifoEvent, fill_fifo_event_time); 719 720 vector<Tick> dma_done_event_tick; 721 dma_done_event_tick.resize(maxOutstandingDma); 722 arrayParamIn(cp, section, "dma_done_event_tick", dma_done_event_tick); 723 for (int x = 0; x < maxOutstandingDma; x++) { 724 if (dma_done_event_tick[x]) 725 schedule(dmaDoneEvent[x], dma_done_event_tick[x]); 726 } 727 728 if (lcdControl.lcdpwr) { 729 updateVideoParams(); 730 if (vncserver) 731 vncserver->setDirty(); 732 } 733} 734 735void 736Pl111::generateInterrupt() 737{ 738 DPRINTF(PL111, "Generate Interrupt: lcdImsc=0x%x lcdRis=0x%x lcdMis=0x%x\n", 739 (uint32_t)lcdImsc, (uint32_t)lcdRis, (uint32_t)lcdMis); 740 lcdMis = lcdImsc & lcdRis; 741 742 if (lcdMis.underflow || lcdMis.baseaddr || lcdMis.vcomp || lcdMis.ahbmaster) { 743 gic->sendInt(intNum); 744 DPRINTF(PL111, " -- Generated\n"); 745 } 746} 747 748AddrRangeList 749Pl111::getAddrRanges() 750{ 751 AddrRangeList ranges; 752 ranges.push_back(RangeSize(pioAddr, pioSize)); 753 return ranges; 754} 755 756Pl111 * 757Pl111Params::create() 758{ 759 return new Pl111(this); 760} 761 762 763