From 3cd166d065894c4afe54a9a5e591b37e2b50f5ce Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Sat, 19 Jul 2025 08:33:48 +0100 Subject: [PATCH] MG_ARCH_CUBE nitpicks --- mongoose.h | 18 +++++++++--------- src/arch_cube.h | 2 +- src/drivers/stm32f.h | 8 ++++---- src/drivers/stm32h.h | 8 ++++---- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mongoose.h b/mongoose.h index a5abc35e..8522ab67 100644 --- a/mongoose.h +++ b/mongoose.h @@ -183,7 +183,7 @@ extern "C" { // use HAL-defined execute-in-ram section #define MG_IRAM __attribute__((section(".RamFunc"))) -#ifndef STM32H5 +#ifndef HAL_ICACHE_MODULE_ENABLED #define HAL_ICACHE_IsEnabled() 0 #define HAL_ICACHE_Enable() (void) 0 #define HAL_ICACHE_Disable() (void) 0 @@ -3494,9 +3494,9 @@ struct mg_tcpip_driver_stm32f_data { #endif #if MG_ARCH == MG_ARCH_CUBE -#define MG_NEIRQ NVIC_EnableIRQ(ETH_IRQn) -#else -#define MG_NEIRQ +#define MG_ENABLE_ETH_IRQ() NVIC_EnableIRQ(ETH_IRQn) +#else +#define MG_ENABLE_ETH_IRQ() #endif #define MG_TCPIP_DRIVER_INIT(mgr) \ @@ -3511,7 +3511,7 @@ struct mg_tcpip_driver_stm32f_data { mif_.driver = &mg_tcpip_driver_stm32f; \ mif_.driver_data = &driver_data_; \ MG_SET_MAC_ADDRESS(mif_.mac); \ - MG_NEIRQ; \ + MG_ENABLE_ETH_IRQ(); \ mg_tcpip_init(mgr, &mif_); \ MG_INFO(("Driver: stm32f, MAC: %M", mg_print_mac, mif_.mac)); \ } while (0) @@ -3560,9 +3560,9 @@ struct mg_tcpip_driver_stm32h_data { #endif #if MG_ENABLE_DRIVER_STM32H && MG_ARCH == MG_ARCH_CUBE -#define MG_NEIRQ NVIC_EnableIRQ(ETH_IRQn) -#else -#define MG_NEIRQ +#define MG_ENABLE_ETH_IRQ() NVIC_EnableIRQ(ETH_IRQn) +#else +#define MG_ENABLE_ETH_IRQ() #endif #define MG_TCPIP_DRIVER_INIT(mgr) \ @@ -3579,7 +3579,7 @@ struct mg_tcpip_driver_stm32h_data { mif_.driver_data = &driver_data_; \ MG_SET_MAC_ADDRESS(mif_.mac); \ mg_tcpip_init(mgr, &mif_); \ - MG_NEIRQ; \ + MG_ENABLE_ETH_IRQ(); \ MG_INFO(("Driver: stm32h, MAC: %M", mg_print_mac, mif_.mac)); \ } while (0) diff --git a/src/arch_cube.h b/src/arch_cube.h index f4cd7592..e7f4a60d 100644 --- a/src/arch_cube.h +++ b/src/arch_cube.h @@ -59,7 +59,7 @@ // use HAL-defined execute-in-ram section #define MG_IRAM __attribute__((section(".RamFunc"))) -#ifndef STM32H5 +#ifndef HAL_ICACHE_MODULE_ENABLED #define HAL_ICACHE_IsEnabled() 0 #define HAL_ICACHE_Enable() (void) 0 #define HAL_ICACHE_Disable() (void) 0 diff --git a/src/drivers/stm32f.h b/src/drivers/stm32f.h index 2695e86c..fa712855 100644 --- a/src/drivers/stm32f.h +++ b/src/drivers/stm32f.h @@ -29,9 +29,9 @@ struct mg_tcpip_driver_stm32f_data { #endif #if MG_ARCH == MG_ARCH_CUBE -#define MG_NEIRQ NVIC_EnableIRQ(ETH_IRQn) -#else -#define MG_NEIRQ +#define MG_ENABLE_ETH_IRQ() NVIC_EnableIRQ(ETH_IRQn) +#else +#define MG_ENABLE_ETH_IRQ() #endif #define MG_TCPIP_DRIVER_INIT(mgr) \ @@ -46,7 +46,7 @@ struct mg_tcpip_driver_stm32f_data { mif_.driver = &mg_tcpip_driver_stm32f; \ mif_.driver_data = &driver_data_; \ MG_SET_MAC_ADDRESS(mif_.mac); \ - MG_NEIRQ; \ + MG_ENABLE_ETH_IRQ(); \ mg_tcpip_init(mgr, &mif_); \ MG_INFO(("Driver: stm32f, MAC: %M", mg_print_mac, mif_.mac)); \ } while (0) diff --git a/src/drivers/stm32h.h b/src/drivers/stm32h.h index aa617c91..05969f68 100644 --- a/src/drivers/stm32h.h +++ b/src/drivers/stm32h.h @@ -41,9 +41,9 @@ struct mg_tcpip_driver_stm32h_data { #endif #if MG_ENABLE_DRIVER_STM32H && MG_ARCH == MG_ARCH_CUBE -#define MG_NEIRQ NVIC_EnableIRQ(ETH_IRQn) -#else -#define MG_NEIRQ +#define MG_ENABLE_ETH_IRQ() NVIC_EnableIRQ(ETH_IRQn) +#else +#define MG_ENABLE_ETH_IRQ() #endif #define MG_TCPIP_DRIVER_INIT(mgr) \ @@ -60,7 +60,7 @@ struct mg_tcpip_driver_stm32h_data { mif_.driver_data = &driver_data_; \ MG_SET_MAC_ADDRESS(mif_.mac); \ mg_tcpip_init(mgr, &mif_); \ - MG_NEIRQ; \ + MG_ENABLE_ETH_IRQ(); \ MG_INFO(("Driver: stm32h, MAC: %M", mg_print_mac, mif_.mac)); \ } while (0)