diff options
| author | sakumisu <[email protected]> | 2022-01-30 15:23:32 +0800 |
|---|---|---|
| committer | sakimusu <[email protected]> | 2022-01-30 22:06:00 +0800 |
| commit | 6cf67c46f2ea36d848d216cab51cc70b6a7da5d0 (patch) | |
| tree | 4c8b16250694b928bdff5d79f7e677ed01b71ef6 | |
| parent | a623d2eff286b95de1d2986c2b2ffd64a48bb5ed (diff) | |
update malloc align size when use dcache
| -rw-r--r-- | common/usb_mem.h | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/common/usb_mem.h b/common/usb_mem.h index 776786b0..a496216a 100644 --- a/common/usb_mem.h +++ b/common/usb_mem.h @@ -22,11 +22,6 @@ */ #ifndef _USB_MEM_H -//#include <stdint.h> -//#include <stdio.h> -//#include <stdlib.h> -//#include <malloc.h> - #define DCACHE_LINE_SIZE 32 #define DCACHE_LINEMASK (DCACHE_LINE_SIZE -1) @@ -50,14 +45,12 @@ static inline void usb_free(void *ptr) static inline void *usb_iomalloc(size_t size) { size = (size + DCACHE_LINEMASK) & ~DCACHE_LINEMASK; - uint32_t no_cache_addr = (uint32_t)(uintptr_t)memalign(DCACHE_LINE_SIZE, size) & ~(1 << 30); - return (void *)no_cache_addr; + return malloc(size); } static inline void usb_iofree(void *addr) { - uint32_t cache_addr = (uint32_t)(uintptr_t)addr | (1 << 30); - free((void *)cache_addr); + free(addr); } #else static inline void *usb_iomalloc(size_t size) |
