From 5e1cac1e7c2dd4c86f5b17c116bfa294284a0f09 Mon Sep 17 00:00:00 2001 From: Matthieu A Date: Wed, 21 May 2025 12:10:26 +0200 Subject: [PATCH 1/4] Add possibility to redefine irq handlers at application level --- include/FreeRTOSFATConfigDefaults.h | 6 ++++++ portable/STM32F4xx/ff_sddisk.c | 4 ++++ portable/STM32F7xx/ff_sddisk.c | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/include/FreeRTOSFATConfigDefaults.h b/include/FreeRTOSFATConfigDefaults.h index 8bc4836..797a350 100644 --- a/include/FreeRTOSFATConfigDefaults.h +++ b/include/FreeRTOSFATConfigDefaults.h @@ -521,4 +521,10 @@ #define FF_CreateIOManger FF_CreateIOManager #endif /* ffconfigENABLE_BACKWARD_COMPATIBILITY */ +#ifndef ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER + +/* Set to 0 to remove SD detection interrupt handlers definition */ + #define ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER 1 +#endif + #endif /* ifndef FF_DEFAULTCONFIG_H */ diff --git a/portable/STM32F4xx/ff_sddisk.c b/portable/STM32F4xx/ff_sddisk.c index ac48ee2..0ee5091 100644 --- a/portable/STM32F4xx/ff_sddisk.c +++ b/portable/STM32F4xx/ff_sddisk.c @@ -1153,6 +1153,7 @@ static const char * prvSDCodePrintable( uint32_t ulCode ) #endif /* SDIO_USES_DMA != 0 */ /*-----------------------------------------------------------*/ +#if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; @@ -1163,10 +1164,13 @@ void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } +#endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ +#if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) void EXTI15_10_IRQHandler( void ) { HAL_GPIO_EXTI_IRQHandler( configSD_DETECT_PIN ); /* GPIO PIN H.13 */ } +#endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ diff --git a/portable/STM32F7xx/ff_sddisk.c b/portable/STM32F7xx/ff_sddisk.c index eb2aad3..f84271f 100644 --- a/portable/STM32F7xx/ff_sddisk.c +++ b/portable/STM32F7xx/ff_sddisk.c @@ -1263,6 +1263,7 @@ static const char * prvSDCodePrintable( uint32_t ulCode ) #endif /* SDIO_USES_DMA != 0 */ /*-----------------------------------------------------------*/ +#if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; @@ -1273,10 +1274,13 @@ void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } } +#endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ +#if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) void EXTI15_10_IRQHandler( void ) { HAL_GPIO_EXTI_IRQHandler( configSD_DETECT_PIN ); /* GPIO PIN H.13 */ } +#endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ From 70e52ac0bc9f60ee749865800a0d55daeeb2b09d Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Thu, 22 May 2025 06:26:56 +0000 Subject: [PATCH 2/4] Move the default definition to ff_sddisk.c files Signed-off-by: Gaurav Aggarwal --- include/FreeRTOSFATConfigDefaults.h | 6 ------ portable/STM32F4xx/ff_sddisk.c | 6 ++++++ portable/STM32F7xx/ff_sddisk.c | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/include/FreeRTOSFATConfigDefaults.h b/include/FreeRTOSFATConfigDefaults.h index 797a350..8bc4836 100644 --- a/include/FreeRTOSFATConfigDefaults.h +++ b/include/FreeRTOSFATConfigDefaults.h @@ -521,10 +521,4 @@ #define FF_CreateIOManger FF_CreateIOManager #endif /* ffconfigENABLE_BACKWARD_COMPATIBILITY */ -#ifndef ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER - -/* Set to 0 to remove SD detection interrupt handlers definition */ - #define ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER 1 -#endif - #endif /* ifndef FF_DEFAULTCONFIG_H */ diff --git a/portable/STM32F4xx/ff_sddisk.c b/portable/STM32F4xx/ff_sddisk.c index 0ee5091..82e72ac 100644 --- a/portable/STM32F4xx/ff_sddisk.c +++ b/portable/STM32F4xx/ff_sddisk.c @@ -82,6 +82,12 @@ #define sdARRAY_SIZE( x ) ( int ) ( sizeof( x ) / sizeof( x )[ 0 ] ) #endif +#ifndef ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER + /* Set to 0 to remove SD detection interrupt handlers definition. */ + #define ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER 1 +#endif + + /*-----------------------------------------------------------*/ /* diff --git a/portable/STM32F7xx/ff_sddisk.c b/portable/STM32F7xx/ff_sddisk.c index f84271f..07bd996 100644 --- a/portable/STM32F7xx/ff_sddisk.c +++ b/portable/STM32F7xx/ff_sddisk.c @@ -94,6 +94,12 @@ #define sdARRAY_SIZE( x ) ( int ) ( sizeof( x ) / sizeof( x )[ 0 ] ) #endif +#ifndef ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER + + /* Set to 0 to remove SD detection interrupt handlers definition. */ + #define ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER 1 +#endif + #ifdef STM32F7xx #define SRAM1_MAX_SIZE ( 368U * 1024U ) From 0758704480e66d6a0de9a07fa84114319818fa2a Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Thu, 22 May 2025 06:27:50 +0000 Subject: [PATCH 3/4] Update Ubuntu version for formatting workflow Signed-off-by: Gaurav Aggarwal --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b7f324..92fdd4c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: jobs: # Currently no unit tests formatting: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Check Formatting of Files From ab8b94e4c6fb2f9d0344326fc85fae340443aa55 Mon Sep 17 00:00:00 2001 From: Gaurav Aggarwal Date: Thu, 22 May 2025 06:33:33 +0000 Subject: [PATCH 4/4] Fix formatting check Signed-off-by: Gaurav Aggarwal --- portable/STM32F4xx/ff_sddisk.c | 24 ++++++++++++------------ portable/STM32F7xx/ff_sddisk.c | 25 ++++++++++++------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/portable/STM32F4xx/ff_sddisk.c b/portable/STM32F4xx/ff_sddisk.c index 82e72ac..50083ca 100644 --- a/portable/STM32F4xx/ff_sddisk.c +++ b/portable/STM32F4xx/ff_sddisk.c @@ -1160,23 +1160,23 @@ static const char * prvSDCodePrintable( uint32_t ulCode ) /*-----------------------------------------------------------*/ #if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) -void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) -{ - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - - if( GPIO_Pin == configSD_DETECT_PIN ) + void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) { - vApplicationCardDetectChangeHookFromISR( &xHigherPriorityTaskWoken ); - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + + if( GPIO_Pin == configSD_DETECT_PIN ) + { + vApplicationCardDetectChangeHookFromISR( &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + } } -} #endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ #if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) -void EXTI15_10_IRQHandler( void ) -{ - HAL_GPIO_EXTI_IRQHandler( configSD_DETECT_PIN ); /* GPIO PIN H.13 */ -} + void EXTI15_10_IRQHandler( void ) + { + HAL_GPIO_EXTI_IRQHandler( configSD_DETECT_PIN ); /* GPIO PIN H.13 */ + } #endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ diff --git a/portable/STM32F7xx/ff_sddisk.c b/portable/STM32F7xx/ff_sddisk.c index 07bd996..99d7120 100644 --- a/portable/STM32F7xx/ff_sddisk.c +++ b/portable/STM32F7xx/ff_sddisk.c @@ -95,7 +95,6 @@ #endif #ifndef ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER - /* Set to 0 to remove SD detection interrupt handlers definition. */ #define ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER 1 #endif @@ -1270,23 +1269,23 @@ static const char * prvSDCodePrintable( uint32_t ulCode ) /*-----------------------------------------------------------*/ #if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) -void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) -{ - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - - if( GPIO_Pin == configSD_DETECT_PIN ) + void HAL_GPIO_EXTI_Callback( uint16_t GPIO_Pin ) { - vApplicationCardDetectChangeHookFromISR( &xHigherPriorityTaskWoken ); - portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + + if( GPIO_Pin == configSD_DETECT_PIN ) + { + vApplicationCardDetectChangeHookFromISR( &xHigherPriorityTaskWoken ); + portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); + } } -} #endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/ #if ( ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0 ) -void EXTI15_10_IRQHandler( void ) -{ - HAL_GPIO_EXTI_IRQHandler( configSD_DETECT_PIN ); /* GPIO PIN H.13 */ -} + void EXTI15_10_IRQHandler( void ) + { + HAL_GPIO_EXTI_IRQHandler( configSD_DETECT_PIN ); /* GPIO PIN H.13 */ + } #endif /* ffconfigSDIO_DRIVER_DEFINES_SD_DETECTION_INTERRUPT_HANDLER != 0*/ /*-----------------------------------------------------------*/