Fix bug in writing to constant src/dst address.
Copying has to be conduct in full words (at least for STM32). Renamed copy function to tu_fifo_write_n_const_addr_full_words()
This commit is contained in:
@@ -517,7 +517,7 @@ static void receive_packet(xfer_ctl_t *xfer, /* usb_out_endpoint_t * out_ep, */
|
||||
if (xfer->ff)
|
||||
{
|
||||
// Ring buffer
|
||||
tu_fifo_write_n_const_addr(xfer->ff, (const void *) rx_fifo, to_recv_size);
|
||||
tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *) rx_fifo, to_recv_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -573,7 +573,7 @@ static void transmit_packet(xfer_ctl_t *xfer, volatile usb_in_endpoint_t *in_ep,
|
||||
|
||||
if (xfer->ff)
|
||||
{
|
||||
tu_fifo_read_n_const_addr(xfer->ff, (void *) tx_fifo, to_xfer_size);
|
||||
tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *) tx_fifo, to_xfer_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -437,7 +437,7 @@ void dcd_int_handler(uint8_t rhport)
|
||||
// write to EP fifo
|
||||
if (xfer->ff)
|
||||
{
|
||||
tu_fifo_read_n_const_addr(xfer->ff, (void *) &UDP->UDP_FDR[epnum], xact_len);
|
||||
tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *) &UDP->UDP_FDR[epnum], xact_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -470,7 +470,7 @@ void dcd_int_handler(uint8_t rhport)
|
||||
// Read from EP fifo
|
||||
if (xfer->ff)
|
||||
{
|
||||
tu_fifo_write_n_const_addr(xfer->ff, (const void *) &UDP->UDP_FDR[epnum], xact_len);
|
||||
tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *) &UDP->UDP_FDR[epnum], xact_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -183,7 +183,7 @@ static void dcd_userEP_in_xfer(struct xfer_ctl_t *xfer, USBD_EP_T *ep)
|
||||
/* provided buffers are thankfully 32-bit aligned, allowing most data to be transfered as 32-bit */
|
||||
if (xfer->ff)
|
||||
{
|
||||
tu_fifo_read_n_const_addr(xfer->ff, (void *) (&ep->EPDAT_BYTE), bytes_now);
|
||||
tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *) (&ep->EPDAT_BYTE), bytes_now);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -657,7 +657,7 @@ void dcd_int_handler(uint8_t rhport)
|
||||
/* copy the data from the PC to the previously provided buffer */
|
||||
if (xfer->ff)
|
||||
{
|
||||
tu_fifo_write_n_const_addr(xfer->ff, (const void *) &ep->EPDAT_BYTE, tu_min16(available_bytes, xfer->total_bytes - xfer->out_bytes_so_far));
|
||||
tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *) &ep->EPDAT_BYTE, tu_min16(available_bytes, xfer->total_bytes - xfer->out_bytes_so_far));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -902,7 +902,7 @@ static void handle_rxflvl_ints(uint8_t rhport, USB_OTG_OUTEndpointTypeDef * out_
|
||||
if (xfer->ff)
|
||||
{
|
||||
// Ring buffer
|
||||
tu_fifo_write_n_const_addr(xfer->ff, (const void *) rx_fifo, bcnt);
|
||||
tu_fifo_write_n_const_addr_full_words(xfer->ff, (const void *) rx_fifo, bcnt);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1008,7 +1008,7 @@ static void handle_epin_ints(uint8_t rhport, USB_OTG_DeviceTypeDef * dev, USB_OT
|
||||
|
||||
// Process every single packet (only whole packets can be written to fifo)
|
||||
for(uint16_t i = 0; i < remaining_packets; i++){
|
||||
uint16_t remaining_bytes = (in_ep[n].DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DIEPTSIZ_XFRSIZ_Pos;
|
||||
volatile uint16_t remaining_bytes = (in_ep[n].DIEPTSIZ & USB_OTG_DIEPTSIZ_XFRSIZ_Msk) >> USB_OTG_DIEPTSIZ_XFRSIZ_Pos;
|
||||
// Packet can not be larger than ep max size
|
||||
uint16_t packet_size = tu_min16(remaining_bytes, xfer->max_size);
|
||||
|
||||
@@ -1022,7 +1022,7 @@ static void handle_epin_ints(uint8_t rhport, USB_OTG_DeviceTypeDef * dev, USB_OT
|
||||
if (xfer->ff)
|
||||
{
|
||||
usb_fifo_t tx_fifo = FIFO_BASE(rhport, n);
|
||||
tu_fifo_read_n_const_addr(xfer->ff, (void *) tx_fifo, packet_size);
|
||||
tu_fifo_read_n_const_addr_full_words(xfer->ff, (void *) tx_fifo, packet_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user