English
Language : 

MB87P2020 Datasheet, PDF (57/356 Pages) Fujitsu Component Limited. – Colour LCD/CRT/TV Controller
User Logic Bus
for every bitmap dimension. The reading of data from output FIFO is only done if the calculated package
size (pkg_size) has been reached or if the bitmap has been completely finished (last package). As flush
command for input FIFO after writing a whole package the next GetPixel command is sent to display
controller.
// Struct for bitmap data
struct S_BM {
byte layer;
// layer to operate on
word x,y,dx,dy; // coordinates: offsets x,y; length dx,dy
dword *data;
// bitmap data from x,y to (x+dx-1,y+dy-1)
// amount: dx*dy
};
/* Read back function with optimal package sizes */
dword GetBM(struct S_BM *bm) {
dword amount;
word x, y;
byte pkg_cnt, pkg_size, reqcnt, of_size;
// calculate optimal package size for given request count
reqcnt = G0REQCNT + 1;
// minimum data amount for block transfer
of_size = G0CLKPDR_ID? 64: 128; // FIFO size for Jasmine : Lavender
pkg_size = (of_size / reqcnt) * reqcnt;
// initialize data counters
amount = 0; // bitmap pixels accumulative
pkg_cnt = 0; // intra package count
GDC_CMD_GtPx(); // GDC Mode: Get Pixel
while (!G0FLNOM_IFE); /* IFIFO should be empty that packet fits into */
// bitmap region, picture processing loop
for (y = 0; y < bm->dy; y++) {
for (x = 0; x < bm->dx; x++) {
// write address to input FIFO (relative to BM start point)
G0IFIFO = pix_address(bm->layer, x + bm->x, y + bm->y);
pkg_cnt++;
// get data if pkg_size completed (or even smaller last package)
if (pkg_cnt == pkg_size || (y == bm->dy - 1 && x == bm->dx - 1)) {
GDC_CMD_GtPx();
// flush by sending new command
G0OFUL_UL = pkg_cnt;
// initialize block size FIFO limit
while (G0FLNOM_OFH == 0); // wait for all data avoids OF empty polling
while (pkg_cnt) {
// receive data from OFIFO
bm->data[amount++] = G0OFIFO;) // Set pixel in bitmap array
pkg_cnt--;
} // while pkg_cnt
} // if pkg_cnt == pkg_size
} // x-loop
} // y-loop
return amount; // return number of data words in array
}
Figure 1-9: C-example for reading large data amounts from display controller
Note that for writing data to input FIFO in example from figure 1-9 no flag polling is necessary because it
is known that the amount of data is not larger than FIFO size (output FIFO and input FIFO have the same
size) and the input FIFO is empty at package start. Normally flag polling is necessary before writing data
to input FIFO. The API function ’GDC_FIFO_INP’ which was already described in chapter 1.5.1 automat-
ically takes care of this issue.
In the example in figure 1-9 the package size is calculated dynamically in order to experiment with different
values for REQCNT. Normally it is possible to set up REQCNT according to application needs and calculate
the maximal package size offline. If an application is not dependent on reading data from output FIFO at
Functional description
Page 57