Changeset 9520ec3 in rtems


Ignore:
Timestamp:
Feb 14, 2020, 8:31:44 AM (5 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
a9bc7a5
Parents:
6b0873f
git-author:
Sebastian Huber <sebastian.huber@…> (02/14/20 08:31:44)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/25/20 06:15:18)
Message:

config: Simplify initialization task config

With the removal of the CONFIGURE_HAS_OWN_INIT_TASK_TABLE configuration
option at most one Classic API user initialization task can be
configured.

Provide an RTEMS API configuration table for backward compatibility.

Update #3873.

Location:
cpukit
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • cpukit/Makefile.am

    r6b0873f r9520ec3  
    698698librtemscpu_a_SOURCES += rtems/src/eventsend.c
    699699librtemscpu_a_SOURCES += rtems/src/eventsurrender.c
     700librtemscpu_a_SOURCES += rtems/src/getapiconfig.c
    700701librtemscpu_a_SOURCES += rtems/src/getcurrentprocessor.c
    701702librtemscpu_a_SOURCES += rtems/src/getprocessorcount.c
     
    790791librtemscpu_a_SOURCES += rtems/src/taskgetscheduler.c
    791792librtemscpu_a_SOURCES += rtems/src/taskident.c
     793librtemscpu_a_SOURCES += rtems/src/taskinitdefault.c
    792794librtemscpu_a_SOURCES += rtems/src/taskinitusers.c
    793795librtemscpu_a_SOURCES += rtems/src/taskissuspended.c
  • cpukit/include/rtems/confdefs.h

    r6b0873f r9520ec3  
    103103 *        used remarkably reliably by most applications.
    104104 */
    105 
    106 /**
    107  * This is the Classic API initialization tasks table.
    108  */
    109 extern rtems_initialization_tasks_table Initialization_tasks[];
    110105
    111106/**
     
    13631358#endif
    13641359
    1365 #ifdef CONFIGURE_INIT
    1366   rtems_initialization_tasks_table Initialization_tasks[] = {
    1367     { CONFIGURE_INIT_TASK_NAME,
    1368       CONFIGURE_INIT_TASK_STACK_SIZE,
    1369       CONFIGURE_INIT_TASK_PRIORITY,
    1370       CONFIGURE_INIT_TASK_ATTRIBUTES,
    1371       CONFIGURE_INIT_TASK_ENTRY_POINT,
    1372       CONFIGURE_INIT_TASK_INITIAL_MODES,
    1373       CONFIGURE_INIT_TASK_ARGUMENTS
    1374     }
    1375   };
    1376 #endif
    1377 
    1378 /**
    1379  * This is the name of the Initialization Tasks Table generated.
    1380  */
    1381 #define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
    1382 
    1383 /*
    1384  * This is the size of the Initialization Tasks Table generated.
    1385  */
    1386 #define CONFIGURE_INIT_TASK_TABLE_SIZE \
    1387   RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
    1388 
    13891360#else     /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
    1390 
    1391 /*
    1392  * This is the name of the Initialization Task when none is configured.
    1393  */
    1394 #define CONFIGURE_INIT_TASK_TABLE      NULL
    1395 
    1396 /*
    1397  * This is the size of the Initialization Task when none is configured.
    1398  */
    1399 #define CONFIGURE_INIT_TASK_TABLE_SIZE 0
    14001361
    14011362/*
     
    25812542  #endif
    25822543
    2583   /**
    2584    * This is the Classic API Configuration Table.
    2585    */
    2586   rtems_api_configuration_table Configuration_RTEMS_API = {
    2587     CONFIGURE_INIT_TASK_TABLE_SIZE,
    2588     CONFIGURE_INIT_TASK_TABLE
    2589   };
    2590 
    25912544  #if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
    25922545    POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[
     
    27802733#ifdef CONFIGURE_INIT
    27812734  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
     2735    const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
     2736      CONFIGURE_INIT_TASK_NAME,
     2737      CONFIGURE_INIT_TASK_STACK_SIZE,
     2738      CONFIGURE_INIT_TASK_PRIORITY,
     2739      CONFIGURE_INIT_TASK_ATTRIBUTES,
     2740      CONFIGURE_INIT_TASK_ENTRY_POINT,
     2741      CONFIGURE_INIT_TASK_INITIAL_MODES,
     2742      CONFIGURE_INIT_TASK_ARGUMENTS
     2743    };
     2744
    27822745    RTEMS_SYSINIT_ITEM(
    2783       _RTEMS_tasks_Initialize_user_tasks_body,
     2746      _RTEMS_tasks_Initialize_user_task,
    27842747      RTEMS_SYSINIT_CLASSIC_USER_TASKS,
    27852748      RTEMS_SYSINIT_ORDER_MIDDLE
  • cpukit/include/rtems/config.h

    r6b0873f r9520ec3  
    249249#endif
    250250
    251 #define rtems_configuration_get_rtems_api_configuration() \
    252         (&Configuration_RTEMS_API)
    253 
    254251#ifdef __cplusplus
    255252}
  • cpukit/include/rtems/rtems/config.h

    r6b0873f r9520ec3  
    5656   * Tasks which are configured for this application.
    5757   */
    58   rtems_initialization_tasks_table *User_initialization_tasks_table;
     58  const rtems_initialization_tasks_table *User_initialization_tasks_table;
    5959} rtems_api_configuration_table;
    60 
    61 /**
    62  *  @brief RTEMS API Configuration Table
    63  *
    64  *  This is the RTEMS API Configuration Table expected to be generated
    65  *  by confdefs.h.
    66  */
    67 extern rtems_api_configuration_table Configuration_RTEMS_API;
    6860
    6961/**@}*/
     
    8779uint32_t rtems_configuration_get_maximum_tasks( void );
    8880
     81const rtems_api_configuration_table *
     82rtems_configuration_get_rtems_api_configuration( void );
     83
    8984#ifdef __cplusplus
    9085}
  • cpukit/include/rtems/rtems/tasksdata.h

    r6b0873f r9520ec3  
    5454
    5555/**
    56  *  @brief _RTEMS_tasks_Initialize_user_tasks_body
     56 * @brief Initialization table for the first user task.
    5757 *
    58  *  This routine creates and starts all configured user
    59  *  initialization threads.
    60  *
    61  *  Input parameters: NONE
    62  *
    63  *  Output parameters:  NONE
    64  *
    65  *  RTEMS Task Manager
     58 * This table is used by _RTEMS_tasks_Initialize_user_task() and initialized
     59 * via <rtems/confdefs.h>.
    6660 */
     61extern const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table;
    6762
    68 extern void _RTEMS_tasks_Initialize_user_tasks_body( void );
     63/**
     64 * @brief System initialization handler to create and start the first user
     65 * task.
     66 */
     67extern void _RTEMS_tasks_Initialize_user_task( void );
    6968
    7069/**
  • cpukit/libmisc/monitor/mon-config.c

    r6b0873f r9520ec3  
    3030)
    3131{
    32     rtems_api_configuration_table *r = &Configuration_RTEMS_API;
     32    const rtems_api_configuration_table *r;
     33
     34    r = rtems_configuration_get_rtems_api_configuration();
    3335
    3436    canonical_config->work_space_size = rtems_configuration_get_work_space_size();
  • cpukit/libmisc/monitor/mon-itask.c

    r6b0873f r9520ec3  
    4141)
    4242{
    43     rtems_initialization_tasks_table *itask;
     43    const rtems_api_configuration_table *config;
     44    const rtems_initialization_tasks_table *itask;
    4445    uint32_t   n = rtems_object_id_get_index(*next_id);
    4546
    46     if (n >= Configuration_RTEMS_API.number_of_initialization_tasks)
     47    config = rtems_configuration_get_rtems_api_configuration();
     48    if (n >= config->number_of_initialization_tasks)
    4749        goto failed;
    4850
    4951    _Objects_Allocator_lock();
    5052
    51     itask = Configuration_RTEMS_API.User_initialization_tasks_table + n;
     53    itask = config->User_initialization_tasks_table + n;
    5254
    5355    /*
  • cpukit/rtems/src/taskinitusers.c

    r6b0873f r9520ec3  
    1919#endif
    2020
    21 #include <rtems/config.h>
    22 #include <rtems/rtems/status.h>
    23 #include <rtems/rtems/support.h>
    24 #include <rtems/rtems/modes.h>
     21#include <rtems/rtems/tasksimpl.h>
    2522#include <rtems/score/assert.h>
    26 #include <rtems/score/stack.h>
    27 #include <rtems/rtems/tasksimpl.h>
    28 #include <rtems/score/thread.h>
    29 #include <rtems/score/wkspace.h>
     23#include <rtems/score/threadimpl.h>
     24#include <rtems/score/interr.h>
    3025
    31 /*
    32  *  _RTEMS_tasks_Initialize_user_tasks_body
    33  *
    34  *  This routine creates and starts all configured user
    35  *  initialization threads.
    36  *
    37  *  Input parameters: NONE
    38  *
    39  *  Output parameters:  NONE
    40  */
     26void _RTEMS_tasks_Initialize_user_task( void )
     27{
     28  rtems_id                                id;
     29  rtems_status_code                       return_value;
     30  const rtems_initialization_tasks_table *user_task;
     31  rtems_task_entry                        entry_point;
    4132
    42 void _RTEMS_tasks_Initialize_user_tasks_body( void )
    43 {
    44   uint32_t                          index;
    45   uint32_t                          maximum;
    46   rtems_id                          id;
    47   rtems_status_code                 return_value;
    48   rtems_initialization_tasks_table *user_tasks;
    49   rtems_task_entry                  entry_point;
     33  user_task = &_RTEMS_tasks_User_task_table;
     34  return_value = rtems_task_create(
     35    user_task->name,
     36    user_task->initial_priority,
     37    user_task->stack_size,
     38    user_task->mode_set,
     39    user_task->attribute_set,
     40    &id
     41  );
     42  if ( !rtems_is_status_successful( return_value ) ) {
     43    _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
     44  }
    5045
    51   /*
    52    *  Move information into local variables
    53    */
    54   user_tasks = Configuration_RTEMS_API.User_initialization_tasks_table;
    55   maximum    = Configuration_RTEMS_API.number_of_initialization_tasks;
     46  entry_point = user_task->entry_point;
     47  if ( entry_point == NULL ) {
     48    _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
     49  }
    5650
    57   /*
    58    *  Verify that we have a set of user tasks to iterate
    59    */
    60   if ( !user_tasks )
    61     return;
     51  return_value = rtems_task_start(
     52    id,
     53    entry_point,
     54    user_task->argument
     55  );
     56  _Assert( rtems_is_status_successful( return_value ) );
     57  (void) return_value;
    6258
    63   /*
    64    *  Now iterate over the initialization tasks and create/start them.
    65    */
    66   for ( index=0 ; index < maximum ; index++ ) {
    67     return_value = rtems_task_create(
    68       user_tasks[ index ].name,
    69       user_tasks[ index ].initial_priority,
    70       user_tasks[ index ].stack_size,
    71       user_tasks[ index ].mode_set,
    72       user_tasks[ index ].attribute_set,
    73       &id
    74     );
    75     if ( !rtems_is_status_successful( return_value ) ) {
    76       _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
    77     }
    78 
    79     entry_point = user_tasks[ index ].entry_point;
    80     if ( entry_point == NULL ) {
    81       _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
    82     }
    83 
    84     return_value = rtems_task_start(
    85       id,
    86       entry_point,
    87       user_tasks[ index ].argument
    88     );
    89     _Assert( rtems_is_status_successful( return_value ) );
    90     (void) return_value;
    91 
    92     if ( _Thread_Global_constructor == 0 ) {
    93       _Thread_Global_constructor = id;
    94     }
     59  if ( _Thread_Global_constructor == 0 ) {
     60    _Thread_Global_constructor = id;
    9561  }
    9662}
Note: See TracChangeset for help on using the changeset viewer.