mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-31 16:20:57 +00:00
Merge pull request #2146 from tannewt/host_cache_align
Fix host buffer alignment setting
This commit is contained in:
commit
2bab947e38
@ -78,6 +78,12 @@ TU_ATTR_ALWAYS_INLINE static inline void imxrt_dcache_clean(void const* addr, ui
|
|||||||
TU_ATTR_ALWAYS_INLINE static inline void imxrt_dcache_invalidate(void const* addr, uint32_t data_size) {
|
TU_ATTR_ALWAYS_INLINE static inline void imxrt_dcache_invalidate(void const* addr, uint32_t data_size) {
|
||||||
const uintptr_t addr32 = (uintptr_t) addr;
|
const uintptr_t addr32 = (uintptr_t) addr;
|
||||||
if (imxrt_is_cache_mem(addr32)) {
|
if (imxrt_is_cache_mem(addr32)) {
|
||||||
|
// Invalidating does not push cached changes back to RAM so we need to be
|
||||||
|
// *very* careful when we do it. If we're not aligned, then we risk resetting
|
||||||
|
// values back to their RAM state.
|
||||||
|
// if (addr32 % 32 != 0) {
|
||||||
|
// TU_BREAKPOINT();
|
||||||
|
// }
|
||||||
SCB_InvalidateDCache_by_Addr((void*) addr32, (int32_t) data_size);
|
SCB_InvalidateDCache_by_Addr((void*) addr32, (int32_t) data_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,11 @@
|
|||||||
|
|
||||||
// Attribute to align memory for host controller
|
// Attribute to align memory for host controller
|
||||||
#ifndef CFG_TUH_MEM_ALIGN
|
#ifndef CFG_TUH_MEM_ALIGN
|
||||||
#define CFG_TUH_MEM_ALIGN TU_ATTR_ALIGNED(4)
|
#ifdef CFG_TUSB_MEM_ALIGN
|
||||||
|
#define CFG_TUH_MEM_ALIGN CFG_TUSB_MEM_ALIGN
|
||||||
|
#else
|
||||||
|
#define CFG_TUH_MEM_ALIGN TU_ATTR_ALIGNED(4)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//------------- CLASS -------------//
|
//------------- CLASS -------------//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user