1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-23 00:05:28 +03:00

Potential fix for GCC 13 VCP broken on H7

This commit is contained in:
Pawel Spychalski (DzikuVx) 2024-04-02 11:23:07 +02:00
parent 005194e73a
commit 1e09f0d075
2 changed files with 12 additions and 8 deletions

View file

@ -23,7 +23,10 @@
// Use all available bits for priority and zero bits to sub-priority // Use all available bits for priority and zero bits to sub-priority
#ifdef USE_HAL_DRIVER #ifdef USE_HAL_DRIVER
#define NVIC_PRIORITY_GROUPING NVIC_PRIORITYGROUP_4 #define NVIC_PRIORITY_GROUPING NVIC_PRIORITYGROUP_4
#define NVIC_BUILD_PRIORITY(base,sub) (((((base)<<(4-(7-(NVIC_PRIORITY_GROUPING))))|((sub)&(0x0f>>(7-(NVIC_PRIORITY_GROUPING)))))<<4)&0xf0)
#else #else
#define NVIC_PRIORITY_GROUPING NVIC_PriorityGroup_4 #define NVIC_PRIORITY_GROUPING NVIC_PriorityGroup_4
#endif #endif
#endif #endif

View file

@ -54,6 +54,8 @@
#include "usbd_cdc_interface.h" #include "usbd_cdc_interface.h"
#include "stdbool.h" #include "stdbool.h"
#include "drivers/time.h" #include "drivers/time.h"
#include "drivers/nvic.h"
#include "build/atomic.h"
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/
@ -366,14 +368,13 @@ uint32_t CDC_Receive_BytesAvailable(void)
uint32_t CDC_Send_FreeBytes(void) uint32_t CDC_Send_FreeBytes(void)
{ {
/* uint32_t freeBytes;
return the bytes free in the circular buffer
functionally equivalent to: ATOMIC_BLOCK(NVIC_BUILD_PRIORITY(6, 0)) {
(APP_Rx_ptr_out > APP_Rx_ptr_in ? APP_Rx_ptr_out - APP_Rx_ptr_in : APP_RX_DATA_SIZE - APP_Rx_ptr_in + APP_Rx_ptr_in) freeBytes = ((UserTxBufPtrOut - UserTxBufPtrIn) + (-((int)(UserTxBufPtrOut <= UserTxBufPtrIn)) & APP_TX_DATA_SIZE)) - 1;
but without the impact of the condition check. }
*/
return ((UserTxBufPtrOut - UserTxBufPtrIn) + (-((int)(UserTxBufPtrOut <= UserTxBufPtrIn)) & APP_TX_DATA_SIZE)) - 1; return freeBytes;
} }
/** /**