summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2020-07-02 11:58:40 +0700
committerhathach <[email protected]>2020-07-02 11:58:40 +0700
commit9a290febcdd7aaa50657f3d31da31bd493fa3a0e (patch)
treeca71d1f7bc855c0eed319630082825b5e2802633
parent4966fb2e13ca2629763e76d82b67e531c3e20ede (diff)
change default port some stm bsp
- f769disco default port is highspeed port1 - remove PORT0 on stlink since the board only populated HS connector
-rw-r--r--hw/bsp/stlinkv3mini/board.mk12
-rw-r--r--hw/bsp/stm32f723disco/board.mk9
-rw-r--r--hw/bsp/stm32h743eval/board.mk13
-rw-r--r--src/portable/st/synopsys/dcd_synopsys.c58
4 files changed, 49 insertions, 43 deletions
diff --git a/hw/bsp/stlinkv3mini/board.mk b/hw/bsp/stlinkv3mini/board.mk
index 8576eeaa8..1a64c3735 100644
--- a/hw/bsp/stlinkv3mini/board.mk
+++ b/hw/bsp/stlinkv3mini/board.mk
@@ -1,5 +1,3 @@
-PORT ?= 1
-
CFLAGS += \
-flto \
-mthumb \
@@ -11,14 +9,8 @@ CFLAGS += \
-DSTM32F723xx \
-DHSE_VALUE=25000000 \
-DCFG_TUSB_MCU=OPT_MCU_STM32F7 \
- -DBOARD_DEVICE_RHPORT_NUM=$(PORT)
-
-ifeq ($(PORT), 1)
-CFLAGS += -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
-$(info "PORT1 HS")
-else
-$(info "PORT0")
-endif
+ -DBOARD_DEVICE_RHPORT_NUM=1 \
+ -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
# mcu driver cause following warnings
CFLAGS += -Wno-error=shadow -Wno-error=cast-align
diff --git a/hw/bsp/stm32f723disco/board.mk b/hw/bsp/stm32f723disco/board.mk
index 2bd3b0756..2cf3ac633 100644
--- a/hw/bsp/stm32f723disco/board.mk
+++ b/hw/bsp/stm32f723disco/board.mk
@@ -1,4 +1,5 @@
-PORT ?= 0
+# Default is Highspeed port
+PORT ?= 1
CFLAGS += \
-flto \
@@ -14,10 +15,10 @@ CFLAGS += \
-DBOARD_DEVICE_RHPORT_NUM=$(PORT)
ifeq ($(PORT), 1)
-CFLAGS += -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
-$(info "PORT1 HS")
+ CFLAGS += -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
+ $(info "PORT1 High Speed")
else
-$(info "PORT0")
+ $(info "PORT0 Full Speed")
endif
# mcu driver cause following warnings
diff --git a/hw/bsp/stm32h743eval/board.mk b/hw/bsp/stm32h743eval/board.mk
index cbf37a95d..47d592c58 100644
--- a/hw/bsp/stm32h743eval/board.mk
+++ b/hw/bsp/stm32h743eval/board.mk
@@ -1,3 +1,6 @@
+# Default is Highspeed port
+PORT ?= 1
+
CFLAGS += \
-flto \
-mthumb \
@@ -8,8 +11,14 @@ CFLAGS += \
-nostdlib -nostartfiles \
-DSTM32H743xx \
-DCFG_TUSB_MCU=OPT_MCU_STM32H7 \
- -DBOARD_DEVICE_RHPORT_NUM=1 \
- -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
+ -DBOARD_DEVICE_RHPORT_NUM=$(PORT)
+
+ifeq ($(PORT), 1)
+ CFLAGS += -DBOARD_DEVICE_RHPORT_SPEED=OPT_MODE_HIGH_SPEED
+ $(info "PORT1 High Speed")
+else
+ $(info "PORT0 Full Speed")
+endif
# suppress warning caused by vendor mcu driver
CFLAGS += -Wno-error=maybe-uninitialized -Wno-error=cast-align
diff --git a/src/portable/st/synopsys/dcd_synopsys.c b/src/portable/st/synopsys/dcd_synopsys.c
index 03238f8e2..a2d1983c2 100644
--- a/src/portable/st/synopsys/dcd_synopsys.c
+++ b/src/portable/st/synopsys/dcd_synopsys.c
@@ -390,7 +390,7 @@ void dcd_init (uint8_t rhport)
// Select default internal VBUS Indicator and Drive for ULPI
usb_otg->GUSBCFG &= ~(USB_OTG_GUSBCFG_ULPIEVBUSD | USB_OTG_GUSBCFG_ULPIEVBUSI);
-#if defined(USB_HS_PHYC)
+ #if defined(USB_HS_PHYC)
// Highspeed with embedded UTMI PHYC
// Select UTMI Interface
@@ -399,8 +399,9 @@ void dcd_init (uint8_t rhport)
// Enables control of a High Speed USB PHY
USB_HS_PHYCInit();
-#endif
- } else
+ #endif
+ }
+ else
#endif
{
// Enable internal PHY
@@ -770,43 +771,46 @@ static void handle_rxflvl_ints(uint8_t rhport, USB_OTG_OUTEndpointTypeDef * out_
switch(pktsts) {
case 0x01: // Global OUT NAK (Interrupt)
- break;
+ break;
+
case 0x02: // Out packet recvd
- {
- xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT);
+ {
+ xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, TUSB_DIR_OUT);
- // Read packet off RxFIFO
- read_fifo_packet(rhport, xfer->buffer, bcnt);
+ // Read packet off RxFIFO
+ read_fifo_packet(rhport, xfer->buffer, bcnt);
- // Increment pointer to xfer data
- xfer->buffer += bcnt;
+ // Increment pointer to xfer data
+ xfer->buffer += bcnt;
- // Truncate transfer length in case of short packet
- if(bcnt < xfer->max_size) {
- xfer->total_len -= (out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DOEPTSIZ_XFRSIZ_Pos;
- if(epnum == 0) {
- xfer->total_len -= ep0_pending[TUSB_DIR_OUT];
- ep0_pending[TUSB_DIR_OUT] = 0;
- }
+ // Truncate transfer length in case of short packet
+ if(bcnt < xfer->max_size) {
+ xfer->total_len -= (out_ep[epnum].DOEPTSIZ & USB_OTG_DOEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DOEPTSIZ_XFRSIZ_Pos;
+ if(epnum == 0) {
+ xfer->total_len -= ep0_pending[TUSB_DIR_OUT];
+ ep0_pending[TUSB_DIR_OUT] = 0;
}
}
- break;
+ }
+ break;
+
case 0x03: // Out packet done (Interrupt)
break;
+
case 0x04: // Setup packet done (Interrupt)
out_ep[epnum].DOEPTSIZ |= (3 << USB_OTG_DOEPTSIZ_STUPCNT_Pos);
- break;
+ break;
+
case 0x06: // Setup packet recvd
- {
- // We can receive up to three setup packets in succession, but
- // only the last one is valid.
- _setup_packet[0] = (* rx_fifo);
- _setup_packet[1] = (* rx_fifo);
- }
- break;
+ // We can receive up to three setup packets in succession, but
+ // only the last one is valid.
+ _setup_packet[0] = (* rx_fifo);
+ _setup_packet[1] = (* rx_fifo);
+ break;
+
default: // Invalid
TU_BREAKPOINT();
- break;
+ break;
}
}