Platform Package reference: Function EwRegisterFlashAreaReader()
Description of the function EwRegisterFlashAreaReader() available in Platform Packages for ANSI C compatible target systems. This function is intended to be used when integrating the Embedded Wizard created GUI application with the underlying graphics subsystem, graphics hardware or other external GUI applications coexisting on the same system.
typedef const void* (*XFlashAreaReaderProc)
const void* aAddress
User implemented function to read Flash memory areas into internal buffers. This function has to conform the above type declaration XFlashAreaReaderProc.
Start address of the Flash area to take in account.
End address of the Flash area to take in account.
Size of the page or block, the function will read from the Flash memory. The value is expressed in bytes and it should be a power of two value (e.g. 512, 1024, ... 4096, etc.).
The address to load the corresponding area from the Flash.
The function EwRegisterFlashAreaReader() registers a specified memory area aStartAddress..aEndAddress as belonging to Flash memory not intended to be directly addressed by the CPU. In order to access this Flash memory, the respective Flash pages need to be loaded first into internal buffer. This reading operation has to be handled by external function, specified in the first parameter aReaderProc. The implementation of the function is up to the user. Embedded Wizard invokes this function during the decompression of bitmap or font data automatically to map the Flash contents into the CPU address space. In this way, the not directly accessible Flash data can be processed by Embedded Wizard.
Embedded Wizard allows only one reader to be registered at the same time. Invoking the function EwRegisterFlashAreaReader() twice with different start/end addresses reports an error. In order to remove the previously registered reader, invoke the function with the previously specified start and end addresses and NULL in the aReaderProc parameter. The function EwRegisterFlashAreaReader() should be invoked before invoking EwInitGraphicsEngine().
The implementation of the external function specified in the parameter aReaderProc should perform following steps:
1.Calculate from the given address aAddress the corresponding page within the Flash memory. The size of the page should correspond to the value specified in the parameter aBlockSize.
2.Load this complete page into an internal, static buffer. For optimization purpose the function can read (or cache) several pages simultaneously.
3.Estimate the memory cell within the internal buffer corresponding to the originally given address aAddress.
4.Return a pointer to the estimated memory cell so that the caller can use it to read the data as if the Flash memory would be accessible by the CPU.
5.If the loading fails or aAddress does not lie within the Flash memory, the function should return aAddress without any changes on it.