diff options
| author | sakumisu <[email protected]> | 2022-08-10 21:41:11 +0800 |
|---|---|---|
| committer | sakumisu <[email protected]> | 2022-08-10 21:41:11 +0800 |
| commit | 7ade4dfc9880d837dcd9dbf4157f9c627d0e8b64 (patch) | |
| tree | 0dbee24a47974dcaa79a86b3b923d3aa9bc91f1a | |
| parent | 315bf9baf7e299318898ffc404aced4d29116026 (diff) | |
use usb_iomalloc when alignsize is not equal 4
| -rw-r--r-- | common/usb_mem.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/usb_mem.h b/common/usb_mem.h index db2e0369..928690cc 100644 --- a/common/usb_mem.h +++ b/common/usb_mem.h @@ -35,7 +35,7 @@ #endif #define USB_MEM_ALIGNX __attribute__((aligned(CONFIG_USB_ALIGN_SIZE))) -#ifdef CONFIG_USB_DCACHE_ENABLE +#if defined(CONFIG_USB_DCACHE_ENABLE) || (CONFIG_USB_ALIGN_SIZE > 4) static inline void *usb_iomalloc(size_t size) { void *ptr; @@ -79,18 +79,19 @@ static inline void usb_iofree(void *ptr) real_ptr = (void *)*(unsigned long *)((unsigned long)ptr - sizeof(void *)); usb_free(real_ptr); } +#else +#define usb_iomalloc(size) usb_malloc(size) +#define usb_iofree(ptr) usb_free(ptr) +#endif +#ifdef CONFIG_USB_DCACHE_ENABLE void usb_dcache_clean(uintptr_t addr, uint32_t len); void usb_dcache_invalidate(uintptr_t addr, uint32_t len); void usb_dcache_clean_invalidate(uintptr_t addr, uint32_t len); #else -#define usb_iomalloc(size) usb_malloc(size) -#define usb_iofree(ptr) usb_free(ptr) - #define usb_dcache_clean(addr, len) #define usb_dcache_invalidate(addr, len) #define usb_dcache_clean_invalidate(addr, len) - #endif #endif |
