From a08dcb2f7c7c883559e10c389404a4dc751376fa Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 9 Dec 2019 13:57:51 +0100 Subject: score: Add Thread_Configuration Add the Thread_Configuration structure to reduce the parameter count of _Thread_Initialize(). This makes it easier to add more parameters in the future. It simplifies the code generation since most architectures do not have that many registers available for function parameters. Update #3835. --- cpukit/include/rtems/score/threadimpl.h | 83 ++++++++++++++++++++++++--------- 1 file changed, 60 insertions(+), 23 deletions(-) (limited to 'cpukit/include/rtems/score/threadimpl.h') diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index 1289a3002f..54f6c8c797 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -124,6 +124,61 @@ void _Thread_Create_idle(void); */ void _Thread_Start_multitasking( void ) RTEMS_NO_RETURN; +/** + * @brief The configuration of a new thread to initialize. + */ +typedef struct { + /** + * @brief The scheduler control instance for the thread. + */ + const struct _Scheduler_Control *scheduler; + + /** + * @brief The starting address of the thread area. + */ + void *stack_area; + + /** + * @brief The size of the thread area in bytes. + */ + size_t stack_size; + + /** + * @brief The new thread's priority. + */ + Priority_Control priority; + + /** + * @brief The thread's budget algorithm. + */ + Thread_CPU_budget_algorithms budget_algorithm; + + /** + * @brief The thread's initial budget callout. + */ + Thread_CPU_budget_algorithm_callout budget_callout; + + /** + * @brief Name of the object for the thread. + */ + Objects_Name name; + + /** + * @brief The thread's initial ISR level. + */ + uint32_t isr_level; + + /** + * @brief Indicates whether the thread needs a floating-point area. + */ + bool is_fp; + + /** + * @brief Indicates whether the new thread is preemptible. + */ + bool is_preemptible; +} Thread_Configuration; + /** * @brief Initializes thread. * @@ -138,34 +193,16 @@ void _Thread_Start_multitasking( void ) RTEMS_NO_RETURN; * guaranteed to be of at least minimum size. * * @param information The thread information. - * @param[out] the_thread The thread to initialize. - * @param scheduler The scheduler control instance for the thread. - * @param stack_area The starting address of the thread area. - * @param stack_size The size of the thread area in bytes. - * @param is_fp Indicates whether the thread needs a floating point area. - * @param priority The new thread's priority. - * @param is_preemptible Indicates whether the new thread is preemptible. - * @param budget_algorithm The thread's budget algorithm. - * @param budget_callout The thread's initial budget callout. - * @param isr_level The thread's initial isr level. - * @param name Name of the object for the thread. + * @param the_thread The thread to initialize. + * @param config The configuration of the thread to initialize. * * @retval true The thread initialization was successful. * @retval false The thread initialization failed. */ bool _Thread_Initialize( - Thread_Information *information, - Thread_Control *the_thread, - const struct _Scheduler_Control *scheduler, - void *stack_area, - size_t stack_size, - bool is_fp, - Priority_Control priority, - bool is_preemptible, - Thread_CPU_budget_algorithms budget_algorithm, - Thread_CPU_budget_algorithm_callout budget_callout, - uint32_t isr_level, - Objects_Name name + Thread_Information *information, + Thread_Control *the_thread, + const Thread_Configuration *config ); /** -- cgit v1.2.3