Skip to content

Commit 8c3c35a

Browse files
author
Alrik Vidstrom
committed
Change MAX_NYET_RETRY to MAX_NOTREADY_RETRY
MAX_NYET_RETRY is an incorrect name, because URB_NOTREADY can have several different causes that are unrelated to each other. Therefore, MAX_NOTREADY_RETRY is a better name. This commit also changes a comment regarding the case where the max retries limit has been reached, to better describe what happens.
1 parent c333aa4 commit 8c3c35a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/targets/TARGET_STM/USBEndpoint_STM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ USB_TYPE USBEndpoint::queueTransfer()
181181
state = USB_TYPE_PROCESSING;
182182
/* one request */
183183
td_current->nextTD = (hcTd *)0;
184-
#if defined(MAX_NYET_RETRY)
184+
#if defined(MAX_NOTREADY_RETRY)
185185
td_current->retry = 0;
186186
#endif
187187
td_current->setup = setup;

src/targets/TARGET_STM/USBHALHost_STM.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum,
9393
if ((type == EP_TYPE_BULK) || (type == EP_TYPE_CTRL)) {
9494
switch (urb_state) {
9595
case URB_DONE:
96-
#if defined(MAX_NYET_RETRY)
96+
#if defined(MAX_NOTREADY_RETRY)
9797
td->retry = 0;
9898
#endif
9999
if (td->size > max_size) {
@@ -110,18 +110,18 @@ void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd, uint8_t chnum,
110110
/* try again */
111111
/* abritary limit , to avoid dead lock if other error than
112112
* slow response is */
113-
#if defined(MAX_NYET_RETRY)
114-
if (td->retry < MAX_NYET_RETRY) {
113+
#if defined(MAX_NOTREADY_RETRY)
114+
if (td->retry < MAX_NOTREADY_RETRY) {
115115
/* increment retry counter */
116116
td->retry++;
117117
#endif
118118
length = td->size <= max_size ? td->size : max_size;
119119
HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir, type, !td->setup, (uint8_t *) td->currBufPtr, length, 0);
120120
HAL_HCD_EnableInt(hhcd, chnum);
121121
return;
122-
#if defined(MAX_NYET_RETRY)
122+
#if defined(MAX_NOTREADY_RETRY)
123123
} else {
124-
//USB_ERR("urb_state != URB_NOTREADY");
124+
// MAX_NOTREADY_RETRY reached, so stop trying to resend and instead wait for a timeout at a higher layer
125125
}
126126
#endif
127127
break;

src/targets/TARGET_STM/USBHALHost_STM.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
#define TOTAL_SIZE (HCCA_SIZE + (MAX_ENDPOINT * ED_SIZE) + (MAX_TD * TD_SIZE))
4040

41-
#define MAX_NYET_RETRY 5
41+
#define MAX_NOTREADY_RETRY 5
4242

4343
/* STM device FS have 11 channels (definition is for 60 channels) */
4444
static volatile uint8_t usb_buf[TOTAL_SIZE];

0 commit comments

Comments
 (0)