Changeset 5ae6112 in rtems


Ignore:
Timestamp:
Dec 5, 2019, 2:14:51 PM (6 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
5e589d96
Parents:
1380c822
git-author:
Sebastian Huber <sebastian.huber@…> (12/05/19 14:14:51)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/09/19 07:00:52)
Message:

userext: Simplify configuration

Avoid the use of the workspace and use statically allocated switch
controls for the initial extensions.

Location:
cpukit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/confdefs.h

    r1380c822 r5ae6112  
    21252125    defined(CONFIGURE_STACK_CHECKER_ENABLED) || \
    21262126    (defined(RTEMS_NEWLIB) && !defined(CONFIGURE_DISABLE_NEWLIB_REENTRANCY))
    2127   static const rtems_extensions_table Configuration_Initial_Extensions[] = {
     2127  const User_extensions_Table _User_extensions_Initial_extensions[] = {
    21282128    #if CONFIGURE_RECORD_PER_PROCESSOR_ITEMS > 0 && \
    21292129      defined(CONFIGURE_RECORD_EXTENSIONS_ENABLED)
     
    21442144  };
    21452145
    2146   #define _CONFIGURE_INITIAL_EXTENSION_TABLE Configuration_Initial_Extensions
    2147   #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
    2148     RTEMS_ARRAY_SIZE(Configuration_Initial_Extensions)
     2146  const size_t _User_extensions_Initial_count =
     2147    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions );
     2148
     2149  User_extensions_Switch_control _User_extensions_Initial_switch_controls[
     2150    RTEMS_ARRAY_SIZE( _User_extensions_Initial_extensions )
     2151  ];
    21492152
    21502153  RTEMS_SYSINIT_ITEM(
     
    21532156    RTEMS_SYSINIT_ORDER_MIDDLE
    21542157  );
    2155 #else
    2156   #define _CONFIGURE_INITIAL_EXTENSION_TABLE NULL
    2157   #define _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS 0
    21582158#endif
    21592159
     
    24862486#define _CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
    24872487  _CONFIGURE_MEMORY_FOR_INTERNAL_TASKS
    2488 
    2489 /**
    2490  * This macro reserves the memory required by the statically configured
    2491  * user extensions.
    2492  */
    2493 #define _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS \
    2494   (_CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS == 0 ? 0 : \
    2495     _Configure_From_workspace( \
    2496       _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS \
    2497         * sizeof(User_extensions_Switch_control) \
    2498     ))
    24992488
    25002489/**
     
    25182507     CONFIGURE_MAXIMUM_POSIX_SHMS) + \
    25192508   _CONFIGURE_MEMORY_FOR_POSIX_QUEUED_SIGNALS + \
    2520    _CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
    25212509   _CONFIGURE_MEMORY_FOR_MP + \
    25222510   CONFIGURE_MESSAGE_BUFFER_MEMORY + \
     
    29242912      #endif
    29252913    #endif
    2926     _CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
    2927     _CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
    29282914    #if defined(RTEMS_MULTIPROCESSING)
    29292915      CONFIGURE_MULTIPROCESSING_TABLE,        /* pointer to MP config table */
  • cpukit/include/rtems/config.h

    r1380c822 r5ae6112  
    3030#include <rtems/score/object.h>
    3131#include <rtems/score/isr.h>
     32#include <rtems/score/userextdata.h>
    3233#include <rtems/score/watchdogticks.h>
    3334#include <rtems/rtems/config.h>
     
    207208
    208209  uint32_t                       number_of_initial_extensions;
    209   const rtems_extensions_table  *User_extension_table;
    210210  #if defined(RTEMS_MULTIPROCESSING)
    211211    rtems_multiprocessing_table   *User_multiprocessing_table;
     
    303303
    304304#define rtems_configuration_get_number_of_initial_extensions() \
    305         (Configuration.number_of_initial_extensions)
     305  ((uint32_t) _User_extensions_Initial_count)
    306306
    307307#define rtems_configuration_get_user_extension_table() \
    308         (Configuration.User_extension_table)
     308  (&_User_extensions_Initial_extensions[ 0 ])
    309309
    310310#if defined(RTEMS_MULTIPROCESSING)
  • cpukit/include/rtems/score/userextdata.h

    r1380c822 r5ae6112  
    5454}   User_extensions_Control;
    5555
     56/**
     57 * @brief The count of initial user extensions.
     58 *
     59 * Application provided via <rtems/confdefs.h>.
     60 */
     61extern const size_t _User_extensions_Initial_count;
     62
     63/**
     64 * @brief The table of initial user extensions.
     65 *
     66 * Application provided via <rtems/confdefs.h>.
     67 */
     68extern const User_extensions_Table _User_extensions_Initial_extensions[];
     69
     70/**
     71 * @brief A spare switch control for each initial user extension.
     72 *
     73 * Application provided via <rtems/confdefs.h>.
     74 */
     75extern User_extensions_Switch_control
     76  _User_extensions_Initial_switch_controls[];
     77
    5678/** @} */
    5779
  • cpukit/score/src/userext.c

    r1380c822 r5ae6112  
    2020#endif
    2121
    22 #include <rtems/config.h>
    2322#include <rtems/score/userextimpl.h>
    24 #include <rtems/score/wkspace.h>
    2523
    2624void _User_extensions_Handler_initialization(void)
    2725{
    28   User_extensions_Switch_control *initial_extension_switch_controls;
    2926  const User_extensions_Table    *initial_table;
    30   uint32_t                        n;
    31   uint32_t                        i;
     27  User_extensions_Switch_control *initial_switch_controls;
     28  size_t                          n;
     29  size_t                          i;
    3230
    33   n = rtems_configuration_get_number_of_initial_extensions();
    34 
    35   initial_extension_switch_controls = _Workspace_Allocate_or_fatal_error(
    36     n * sizeof( *initial_extension_switch_controls )
    37   );
    38 
    39   initial_table = rtems_configuration_get_user_extension_table();
     31  initial_table = _User_extensions_Initial_extensions;
     32  initial_switch_controls = _User_extensions_Initial_switch_controls;
     33  n = _User_extensions_Initial_count;
    4034
    4135  for ( i = 0 ; i < n ; ++i ) {
     
    4741      User_extensions_Switch_control *c;
    4842
    49       c = &initial_extension_switch_controls[ i ];
     43      c = &initial_switch_controls[ i ];
    5044      c->thread_switch = callout;
    5145      _Chain_Initialize_node( &c->Node );
  • cpukit/score/src/userextiterate.c

    r1380c822 r5ae6112  
    88
    99/*
    10  * Copyright (c) 2012, 2017 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2012, 2019 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    2525#endif
    2626
    27 #include <rtems/config.h>
    2827#include <rtems/score/userextimpl.h>
    2928
     
    165164  executing = _Thread_Get_executing();
    166165
    167   initial_begin = rtems_configuration_get_user_extension_table();
    168   initial_end =
    169     initial_begin + rtems_configuration_get_number_of_initial_extensions();
     166  initial_begin = _User_extensions_Initial_extensions;
     167  initial_end = initial_begin + _User_extensions_Initial_count;
    170168
    171169  if ( direction == CHAIN_ITERATOR_FORWARD ) {
Note: See TracChangeset for help on using the changeset viewer.