Skip to content

Commit

Permalink
Merge branch 'feature/freertos_enable_port_optimized_task_selection_o…
Browse files Browse the repository at this point in the history
…n_riscv_targets' into 'master'

freertos: Enable configUSE_PORT_OPTIMISED_TASK_SELECTION for RISC-V targets

See merge request espressif/esp-idf!20652
  • Loading branch information
sudeep-mohanty committed Oct 19, 2022
2 parents ba663ac + 7007098 commit 7a58ffa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@

// ------------------ Scheduler Related --------------------

#ifdef CONFIG_FREERTOS_OPTIMIZED_SCHEDULER
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#else
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#endif
#define configMAX_API_CALL_INTERRUPT_PRIORITY 0

/* ------------------------------------------------ ESP-IDF Additions --------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,19 @@ FORCE_INLINE_ATTR BaseType_t xPortGetCoreID(void)
#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0)
#endif

// -------------- Optimized Task Selection -----------------

#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1
/* Check the configuration. */
#if( configMAX_PRIORITIES > 32 )
#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 different priorities as tasks that share a priority will time slice.
#endif

/* Store/clear the ready priorities in a bit map. */
#define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )
#define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - __builtin_clz( ( uxReadyPriorities ) ) )
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */


/* --------------------------------------------- Inline Implementations ------------------------------------------------
Expand Down
5 changes: 2 additions & 3 deletions components/freertos/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ menu "FreeRTOS"
details).

config FREERTOS_OPTIMIZED_SCHEDULER
# Todo: Not available in SMP FREERTOS (IDF-4986)
# Todo: Rename to CONFIG_FREERTOS_USE_PORT_OPTIMISED_TASK_SELECTION (IDF-4986)
# Todo: Not available in SMP FREERTOS (IDF-3733)
bool "configUSE_PORT_OPTIMISED_TASK_SELECTION"
depends on FREERTOS_UNICORE
default y
help
Enables port specific task selection method. This option can will speed up the search of ready tasks
Enables port specific task selection method. This option can speed up the search of ready tasks
when scheduling (see configUSE_PORT_OPTIMISED_TASK_SELECTION documentation for more details).

choice FREERTOS_CHECK_STACKOVERFLOW
Expand Down

0 comments on commit 7a58ffa

Please sign in to comment.