remove ep descriptor wMaxPacketSize bitfield due to endian issue
This commit is contained in:
@@ -394,7 +394,7 @@ static const tusb_desc_endpoint_t ep0OUT_desc =
|
||||
|
||||
.bEndpointAddress = 0x00,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_CONTROL },
|
||||
.wMaxPacketSize = { .size = CFG_TUD_ENDPOINT0_SIZE },
|
||||
.wMaxPacketSize = CFG_TUD_ENDPOINT0_SIZE,
|
||||
.bInterval = 0
|
||||
};
|
||||
|
||||
@@ -405,7 +405,7 @@ static const tusb_desc_endpoint_t ep0IN_desc =
|
||||
|
||||
.bEndpointAddress = 0x80,
|
||||
.bmAttributes = { .xfer = TUSB_XFER_CONTROL },
|
||||
.wMaxPacketSize = { .size = CFG_TUD_ENDPOINT0_SIZE },
|
||||
.wMaxPacketSize = CFG_TUD_ENDPOINT0_SIZE,
|
||||
.bInterval = 0
|
||||
};
|
||||
|
||||
@@ -741,7 +741,7 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc
|
||||
(void)rhport;
|
||||
uint8_t const epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress);
|
||||
uint8_t const dir = tu_edpt_dir(p_endpoint_desc->bEndpointAddress);
|
||||
const uint16_t epMaxPktSize = p_endpoint_desc->wMaxPacketSize.size;
|
||||
const uint16_t epMaxPktSize = tu_edpt_packet_size(p_endpoint_desc);
|
||||
uint16_t pma_addr;
|
||||
uint32_t wType;
|
||||
|
||||
@@ -778,19 +778,19 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc
|
||||
// or being double-buffered (bulk endpoints)
|
||||
pcd_clear_ep_kind(USB,0);
|
||||
|
||||
pma_addr = dcd_pma_alloc(p_endpoint_desc->bEndpointAddress, p_endpoint_desc->wMaxPacketSize.size);
|
||||
pma_addr = dcd_pma_alloc(p_endpoint_desc->bEndpointAddress, epMaxPktSize);
|
||||
|
||||
if(dir == TUSB_DIR_IN)
|
||||
{
|
||||
*pcd_ep_tx_address_ptr(USB, epnum) = pma_addr;
|
||||
pcd_set_ep_tx_cnt(USB, epnum, p_endpoint_desc->wMaxPacketSize.size);
|
||||
pcd_set_ep_tx_cnt(USB, epnum, epMaxPktSize);
|
||||
pcd_clear_tx_dtog(USB, epnum);
|
||||
pcd_set_ep_tx_status(USB,epnum,USB_EP_TX_NAK);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pcd_ep_rx_address_ptr(USB, epnum) = pma_addr;
|
||||
pcd_set_ep_rx_cnt(USB, epnum, p_endpoint_desc->wMaxPacketSize.size);
|
||||
pcd_set_ep_rx_cnt(USB, epnum, epMaxPktSize);
|
||||
pcd_clear_rx_dtog(USB, epnum);
|
||||
pcd_set_ep_rx_status(USB, epnum, USB_EP_RX_NAK);
|
||||
}
|
||||
|
||||
@@ -622,10 +622,10 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
||||
TU_ASSERT(epnum < EP_MAX);
|
||||
|
||||
xfer_ctl_t * xfer = XFER_CTL_BASE(epnum, dir);
|
||||
xfer->max_size = desc_edpt->wMaxPacketSize.size;
|
||||
xfer->max_size = tu_edpt_packet_size(desc_edpt);
|
||||
xfer->interval = desc_edpt->bInterval;
|
||||
|
||||
uint16_t const fifo_size = (desc_edpt->wMaxPacketSize.size + 3) / 4; // Round up to next full word
|
||||
uint16_t const fifo_size = (xfer->max_size + 3) / 4; // Round up to next full word
|
||||
|
||||
if(dir == TUSB_DIR_OUT)
|
||||
{
|
||||
@@ -644,7 +644,7 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
||||
out_ep[epnum].DOEPCTL |= (1 << USB_OTG_DOEPCTL_USBAEP_Pos) |
|
||||
(desc_edpt->bmAttributes.xfer << USB_OTG_DOEPCTL_EPTYP_Pos) |
|
||||
(desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? USB_OTG_DOEPCTL_SD0PID_SEVNFRM : 0) |
|
||||
(desc_edpt->wMaxPacketSize.size << USB_OTG_DOEPCTL_MPSIZ_Pos);
|
||||
(xfer->max_size << USB_OTG_DOEPCTL_MPSIZ_Pos);
|
||||
|
||||
dev->DAINTMSK |= (1 << (USB_OTG_DAINTMSK_OEPM_Pos + epnum));
|
||||
}
|
||||
@@ -686,7 +686,7 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_edpt)
|
||||
(epnum << USB_OTG_DIEPCTL_TXFNUM_Pos) |
|
||||
(desc_edpt->bmAttributes.xfer << USB_OTG_DIEPCTL_EPTYP_Pos) |
|
||||
(desc_edpt->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? USB_OTG_DIEPCTL_SD0PID_SEVNFRM : 0) |
|
||||
(desc_edpt->wMaxPacketSize.size << USB_OTG_DIEPCTL_MPSIZ_Pos);
|
||||
(xfer->max_size << USB_OTG_DIEPCTL_MPSIZ_Pos);
|
||||
|
||||
dev->DAINTMSK |= (1 << (USB_OTG_DAINTMSK_IEPM_Pos + epnum));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user