Skip to content

Commit bc63f59

Browse files
committed
mcu specific rename
1 parent 244154e commit bc63f59

File tree

5 files changed

+46
-33
lines changed

5 files changed

+46
-33
lines changed

src/common/tusb_mcu_attr.h renamed to src/common/tusb_mcu.h

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,22 @@
2424
* This file is part of the TinyUSB stack.
2525
*/
2626

27-
#ifndef TUSB_MCU_ATTR_H_
28-
#define TUSB_MCU_ATTR_H_
27+
#ifndef TUSB_MCU_H_
28+
#define TUSB_MCU_H_
29+
30+
//--------------------------------------------------------------------+
31+
// Port Specific
32+
// TUP stand for TinyUSB Port (can be renamed)
33+
//--------------------------------------------------------------------+
34+
35+
//------------- Unaligned Memory Access -------------//
36+
37+
// ARMv7+ (M3-M7, M23-M33) can access unaligned memory
38+
#if (defined(__ARM_ARCH) && (__ARM_ARCH >= 7))
39+
#define TUP_ARCH_STRICT_ALIGN 0
40+
#else
41+
#define TUP_ARCH_STRICT_ALIGN 1
42+
#endif
2943

3044
/* USB Controller Attributes for Device, Host or MCU (both)
3145
* - ENDPOINT_MAX: max (logical) number of endpoint
@@ -45,7 +59,7 @@
4559

4660
#elif TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX)
4761
// TODO USB0 has 6, USB1 has 4
48-
#define MCU_ATTR_CONTROLLER_CHIPIDEA_HS
62+
#define TUP_USBIP_CHIPIDEA_HS
4963
#define DCD_ATTR_ENDPOINT_MAX 6
5064
#define DCD_ATTR_RHPORT_HIGHSPEED 0x01 // Port0 HS, Port1 FS
5165

@@ -63,7 +77,7 @@
6377
#define DCD_ATTR_ENDPOINT_MAX 6
6478

6579
#elif TU_CHECK_MCU(OPT_MCU_MIMXRT10XX)
66-
#define MCU_ATTR_CONTROLLER_CHIPIDEA_HS
80+
#define TUP_USBIP_CHIPIDEA_HS
6781
#define DCD_ATTR_ENDPOINT_MAX 8
6882
#define DCD_ATTR_RHPORT_HIGHSPEED 0x03 // Port0 HS, Port1 HS
6983

@@ -106,6 +120,8 @@
106120
#if defined (STM32F105x8) || defined (STM32F105xB) || defined (STM32F105xC) || \
107121
defined (STM32F107xB) || defined (STM32F107xC)
108122
#define DCD_ATTR_ENDPOINT_MAX 4
123+
124+
#define TUP_USBIP_DWC2
109125
#define DCD_ATTR_DWC2_STM32
110126
#else
111127
#define DCD_ATTR_ENDPOINT_MAX 8
@@ -114,6 +130,8 @@
114130
#elif TU_CHECK_MCU(OPT_MCU_STM32F2)
115131
// FS has 4 ep, HS has 5 ep
116132
#define DCD_ATTR_ENDPOINT_MAX 6
133+
134+
#define TUP_USBIP_DWC2
117135
#define DCD_ATTR_DWC2_STM32
118136

119137
#elif TU_CHECK_MCU(OPT_MCU_STM32F3)
@@ -122,15 +140,21 @@
122140
#elif TU_CHECK_MCU(OPT_MCU_STM32F4)
123141
// For most mcu, FS has 4, HS has 6. TODO 446/469/479 HS has 9
124142
#define DCD_ATTR_ENDPOINT_MAX 6
143+
144+
#define TUP_USBIP_DWC2
125145
#define DCD_ATTR_DWC2_STM32
126146

127147
#elif TU_CHECK_MCU(OPT_MCU_STM32F7)
128148
// FS has 6, HS has 9
129149
#define DCD_ATTR_ENDPOINT_MAX 9
150+
151+
#define TUP_USBIP_DWC2
130152
#define DCD_ATTR_DWC2_STM32
131153

132154
#elif TU_CHECK_MCU(OPT_MCU_STM32H7)
133155
#define DCD_ATTR_ENDPOINT_MAX 9
156+
157+
#define TUP_USBIP_DWC2
134158
#define DCD_ATTR_DWC2_STM32
135159

136160
#elif TU_CHECK_MCU(OPT_MCU_STM32G4)
@@ -146,6 +170,8 @@
146170
defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || \
147171
defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx)
148172
#define DCD_ATTR_ENDPOINT_MAX 6
173+
174+
#define TUP_USBIP_DWC2
149175
#define DCD_ATTR_DWC2_STM32
150176
#else
151177
#define DCD_ATTR_ENDPOINT_MAX 8

src/portable/chipidea/ci_hs/dcd_ci_hs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include "tusb_option.h"
2828

29-
#if CFG_TUD_ENABLED && defined(MCU_ATTR_CONTROLLER_CHIPIDEA_HS)
29+
#if CFG_TUD_ENABLED && defined(TUP_USBIP_CHIPIDEA_HS)
3030

3131
//--------------------------------------------------------------------+
3232
// INCLUDE

src/portable/ehci/ehci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#define EHCI_DBG 2
4646

4747
// Framelist size as small as possible to save SRAM
48-
#ifdef MCU_ATTR_CONTROLLER_CHIPIDEA_HS
48+
#ifdef TUP_USBIP_CHIPIDEA_HS
4949
// NXP Transdimension: 8 elements
5050
#define FRAMELIST_SIZE_BIT_VALUE 7u
5151
#define FRAMELIST_SIZE_USBCMD_VALUE (((FRAMELIST_SIZE_BIT_VALUE & 3) << EHCI_USBCMD_POS_FRAMELIST_SIZE) | \

src/portable/synopsys/dwc2/dcd_dwc2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "tusb_option.h"
3131

3232
#if CFG_TUD_ENABLED && \
33-
( defined(DCD_ATTR_DWC2_STM32) || \
33+
( defined(TUP_USBIP_DWC2) || \
3434
TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3, OPT_MCU_GD32VF103) || \
3535
TU_CHECK_MCU(OPT_MCU_EFM32GG, OPT_MCU_BCM2711, OPT_MCU_BCM2835) || \
3636
TU_CHECK_MCU(OPT_MCU_BCM2837, OPT_MCU_XMC4000) )

src/tusb_option.h

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
#include "tusb_config.h"
173173
#endif
174174

175-
#include "common/tusb_mcu_attr.h"
175+
#include "common/tusb_mcu.h"
176176

177177
//--------------------------------------------------------------------
178178
// RootHub Mode Configuration
@@ -239,6 +239,18 @@
239239
#define TUSB_OPT_DEVICE_ENABLED CFG_TUD_ENABLED
240240
#define TUSB_OPT_HOST_ENABLED CFG_TUH_ENABLED
241241

242+
// TODO move later
243+
// TUP_MCU_STRICT_ALIGN will overwrite TUP_ARCH_STRICT_ALIGN.
244+
// In case TUP_MCU_STRICT_ALIGN = 1 and TUP_ARCH_STRICT_ALIGN =0, we will not reply on compiler
245+
// to generate unaligned access code.
246+
// LPC_IP3511 Highspeed cannot access unaligned memory on USB_RAM
247+
#if TUD_OPT_HIGH_SPEED && (CFG_TUSB_MCU == OPT_MCU_LPC54XXX || CFG_TUSB_MCU == OPT_MCU_LPC55XX)
248+
#define TUP_MCU_STRICT_ALIGN 1
249+
#else
250+
#define TUP_MCU_STRICT_ALIGN 0
251+
#endif
252+
253+
242254
//--------------------------------------------------------------------+
243255
// COMMON OPTIONS
244256
//--------------------------------------------------------------------+
@@ -371,31 +383,6 @@
371383
#define CFG_TUH_VENDOR 0
372384
#endif
373385

374-
//--------------------------------------------------------------------+
375-
// Port Specific
376-
// TUP stand for TinyUSB Port (can be renamed)
377-
//--------------------------------------------------------------------+
378-
379-
//------------- Unaligned Memory -------------//
380-
381-
// ARMv7+ (M3-M7, M23-M33) can access unaligned memory
382-
#if (defined(__ARM_ARCH) && (__ARM_ARCH >= 7))
383-
#define TUP_ARCH_STRICT_ALIGN 0
384-
#else
385-
#define TUP_ARCH_STRICT_ALIGN 1
386-
#endif
387-
388-
// TUP_MCU_STRICT_ALIGN will overwrite TUP_ARCH_STRICT_ALIGN.
389-
// In case TUP_MCU_STRICT_ALIGN = 1 and TUP_ARCH_STRICT_ALIGN =0, we will not reply on compiler
390-
// to generate unaligned access code.
391-
// LPC_IP3511 Highspeed cannot access unaligned memory on USB_RAM
392-
#if TUD_OPT_HIGH_SPEED && (CFG_TUSB_MCU == OPT_MCU_LPC54XXX || CFG_TUSB_MCU == OPT_MCU_LPC55XX)
393-
#define TUP_MCU_STRICT_ALIGN 1
394-
#else
395-
#define TUP_MCU_STRICT_ALIGN 0
396-
#endif
397-
398-
399386
//------------------------------------------------------------------
400387
// Configuration Validation
401388
//------------------------------------------------------------------

0 commit comments

Comments
 (0)