From 6a0e806d34e9911f6c959466faed2cea89bd4990 Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Sat, 4 May 2024 18:04:29 +0200
Subject: [PATCH] Added conditinal definitions to be compatible with simulation

---
 f4/include/stm32f4xx_hal_pcd.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/f4/include/stm32f4xx_hal_pcd.h b/f4/include/stm32f4xx_hal_pcd.h
index 5fdc7a3..4aafc75 100644
--- a/f4/include/stm32f4xx_hal_pcd.h
+++ b/f4/include/stm32f4xx_hal_pcd.h
@@ -203,8 +203,10 @@ typedef struct
 #define __HAL_PCD_UNGATE_PHYCLOCK(__HANDLE__) \
   *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) &= ~(USB_OTG_PCGCCTL_STOPCLK)
 
-#define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) \
-  *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK
+#ifndef __HAL_PCD_GATE_PHYCLOCK
+  #define __HAL_PCD_GATE_PHYCLOCK(__HANDLE__) \
+    *(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE) |= USB_OTG_PCGCCTL_STOPCLK
+#endif
 
 #define __HAL_PCD_IS_PHY_SUSPENDED(__HANDLE__) \
   ((*(__IO uint32_t *)((uint32_t)((__HANDLE__)->Instance) + USB_OTG_PCGCCTL_BASE)) & 0x10U)
-- 
GitLab