Revert "Use byte copy.", add barrier after buffer write.
Signed-off-by: MasterPhi <admin@hifiphile.com>
This commit is contained in:
parent
67a6560ec9
commit
30fff56aa4
|
@ -244,9 +244,7 @@ static void dcd_ep_handler(uint8_t ep_ix)
|
||||||
uint8_t *ptr = EP_GET_FIFO_PTR(0,8);
|
uint8_t *ptr = EP_GET_FIFO_PTR(0,8);
|
||||||
if (xfer->buffer)
|
if (xfer->buffer)
|
||||||
{
|
{
|
||||||
//memcpy(xfer->buffer + xfer->queued_len, ptr, count);
|
memcpy(xfer->buffer + xfer->queued_len, ptr, count);
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
xfer->buffer[i + xfer->queued_len] = ptr[i];
|
|
||||||
} else {
|
} else {
|
||||||
tu_fifo_write_n(xfer->fifo, ptr, count);
|
tu_fifo_write_n(xfer->fifo, ptr, count);
|
||||||
}
|
}
|
||||||
|
@ -291,9 +289,7 @@ static void dcd_ep_handler(uint8_t ep_ix)
|
||||||
uint8_t *ptr = EP_GET_FIFO_PTR(ep_ix,8);
|
uint8_t *ptr = EP_GET_FIFO_PTR(ep_ix,8);
|
||||||
if (xfer->buffer)
|
if (xfer->buffer)
|
||||||
{
|
{
|
||||||
//memcpy(xfer->buffer + xfer->queued_len, ptr, count);
|
memcpy(xfer->buffer + xfer->queued_len, ptr, count);
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
xfer->buffer[i + xfer->queued_len] = ptr[i];
|
|
||||||
} else {
|
} else {
|
||||||
tu_fifo_write_n(xfer->fifo, ptr, count);
|
tu_fifo_write_n(xfer->fifo, ptr, count);
|
||||||
}
|
}
|
||||||
|
@ -538,6 +534,8 @@ bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * ep_desc)
|
||||||
static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix)
|
static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix)
|
||||||
{
|
{
|
||||||
uint16_t len = (uint16_t)(xfer->total_len - xfer->queued_len);
|
uint16_t len = (uint16_t)(xfer->total_len - xfer->queued_len);
|
||||||
|
if (len)
|
||||||
|
{
|
||||||
if (len > xfer->max_packet_size)
|
if (len > xfer->max_packet_size)
|
||||||
{
|
{
|
||||||
len = xfer->max_packet_size;
|
len = xfer->max_packet_size;
|
||||||
|
@ -545,19 +543,19 @@ static void dcd_transmit_packet(xfer_ctl_t * xfer, uint8_t ep_ix)
|
||||||
uint8_t *ptr = EP_GET_FIFO_PTR(ep_ix,8);
|
uint8_t *ptr = EP_GET_FIFO_PTR(ep_ix,8);
|
||||||
if(xfer->buffer)
|
if(xfer->buffer)
|
||||||
{
|
{
|
||||||
//memcpy(ptr, xfer->buffer + xfer->queued_len, len);
|
memcpy(ptr, xfer->buffer + xfer->queued_len, len);
|
||||||
for(int i = 0; i < len; i++)
|
|
||||||
ptr[i] = xfer->buffer[i + xfer->queued_len];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tu_fifo_read_n(xfer->fifo, ptr, len);
|
tu_fifo_read_n(xfer->fifo, ptr, len);
|
||||||
}
|
}
|
||||||
|
__DSB();
|
||||||
|
__ISB();
|
||||||
xfer->queued_len = (uint16_t)(xfer->queued_len + len);
|
xfer->queued_len = (uint16_t)(xfer->queued_len + len);
|
||||||
|
}
|
||||||
if (ep_ix == 0U)
|
if (ep_ix == 0U)
|
||||||
{
|
{
|
||||||
// Control endpoint: clear the interrupt flag to send the data
|
// Control endpoint: clear the interrupt flag to send the data
|
||||||
USBHS->USBHS_DEVEPTICR[0] = USBHS_DEVEPTICR_TXINIC;
|
USBHS->USBHS_DEVEPTICR[0] = USBHS_DEVEPTICR_TXINIC;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Other endpoint types: clear the FIFO control flag to send the data
|
// Other endpoint types: clear the FIFO control flag to send the data
|
||||||
USBHS->USBHS_DEVEPTIDR[ep_ix] = USBHS_DEVEPTIDR_FIFOCONC;
|
USBHS->USBHS_DEVEPTIDR[ep_ix] = USBHS_DEVEPTIDR_FIFOCONC;
|
||||||
|
|
Loading…
Reference in New Issue