fix potential race condition in boot-cypress #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR depends on PR #18
IMPORTANT: I have not tested this change,
Note that I have tested similar changes in glasgow firmware, with success (will send a PR for that soon).
Note that this also potentially fixes any errors going unnoticed.
If we set HSNAK when we arm the buffer, the host will complete its status stage as soon as it sends the data stage, and will not wait for
eeprom_write
to finish. TheSTALL_EP0()
call that we execute on line 154, will not have an effect, because the following setup packet will clear it (this is how the FX2 works), so this error would go undetected by the host!Note that this change should still be tested before being merged, because before this change,
the firmware was not sensitive to potential spurious errors returned by eeprom_write.
If
eeprom_write
had a spurious errors problem, then this PR could introduce a regression,so I suggest not merging this PR without testing it first.
Note that
STALL_EP0()
already setsHSNAK
, so it's not necessary to callACK_EP0();
on failure.