1212 * This software component is licensed by ST under Ultimate Liberty license
1313 * SLA0044, the "License"; You may not use this file except in compliance with
1414 * the License. You may obtain a copy of the License at:
15- * http:// www.st.com/SLA0044
15+ * www.st.com/SLA0044
1616 *
1717 ******************************************************************************
1818 */
@@ -67,14 +67,14 @@ static int8_t USBD_CDC_Init(void);
6767static int8_t USBD_CDC_DeInit (void );
6868static int8_t USBD_CDC_Control (uint8_t cmd , uint8_t * pbuf , uint16_t length );
6969static int8_t USBD_CDC_Receive (uint8_t * pbuf , uint32_t * Len );
70- static int8_t USBD_CDC_Transferred ( void );
70+ static int8_t USBD_CDC_TransmitCplt ( uint8_t * pbuf , uint32_t * Len , uint8_t epnum );
7171
7272USBD_CDC_ItfTypeDef USBD_CDC_fops = {
7373 USBD_CDC_Init ,
7474 USBD_CDC_DeInit ,
7575 USBD_CDC_Control ,
7676 USBD_CDC_Receive ,
77- USBD_CDC_Transferred
77+ USBD_CDC_TransmitCplt
7878};
7979
8080USBD_CDC_LineCodingTypeDef linecoding = {
@@ -100,7 +100,7 @@ static int8_t USBD_CDC_Init(void)
100100 receivePended = true;
101101 USBD_CDC_SetRxBuffer (& hUSBD_Device_CDC , CDC_ReceiveQueue_ReserveBlock (& ReceiveQueue ));
102102
103- return (USBD_OK );
103+ return (( int8_t ) USBD_OK );
104104}
105105
106106/**
@@ -111,7 +111,7 @@ static int8_t USBD_CDC_Init(void)
111111 */
112112static int8_t USBD_CDC_DeInit (void )
113113{
114- return (USBD_OK );
114+ return (( int8_t ) USBD_OK );
115115}
116116
117117
@@ -201,7 +201,7 @@ static int8_t USBD_CDC_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
201201 break ;
202202 }
203203
204- return (USBD_OK );
204+ return (( int8_t ) USBD_OK );
205205}
206206
207207/**
@@ -211,7 +211,7 @@ static int8_t USBD_CDC_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
211211 *
212212 * @note
213213 * This function will issue a NAK packet on any OUT packet received on
214- * USB endpoint untill exiting this function. If you exit this function
214+ * USB endpoint until exiting this function. If you exit this function
215215 * before transfer is complete on CDC interface (ie. using DMA controller)
216216 * it will result in receiving more data while previous ones are still
217217 * not sent.
@@ -237,16 +237,31 @@ static int8_t USBD_CDC_Receive(uint8_t *Buf, uint32_t *Len)
237237 if (!CDC_resume_receive ()) {
238238 USBD_CDC_ClearBuffer (& hUSBD_Device_CDC );
239239 }
240- return USBD_OK ;
240+ return (( int8_t ) USBD_OK ) ;
241241}
242242
243243
244- static int8_t USBD_CDC_Transferred (void )
244+ /**
245+ * @brief USBD_CDC_TransmitCplt
246+ * Data transmited callback
247+ *
248+ * @note
249+ * This function is IN transfer complete callback used to inform user that
250+ * the submitted Data is successfully sent over USB.
251+ *
252+ * @param Buf: Buffer of data to be received
253+ * @param Len: Number of data received (in bytes)
254+ * @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL
255+ */
256+ static int8_t USBD_CDC_TransmitCplt (uint8_t * Buf , uint32_t * Len , uint8_t epnum )
245257{
258+ UNUSED (Buf );
259+ UNUSED (Len );
260+ UNUSED (epnum );
246261 transmitStart = 0 ;
247262 CDC_TransmitQueue_CommitRead (& TransmitQueue );
248263 CDC_continue_transmit ();
249- return (USBD_OK );
264+ return (( int8_t ) USBD_OK );
250265}
251266
252267void CDC_init (void )
@@ -284,9 +299,9 @@ bool CDC_connected()
284299 if (transmitTime ) {
285300 transmitTime = HAL_GetTick () - transmitTime ;
286301 }
287- return hUSBD_Device_CDC .dev_state == USBD_STATE_CONFIGURED
288- && transmitTime < USB_CDC_TRANSMIT_TIMEOUT
289- && lineState ;
302+ return (( hUSBD_Device_CDC .dev_state == USBD_STATE_CONFIGURED )
303+ && ( transmitTime < USB_CDC_TRANSMIT_TIMEOUT )
304+ && lineState ) ;
290305}
291306
292307void CDC_continue_transmit (void )
@@ -296,7 +311,7 @@ void CDC_continue_transmit(void)
296311 USBD_CDC_HandleTypeDef * hcdc = (USBD_CDC_HandleTypeDef * ) hUSBD_Device_CDC .pClassData ;
297312 /*
298313 * TS: This method can be called both in the main thread
299- * (via USBSerial::write) and in the IRQ stream (via USBD_CDC_Transferred ),
314+ * (via USBSerial::write) and in the IRQ stream (via USBD_CDC_TransmistCplt ),
300315 * BUT the main thread cannot pass this condition while waiting for a IRQ!
301316 * This is not possible because TxState is not zero while waiting for data
302317 * transfer ending! The IRQ thread is uninterrupted, since its priority
0 commit comments