summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2023-05-08 20:21:59 +0800
committersakumisu <[email protected]>2023-05-08 20:22:04 +0800
commit0c218441661764107799b732d977384b22c8ca84 (patch)
tree51cc0df36b366c77b98b73639ef81f29d9fe7e2c
parentf446a7e95bb3d1e3544890a39fba4f41066654e9 (diff)
prevent variables being optimised
-rw-r--r--port/dwc2/usb_dc_dwc2.c6
-rw-r--r--port/dwc2/usb_hc_dwc2.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/port/dwc2/usb_dc_dwc2.c b/port/dwc2/usb_dc_dwc2.c
index e7d3feab..f05207c4 100644
--- a/port/dwc2/usb_dc_dwc2.c
+++ b/port/dwc2/usb_dc_dwc2.c
@@ -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));
diff --git a/port/dwc2/usb_hc_dwc2.c b/port/dwc2/usb_hc_dwc2.c
index 1f18771f..7c51eaa7 100644
--- a/port/dwc2/usb_hc_dwc2.c
+++ b/port/dwc2/usb_hc_dwc2.c
@@ -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));