Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ipconfigEMAC_TASK_HOOK macro to STMH7xx network interface #1176

Merged
merged 6 commits into from
Aug 7, 2024

Conversation

kzorer
Copy link
Contributor

@kzorer kzorer commented Aug 5, 2024

Add ipconfigEMAC_TASK_HOOK macro to allow for configurable watchdog timer for STMH7xx MCUs

Description

  • Introduced the ipconfigEMAC_TASK_HOOK macro, which defaults to a no-op but can be overridden in FreeRTOSIPConfig.h.
  • Added ipconfigEMAC_TASK_HOOK() call in the Ethernet status checking code to enable optional watchdog timer functionality.
  • This change allows users to define ipconfigEMAC_TASK_HOOK in FreeRTOSIPConfig.h to enable or disable the watchdog timer, providing greater flexibility in managing Ethernet operations.
  • The macro is safely defined as an empty statement if not previously defined, ensuring backward compatibility.

Test Steps

  • Ensure that FreeRTOSIPConfig.h is properly configured to include or exclude the ipconfigEMAC_TASK_HOOK macro.
  • Deploy the firmware to the target hardware.
  • Test Ethernet link status changes by simulating link up and link down events.
  • Confirm that if ipconfigEMAC_TASK_HOOK is defined, the corresponding watchdog timer functionality is correctly invoked.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kzorer kzorer requested a review from a team as a code owner August 5, 2024 19:06
@kzorer kzorer closed this Aug 5, 2024
@kzorer kzorer reopened this Aug 5, 2024
@@ -87,6 +87,9 @@
#define niEMAC_HANDLER_TASK_PRIORITY configMAX_PRIORITIES - 1
#endif

#ifndef ipconfigEMAC_WATCHDOG_TIMER
Copy link
Member

@aggarg aggarg Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we name it so that it does not seem specific to watchdog? The reason is that someone may want to use it for a different purpose too. How about something like iptraceEMAC_TASK_ITERATION or iptraceEMAC_TASK_HOOK?

aggarg and others added 3 commits August 6, 2024 22:49
@aggarg aggarg changed the title Add ipconfigEMAC_WATCHDOG_TIMER macro to allow for configurable watchdog timer for STMH7xx MCUs Add ipconfigEMAC_TASK_HOOK macro to STMH7xx network interface Aug 6, 2024
@aggarg aggarg merged commit bb11bb9 into FreeRTOS:main Aug 7, 2024
10 checks passed
@htibosch
Copy link
Contributor

The above PR went too fast, I missed.
We already have a macro ipconfigWATCHDOG_TIMER() which could be used for this purpose.

@aggarg
Copy link
Member

aggarg commented Aug 12, 2024

@htibosch If I understand correctly, ipconfigWATCHDOG_TIMER is called from the IP task and thereby enables the application to monitor the IP task. On the other hand, this change enables the application to monitor the EMAC task. Or did I miss something?

@htibosch
Copy link
Contributor

About the other PR 1178, this is how you can obtain the task handle of the EMAC task:

TaskHandle_t xHandle = xTaskGetHandle( niEMAC_HANDLER_TASK_NAME );

It will return the handle of the EMAC handler task. There is no need for a new function FreeRTOS_GetEMACTaskHandle().

The existing application hook ipconfigWATCHDOG_TIMER is supposed to pet a watchdog. In my private projects, I have a watchdog per task. So it would call:

extern void watchdog_timer( TaskHandle_t pxTask );
#define ipconfigWATCHDOG_TIMER() \
    do{ \
          watchdog_timer( xTaskGetCurrentTaskHandle() ); \
    } while( 0 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants