[RTEMS Project] #3959: Add rtems_task_create_from_config() (was: Add rtems_task_build())

RTEMS trac trac at rtems.org
Thu Sep 3 04:33:57 UTC 2020


#3959: Add rtems_task_create_from_config()
-----------------------------+------------------------------
 Reporter:  Sebastian Huber  |       Owner:  Sebastian Huber
     Type:  enhancement      |      Status:  assigned
 Priority:  normal           |   Milestone:  6.1
Component:  rtems            |     Version:  6
 Severity:  normal           |  Resolution:
 Keywords:                   |  Blocked By:
 Blocking:                   |
-----------------------------+------------------------------
Description changed by Sebastian Huber:

Old description:

> In RTEMS 5 a lot of development was done to allow a static allocation of
> resources provided by RTEMS and avoid the use of a heap. One missing
> piece is the support for statically allocated RTEMS tasks. The
> rtems_task_create() function allocates the task stack from a heap. We
> need an alternative function which allocates an RTEMS tasks with a user
> provided stack (similar to the POSIX threads). Proposed API:
> {{{
> /**
>  * @brief The task configuration to build a task.
>  */
> typedef struct {
>   /**
>    * @brief The name of the task.
>    */
>   rtems_name name;
>
>   /**
>    * @brief The initial priority of the task.
>    */
>   rtems_task_priority initial_priority;
>
>   /**
>    * @brief The task stack area begin address for the task.
>    */
>   void *stack_area;
>
>   /**
>    * @brief The task stack area size in bytes for the task.
>    */
>   size_t stack_size;
>
>   /**
>    * @brief The function to free the task stack area if the task gets
> deleted.
>    */
>   void ( *stack_free )( void * );
>
>   /**
>    * @brief The initial modes of the task.
>    */
>   rtems_mode initial_modes;
>
>   /**
>    * @brief The attribute set of the task.
>    */
>   rtems_attribute attribute_set;
> } rtems_task_config;
>
> /**
>  * @brief Builds a task according to the specified configuration.
>  *
>  * @param config The task configuration.
>  * @param[out] id The task identifier of the new task.
>  *
>  * @retval RTEMS_SUCCESSFUL Successful operation.
>  * @retval RTEMS_INVALID_ADDRESS The id parameter is @c NULL.
>  * @retval RTEMS_INVALID_NAME The task name is invalid.
>  * @retval RTEMS_INVALID_PRIORITY The initial priority of the task is
> invalid.
>  * @retval RTEMS_TOO_MANY No task is available.
>  * @retval RTEMS_UNSATISFIED A task create extension failed.
>  */
> rtems_status_code rtems_task_build(
>   const rtems_task_config *config,
>   rtems_id                *id
> );
> }}}

New description:

 In RTEMS 5 a lot of development was done to allow a static allocation of
 resources provided by RTEMS and avoid the use of a heap. One missing piece
 is the support for statically allocated RTEMS tasks. The
 rtems_task_create() function allocates the task stack from a heap. We need
 an alternative function which allocates an RTEMS tasks with a user
 provided stack (similar to the POSIX threads). Proposed API:
 {{{
 /**
  * @brief The task configuration to build a task.
  */
 typedef struct {
   /**
    * @brief The name of the task.
    */
   rtems_name name;

   /**
    * @brief The initial priority of the task.
    */
   rtems_task_priority initial_priority;

   /**
    * @brief The task stack area begin address for the task.
    */
   void *stack_area;

   /**
    * @brief The task stack area size in bytes for the task.
    */
   size_t stack_size;

   /**
    * @brief The function to free the task stack area if the task gets
 deleted.
    */
   void ( *stack_free )( void * );

   /**
    * @brief The initial modes of the task.
    */
   rtems_mode initial_modes;

   /**
    * @brief The attribute set of the task.
    */
   rtems_attribute attribute_set;
 } rtems_task_config;

 /**
  * @brief Builds a task according to the specified configuration.
  *
  * @param config The task configuration.
  * @param[out] id The task identifier of the new task.
  *
  * @retval RTEMS_SUCCESSFUL Successful operation.
  * @retval RTEMS_INVALID_ADDRESS The id parameter is @c NULL.
  * @retval RTEMS_INVALID_NAME The task name is invalid.
  * @retval RTEMS_INVALID_PRIORITY The initial priority of the task is
 invalid.
  * @retval RTEMS_TOO_MANY No task is available.
  * @retval RTEMS_UNSATISFIED A task create extension failed.
  */
 rtems_status_code rtems_task_create_from_config(
   const rtems_task_config *config,
   rtems_id                *id
 );
 }}}

--

--
Ticket URL: <http://devel.rtems.org/ticket/3959#comment:7>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list