HAL GFXMMU How to Use

group GFXMMU_How_To_Use

GFXMMU peripheral overview

  • The GFXMMU is a graphical oriented memory management unit which aims to optimize the memory usage depending on the display shape.

  • This peripheral allows the microcontroller to store only the visible parts of non-rectangular displays in a contiguous physical memory area, reducing the framebuffer memory footprint.

How to use this driver

The HAL GFXMMU driver can be used as follows:

  • Initialize the GFXMMU handle by calling the HAL_GFXMMU_Init() API that performs these operations:

    • Associate instance to the handle.

    • Enable the GFXMMU clock interface (When USE_HAL_GFXMMU_CLK_ENABLE_MODEL compilation flag is set to HAL_CLK_ENABLE_PERIPH_ONLY in the stm32u5xx_hal_conf.h module).

    • When the USE_HAL_GFXMMU_CLK_ENABLE_MODEL is not defined or defined to HAL_CLK_ENABLE_NO,then the user needs to enable the GFXMMU clock at application side using the HAL_RCC_GFXMMU_EnableClock API.

    • The initialization of the handle state to the HAL_GFXMMU_STATE_INIT.

  • Configure the GFXMMU module with user values:

    • Declare a hal_gfxmmu_config_t structure.

    • Fill all parameters of the declared configuration structure.

    • Call HAL_GFXMMU_SetConfig() function, this function: Updates the GFXMMU registers according to the user configuration provided by the input config structure.

  • The GFXMMU allows up to four virtual buffers to be set. Each buffer can be associated to a physical address by calling HAL_GFXMMU_SetBuffPhysicalAddr() .

  • The default value to be returned when reading from a virtual memory location that is not physically mapped is set by calling HAL_GFXMMU_SetDefaultReturnVal() .

  • When there is a need to reset the LUT configuration use the HAL_GFXMMU_ResetLutLines() , this function: Deactivate all LUT lines (or a range of lines).

  • When needed to enable/disable the cache and prefetch mechanism use:

    • HAL_GFXMMU_SetConfigCache() to set the outer cachability or/and bufferability (*).

    • HAL_GFXMMU_EnableCache() to enable the (cache or address cache) (**).

    • HAL_GFXMMU_DisableCache() to disable the (cache or address cache) (**).

    • HAL_GFXMMU_EnableCacheLockBuff() to lock the (cache or address cache) to a buffer (**).

    • HAL_GFXMMU_DisableCacheLockBuff() to unlock the (cache or address cache) from a buffer (**).

    • HAL_GFXMMU_EnablePrefetch() to enable the prefetch mechanism (*).

    • HAL_GFXMMU_DisablePrefetch() to disable the prefetch mechanism (*).

    • HAL_GFXMMU_EnableForceCache() to enable the force cache (*).

    • HAL_GFXMMU_DisableForceCache() to disable the force cache (*).

    • HAL_GFXMMU_InvalidateCache() to invalidate the cache content (*).

    • HAL_GFXMMU_CleanCache() to clean the cache content (*).

    • HAL_GFXMMU_CleanInvalidateCache() to clean and invalidate the cache content (*).

  • To deinitialize the GFXMMU peripheral use HAL_GFXMMU_DeInit() .

  • Retrieve the HAL GFXMMU information:

  • Register callback:

    • When the compilation flag USE_HAL_GFXMMU_REGISTER_CALLBACKS is set to 1 in the stm32u5xx_hal_conf.h, it allows to configure dynamically the driver callbacks instead of using the default ones.

    • Call HAL_GFXMMU_RegisterErrorCallback() to register a user error callback.

Note

  • (*) feature not available on all devices.

  • (**) the selected cache or address cache is based on the used devices. For more information please refer to the section “GFXMMU implementation” in the reference manual.