libi2c: Claiming driver slot failed

Nick Withers nick.withers at anu.edu.au
Fri Aug 9 03:52:00 UTC 2013


On Fri, 2013-08-09 at 12:33 +1000, Chris Johns wrote:
> Nick Withers wrote:
> > On Mon, 2013-08-05 at 14:02 +1000, Nick Withers wrote:
> >> Hi guys,
> >>
> >> When I boot an MVME3100 (PowerPC) off the ticker sample application, I
> >> get an error message "libi2c: Claiming driver slot failed (rtems status
> >> code 5)".
> >
> > (snip)
> >
> > I got past this by #defining CONFIGURE_MAXIMUM_DRIVERS up to 10.
> >
> > Is this something that I should have to do? Would've thought the BSP
> > code'd handle this...?
> 
> The BSP may require a number of driver slots while the actual number 
> used depends on your application and the drivers it uses. It is useful 
> on targets where the memory size is small.
> 
> Currently there is no way for the BSP to provide a number for the table 
> so the application needs to size things to get it running. If you have 
> ideas on how this could be done we would welcome it.

Wouldn't something like the following do it (and not break the existing
"way it's done")?
____

diff --git a/c/src/lib/libbsp/powerpc/mvme3100/include/bsp.h b/c/src/lib/libbsp/powerpc/mvme3100/include/bsp.h
index 22e55f5..4a4f885 100644
--- a/c/src/lib/libbsp/powerpc/mvme3100/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/mvme3100/include/bsp.h
@@ -137,6 +137,8 @@
 #define        BSP_I2C_DS1621_RAW_DEV_NAME      (BSP_I2C_BUS0_NAME"."BSP_I2C_DS1621_RAW_NAME)
 #define        BSP_I2C_DS1375_RAW_DEV_NAME      (BSP_I2C_BUS0_NAME"."BSP_I2C_DS1375_RAW_NAME)

+#define BSP_I2C_DRIVERS                  1
+
 /* Definitions useful for bootloader (netboot); where to find
  * boot/'environment' parameters.
  */
@@ -146,6 +148,8 @@
 #define BSP_BOOTPARMS_WRITE_ENABLE()     do { BSP_eeprom_write_enable(); } while (0)
 #define BSP_BOOTPARMS_WRITE_DISABLE()    do { BSP_eeprom_write_protect();} while (0)

+#define CONFIGURE_BSP_MAXIMUM_DRIVERS    BSP_I2C_DEVS
+

 #ifdef __cplusplus
 extern "C" {
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index ed1385a..557bdf5 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1184,7 +1184,11 @@ const rtems_libio_helper rtems_fs_init_helper =
  * for both the statically and dynamically installed drivers.
  */
 #ifndef CONFIGURE_MAXIMUM_DRIVERS
-  #define CONFIGURE_MAXIMUM_DRIVERS CONFIGURE_NUMBER_OF_DRIVERS
+  #ifndef CONFIGURE_BSP_MAXIMUM_DRIVERS
+    #define CONFIGURE_MAXIMUM_DRIVERS CONFIGURE_NUMBER_OF_DRIVERS
+  #else
+    #define CONFIGURE_MAXIMUM_DRIVERS (CONFIGURE_NUMBER_OF_DRIVERS + CONFIGURE_BSP_MAXIMUM_DRIVERS)
+  #endif
 #endif
____

I've no qualms about specifying my *application's* extra driver
requirements, but it'd be nice if that were separated from those of the
BSP, which would ideally be abstracted away from me as much as
possible...? This'd help with porting application to other boards, I'd
think.

> Chris
> 

-- 
Nick Withers

Embedded Systems Programmer
Room 2.26, Building 57
Department of Nuclear Physics
Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)

eMail: nick.withers at anu.edu.au
Phone: +61 2 6125 2091
Mobile: +61 414 397 446





More information about the users mailing list