From: Tilman Sauerbeck Date: Thu, 4 Jul 2019 04:52:42 +0000 (+0200) Subject: common: Remove unused function USB_VcomReadBlocking(). X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=7976a7d8491b4d9511a14cbb14df29841b45b1c0;p=gps-watch.git common: Remove unused function USB_VcomReadBlocking(). --- diff --git a/src/common/virtual_com.c b/src/common/virtual_com.c index 933b8fd..454e103 100644 --- a/src/common/virtual_com.c +++ b/src/common/virtual_com.c @@ -105,7 +105,6 @@ static uint8_t s_currRecvBuf[DATA_BUFF_SIZE]; volatile static uint32_t s_recvSize = 0; volatile static uint32_t s_sendSize = 0; volatile static uint8_t s_sendComplete = 0; -volatile static uint8_t s_currRecvIndex = 0; static uint32_t s_usbBulkMaxPacketSize = FS_CDC_VCOM_BULK_OUT_PACKET_SIZE; /******************************************************************************* * Prototypes @@ -637,57 +636,6 @@ flush_tx_buffer (void *user_data, void *vbuf, size_t bufsiz, size_t count) return count; } -/* See virtual_com.h for documentation of this function. */ -status_t USB_VcomReadBlocking(usb_device_handle baseAddr, uint8_t *buf, size_t count) -{ - status_t error = kStatus_Success; - size_t bufIndex = 0U, bytesToReceive = 0U; - assert(count != 0U); - - /* Waiting for the USB ready. */ - while ((s_cdcVcom.attach != 1) || (s_cdcVcom.startTransactions != 1)) - { - }; - - do - { - /* If no receive request. */ - if (s_recvSize <= 0) - { - if (kStatus_USB_Success != - USB_DeviceRecvRequest(baseAddr, USB_CDC_VCOM_BULK_OUT_ENDPOINT, s_currRecvBuf, s_usbBulkMaxPacketSize)) - { - return kStatus_Fail; - } - s_currRecvIndex = 0; - } - /* Waiting for data received by virtual com. */ - while (s_recvSize <= 0) - { - }; - - /* When receive request is error. */ - if (0xFFFFFFFFU == s_recvSize) - { - /* Waiting for the USB ready and transfer started. */ - while ((s_cdcVcom.attach != 1) || (s_cdcVcom.startTransactions != 1)) - { - }; - s_recvSize = 0; - } - else - { - bytesToReceive = MIN(count, s_recvSize); - memcpy((void *)&buf[bufIndex], s_currRecvBuf + s_currRecvIndex, bytesToReceive); - count -= bytesToReceive; - s_recvSize -= bytesToReceive; - bufIndex += bytesToReceive; - s_currRecvIndex += bytesToReceive; - } - } while (0U != count); - return error; -} - /* See virtual_com.h for documentation of this function. */ usb_device_handle USB_VcomInit(void) { diff --git a/src/common/virtual_com.h b/src/common/virtual_com.h index 5c15353..1b512ad 100644 --- a/src/common/virtual_com.h +++ b/src/common/virtual_com.h @@ -136,18 +136,6 @@ usb_device_handle USB_VcomInit(void); */ void USB_VcomDeinit(usb_device_handle deviceHandle); -/*! - * @brief USB recive data from host using a blocking method. - * - * This function recives data from host by usb cdc protocol - * @param baseAddr pointer to USB device handle. - * @param buf pointer to the data. - * @param count size of the transfer. - * - * @return A USB error code or kStatus_USB_Success. - */ -status_t USB_VcomReadBlocking(usb_device_handle baseAddr, uint8_t *buf, size_t count); - /*! * @brief USB send data to host using a blocking method. *