Tutorial
FM4, S6E2DH/S6E2DF/S6E2D5/S6E2D3 Series, 32-Bit Microcontroller, Graphic Driver User Manual, Doc. No. 002-04387 Rev. *A
37
6.5.3 Initialization
Driver initialization and 1kB for the command sequencer FIFO.
// driver initialization
UTIL_SUCCESS(ret, mmlGdcSysInitializeDriver(0));
// get virtual addresses (not required for devices without MMU) */
MM_GDC_PHYS_TO_VIRT((MM_ADDR)instructionBufferAddr, &vInstrBufferAddr);
// recalculate addresses using the vImgAddr as start
MM_GDC_PHYS_TO_VIRT((MM_ADDR)imgAddr, &vImgAddr);
patternAddr = (MM_U32)vImgAddr + imgSize;
textAddr = patte patternSize; storeAddr = te textSize;
// set up an instruction buffer for the command sequencer
UTIL_SUCCESS(ret, mmlGdcSysSetInstructionBuffer( vInstrBufferAddr, instructionBufferSize));
6.5.4 Fill with constant color
First of all the store surface surfStore has to be initialized with mmlGdcSmResetSurfaceObject. We use
MML_GDC_SURF_FORMAT_R5G6B5 as the color format, which means
5 bits for red channel.
6 bits for green channel.
5 bits for blue channel.
We use 0/0/255/255 (pure blue, non-transparent) as the constant color for the store surface. To setup the blit path,
the context has to be reset and the store surface is bound to MML_GDC_PE_STORE.
mmlGdcPeFill finally fills the store surface with the given constant color.
// the store surface
mmlGdcSmResetSurfaceObject(surfStore);
// use format 5/6/5
UTIL_SUCCESS(ret, mmlGdcSmAssignBuffer(surfStore, storeWidth, storeHeight,
MML_GDC_SURF_FORMAT_R5G6B5, (void *)storeAddr, 0));
// the context must be reset like the surface
mmlGdcPeResetContext(ctx);
// we use a coordinate system starting in the upper left corner
mmlGdcPeAttribute(ctx, MML_GDC_PE_ATTR_ZERO_POINT, MML_GDC_PE_ATTR_ZERO_TOP_LEFT);
// Bind the surface to the context
UTIL_SUCCESS(ret, mmlGdcPeBindSurface(ctx, MML_GDC_PE_STORE, surfStore));
// define the constant color
UTIL_SUCCESS(ret, mmlGdcPeColor(ctx, 0, 0, 255, 255));
UTIL_SUCCESS(ret, mmlGdcPeFill(ctx, 0, 0, storeWidth, storeHeight));