adding speed detect on bus reset

This commit is contained in:
hathach 2020-06-01 13:40:18 +07:00
parent 710c54f8cb
commit e92118635c
2 changed files with 6 additions and 3 deletions

View File

@ -48,7 +48,7 @@ FREERTOS_PORT = ARM_CM7/r0p1
# For flash-jlink target # For flash-jlink target
JLINK_DEVICE = stm32h743xi JLINK_DEVICE = stm32h743xi
JLINK_IF = jtag JLINK_IF = swd
# flash target using on-board stlink # flash target using on-board stlink
flash: flash-stlink flash: flash-stlink

View File

@ -40,7 +40,8 @@
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
// Device Data // Device Data
//--------------------------------------------------------------------+ //--------------------------------------------------------------------+
typedef struct { typedef struct
{
struct TU_ATTR_PACKED struct TU_ATTR_PACKED
{ {
volatile uint8_t connected : 1; volatile uint8_t connected : 1;
@ -53,6 +54,8 @@ typedef struct {
uint8_t self_powered : 1; // configuration descriptor's attribute uint8_t self_powered : 1; // configuration descriptor's attribute
}; };
uint8_t speed;
uint8_t itf2drv[16]; // map interface number to driver (0xff is invalid) uint8_t itf2drv[16]; // map interface number to driver (0xff is invalid)
uint8_t ep2drv[8][2]; // map endpoint to driver ( 0xff is invalid ) uint8_t ep2drv[8][2]; // map endpoint to driver ( 0xff is invalid )
@ -384,7 +387,7 @@ void tud_task (void)
{ {
case DCD_EVENT_BUS_RESET: case DCD_EVENT_BUS_RESET:
usbd_reset(event.rhport); usbd_reset(event.rhport);
// TODO DCD should report operational speed (LS/FS/HS) _usbd_dev.speed = event.bus_reset.speed;
break; break;
case DCD_EVENT_UNPLUGGED: case DCD_EVENT_UNPLUGGED: