summaryrefslogtreecommitdiff
path: root/src/tusb_option.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2023-03-24 14:02:09 +0700
committerhathach <[email protected]>2023-03-24 14:05:21 +0700
commit71fb6469d4997347f2014daa41839391cc070a74 (patch)
tree02f5dfdb186c6f70f35d1618999f374dbf94775f /src/tusb_option.h
parent7440782afb8841332005000aa72241300ddccd53 (diff)
separate CFG_TUSB_MEM_SECTION and CFG_TUSB_MEM_ALIGN to
- CFG_TUD_MEM_SECTION and CFG_TUD_MEM_ALIGN - CFG_TUH_MEM_SECTION and CFG_TUH_MEM_ALIGN - fix missing mem section and align for host
Diffstat (limited to 'src/tusb_option.h')
-rw-r--r--src/tusb_option.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/tusb_option.h b/src/tusb_option.h
index c679f2f12..f8ac722f4 100644
--- a/src/tusb_option.h
+++ b/src/tusb_option.h
@@ -289,12 +289,15 @@
#define CFG_TUSB_DEBUG 0
#endif
-// place data in accessible RAM for usb controller
+// TODO MEM_SECTION can be different for host and device controller
+// should use CFG_TUD_MEM_SECTION, CFG_TUH_MEM_SECTION
#ifndef CFG_TUSB_MEM_SECTION
#define CFG_TUSB_MEM_SECTION
#endif
// alignment requirement of buffer used for endpoint transferring
+// TODO MEM_ALIGN can be different for host and device controller
+// should use CFG_TUD_MEM_ALIGN, CFG_TUH_MEM_ALIGN
#ifndef CFG_TUSB_MEM_ALIGN
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)
#endif
@@ -312,6 +315,26 @@
// Device Options (Default)
//--------------------------------------------------------------------
+// Attribute to place data in accessible RAM for device controller
+// default to CFG_TUSB_MEM_SECTION for backward-compatible
+#ifndef CFG_TUD_MEM_SECTION
+ #ifdef CFG_TUSB_MEM_SECTION
+ #define CFG_TUD_MEM_SECTION CFG_TUSB_MEM_SECTION
+ #else
+ #define CFG_TUD_MEM_SECTION
+ #endif
+#endif
+
+// Attribute to align memory for device controller
+// default to CFG_TUSB_MEM_ALIGN for backward-compatible
+#ifndef CFG_TUD_MEM_ALIGN
+ #ifdef CFG_TUSB_MEM_ALIGN
+ #define CFG_TUD_MEM_ALIGN CFG_TUSB_MEM_ALIGN
+ #else
+ #define CFG_TUD_MEM_ALIGN TU_ATTR_ALIGNED(4)
+ #endif
+#endif
+
#ifndef CFG_TUD_ENDPOINT0_SIZE
#define CFG_TUD_ENDPOINT0_SIZE 64
#endif
@@ -390,6 +413,21 @@
#endif
#endif // CFG_TUH_ENABLED
+// Attribute to place data in accessible RAM for host controller
+// default to CFG_TUSB_MEM_SECTION for backward-compatible
+#ifndef CFG_TUH_MEM_SECTION
+ #ifdef CFG_TUSB_MEM_SECTION
+ #define CFG_TUH_MEM_SECTION CFG_TUSB_MEM_SECTION
+ #else
+ #define CFG_TUH_MEM_SECTION
+ #endif
+#endif
+
+// Attribute to align memory for host controller
+#ifndef CFG_TUH_MEM_ALIGN
+ #define CFG_TUH_MEM_ALIGN TU_ATTR_ALIGNED(4)
+#endif
+
//------------- CLASS -------------//
#ifndef CFG_TUH_HUB