config, _IO_Initialize_all_drivers

Joel Sherrill joel at rtems.org
Fri Feb 18 16:47:18 UTC 2022


On Fri, Feb 18, 2022 at 10:18 AM Heinz Junkes <junkes at fhi-berlin.mpg.de> wrote:
>
> I'm still trying to get the booting and registering and initialising of the i2c devices on the MVME3100 to work properly.
>
> In confdefs/iodrivers.h the driver address table is built up and then
> _IO_Initialize_all_drivers() is called without registering the individual devices first.
>
> If I now enter in already before in bspstart.c
>
> RTEMS_SYSINIT_ITEM(
>   mvme3100_i2c_initialize,
>   RTEMS_SYSINIT_BSP_PRE_DRIVERS,
>   RTEMS_SYSINIT_ORDER_MIDDLE
> );
>
> a device (register it and e.g. got the major number 0) this is ignored by the IO_Initialize_all_drivers().

Any method registered that way is "void METHOD(void)" so you are lucky
you saw 0 for major.

> Shouldn't initialisation be preceded by registration ( rtems_io_register_driver() )?

"Normally" the driver initialization entry registers names.

I don't know if it is a good example but libtests/i2c01 is doing
something different.

Perhaps someone who has more knowledge of the i2c framework needs
to speak up.

FWIW Christian is often on Discord. It's good for quick answers.

--joel-



> Heinz
>
> rtems_driver_address_table
> _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
>   #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
>     CONFIGURE_BSP_PREREQUISITE_DRIVERS,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
>     CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
>     CONSOLE_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER
>     RTC_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER
>     WATCHDOG_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
>     DEVNULL_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
>     DEVZERO_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
>     IDE_CONTROLLER_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
>     ATA_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER
>     FRAME_BUFFER_DRIVER_TABLE_ENTRY,
>   #endif
>   #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
>     CONFIGURE_APPLICATION_EXTRA_DRIVERS,
>   #endif
>   #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) \
>     || ( !defined(CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_NEEDS_RTC_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) \
>       && !defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS) )
>     NULL_DRIVER_TABLE_ENTRY
>   #endif
> };
>
> const size_t _IO_Number_of_drivers =
>   RTEMS_ARRAY_SIZE( _IO_Driver_address_table );
>
> RTEMS_SYSINIT_ITEM(
>   _IO_Initialize_all_drivers,
>   RTEMS_SYSINIT_DEVICE_DRIVERS,
>   RTEMS_SYSINIT_ORDER_MIDDLE
> );
>
>
>
> ------------------------------------------------------------------------------
> Fritz-Haber-Institut    | Phone:         (+49 30) 8413-4270
> Heinz Junkes             | Fax (G3+G4):   (+49 30) 8413-5900
> Faradayweg 4-6        | VC: 102220181216 at bjn.vc
> D - 14195 Berlin        | E-Mail:        junkes at fhi-berlin.mpg.de
> ------------------------------------------------------------------------------
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list