New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
STM32 PCD negative numbers issue #6609
Changes from 3 commits
430784b
8f4a5e2
2211a27
b45d423
20f11bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,7 +145,7 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd) | |
|
||
// MBED: added | ||
if(hpcd->State == HAL_PCD_STATE_RESET) | ||
{ | ||
{ | ||
/* Allocate lock resource and initialize it */ | ||
hpcd->Lock = HAL_UNLOCKED; | ||
for (i = 0; i < hpcd->Init.dev_endpoints ; i++) | ||
|
@@ -1300,14 +1300,14 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t | |
{ | ||
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance; | ||
USB_OTG_EPTypeDef *ep; | ||
int32_t len = 0; | ||
uint32_t len; | ||
uint32_t len32b; | ||
uint32_t fifoemptymsk = 0; | ||
|
||
ep = &hpcd->IN_ep[epnum]; | ||
len = ep->xfer_len - ep->xfer_count; | ||
|
||
if (len > ep->maxpacket) | ||
if (((int32_t)len > 0) && (len > ep->maxpacket)) | ||
{ | ||
len = ep->maxpacket; | ||
} | ||
|
@@ -1322,7 +1322,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t | |
/* Write the FIFO */ | ||
len = ep->xfer_len - ep->xfer_count; | ||
|
||
if (len > ep->maxpacket) | ||
if (((int32_t)len > 0) && (len > ep->maxpacket)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep original code |
||
{ | ||
len = ep->maxpacket; | ||
} | ||
|
@@ -1334,7 +1334,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t | |
ep->xfer_count += len; | ||
} | ||
|
||
if(len <= 0) | ||
if ((int32_t)len <= 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. keep original code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jeromecoutant No, I don't think that'll work. Since That is why I added checks for If I make those changes as you suggest, that would change the behavior of the code. Is my understanding/interpretation wrong? |
||
{ | ||
fifoemptymsk = 0x1 << epnum; | ||
atomic_clr_u32(&USBx_DEVICE->DIEPEMPMSK, fifoemptymsk); // MBED: changed | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep original code