summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-11-22 12:25:37 +0700
committerhathach <[email protected]>2024-11-22 12:25:37 +0700
commit090964cd1b15c247c45d41f54dc249acc047137d (patch)
tree534c43209bb94dc1039c9a12559e9a14d3f5e43d /src/common
parentf1486707532aae4b48560a441a66744eb0741245 (diff)
apply TUD_EPBUF_DEF for device: bth, dfu, hid, msc
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_types.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index d0a5c866f..c726add84 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -36,14 +36,20 @@
#endif
// DCache padding for variable to occupy full cache line
-#define TUD_DCACHE_PADDING uint8_t TU_XSTRCAT(dcache_padding_, _TU_COUNTER_)[CFG_TUD_MEM_DCACHE_ENABLE ? CFG_TUD_MEM_DCACHE_LINE_SIZE : 1]
+#define TUD_EPBUF_DCACHE_SIZE(_size) \
+ (CFG_TUD_MEM_DCACHE_ENABLE ? (TU_DIV_CEIL(_size, CFG_TUD_MEM_DCACHE_LINE_SIZE) * CFG_TUD_MEM_DCACHE_LINE_SIZE) : (_size))
#define TUD_EPBUF_DEF(_name, _size) \
union { \
CFG_TUD_MEM_ALIGN uint8_t _name[_size]; \
- uint8_t _name##_dcache_padding[CFG_TUD_MEM_DCACHE_ENABLE ? (TU_DIV_CEIL(_size, CFG_TUD_MEM_DCACHE_LINE_SIZE) * CFG_TUD_MEM_DCACHE_LINE_SIZE) : 1]; \
+ uint8_t _name##_dcache_padding[TUD_EPBUF_DCACHE_SIZE(_size)]; \
};
+#define TUD_EPBUF_TYPE_DEF(_name, _type) \
+ union { \
+ CFG_TUD_MEM_ALIGN _type _name; \
+ uint8_t _name##_dcache_padding[TUD_EPBUF_DCACHE_SIZE(sizeof(_type))]; \
+ };
/*------------------------------------------------------------------*/
/* CONSTANTS