English
Language : 

MB87P2020 Datasheet, PDF (88/356 Pages) Fujitsu Component Limited. – Colour LCD/CRT/TV Controller
MB87J2120, MB87P2020-A Hardware Manual
/* layer description record lookup and bit per pixel (bpp) mapping */
byte bpp_lookup(byte layer) {
switch (G0CSPC_CSC(layer)) {
case 0:
// 1bpp
return 1;
case 1:
// 2bpp
return 2;
case 2:
// 4bpp
return 4;
case 3:
// 8bpp
return 8;
case 4:
// RGB555
case 5:
// RGB565
case 7:
// YUV422
case 0x0e:
// YUV555
case 0x0f:
// YUV655
return 16;
default:
// (6) RGB888, (8) YUV444
return 32;
}
}
Figure 1-10: Figuring out bpp value from layer setting
void DrawRect (dword c, byte l, word x, word y, word sx, word sy) {
dword corners[2];
corners[0] = pix_address(l, x, y);
corners[1] = pix_address(l, x+sx-1, y+sy-1);
GDC_CMD_DwRt(c);
GDC_FIFO_INP((dword*) corners, 2, 0);
}
void DrawLine (dword c, byte l, word x, word y, word lx, word ly) {
dword corners[2];
corners[0] = pix_address(l, x, y);
corners[1] = pix_address(l, x+lx-1, y+ly-1);
GDC_CMD_DwLn(c);
GDC_FIFO_INP((dword*) corners, 2, 0);
}
Figure 1-11: Easy to use drawing functions for the example
The functions above are not that important for understanding address calculation but used in examples giv-
en. They are shown for completeness only.
Most interesting is phy_address() function given in figure 1-12. Any information is queried from GDC reg-
isters. This is done for better understanding of internal arithmetic only. If some settings are known before
and fixed for the application, the algorithm can be simplified, which decreases execution time significantly.
It also shows the differences for Lavender and Jasmine.
Page 88