prevent variables being optimised

This commit is contained in:
sakumisu
2023-05-08 20:21:59 +08:00
parent f446a7e95b
commit 0c21844166
2 changed files with 6 additions and 6 deletions

View File

@@ -191,7 +191,7 @@ USB_NOCACHE_RAM_SECTION struct dwc2_udc {
static inline int dwc2_reset(void)
{
uint32_t count = 0U;
volatile uint32_t count = 0U;
/* Wait for AHB master IDLE state. */
do {
@@ -252,7 +252,7 @@ static inline void dwc2_set_mode(uint8_t mode)
static inline int dwc2_flush_rxfifo(void)
{
uint32_t count = 0;
volatile uint32_t count = 0;
USB_OTG_GLB->GRSTCTL = USB_OTG_GRSTCTL_RXFFLSH;
@@ -267,7 +267,7 @@ static inline int dwc2_flush_rxfifo(void)
static inline int dwc2_flush_txfifo(uint32_t num)
{
uint32_t count = 0U;
volatile uint32_t count = 0U;
USB_OTG_GLB->GRSTCTL = (USB_OTG_GRSTCTL_TXFFLSH | (num << 6));

View File

@@ -66,7 +66,7 @@ struct dwc2_hcd {
static inline int dwc2_reset(void)
{
uint32_t count = 0U;
volatile uint32_t count = 0U;
/* Wait for AHB master IDLE state. */
do {
@@ -127,7 +127,7 @@ static inline void dwc2_set_mode(uint8_t mode)
static inline int dwc2_flush_rxfifo(void)
{
uint32_t count = 0;
volatile uint32_t count = 0;
USB_OTG_GLB->GRSTCTL = USB_OTG_GRSTCTL_RXFFLSH;
@@ -142,7 +142,7 @@ static inline int dwc2_flush_rxfifo(void)
static inline int dwc2_flush_txfifo(uint32_t num)
{
uint32_t count = 0U;
volatile uint32_t count = 0U;
USB_OTG_GLB->GRSTCTL = (USB_OTG_GRSTCTL_TXFFLSH | (num << 6));