mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
usb cdc: allow use of entire rx buffer
Previously, the code only allowed n-1 bytes of the available space to be used.
This commit is contained in:
parent
86aead52ce
commit
e2bb7140fe
@ -266,7 +266,7 @@ static void PIOS_USB_COM_HID_RxStart(uint32_t usbcom_id, uint16_t rx_bytes_avail
|
|||||||
// If endpoint was stalled and there is now space make it valid
|
// If endpoint was stalled and there is now space make it valid
|
||||||
PIOS_IRQ_Disable();
|
PIOS_IRQ_Disable();
|
||||||
if ((GetEPRxStatus(usb_com_dev->cfg->data_rx_ep) != EP_RX_VALID) &&
|
if ((GetEPRxStatus(usb_com_dev->cfg->data_rx_ep) != EP_RX_VALID) &&
|
||||||
(rx_bytes_avail > PIOS_USB_COM_DATA_LENGTH)) {
|
(rx_bytes_avail >= PIOS_USB_COM_DATA_LENGTH)) {
|
||||||
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
||||||
}
|
}
|
||||||
PIOS_IRQ_Enable();
|
PIOS_IRQ_Enable();
|
||||||
@ -355,7 +355,7 @@ static void PIOS_USB_COM_HID_EP_OUT_Callback(void)
|
|||||||
&headroom,
|
&headroom,
|
||||||
&need_yield);
|
&need_yield);
|
||||||
#endif
|
#endif
|
||||||
if (headroom > PIOS_USB_COM_DATA_LENGTH) {
|
if (headroom >= PIOS_USB_COM_DATA_LENGTH) {
|
||||||
/* We have room for a maximum length message */
|
/* We have room for a maximum length message */
|
||||||
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
||||||
} else {
|
} else {
|
||||||
@ -385,7 +385,7 @@ static void PIOS_USB_COM_CDC_RxStart(uint32_t usbcom_id, uint16_t rx_bytes_avail
|
|||||||
// If endpoint was stalled and there is now space make it valid
|
// If endpoint was stalled and there is now space make it valid
|
||||||
PIOS_IRQ_Disable();
|
PIOS_IRQ_Disable();
|
||||||
if ((GetEPRxStatus(usb_com_dev->cfg->data_rx_ep) != EP_RX_VALID) &&
|
if ((GetEPRxStatus(usb_com_dev->cfg->data_rx_ep) != EP_RX_VALID) &&
|
||||||
(rx_bytes_avail > sizeof(usb_com_dev->rx_packet_buffer))) {
|
(rx_bytes_avail >= sizeof(usb_com_dev->rx_packet_buffer))) {
|
||||||
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
||||||
}
|
}
|
||||||
PIOS_IRQ_Enable();
|
PIOS_IRQ_Enable();
|
||||||
@ -485,7 +485,7 @@ static void PIOS_USB_COM_CDC_DATA_EP_OUT_Callback(void)
|
|||||||
&headroom,
|
&headroom,
|
||||||
&need_yield);
|
&need_yield);
|
||||||
|
|
||||||
if (headroom > sizeof(usb_com_dev->rx_packet_buffer)) {
|
if (headroom >= sizeof(usb_com_dev->rx_packet_buffer)) {
|
||||||
/* We have room for a maximum length message */
|
/* We have room for a maximum length message */
|
||||||
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
SetEPRxStatus(usb_com_dev->cfg->data_rx_ep, EP_RX_VALID);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user