Re: [PATCH rtems 2/3] confdefs: Add configure macro for libi2c

2023-07-27 Thread Vijay Kumar Banerjee
On Tue, Jul 25, 2023 at 12:23 AM Sebastian Huber
 wrote:
>
>
>
> On 25.07.23 04:31, Vijay Kumar Banerjee wrote:
> > On Mon, Jul 24, 2023 at 10:09 AM Sebastian Huber
> >   wrote:
> >> On 20.07.23 03:10, Vijay Kumar Banerjee wrote:
> >>> Add CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER define
> >> Do we really need this? What happens if an I2C device needs interrupts
> >> during initialization?
> >>
> > the libi2c initialize calls rtems_io_register_driver, which requires
> > `CONFIGURE_MAXIMUM_DRIVERS` defined from the application. In some
> > BSPs, like mvme3100, libi2c is initialized at sysinit, causing the
> > application to crash without the define. Adding this confdefs macro
> > allows the user to add the libi2c if it is needed by the app, or omit
> > it without crashing the system. In its current state, libi2c requires
> > the BSP to handle registering the buses and drivers after
> > initialization, the interrupt can be handled by the BSP I2C handler.
>
> Ok, maybe one option is to use IMFS_make_generic_node() instead of using
> rtems_io_register_driver(). Another option is to use the new I2C framework.
>
> If you really need this new application configuration option, then
> please document it:
>
> https://docs.rtems.org/branches/master/eng/req/howto.html#application-configuration-options
>

Thanks for the review and suggestions. I am unsure how much work it
would be to refactor the BSP to use the new I2C framework, but that is
likely the neatest approach. For now, I will send a v2 of this
patchset with documentation. It would be good to have libi2c working
on mvme3100 in RTEMS 6.


Best regards,
Vijay

> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems 2/3] confdefs: Add configure macro for libi2c

2023-07-24 Thread Sebastian Huber



On 25.07.23 04:31, Vijay Kumar Banerjee wrote:

On Mon, Jul 24, 2023 at 10:09 AM Sebastian Huber
  wrote:

On 20.07.23 03:10, Vijay Kumar Banerjee wrote:

Add CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER define

Do we really need this? What happens if an I2C device needs interrupts
during initialization?


the libi2c initialize calls rtems_io_register_driver, which requires
`CONFIGURE_MAXIMUM_DRIVERS` defined from the application. In some
BSPs, like mvme3100, libi2c is initialized at sysinit, causing the
application to crash without the define. Adding this confdefs macro
allows the user to add the libi2c if it is needed by the app, or omit
it without crashing the system. In its current state, libi2c requires
the BSP to handle registering the buses and drivers after
initialization, the interrupt can be handled by the BSP I2C handler.


Ok, maybe one option is to use IMFS_make_generic_node() instead of using 
rtems_io_register_driver(). Another option is to use the new I2C framework.


If you really need this new application configuration option, then 
please document it:


https://docs.rtems.org/branches/master/eng/req/howto.html#application-configuration-options

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems 2/3] confdefs: Add configure macro for libi2c

2023-07-24 Thread Vijay Kumar Banerjee
Hi Sebastian,

On Mon, Jul 24, 2023 at 10:09 AM Sebastian Huber
 wrote:
>
> On 20.07.23 03:10, Vijay Kumar Banerjee wrote:
> > Add CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER define
>
> Do we really need this? What happens if an I2C device needs interrupts
> during initialization?
>

the libi2c initialize calls rtems_io_register_driver, which requires
`CONFIGURE_MAXIMUM_DRIVERS` defined from the application. In some
BSPs, like mvme3100, libi2c is initialized at sysinit, causing the
application to crash without the define. Adding this confdefs macro
allows the user to add the libi2c if it is needed by the app, or omit
it without crashing the system. In its current state, libi2c requires
the BSP to handle registering the buses and drivers after
initialization, the interrupt can be handled by the BSP I2C handler.




> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH rtems 2/3] confdefs: Add configure macro for libi2c

2023-07-24 Thread Sebastian Huber

On 20.07.23 03:10, Vijay Kumar Banerjee wrote:

Add CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER define


Do we really need this? What happens if an I2C device needs interrupts 
during initialization?


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH rtems 2/3] confdefs: Add configure macro for libi2c

2023-07-19 Thread Vijay Kumar Banerjee
Add CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER define
---
 cpukit/include/rtems/confdefs/iodrivers.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/cpukit/include/rtems/confdefs/iodrivers.h 
b/cpukit/include/rtems/confdefs/iodrivers.h
index 16d64fbb98..cf5530fe2b 100644
--- a/cpukit/include/rtems/confdefs/iodrivers.h
+++ b/cpukit/include/rtems/confdefs/iodrivers.h
@@ -60,6 +60,7 @@
   defined(CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER) || \
   defined(CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER) || \
   defined(CONFIGURE_APPLICATION_NEEDS_FRAME_BUFFER_DRIVER) || \
+  defined(CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER) || \
   defined(CONFIGURE_APPLICATION_EXTRA_DRIVERS)
 #define _CONFIGURE_HAS_IO_DRIVERS
 #endif
@@ -112,6 +113,10 @@
   #include 
 #endif
 
+#ifdef CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER
+  #include 
+#endif
+
 #ifndef CONFIGURE_MAXIMUM_DRIVERS
   #define CONFIGURE_MAXIMUM_DRIVERS
 #endif
@@ -157,6 +162,9 @@ _IO_Driver_address_table[ CONFIGURE_MAXIMUM_DRIVERS ] = {
   #ifdef CONFIGURE_APPLICATION_EXTRA_DRIVERS
 CONFIGURE_APPLICATION_EXTRA_DRIVERS,
   #endif
+  #ifdef CONFIGURE_APPLICATION_NEEDS_LIBI2C_DRIVER
+RTEMS_LIBI2C_DRIVER_TABLE_ENTRY,
+  #endif
   #if defined(CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER) || \
 !defined(_CONFIGURE_HAS_IO_DRIVERS)
 NULL_DRIVER_TABLE_ENTRY
-- 
2.34.3

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel