void platform_map_mem_region(unsigned int va,unsigned int pa, unsigned int size,unsigned int flags) { unsigned int r5_flags; /* Assume DEVICE_SHARED if nothing indicates this is memory. */ r5_flags = DEVICE_SHARED; if (flags & SHARED_MEM) { r5_flags = NORM_SHARED_NCACHE; if (flags & WB_CACHE) { r5_flags = NORM_SHARED_WB_WA; } else if (flags & WT_CACHE) { r5_flags = NORM_SHARED_WT_NWA; } } else if (flags & MEM_MAPPED) { r5_flags = NORM_NSHARED_NCACHE; if (flags & WB_CACHE) { r5_flags = NORM_NSHARED_WB_WA; } else if (flags & WT_CACHE) { r5_flags = NORM_NSHARED_WT_NWA; } } Xil_SetMPURegion(pa, size, r5_flags | PRIV_RW_USER_RW); return; }
/** * @brief This function sets the memory attributes for a section covering * 1MB, of memory in the translation table. * * @param Addr: 32-bit address for which memory attributes need to be set. * @param attrib: Attribute for the given memory region. * @return None. * * ******************************************************************************/ void Xil_SetTlbAttributes(INTPTR addr, u32 attrib) { INTPTR Localaddr = addr; Localaddr &= (~(0xFFFFFU)); /* Setting the MPU region with given attribute with 1MB size */ Xil_SetMPURegion(Localaddr, 0x100000, attrib); }