[Feature Request] Hook function after xTaskResumeAll in IDLE task

Offen
#349 6 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 3 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
c

Rechercherichtung

The change belongs in prvIdleTask in tasks.c, just after the xTaskResumeAll() call, and it would be gated by a new configUSE_IDLE_RESUMED_HOOK macro whose default lives in the config header. Read how the existing vApplicationIdleHook call is guarded, then check the idle task's behaviour around tickless sleep. Done means the hook is called once per idle pass when the flag is set, and the code builds with the flag off. Expect the maintainers to weigh in on whether this is wanted, since the thread has been idle for years.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement

Is your feature request related to a problem? Please describe.

On ARM Cortex-M SoC (not sure for other systems),
for tickless idle feature, developers can define generally one hook and three functions:

  • vApplicationIdleHook
  • PreSuppressTicksAndSleepProcessing
  • PreSleepProcessing
  • PostSleepProcessing

In PostSleepProcessing, the whole system continues its processing, and some OS APIs are quite likely to be called here. But, at this moment, OS is suspended, only a small portion of
APIs are allowed.

Describe the solution you'd like

Suggest to add a hook after xTaskResumeAll() in prvIdleTask:

https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/bad8f01afd2554d6f673f4ea9ea7adb51cd9da33/tasks.c#L3537

#if ( configUSE_IDLE_RESUMED_HOOK == 1 )
{
    extern void vApplicationIdleResumedHook( void );

    /* Call the user defined function from within the idle task.  This
    allows the application designer to add background functionality
    without the overhead of a separate task.
    */
    vApplicationIdleResumedHook();
}
#endif /* configUSE_IDLE_RESUMED_HOOK */

Describe alternatives you've considered

Use xSemaphoreGiveFromISR in PostSleepProcessing to notify a another task.
This is not convenient.

Vorherrschende Sprache
C
Sterne
4.6k
Forks
1.6k
Ø Merge
2 T. 22 Std.
Gemergte PRs (30 T.)
4

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus FreeRTOS/FreeRTOS-Kernel

Alle Issues in FreeRTOS/FreeRTOS-Kernel

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.