@@ -289,18 +289,14 @@ USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
289
289
USBD_StatusTypeDef USBD_LL_DataOutStage (USBD_HandleTypeDef * pdev ,
290
290
uint8_t epnum , uint8_t * pdata )
291
291
{
292
- USBD_EndpointTypeDef * pep ;
293
-
294
292
if (epnum == 0U ) {
295
- pep = & pdev -> ep_out [0 ];
296
-
297
293
if (pdev -> ep0_state == USBD_EP0_DATA_OUT ) {
298
- if (pep -> rem_length > USB_MAX_EP0_SIZE ) {
299
- pep -> rem_length -= USB_MAX_EP0_SIZE ;
294
+ if (pdev -> ep0_rem_len > USB_MAX_EP0_SIZE ) {
295
+ pdev -> ep0_rem_len -= USB_MAX_EP0_SIZE ;
300
296
301
297
USBD_CtlContinueRx (pdev ,
302
298
pdata ,
303
- (uint16_t )MIN (pep -> rem_length , USB_MAX_EP0_SIZE ));
299
+ (uint16_t )MIN (pdev -> ep0_rem_len , USB_MAX_EP0_SIZE ));
304
300
} else {
305
301
if ((pdev -> pClass -> EP0_RxReady != NULL ) &&
306
302
(pdev -> dev_state == USBD_STATE_CONFIGURED )) {
@@ -338,24 +334,20 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
338
334
USBD_StatusTypeDef USBD_LL_DataInStage (USBD_HandleTypeDef * pdev , uint8_t epnum ,
339
335
uint8_t * pdata )
340
336
{
341
- USBD_EndpointTypeDef * pep ;
342
-
343
337
if (epnum == 0U ) {
344
- pep = & pdev -> ep_in [0 ];
345
-
346
338
if (pdev -> ep0_state == USBD_EP0_DATA_IN ) {
347
- if (pep -> rem_length > USB_MAX_EP0_SIZE ) {
348
- pep -> rem_length -= USB_MAX_EP0_SIZE ;
339
+ if (pdev -> ep0_rem_len > USB_MAX_EP0_SIZE ) {
340
+ pdev -> ep0_rem_len -= USB_MAX_EP0_SIZE ;
349
341
350
- USBD_CtlContinueSendData (pdev , pdata , (uint16_t )pep -> rem_length );
342
+ USBD_CtlContinueSendData (pdev , pdata , (uint16_t )pdev -> ep0_rem_len );
351
343
352
344
/* Prepare endpoint for premature end of transfer */
353
345
USBD_LL_PrepareReceive (pdev , 0U , NULL , 0U );
354
346
} else {
355
347
/* last packet is MPS multiple, so send ZLP packet */
356
- if ((pep -> total_length % USB_MAX_EP0_SIZE == 0U ) &&
357
- (pep -> total_length >= USB_MAX_EP0_SIZE ) &&
358
- (pep -> total_length < pdev -> ep0_data_len )) {
348
+ if ((pdev -> ep0_total_len % USB_MAX_EP0_SIZE == 0U ) &&
349
+ (pdev -> ep0_total_len >= USB_MAX_EP0_SIZE ) &&
350
+ (pdev -> ep0_total_len < pdev -> ep0_data_len )) {
359
351
USBD_CtlContinueSendData (pdev , NULL , 0U );
360
352
pdev -> ep0_data_len = 0U ;
361
353
0 commit comments