1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

some optimizations, use real rx and tx buffer size instead of max buffer leghts

This commit is contained in:
Alessio Morale 2013-06-05 00:53:50 +02:00
parent ce2bce353f
commit 901db6f828
2 changed files with 4 additions and 3 deletions

View File

@ -218,12 +218,12 @@ static bool PIOS_USB_HID_SendReport(struct pios_usb_hid_dev *usb_hid_dev)
#ifdef PIOS_USB_BOARD_BL_HID_HAS_NO_LENGTH_BYTE
PIOS_USBHOOK_EndpointTx(usb_hid_dev->cfg->data_tx_ep,
usb_hid_dev->tx_packet_buffer,
sizeof(usb_hid_dev->tx_packet_buffer));
bytes_to_tx + 1);
#else
usb_hid_dev->tx_packet_buffer[1] = bytes_to_tx;
PIOS_USBHOOK_EndpointTx(usb_hid_dev->cfg->data_tx_ep,
usb_hid_dev->tx_packet_buffer,
sizeof(usb_hid_dev->tx_packet_buffer));
bytes_to_tx + 2);
#endif
#if defined(PIOS_INCLUDE_FREERTOS)

View File

@ -403,7 +403,8 @@ static uint8_t PIOS_USBHOOK_CLASS_DataIn(void *pdev, uint8_t epnum)
if ((epnum_idx < NELEMENTS(usb_epin_table)) && usb_epin_table[epnum_idx].cb) {
struct usb_ep_entry *ep = &(usb_epin_table[epnum_idx]);
if (!ep->cb(ep->context, epnum_idx, ep->max_len)) {
uint16_t rxcount = USBD_GetRxCount(pdev, epnum);
if (!ep->cb(ep->context, epnum_idx, rxcount)) {
/* NOTE: use real endpoint number including direction bit */
DCD_SetEPStatus(pdev, epnum, USB_OTG_EP_TX_NAK);
}