[usb] Default poll timeout of 1ms for GetStatus.

Change-Id: Ic25219d04ea3c5d0a3c84872da2a94aae4342b32
This commit is contained in:
Léa Saviot
2018-03-27 14:38:31 +02:00
parent 18778d37b0
commit ac96eed5dd
2 changed files with 4 additions and 3 deletions

View File

@@ -55,7 +55,7 @@ bool DFUInterface::getStatus(SetupPacket * request, uint8_t * transferBuffer, ui
actionsAfterStatus = true;
}
// Copy the status on the TxFifo
*transferBufferLength = StatusData(m_status, k_pollTimeout, m_state).copy(transferBuffer, transferBufferMaxLength);
*transferBufferLength = StatusData(m_status, m_state).copy(transferBuffer, transferBufferMaxLength);
// Additional actions if needed
if (actionsAfterStatus) {
if (m_largeBufferLength != 0) {

View File

@@ -93,7 +93,9 @@ private:
class StatusData : public Streamable {
public:
StatusData(Status status, uint32_t pollTimeout, State state) :
StatusData(Status status, State state, uint32_t pollTimeout = 1) :
/* We put a default pollTimeout value of 1ms: if the device is busy, the
* host has to wait 1ms before sending a getStatus Request. */
m_bStatus((uint8_t)status),
m_bwPollTimeout{uint8_t((pollTimeout>>16) & 0xFF), uint8_t((pollTimeout>>8) & 0xFF), uint8_t(pollTimeout & 0xFF)},
m_bState((uint8_t)state),
@@ -118,7 +120,6 @@ private:
uint8_t m_bState; // Current state of the device
};
constexpr static uint32_t k_pollTimeout = 1; // TODO: needed? value ?
constexpr static uint8_t k_flashMemorySectorsCount = 12;
constexpr static uint16_t k_maxTransferSize = 2048;