12
12
* This software component is licensed by ST under Ultimate Liberty license
13
13
* SLA0044, the "License"; You may not use this file except in compliance with
14
14
* the License. You may obtain a copy of the License at:
15
- * http:// www.st.com/SLA0044
15
+ * www.st.com/SLA0044
16
16
*
17
17
******************************************************************************
18
18
*/
@@ -67,14 +67,14 @@ static int8_t USBD_CDC_Init(void);
67
67
static int8_t USBD_CDC_DeInit (void );
68
68
static int8_t USBD_CDC_Control (uint8_t cmd , uint8_t * pbuf , uint16_t length );
69
69
static 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 );
71
71
72
72
USBD_CDC_ItfTypeDef USBD_CDC_fops = {
73
73
USBD_CDC_Init ,
74
74
USBD_CDC_DeInit ,
75
75
USBD_CDC_Control ,
76
76
USBD_CDC_Receive ,
77
- USBD_CDC_Transferred
77
+ USBD_CDC_TransmitCplt
78
78
};
79
79
80
80
USBD_CDC_LineCodingTypeDef linecoding = {
@@ -100,7 +100,7 @@ static int8_t USBD_CDC_Init(void)
100
100
receivePended = true;
101
101
USBD_CDC_SetRxBuffer (& hUSBD_Device_CDC , CDC_ReceiveQueue_ReserveBlock (& ReceiveQueue ));
102
102
103
- return (USBD_OK );
103
+ return (( int8_t ) USBD_OK );
104
104
}
105
105
106
106
/**
@@ -111,7 +111,7 @@ static int8_t USBD_CDC_Init(void)
111
111
*/
112
112
static int8_t USBD_CDC_DeInit (void )
113
113
{
114
- return (USBD_OK );
114
+ return (( int8_t ) USBD_OK );
115
115
}
116
116
117
117
@@ -201,7 +201,7 @@ static int8_t USBD_CDC_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
201
201
break ;
202
202
}
203
203
204
- return (USBD_OK );
204
+ return (( int8_t ) USBD_OK );
205
205
}
206
206
207
207
/**
@@ -211,7 +211,7 @@ static int8_t USBD_CDC_Control(uint8_t cmd, uint8_t *pbuf, uint16_t length)
211
211
*
212
212
* @note
213
213
* 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
215
215
* before transfer is complete on CDC interface (ie. using DMA controller)
216
216
* it will result in receiving more data while previous ones are still
217
217
* not sent.
@@ -237,16 +237,31 @@ static int8_t USBD_CDC_Receive(uint8_t *Buf, uint32_t *Len)
237
237
if (!CDC_resume_receive ()) {
238
238
USBD_CDC_ClearBuffer (& hUSBD_Device_CDC );
239
239
}
240
- return USBD_OK ;
240
+ return (( int8_t ) USBD_OK ) ;
241
241
}
242
242
243
243
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 )
245
257
{
258
+ UNUSED (Buf );
259
+ UNUSED (Len );
260
+ UNUSED (epnum );
246
261
transmitStart = 0 ;
247
262
CDC_TransmitQueue_CommitRead (& TransmitQueue );
248
263
CDC_continue_transmit ();
249
- return (USBD_OK );
264
+ return (( int8_t ) USBD_OK );
250
265
}
251
266
252
267
void CDC_init (void )
@@ -284,9 +299,9 @@ bool CDC_connected()
284
299
if (transmitTime ) {
285
300
transmitTime = HAL_GetTick () - transmitTime ;
286
301
}
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 ) ;
290
305
}
291
306
292
307
void CDC_continue_transmit (void )
@@ -296,7 +311,7 @@ void CDC_continue_transmit(void)
296
311
USBD_CDC_HandleTypeDef * hcdc = (USBD_CDC_HandleTypeDef * ) hUSBD_Device_CDC .pClassData ;
297
312
/*
298
313
* 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 ),
300
315
* BUT the main thread cannot pass this condition while waiting for a IRQ!
301
316
* This is not possible because TxState is not zero while waiting for data
302
317
* transfer ending! The IRQ thread is uninterrupted, since its priority
0 commit comments