Add sr5ReadDataTimeout for bootloader
This commit is contained in:
parent
51dfe6faea
commit
ce3c18e050
|
@ -152,17 +152,21 @@ void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size) {
|
int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int timeout) {
|
||||||
#if TS_UART_DMA_MODE || defined(__DOXYGEN__)
|
#if TS_UART_DMA_MODE || defined(__DOXYGEN__)
|
||||||
UNUSED(tsChannel);
|
UNUSED(tsChannel);
|
||||||
return (int)chIQReadTimeout(&tsUartDma.fifoRxQueue, (uint8_t * )buffer, (size_t)size, SR5_READ_TIMEOUT);
|
return (int)chIQReadTimeout(&tsUartDma.fifoRxQueue, (uint8_t * )buffer, (size_t)size, timeout);
|
||||||
#else /* TS_UART_DMA_MODE */
|
#else /* TS_UART_DMA_MODE */
|
||||||
if (tsChannel->channel == NULL)
|
if (tsChannel->channel == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, SR5_READ_TIMEOUT);
|
return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, timeout);
|
||||||
#endif /* TS_UART_DMA_MODE */
|
#endif /* TS_UART_DMA_MODE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size) {
|
||||||
|
return sr5ReadDataTimeout(tsChannel, buffer, size, SR5_READ_TIMEOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds size to the beginning of a packet and a crc32 at the end. Then send the packet.
|
* Adds size to the beginning of a packet and a crc32 at the end. Then send the packet.
|
||||||
|
|
|
@ -101,6 +101,7 @@ void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size);
|
||||||
void sr5WriteCrcPacket(ts_channel_s *tsChannel, const uint8_t responseCode, const void *buf, const uint16_t size);
|
void sr5WriteCrcPacket(ts_channel_s *tsChannel, const uint8_t responseCode, const void *buf, const uint16_t size);
|
||||||
void sr5SendResponse(ts_channel_s *tsChannel, ts_response_format_e mode, const uint8_t * buffer, int size);
|
void sr5SendResponse(ts_channel_s *tsChannel, ts_response_format_e mode, const uint8_t * buffer, int size);
|
||||||
int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size);
|
int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size);
|
||||||
|
int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int timeout);
|
||||||
bool sr5IsReady(bool isConsoleRedirect);
|
bool sr5IsReady(bool isConsoleRedirect);
|
||||||
|
|
||||||
#endif /* CONSOLE_TUNERSTUDIO_TUNERSTUDIO_IO_H_ */
|
#endif /* CONSOLE_TUNERSTUDIO_TUNERSTUDIO_IO_H_ */
|
||||||
|
|
Loading…
Reference in New Issue