English
Language : 

MB87P2020 Datasheet, PDF (90/356 Pages) Fujitsu Component Limited. – Colour LCD/CRT/TV Controller
MB87J2120, MB87P2020-A Hardware Manual
Last example is an intelligent ClearLayer function, which determines the start address of the next layer au-
tomatically. In that way layer size in Y-dimension is calculated before drawing a monochrome rectangle
filling the complete layer.
void ClrLayer(dword color, byte layer) {
dword R0[2];
int j;
byte ppw;
dword next_layer_phy, PhysSz;
word DomSzXWrd, DomSzXBlk, DomSzYLin, DomSzY;
/* --------------- calculation of Domain Size Y --------------- */
next_layer_phy = 0x100000;
/* max memory size */
/* search next Layer start address
and calculate physical size from actual to next layer */
for (j=0; j<16; j++) {
if ((layer!=j) && (G0PHA(j)>G0PHA(layer)) && (next_layer_phy>G0PHA(j))) {
next_layer_phy = G0PHA(j);
}
}
/* calculate max Domain Size Y to fit in Physical Layer Size */
PhysSz = next_layer_phy - G0PHA(layer);
ppw = 32/bpp_lookup(layer); /* pixel per word */
DomSzXWrd = G0DSZ_X(layer)/ppw + (G0DSZ_X(layer)%ppw? 1: 0);
if (G0CLKPDR_ID == 1) {
/* Jasmine 8x32 row blocks */
DomSzXBlk = DomSzXWrd/8 + ((DomSzXWrd & 0x7)? 1: 0);
DomSzYLin = PhysSz/4/DomSzXBlk/8;
DomSzY = DomSzYLin - (DomSzYLin & 0x1f);
}
if (G0CLKPDR_ID == 0) {
/* Lavender 16x64 row blocks */
DomSzXBlk = DomSzXWrd/16 + ((DomSzXWrd & 0xf)? 1: 0);
DomSzYLin = PhysSz/4/DomSzXBlk/16;
DomSzY = DomSzYLin - (DomSzYLin & 0x3f);
}
/* ----------------- Clea layer function ------------------- */
R0[0] = pix_address(layer, 0, 0);
R0[1] = pix_address(layer, G0DSZ_X(layer)-1, DomSzY-1);
GDC_CMD_DwRt(color);
GDC_FIFO_INP(R0, 2, 0);
}
Figure 1-13: ClearLayer with automatic layer size detection
1.5.1.4 Address Calculation - Example with concrete {X,Y} Pixel
Mkctrl Tcl-GUI
gdc_offset0
gdc_size0
sdram_offset0
Physical Address Layer 0
Domain Size X
Color Space Code
Name in gdc_reg.h
WNDOF0
WNDSZ0
WNDSD0
PHA(0)
DSZ_X(0)
CSPC_CSC(0)
Value
0x40000
0x80000
0x0
0x20000
640
RGB555 (16bpp)
This example calculation is for the Lavender Chip. First calculation returns number of row-blocks in X-di-
mension. We need 20 (0x14) rows side by side for storing 640 pixels with color depth 16 bit.
XBits = DomSzX * bpp = 640 * 16 = 10240 = 0x2800
XRows = XBits[18:9] + (XBits[8:0]? 1: 0) = 10240/512 + 0 = 20 = 0x14
Page 90