mirror of
https://github.com/opentx/opentx.git
synced 2025-07-25 17:25:13 +03:00
Re #2595: buffer full check got stuck (volatile was missing)
This commit is contained in:
parent
10e72cc214
commit
c47a43e5ce
3 changed files with 10 additions and 10 deletions
|
@ -104,7 +104,7 @@ void menuStatisticsView(uint8_t event)
|
||||||
#if defined(USB_SERIAL)
|
#if defined(USB_SERIAL)
|
||||||
extern uint16_t usbWraps;
|
extern uint16_t usbWraps;
|
||||||
extern uint16_t charsWritten;
|
extern uint16_t charsWritten;
|
||||||
extern "C" uint32_t APP_Rx_ptr_in;
|
extern "C" volatile uint32_t APP_Rx_ptr_in;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void menuStatisticsDebug(uint8_t event)
|
void menuStatisticsDebug(uint8_t event)
|
||||||
|
|
|
@ -47,10 +47,10 @@ extern "C" {
|
||||||
extern uint8_t APP_Rx_Buffer []; /* Write CDC received data in this buffer.
|
extern uint8_t APP_Rx_Buffer []; /* Write CDC received data in this buffer.
|
||||||
These data will be sent over USB IN endpoint
|
These data will be sent over USB IN endpoint
|
||||||
in the CDC core functions. */
|
in the CDC core functions. */
|
||||||
extern uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to
|
extern volatile uint32_t APP_Rx_ptr_in; /* Increment this pointer or roll it back to
|
||||||
start address when writing received data
|
start address when writing received data
|
||||||
in the buffer APP_Rx_Buffer. */
|
in the buffer APP_Rx_Buffer. */
|
||||||
extern uint32_t APP_Rx_ptr_out;
|
extern volatile uint32_t APP_Rx_ptr_out;
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
static uint16_t VCP_Init (void);
|
static uint16_t VCP_Init (void);
|
||||||
|
@ -162,13 +162,13 @@ void usbSerialPutc(uint8_t c)
|
||||||
{
|
{
|
||||||
if (!cdcConnected) return;
|
if (!cdcConnected) return;
|
||||||
|
|
||||||
uint32_t APP_Rx_length;
|
uint32_t txDataLen;
|
||||||
do {
|
do {
|
||||||
APP_Rx_length = APP_RX_DATA_SIZE + APP_Rx_ptr_in - APP_Rx_ptr_out;
|
txDataLen = APP_RX_DATA_SIZE + APP_Rx_ptr_in - APP_Rx_ptr_out;
|
||||||
if (APP_Rx_length >= APP_RX_DATA_SIZE) {
|
if (txDataLen >= APP_RX_DATA_SIZE) {
|
||||||
APP_Rx_length -= APP_RX_DATA_SIZE;
|
txDataLen -= APP_RX_DATA_SIZE;
|
||||||
}
|
}
|
||||||
} while (APP_Rx_length == APP_RX_DATA_SIZE-1);
|
} while (txDataLen >= (APP_RX_DATA_SIZE - CDC_DATA_MAX_PACKET_SIZE));
|
||||||
|
|
||||||
APP_Rx_Buffer[APP_Rx_ptr_in] = c;
|
APP_Rx_Buffer[APP_Rx_ptr_in] = c;
|
||||||
++charsWritten;
|
++charsWritten;
|
||||||
|
|
|
@ -179,8 +179,8 @@ __ALIGN_BEGIN uint8_t APP_Rx_Buffer [APP_RX_DATA_SIZE] __ALIGN_END ;
|
||||||
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
|
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
|
||||||
__ALIGN_BEGIN uint8_t CmdBuff[CDC_CMD_PACKET_SZE] __ALIGN_END ;
|
__ALIGN_BEGIN uint8_t CmdBuff[CDC_CMD_PACKET_SZE] __ALIGN_END ;
|
||||||
|
|
||||||
uint32_t APP_Rx_ptr_in = 0;
|
volatile uint32_t APP_Rx_ptr_in = 0;
|
||||||
uint32_t APP_Rx_ptr_out = 0;
|
volatile uint32_t APP_Rx_ptr_out = 0;
|
||||||
uint32_t APP_Rx_length = 0;
|
uint32_t APP_Rx_length = 0;
|
||||||
|
|
||||||
uint8_t USB_Tx_State = 0;
|
uint8_t USB_Tx_State = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue