Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit894c506

Browse files
committed
[USBD] Update after middleware update to 2.6.0
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent0aa8cc0 commit894c506

File tree

12 files changed

+910
-781
lines changed

12 files changed

+910
-781
lines changed

‎cores/arduino/stm32/usb/cdc/usbd_cdc.c

Lines changed: 356 additions & 391 deletions
Large diffs are not rendered by default.

‎cores/arduino/stm32/usb/cdc/usbd_cdc.h

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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
*/
@@ -95,8 +95,7 @@ typedef struct _USBD_CDC_Itf {
9595
int8_t (*DeInit)(void);
9696
int8_t (*Control)(uint8_tcmd,uint8_t*pbuf,uint16_tlength);
9797
int8_t (*Receive)(uint8_t*Buf,uint32_t*Len);
98-
int8_t (*Transferred)(void);
99-
98+
int8_t (*TransmitCplt)(uint8_t*Buf,uint32_t*Len,uint8_tepnum);
10099
}USBD_CDC_ItfTypeDef;
101100

102101

@@ -111,8 +110,7 @@ typedef struct {
111110

112111
__IOuint32_tTxState;
113112
__IOuint32_tRxState;
114-
}
115-
USBD_CDC_HandleTypeDef;
113+
}USBD_CDC_HandleTypeDef;
116114

117115

118116

@@ -140,17 +138,12 @@ extern USBD_ClassTypeDef USBD_CDC;
140138
uint8_tUSBD_CDC_RegisterInterface(USBD_HandleTypeDef*pdev,
141139
USBD_CDC_ItfTypeDef*fops);
142140

143-
uint8_tUSBD_CDC_SetTxBuffer(USBD_HandleTypeDef*pdev,
144-
uint8_t*pbuff,
145-
uint16_tlength);
146-
147-
uint8_tUSBD_CDC_SetRxBuffer(USBD_HandleTypeDef*pdev,
148-
uint8_t*pbuff);
141+
uint8_tUSBD_CDC_SetTxBuffer(USBD_HandleTypeDef*pdev,uint8_t*pbuff,
142+
uint32_tlength);
149143

144+
uint8_tUSBD_CDC_SetRxBuffer(USBD_HandleTypeDef*pdev,uint8_t*pbuff);
150145
uint8_tUSBD_CDC_ReceivePacket(USBD_HandleTypeDef*pdev);
151-
152146
uint8_tUSBD_CDC_ClearBuffer(USBD_HandleTypeDef*pdev);
153-
154147
uint8_tUSBD_CDC_TransmitPacket(USBD_HandleTypeDef*pdev);
155148
/**
156149
* @}

‎cores/arduino/stm32/usb/cdc/usbd_cdc_if.c

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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);
6767
staticint8_tUSBD_CDC_DeInit(void);
6868
staticint8_tUSBD_CDC_Control(uint8_tcmd,uint8_t*pbuf,uint16_tlength);
6969
staticint8_tUSBD_CDC_Receive(uint8_t*pbuf,uint32_t*Len);
70-
staticint8_tUSBD_CDC_Transferred(void);
70+
staticint8_tUSBD_CDC_TransmitCplt(uint8_t*pbuf,uint32_t*Len,uint8_tepnum);
7171

7272
USBD_CDC_ItfTypeDefUSBD_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

8080
USBD_CDC_LineCodingTypeDeflinecoding= {
@@ -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
*/
112112
staticint8_tUSBD_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 endpointuntill exiting this function. If you exit this function
214+
* USB endpointuntil 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-
returnUSBD_OK;
240+
return((int8_t)USBD_OK);
241241
}
242242

243243

244-
staticint8_tUSBD_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+
staticint8_tUSBD_CDC_TransmitCplt(uint8_t*Buf,uint32_t*Len,uint8_tepnum)
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

252267
voidCDC_init(void)
@@ -284,9 +299,9 @@ bool CDC_connected()
284299
if (transmitTime) {
285300
transmitTime=HAL_GetTick()-transmitTime;
286301
}
287-
returnhUSBD_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

292307
voidCDC_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 (viaUSBD_CDC_Transferred),
314+
* (via USBSerial::write) and in the IRQ stream (viaUSBD_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

‎cores/arduino/stm32/usb/cdc/usbd_cdc_if.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
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
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp