/* Disable the cache. 
Call this function to completely shut down cache features. */
void am_hal_cachectrl_disable(void)
/* Disable the cache. 
Call this function to completely shut down cache features. */
void am_hal_cachectrl_disable(void)
{
    uint32_t ui32CacheCfg;
    ui32CacheCfg = AM_REG(CACHECTRL, CACHECFG);
    ui32CacheCfg &= (AM_REG_CACHECTRL_CACHECFG_DCACHE_ENABLE(0) |
                     AM_REG_CACHECTRL_CACHECFG_ICACHE_ENABLE(0));
    AM_REG(CACHECTRL, CACHECFG) = ui32CacheCfg;
    AM_REG(CACHECTRL, CACHECTRL);
    AM_REG(CACHECTRL, CACHECTRL);
    AM_REG(CACHECTRL, CACHECTRL);
    AM_BFW(CACHECTRL, CACHECFG, ENABLE, 0);
    am_hal_pwrctrl_memory_enable(AM_HAL_PWRCTRL_MEMEN_CACHE_DIS);
}