rename board specific macro for example
- BOARD_DEVICE/HOST_RHPORT_NUM to BOARD_TUD/H_RHPORT - BOARD_DEVICE/HOST_RHPORT_SPEED to BOARD_TUD/H_MAX_SPEED
This commit is contained in:
@@ -239,12 +239,12 @@ static void _dcd_ft90x_attach(void)
|
||||
|
||||
CRITICAL_SECTION_BEGIN
|
||||
// Turn off the device enable bit.
|
||||
#if BOARD_DEVICE_RHPORT_SPEED == OPT_MODE_HIGH_SPEED
|
||||
#if BOARD_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED
|
||||
USBD_REG(fctrl) = 0;
|
||||
#else // BOARD_DEVICE_RHPORT_SPEED == OPT_MODE_FULL_SPEED
|
||||
#else // BOARD_TUD_MAX_SPEED == OPT_MODE_FULL_SPEED
|
||||
//Set the full speed only bit if required.
|
||||
USBD_REG(fctrl) = MASK_USBD_FCTRL_MODE_FS_ONLY;
|
||||
#endif // BOARD_DEVICE_RHPORT_SPEED
|
||||
#endif // BOARD_TUD_MAX_SPEED
|
||||
|
||||
// Clear first reset and suspend interrupts.
|
||||
do
|
||||
@@ -291,7 +291,7 @@ static void _dcd_ft90x_detach(void)
|
||||
delayms(1);
|
||||
|
||||
// Disable USB PHY
|
||||
dcd_disconnect(BOARD_DEVICE_RHPORT_NUM);
|
||||
dcd_disconnect(BOARD_TUD_RHPORT);
|
||||
delayms(1);
|
||||
|
||||
// Disable Chip USB device clock/PM configuration.
|
||||
@@ -323,7 +323,7 @@ static void _ft90x_usb_speed(void)
|
||||
delayus(200);
|
||||
}
|
||||
|
||||
#if BOARD_DEVICE_RHPORT_SPEED == OPT_MODE_HIGH_SPEED
|
||||
#if BOARD_TUD_MAX_SPEED == OPT_MODE_HIGH_SPEED
|
||||
|
||||
/* Detect high or full speed */
|
||||
fctrl_val = MASK_USBD_FCTRL_USB_DEV_EN;
|
||||
@@ -347,11 +347,11 @@ static void _ft90x_usb_speed(void)
|
||||
delayus(125 + 5);
|
||||
_speed = (USBD_REG(cmif) & MASK_USBD_CMIF_SOFIRQ) ?
|
||||
TUSB_SPEED_HIGH : TUSB_SPEED_FULL;
|
||||
dcd_event_bus_reset(BOARD_DEVICE_RHPORT_NUM, _speed, true);
|
||||
dcd_event_bus_reset(BOARD_TUD_RHPORT, _speed, true);
|
||||
|
||||
#endif /* !__FT930__ */
|
||||
|
||||
#else // BOARD_DEVICE_RHPORT_SPEED == OPT_MODE_FULL_SPEED
|
||||
#else // BOARD_TUD_MAX_SPEED == OPT_MODE_FULL_SPEED
|
||||
|
||||
/* User force set to full speed */
|
||||
_speed = TUSB_SPEED_FULL;
|
||||
@@ -364,10 +364,10 @@ static void _ft90x_usb_speed(void)
|
||||
}
|
||||
#endif
|
||||
USBD_REG(fctrl) = fctrl_val;
|
||||
dcd_event_bus_reset(BOARD_DEVICE_RHPORT_NUM, _speed, true);
|
||||
dcd_event_bus_reset(BOARD_TUD_RHPORT, _speed, true);
|
||||
return;
|
||||
|
||||
#endif // BOARD_DEVICE_RHPORT_SPEED
|
||||
#endif // BOARD_TUD_MAX_SPEED
|
||||
}
|
||||
|
||||
// Send a buffer to the USB IN FIFO.
|
||||
@@ -899,7 +899,7 @@ void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr)
|
||||
|
||||
void _ft90x_usbd_ISR(void)
|
||||
{
|
||||
tud_int_handler(BOARD_DEVICE_RHPORT_NUM); // Resolves to dcd_int_handler().
|
||||
tud_int_handler(BOARD_TUD_RHPORT); // Resolves to dcd_int_handler().
|
||||
}
|
||||
|
||||
void dcd_int_handler(uint8_t rhport)
|
||||
@@ -937,19 +937,19 @@ void dcd_int_handler(uint8_t rhport)
|
||||
{
|
||||
// Reset endpoints to default state.
|
||||
_ft90x_reset_edpts();
|
||||
dcd_event_bus_reset(BOARD_DEVICE_RHPORT_NUM, _speed, true);
|
||||
dcd_event_bus_reset(BOARD_TUD_RHPORT, _speed, true);
|
||||
}
|
||||
if (cmif & MASK_USBD_CMIF_SUSIRQ) //Handle Suspend interrupt
|
||||
{
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_SUSPEND, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_SUSPEND, true);
|
||||
}
|
||||
if (cmif & MASK_USBD_CMIF_RESIRQ) //Handle Resume interrupt
|
||||
{
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_RESUME, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_RESUME, true);
|
||||
}
|
||||
if (cmif & MASK_USBD_CMIF_SOFIRQ) //Handle SOF interrupt
|
||||
{
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_SOF, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_SOF, true);
|
||||
}
|
||||
}
|
||||
// Handle endpoint interrupts.
|
||||
@@ -980,7 +980,7 @@ void dcd_int_handler(uint8_t rhport)
|
||||
_ft90x_dusb_out(USBD_EP_0, (uint8_t *)_ft90x_setup_packet, sizeof(USB_device_request));
|
||||
|
||||
// Send the packet to tinyusb.
|
||||
dcd_event_setup_received(BOARD_DEVICE_RHPORT_NUM, _ft90x_setup_packet, true);
|
||||
dcd_event_setup_received(BOARD_TUD_RHPORT, _ft90x_setup_packet, true);
|
||||
|
||||
// Clear the interrupt that signals a SETUP packet is received.
|
||||
USBD_EP_SR_REG(USBD_EP_0) = (MASK_USBD_EP0SR_SETUP);
|
||||
@@ -1002,7 +1002,7 @@ void dcd_int_handler(uint8_t rhport)
|
||||
xfer_bytes = _ft90x_edpt_xfer_out(USBD_EP_0, (uint8_t *)ep_xfer[USBD_EP_0].buff_ptr, xfer_bytes);
|
||||
}
|
||||
// Now signal completion of data packet.
|
||||
dcd_event_xfer_complete(BOARD_DEVICE_RHPORT_NUM, (ep_xfer[USBD_EP_0].dir ? TUSB_DIR_IN_MASK : 0), xfer_bytes, XFER_RESULT_SUCCESS, true);
|
||||
dcd_event_xfer_complete(BOARD_TUD_RHPORT, (ep_xfer[USBD_EP_0].dir ? TUSB_DIR_IN_MASK : 0), xfer_bytes, XFER_RESULT_SUCCESS, true);
|
||||
|
||||
// Allow new transfers on the control endpoint.
|
||||
ep_xfer[USBD_EP_0].valid = 0;
|
||||
@@ -1059,7 +1059,7 @@ void dcd_int_handler(uint8_t rhport)
|
||||
if (ep_xfer[ep_number].remain_size == 0)
|
||||
{
|
||||
// Signal tinyUSB.
|
||||
dcd_event_xfer_complete(BOARD_DEVICE_RHPORT_NUM, ep_number | ep_dirmask, ep_xfer[ep_number].total_size, XFER_RESULT_SUCCESS, true);
|
||||
dcd_event_xfer_complete(BOARD_TUD_RHPORT, ep_number | ep_dirmask, ep_xfer[ep_number].total_size, XFER_RESULT_SUCCESS, true);
|
||||
|
||||
// Allow new transfers on this endpoint.
|
||||
ep_xfer[ep_number].valid = 0;
|
||||
@@ -1084,21 +1084,21 @@ void ft90x_usbd_pm_ISR(void)
|
||||
{
|
||||
// Signal connection interrupt
|
||||
SYS->PMCFG_H = MASK_SYS_PMCFG_PM_GPIO_IRQ_PEND;
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_RESUME, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_RESUME, true);
|
||||
}
|
||||
|
||||
if (pmcfg & MASK_SYS_PMCFG_DEV_DIS_DEV)
|
||||
{
|
||||
// Signal disconnection interrupt
|
||||
SYS->PMCFG_H = MASK_SYS_PMCFG_PM_GPIO_IRQ_PEND;
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_UNPLUGGED, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_UNPLUGGED, true);
|
||||
}
|
||||
|
||||
if (pmcfg & MASK_SYS_PMCFG_HOST_RST_DEV)
|
||||
{
|
||||
// Signal Host Reset interrupt
|
||||
SYS->PMCFG_H = MASK_SYS_PMCFG_PM_GPIO_IRQ_PEND;
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_BUS_RESET, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_BUS_RESET, true);
|
||||
}
|
||||
|
||||
if (pmcfg & MASK_SYS_PMCFG_HOST_RESUME_DEV)
|
||||
@@ -1109,7 +1109,7 @@ void ft90x_usbd_pm_ISR(void)
|
||||
{
|
||||
// If we are driving K-state on Device USB port;
|
||||
// We must maintain the 1ms requirement before resuming the phy
|
||||
dcd_event_bus_signal(BOARD_DEVICE_RHPORT_NUM, DCD_EVENT_RESUME, true);
|
||||
dcd_event_bus_signal(BOARD_TUD_RHPORT, DCD_EVENT_RESUME, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -221,7 +221,9 @@ typedef int make_iso_compilers_happy ;
|
||||
#define TUD_OPT_RHPORT -1
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUD_ENABLED
|
||||
#define CFG_TUD_ENABLED (TUD_RHPORT_MODE & OPT_MODE_DEVICE)
|
||||
#endif
|
||||
|
||||
#if CFG_TUD_ENABLED
|
||||
#define TUD_OPT_HIGH_SPEED ((TUD_RHPORT_MODE & OPT_MODE_SPEED_MASK) ? (TUD_RHPORT_MODE & OPT_MODE_HIGH_SPEED) : (TUP_RHPORT_HIGHSPEED & (1 << TUD_OPT_RHPORT)))
|
||||
|
Reference in New Issue
Block a user