@@ -1578,31 +1578,31 @@ static void pipe_set_ep_char(const hcd_pipe_config_t *pipe_config, usb_transfer_
1578
1578
// Calculate the pipe's interval in terms of USB frames
1579
1579
// @see USB-OTG programming guide chapter 6.5 for more information
1580
1580
if (type == USB_TRANSFER_TYPE_INTR || type == USB_TRANSFER_TYPE_ISOCHRONOUS ) {
1581
- unsigned int interval_frames ;
1582
- unsigned int xfer_list_len ;
1583
- if ( type == USB_TRANSFER_TYPE_INTR ) {
1584
- interval_frames = pipe_config -> ep_desc -> bInterval ;
1585
- xfer_list_len = XFER_LIST_LEN_INTR ;
1581
+ // Convert bInterval field to real value
1582
+ // @see USB 2.0 specs, Table 9-13
1583
+ unsigned int interval_value ;
1584
+ if ( type == USB_TRANSFER_TYPE_INTR && pipe_config -> dev_speed != USB_SPEED_HIGH ) {
1585
+ interval_value = pipe_config -> ep_desc -> bInterval ;
1586
1586
} else {
1587
- interval_frames = (1 << (pipe_config -> ep_desc -> bInterval - 1 ));
1588
- xfer_list_len = XFER_LIST_LEN_ISOC ;
1587
+ interval_value = (1 << (pipe_config -> ep_desc -> bInterval - 1 ));
1589
1588
}
1590
1589
// Round down interval to nearest power of 2
1591
- if (interval_frames >= 32 ) {
1592
- interval_frames = 32 ;
1593
- } else if (interval_frames >= 16 ) {
1594
- interval_frames = 16 ;
1595
- } else if (interval_frames >= 8 ) {
1596
- interval_frames = 8 ;
1597
- } else if (interval_frames >= 4 ) {
1598
- interval_frames = 4 ;
1599
- } else if (interval_frames >= 2 ) {
1600
- interval_frames = 2 ;
1601
- } else if (interval_frames >= 1 ) {
1602
- interval_frames = 1 ;
1590
+ if (interval_value >= 32 ) {
1591
+ interval_value = 32 ;
1592
+ } else if (interval_value >= 16 ) {
1593
+ interval_value = 16 ;
1594
+ } else if (interval_value >= 8 ) {
1595
+ interval_value = 8 ;
1596
+ } else if (interval_value >= 4 ) {
1597
+ interval_value = 4 ;
1598
+ } else if (interval_value >= 2 ) {
1599
+ interval_value = 2 ;
1600
+ } else if (interval_value >= 1 ) {
1601
+ interval_value = 1 ;
1603
1602
}
1604
- ep_char -> periodic .interval = interval_frames ;
1603
+ ep_char -> periodic .interval = interval_value ;
1605
1604
// We are the Nth pipe to be allocated. Use N as a phase offset
1605
+ unsigned int xfer_list_len = (type == USB_TRANSFER_TYPE_INTR ) ? XFER_LIST_LEN_INTR : XFER_LIST_LEN_ISOC ;
1606
1606
ep_char -> periodic .phase_offset_frames = pipe_idx & (xfer_list_len - 1 );
1607
1607
} else {
1608
1608
ep_char -> periodic .interval = 0 ;
0 commit comments