Changeset 263f4bec in rtems


Ignore:
Timestamp:
Apr 7, 2014, 12:50:37 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
4bc8d2e
Parents:
3a4d28a
git-author:
Sebastian Huber <sebastian.huber@…> (04/07/14 12:50:37)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/10/14 10:37:40)
Message:

score: Statically initialize IO manager

This simplifies the RTEMS initialization and helps to avoid a memory
overhead. The workspace demands of the IO manager were not included in
the <rtems/confdefs.h> workspace size estimate. This is also fixed as a
side-effect.

Update documentation and move "Specifying Application Defined Device
Driver Table" to the section end. This sub-section is not that
important for the user. Mentioning this at the beginning may lead to
confusion.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libmisc/monitor/mon-driver.c

    r3a4d28a r263f4bec  
    6464)
    6565{
    66     const rtems_configuration_table *c = &Configuration;
    6766    uint32_t   n = rtems_object_id_get_index(*next_id);
    6867
    69     if (n >= c->number_of_device_drivers)
     68    if (n >= _IO_Number_of_drivers)
    7069        goto failed;
    7170
     
    8079
    8180    *next_id += 1;
    82     return (const void *) (c->Device_driver_table + n);
     81    return (const void *) (&_IO_Driver_address_table[n]);
    8382
    8483failed:
  • cpukit/sapi/include/confdefs.h

    r3a4d28a r263f4bec  
    7171
    7272extern rtems_initialization_tasks_table Initialization_tasks[];
    73 extern rtems_driver_address_table       Device_drivers[];
    7473#if defined(RTEMS_MULTIPROCESSING)
    7574  extern rtems_multiprocessing_table      Multiprocessing_configuration;
     
    12031202#ifndef CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
    12041203
     1204/**
     1205 * This specifies the maximum number of device drivers that
     1206 * can be installed in the system at one time.  It must account
     1207 * for both the statically and dynamically installed drivers.
     1208 */
     1209#ifndef CONFIGURE_MAXIMUM_DRIVERS
     1210  #define CONFIGURE_MAXIMUM_DRIVERS
     1211#endif
     1212
    12051213#ifdef CONFIGURE_INIT
    1206   rtems_driver_address_table Device_drivers[] = {
     1214  rtems_driver_address_table
     1215    _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
    12071216    #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
    12081217      CONFIGURE_BSP_PREREQUISITE_DRIVERS,
     
    12551264    #endif
    12561265  };
     1266
     1267  const size_t _IO_Number_of_drivers =
     1268    RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
    12571269#endif
    12581270
    12591271#endif  /* CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE */
    1260 
    1261 /*
    1262  *  Default the number of drivers per node.  This value may be
    1263  *  overridden by the user.
    1264  */
    1265 
    1266 #define CONFIGURE_NUMBER_OF_DRIVERS \
    1267   RTEMS_ARRAY_SIZE(Device_drivers)
    1268 
    1269 /**
    1270  * This specifies the maximum number of device drivers that
    1271  * can be installed in the system at one time.  It must account
    1272  * for both the statically and dynamically installed drivers.
    1273  */
    1274 #ifndef CONFIGURE_MAXIMUM_DRIVERS
    1275   #define CONFIGURE_MAXIMUM_DRIVERS CONFIGURE_NUMBER_OF_DRIVERS
    1276 #endif
    1277 
    12781272
    12791273#ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
     
    24762470      #endif
    24772471    #endif
    2478     CONFIGURE_MAXIMUM_DRIVERS,                /* maximum device drivers */
    2479     CONFIGURE_NUMBER_OF_DRIVERS,              /* static device drivers */
    2480     Device_drivers,                           /* pointer to driver table */
    24812472    CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS,   /* number of static extensions */
    24822473    CONFIGURE_INITIAL_EXTENSION_TABLE,        /* pointer to static extensions */
  • cpukit/sapi/include/rtems/config.h

    r3a4d28a r263f4bec  
    5858
    5959#include <rtems/extension.h>
    60 #include <rtems/io.h>
    6160#if defined(RTEMS_MULTIPROCESSING)
    6261#include <rtems/score/mpci.h>
     
    243242  #endif
    244243
    245   uint32_t                       maximum_drivers;
    246   uint32_t                       number_of_device_drivers;
    247   rtems_driver_address_table    *Device_driver_table;
    248244  uint32_t                       number_of_initial_extensions;
    249245  const rtems_extensions_table  *User_extension_table;
     
    336332   (Configuration.do_zero_of_workspace)
    337333
    338 #define rtems_configuration_get_maximum_drivers() \
    339         (Configuration.maximum_drivers)
    340 
    341 #define rtems_configuration_get_number_of_device_drivers() \
    342         (Configuration.number_of_device_drivers)
    343 
    344 #define rtems_configuration_get_device_driver_table() \
    345         (Configuration.Device_driver_table)
    346 
    347334#define rtems_configuration_get_number_of_initial_extensions() \
    348335        (Configuration.number_of_initial_extensions)
  • cpukit/sapi/include/rtems/io.h

    r3a4d28a r263f4bec  
    251251) RTEMS_COMPILER_DEPRECATED_ATTRIBUTE;
    252252
    253 SAPI_IO_EXTERN uint32_t _IO_Number_of_drivers;
    254 
    255 SAPI_IO_EXTERN rtems_driver_address_table *_IO_Driver_address_table;
    256 
    257 /**
    258  * @brief Initialization of device drivers.
    259  *
    260  * NOTE: The IO manager has been extended to support runtime driver
    261  * registration. The driver table is now allocated in the
    262  * workspace.
    263  */
    264 void _IO_Manager_initialization( void );
     253extern const size_t _IO_Number_of_drivers;
     254
     255extern rtems_driver_address_table _IO_Driver_address_table[];
    265256
    266257/**
  • cpukit/sapi/src/exinit.c

    r3a4d28a r263f4bec  
    3333#include <rtems/extensionimpl.h>
    3434#include <rtems/init.h>
    35 #include <rtems/io.h>
    3635#include <rtems/score/sysstate.h>
    3736
     
    143142  _Extension_Manager_initialization();
    144143
    145   _IO_Manager_initialization();
    146 
    147144  _POSIX_API_Initialize();
    148145
  • cpukit/sapi/src/io.c

    r3a4d28a r263f4bec  
    2020#endif
    2121
    22 #include <rtems/system.h>
    23 #include <rtems/config.h>
    2422#include <rtems/io.h>
    25 #include <rtems/score/isr.h>
    26 #include <rtems/score/thread.h>
    27 #include <rtems/score/wkspace.h>
    28 
    29 #include <string.h>
    30 
    31 void _IO_Manager_initialization(void)
    32 {
    33   uint32_t                    index;
    34   rtems_driver_address_table *driver_table;
    35   uint32_t                    drivers_in_table;
    36   uint32_t                    number_of_drivers;
    37 
    38   driver_table      = rtems_configuration_get_device_driver_table();
    39   drivers_in_table  = rtems_configuration_get_number_of_device_drivers();
    40   number_of_drivers = rtems_configuration_get_maximum_drivers();
    41 
    42   /*
    43    *  If the user claims there are less drivers than are actually in
    44    *  the table, then let's just go with the table's count.
    45    */
    46   if ( number_of_drivers <= drivers_in_table )
    47     number_of_drivers = drivers_in_table;
    48 
    49   /*
    50    *  If the maximum number of driver is the same as the number in the
    51    *  table, then we do not have to copy the driver table.  They can't
    52    *  register any dynamically.
    53    */
    54   if ( number_of_drivers == drivers_in_table ) {
    55     _IO_Driver_address_table = driver_table;
    56     _IO_Number_of_drivers = number_of_drivers;
    57     return;
    58   }
    59 
    60   /*
    61    *  The application requested extra slots in the driver table, so we
    62    *  have to allocate a new driver table and copy theirs to it.
    63    */
    64 
    65   _IO_Driver_address_table = (rtems_driver_address_table *)
    66       _Workspace_Allocate_or_fatal_error(
    67         sizeof( rtems_driver_address_table ) * ( number_of_drivers )
    68       );
    69   _IO_Number_of_drivers = number_of_drivers;
    70 
    71   memset(
    72     _IO_Driver_address_table, 0,
    73     sizeof( rtems_driver_address_table ) * ( number_of_drivers )
    74   );
    75 
    76   for ( index = 0 ; index < drivers_in_table ; index++ )
    77     _IO_Driver_address_table[index] = driver_table[index];
    78 }
    7923
    8024void _IO_Initialize_all_drivers( void )
  • doc/user/conf.t

    r3a4d28a r263f4bec  
    38373837
    38383838@c
    3839 @c === CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE ===
    3840 @c
    3841 @subsection Specifying Application Defined Device Driver Table
    3842 
    3843 @findex CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
    3844 
    3845 @table @b
    3846 @item CONSTANT:
    3847 @code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE}
    3848 
    3849 @item DATA TYPE:
    3850 List of device driver initializers (@code{rtems_driver_address_table}).
    3851 
    3852 @item RANGE:
    3853 Undefined or array of device drivers.
    3854 
    3855 @item DEFAULT VALUE:
    3856 This is not defined by default, indicating the @code{<rtems/confdefs.h>}
    3857 is providing the device driver table.
    3858 
    3859 @end table
    3860 
    3861 @subheading DESCRIPTION:
    3862 @code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE} is defined if the application
    3863 wishes to provide their own Device Driver Table.
    3864 
    3865 The table must be an array of @code{rtems_driver_address_table} entries
    3866 named @code{Device_drivers}.
    3867 
    3868 @subheading NOTES:
    3869 It is expected that there the application would only rarely need to do this.
    3870 
    3871 @c
    38723839@c === CONFIGURE_MAXIMUM_DRIVERS ===
    38733840@c
     
    42984265
    42994266@c
     4267@c === CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE ===
     4268@c
     4269@subsection Specifying Application Defined Device Driver Table
     4270
     4271@findex CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
     4272
     4273@table @b
     4274@item CONSTANT:
     4275@code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE}
     4276
     4277@item DATA TYPE:
     4278Boolean feature macro.
     4279
     4280@item RANGE:
     4281Defined or undefined.
     4282
     4283@item DEFAULT VALUE:
     4284This is not defined by default, indicating the @code{<rtems/confdefs.h>}
     4285is providing the device driver table.
     4286
     4287@end table
     4288
     4289@subheading DESCRIPTION:
     4290@code{CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE} is defined if the application
     4291wishes to provide their own Device Driver Table.
     4292
     4293The table must be an array of @code{rtems_driver_address_table} entries named
     4294@code{_IO_Driver_address_table}.  The application must also provide a const
     4295variable @code{_IO_Number_of_drivers} of type @code{size_t} indicating the
     4296number of entries in the @code{_IO_Driver_address_table}.
     4297
     4298@subheading NOTES:
     4299It is expected that there the application would only rarely need to do this.
     4300
     4301@c
    43004302@c === Multiprocessing Configuration ===
    43014303@c
  • testsuites/libtests/block11/init.c

    r3a4d28a r263f4bec  
    435435
    436436#define CONFIGURE_MAXIMUM_TASKS 1
    437 #define CONFIGURE_MAXIMUM_DRIVERS 2
    438437
    439438#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
  • testsuites/sptests/sp21/init.c

    r3a4d28a r263f4bec  
    3030#define ZERO_DRIVER_MAJOR     0x3
    3131#define NO_DRIVER_MAJOR       0x4
    32 #define INVALID_DRIVER_MAJOR  \
    33      (rtems_configuration_get_number_of_device_drivers() + 1)
     32#define INVALID_DRIVER_MAJOR  UINT32_MAX
    3433
    3534/* driver entries to use with io_register */
  • testsuites/sptests/spsize/size.c

    r3a4d28a r263f4bec  
    290290
    291291/*intr.h*/      0                                         +
    292 
    293 /*io.h*/        (sizeof _IO_Number_of_drivers)            +
    294                 (sizeof _IO_Driver_address_table)         +
    295292
    296293/*isr.h*/       (sizeof _ISR_Nest_level)                  +
Note: See TracChangeset for help on using the changeset viewer.