USB core and CDC fixes
This commit is contained in:
parent
c6c8827492
commit
f9301a6acf
|
@ -451,7 +451,7 @@ uint32 usb_cdcacm_rx(uint8* buf, uint32 len) {
|
|||
|
||||
/* If all bytes have been read, re-enable the RX endpoint, which
|
||||
* was set to NAK when the current batch of bytes was received. */
|
||||
if (n_unread_bytes <= (CDC_SERIAL_BUFFER_SIZE - USB_CDCACM_RX_EPSIZE)) {
|
||||
if (n_unread_bytes == 0) {
|
||||
usb_set_ep_rx_count(USB_CDCACM_RX_ENDP, USB_CDCACM_RX_EPSIZE);
|
||||
usb_set_ep_rx_stat(USB_CDCACM_RX_ENDP, USB_EP_STAT_RX_VALID);
|
||||
}
|
||||
|
@ -567,7 +567,7 @@ static void vcomDataRxCb(void) {
|
|||
|
||||
n_unread_bytes += ep_rx_size;
|
||||
|
||||
if (n_unread_bytes <= (CDC_SERIAL_BUFFER_SIZE - USB_CDCACM_RX_EPSIZE)) {
|
||||
if (n_unread_bytes == 0) {
|
||||
usb_set_ep_rx_count(USB_CDCACM_RX_ENDP, USB_CDCACM_RX_EPSIZE);
|
||||
usb_set_ep_rx_stat(USB_CDCACM_RX_ENDP, USB_EP_STAT_RX_VALID);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
#define USB_StatusIn() Send0LengthData()
|
||||
#define USB_StatusOut() vSetEPRxStatus(EP_RX_VALID)
|
||||
|
||||
#define StatusInfo0 StatusInfo.bw.bb1 /* Reverse bb0 & bb1 */
|
||||
#define StatusInfo1 StatusInfo.bw.bb0
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
u16_u8 StatusInfo;
|
||||
|
@ -857,11 +854,11 @@ u8 Setup0_Process(void)
|
|||
pInformation->USBbmRequestType = *pBuf.b++; /* bmRequestType */
|
||||
pInformation->USBbRequest = *pBuf.b++; /* bRequest */
|
||||
pBuf.w++; /* word not accessed because of 32 bits addressing */
|
||||
pInformation->USBwValue = ByteSwap(*pBuf.w++); /* wValue */
|
||||
pInformation->USBwValue = *pBuf.w++; /* wValue in Little Endian */
|
||||
pBuf.w++; /* word not accessed because of 32 bits addressing */
|
||||
pInformation->USBwIndex = ByteSwap(*pBuf.w++); /* wIndex */
|
||||
pInformation->USBwIndex = *pBuf.w++; /* wIndex in Little Endian */
|
||||
pBuf.w++; /* word not accessed because of 32 bits addressing */
|
||||
pInformation->USBwLength = *pBuf.w; /* wLength */
|
||||
pInformation->USBwLength = *pBuf.w; /* wLength in Little Endian */
|
||||
}
|
||||
|
||||
pInformation->ControlState = SETTING_UP;
|
||||
|
|
|
@ -101,8 +101,9 @@ typedef union
|
|||
u16 w;
|
||||
struct BW
|
||||
{
|
||||
u8 bb1;
|
||||
/* Little Endian */
|
||||
u8 bb0;
|
||||
u8 bb1;
|
||||
}
|
||||
bw;
|
||||
} u16_u8;
|
||||
|
@ -211,6 +212,8 @@ USER_STANDARD_REQUESTS;
|
|||
#define USBwLength USBwLengths.w
|
||||
#define USBwLength0 USBwLengths.bw.bb0
|
||||
#define USBwLength1 USBwLengths.bw.bb1
|
||||
#define StatusInfo0 StatusInfo.bw.bb0
|
||||
#define StatusInfo1 StatusInfo.bw.bb1
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions ------------------------------------------------------- */
|
||||
|
|
Loading…
Reference in New Issue