mirror of
https://github.com/esp8266/Arduino.git
synced 2025-10-15 11:26:40 +03:00
update for USB, USB High Speed software, for betatest, need some improvment. USBCV not passed, USB3.0 passed
This commit is contained in:
committed by
Cristian Maglie
parent
656b83b1a7
commit
22c828def0
@@ -34,7 +34,7 @@
|
||||
#define MAX_ENDPOINTS 10
|
||||
#define EP0 0
|
||||
#define EP0_SIZE 64
|
||||
#define EPX_SIZE 1024
|
||||
#define EPX_SIZE 512
|
||||
|
||||
#define EP_SINGLE_64 (0x32UL) // EP0
|
||||
#define EP_DOUBLE_64 (0x36UL) // Other endpoints
|
||||
@@ -116,7 +116,7 @@
|
||||
//! Get maximal number of banks of endpoints
|
||||
#define udd_get_endpoint_bank_max_nbr(ep) ((ep == 0) ? 1 : (( ep <= 2) ? 3 : 2))
|
||||
//! Get maximal size of endpoint (3X, 1024/64)
|
||||
#define udd_get_endpoint_size_max(ep) (((ep) == 0) ? 64 : 1024)
|
||||
#define udd_get_endpoint_size_max(ep) (((ep) == 0) ? 64 : 512) // for bulk
|
||||
//! Get DMA support of endpoints
|
||||
#define Is_udd_endpoint_dma_supported(ep) ((((ep) >= 1) && ((ep) <= 6)) ? true : false)
|
||||
//! Get High Band Width support of endpoints
|
||||
|
@@ -115,7 +115,7 @@ void UDD_Attach(void)
|
||||
|
||||
// Enable USB line events
|
||||
udd_enable_reset_interrupt();
|
||||
udd_enable_sof_interrupt();
|
||||
// udd_enable_sof_interrupt();
|
||||
|
||||
cpu_irq_restore(flags);
|
||||
}
|
||||
@@ -139,6 +139,7 @@ void UDD_InitEP( uint32_t ul_ep_nb, uint32_t ul_ep_cfg )
|
||||
|
||||
if (!Is_udd_endpoint_configured(ul_ep_nb)) {
|
||||
TRACE_UOTGHS_DEVICE(printf("=> UDD_InitEP : ERROR FAILED TO INIT EP %lu\r\n", ul_ep_nb);)
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +157,7 @@ void UDD_InitEndpoints(const uint32_t* eps_table, const uint32_t ul_eps_table_si
|
||||
|
||||
if (!Is_udd_endpoint_configured(ul_ep_nb)) {
|
||||
TRACE_UOTGHS_DEVICE(printf("=> UDD_InitEP : ERROR FAILED TO INIT EP %lu\r\n", ul_ep_nb);)
|
||||
while(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,6 +217,8 @@ uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len)
|
||||
|
||||
TRACE_UOTGHS_DEVICE(printf("=> UDD_Send (1): ep=%lu ul_send_fifo_ptr=%lu len=%lu\r\n", ep, ul_send_fifo_ptr[ep], len);)
|
||||
|
||||
while( UOTGHS_DEVEPTISR_TXINI != (UOTGHS->UOTGHS_DEVEPTISR[ep] & UOTGHS_DEVEPTISR_TXINI )) {}
|
||||
|
||||
if (ep == EP0)
|
||||
{
|
||||
if (ul_send_fifo_ptr[ep] + len > EP0_SIZE)
|
||||
@@ -222,34 +226,26 @@ uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ul_send_fifo_ptr[ep] + len > EPX_SIZE)
|
||||
len = EPX_SIZE - ul_send_fifo_ptr[ep];
|
||||
ul_send_fifo_ptr[ep] = 0;
|
||||
}
|
||||
|
||||
for (i = 0, ptr_dest += ul_send_fifo_ptr[ep]; i < len; ++i)
|
||||
*ptr_dest++ = *ptr_src++;
|
||||
|
||||
ul_send_fifo_ptr[ep] += i;
|
||||
|
||||
|
||||
if (ep == EP0)
|
||||
{
|
||||
TRACE_UOTGHS_DEVICE(printf("=> UDD_Send (2): ep=%lu ptr_dest=%lu maxlen=%d\r\n", ep, ul_send_fifo_ptr[ep], EP0_SIZE);)
|
||||
if (ul_send_fifo_ptr[ep] == EP0_SIZE)
|
||||
{
|
||||
UDD_ClearIN(); // Fifo is full, release this packet
|
||||
UDD_WaitIN(); // Wait for new FIFO buffer to be ready
|
||||
}
|
||||
UDD_ClearIN(); // Fifo is full, release this packet // UOTGHS->UOTGHS_DEVEPTICR[EP0] = UOTGHS_DEVEPTICR_TXINIC;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ul_send_fifo_ptr[ep] == EPX_SIZE)
|
||||
{
|
||||
UDD_ClearIN(); // Fifo is full, release this packet
|
||||
UDD_WaitIN(); // Wait for new FIFO buffer to be ready
|
||||
}
|
||||
UOTGHS->UOTGHS_DEVEPTICR[ep] = UOTGHS_DEVEPTICR_TXINIC;
|
||||
UOTGHS->UOTGHS_DEVEPTIDR[ep] = UOTGHS_DEVEPTIDR_FIFOCONC;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user