1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-24 08:45:24 +03:00

Re #2595: buffer full check got stuck (volatile was missing)

This commit is contained in:
Damjan Adamic 2015-08-31 10:44:21 +02:00
parent 10e72cc214
commit c47a43e5ce
3 changed files with 10 additions and 10 deletions

View file

@ -104,7 +104,7 @@ void menuStatisticsView(uint8_t event)
#if defined(USB_SERIAL)
extern uint16_t usbWraps;
extern uint16_t charsWritten;
extern "C" uint32_t APP_Rx_ptr_in;
extern "C" volatile uint32_t APP_Rx_ptr_in;
#endif
void menuStatisticsDebug(uint8_t event)

View file

@ -47,10 +47,10 @@ extern "C" {
extern uint8_t APP_Rx_Buffer []; /* Write CDC received data in this buffer.
These data will be sent over USB IN endpoint
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
in the buffer APP_Rx_Buffer. */
extern uint32_t APP_Rx_ptr_out;
extern volatile uint32_t APP_Rx_ptr_out;
/* Private function prototypes -----------------------------------------------*/
static uint16_t VCP_Init (void);
@ -162,13 +162,13 @@ void usbSerialPutc(uint8_t c)
{
if (!cdcConnected) return;
uint32_t APP_Rx_length;
uint32_t txDataLen;
do {
APP_Rx_length = APP_RX_DATA_SIZE + APP_Rx_ptr_in - APP_Rx_ptr_out;
if (APP_Rx_length >= APP_RX_DATA_SIZE) {
APP_Rx_length -= APP_RX_DATA_SIZE;
txDataLen = APP_RX_DATA_SIZE + APP_Rx_ptr_in - APP_Rx_ptr_out;
if (txDataLen >= 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;
++charsWritten;

View file

@ -179,8 +179,8 @@ __ALIGN_BEGIN uint8_t APP_Rx_Buffer [APP_RX_DATA_SIZE] __ALIGN_END ;
#endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
__ALIGN_BEGIN uint8_t CmdBuff[CDC_CMD_PACKET_SZE] __ALIGN_END ;
uint32_t APP_Rx_ptr_in = 0;
uint32_t APP_Rx_ptr_out = 0;
volatile uint32_t APP_Rx_ptr_in = 0;
volatile uint32_t APP_Rx_ptr_out = 0;
uint32_t APP_Rx_length = 0;
uint8_t USB_Tx_State = 0;