X hits on this document

PDF document

AVR32709: AVR32 UC3 Audio Decoder Over USB - page 24 / 29





24 / 29











ram_file_t ram_files[NUMBER_OF_IMAGES] = { { .name = L"/AVR32_start_320x240_RGB565.bmp"}, { .name = L"/disk_nav_320x240_RGB565.bmp"}, { .name = L"/audio_player.bmp"}


The ram_files array is used throughout the GUI to get access to the image data. In order to load other data than RGB565 BMP data to SDRAM the module needs to be modified.

The SDRAM loader module is called once during the initialization of the graphical user interface. When called it initializes the SDRAM interface and reads the raw image data from specified BMP files into SDRAM. To get the raw image data the BMP header must be read to get the image size and the offset of the data in the file. The copy process does also a conversion from the little endian to the big endian data ordering and because of that the final image data can be dumped directly into the display buffer.

A single call to the SDRAM module is enough to do the initialization and load process: void load_sdram_data(int hsb_hz);

The sole parameter is the HSB frequency in hertz which is needed to initialize the SDRAM tim- ings. The above function is called starting from main in the following order:

m a i n ( ) - > c o m _ t a s k ( ) - > g u i _ i n i t ( ) - > s d r a m _ l o a d _ d a t a ( )

SDRAM Memory Management

The images could be placed at specified locations in SDRAM and thus make a memory man- agement unneeded, but on the other hand it is often better to do memory management to remove the task of keeping track of the data in memory from the developer.

The audio player uses a separate memory manager to manage the SDRAM memory (this mem- ory manager can also replace the default memory manager in the Newlib library if needed).

T he s o u r c e f i l e s o f t h e m e m o r y m a n a g e r a re l o c a t e d i n / S E R V I C E S / M E M - ORY/MEMORY_MANAGER/DLMALLOC/ and the additional configuration of it is /APPLICATIONS/AUDIO-PLAYER/CONF/conf_dlmalloc.h.

The memory manager is initialized in the SDRAM loader module and it is configured to use the whole SDRAM memory. After the initialization memory can be allocated from the SDRAM with the mspace_malloc call. Memory from the internal SRAM can be allocated with the default mal- loc call.

JPEG Decoder

The JPEG decoder is used for the MP3 cover art file support.

The source code of the IJG JPEG decoder is located under /SERVICES/PICTURES/JPG/IJG/. Documentation of the library can be found in /SERVICES/PICTURES/JPG/IJG/libjpeg.doc and an overview in the README file.

The IJG license text can be found in /SERVICES/PICTURES/JPG/IJG/license.txt.



Document info
Document views71
Page views71
Page last viewedThu Oct 27 20:44:29 UTC 2016