change default port some stm bsp

- f769disco default port is highspeed port1
- remove PORT0 on stlink since the board only populated HS connector
This commit is contained in:
hathach 2020-07-02 11:58:40 +07:00
parent 4966fb2e13
commit 9a290febcd
No known key found for this signature in database
GPG Key ID: 2FA891220FBFD581
4 changed files with 49 additions and 43 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}
}