dwc2 stm32 check if dcache enabled before calling SCB DCache function

This commit is contained in:
hathach
2025-11-26 16:15:12 +07:00
parent c925277e24
commit f63b67211b

View File

@ -337,6 +337,9 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t round_up_to_cache_line_size(uint32_
}
TU_ATTR_ALWAYS_INLINE static inline bool is_cache_mem(uintptr_t addr) {
if (0 == (SCB->CCR & SCB_CCR_DC_Msk)) {
return false; // D-Cache is disabled
}
for (unsigned int i = 0; i < TU_ARRAY_SIZE(uncached_regions); i++) {
if (uncached_regions[i].start <= addr && addr <= uncached_regions[i].end) { return false; }
}