This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

update I2C subsystem to use the right init priority


All I2C buses now initialize at CYG_INIT_BUS_I2C. This also fixes a
bug in the bitbanging documentation.

Bart

2009-02-09  Bart Veer  <bartv@ecoscentric.com>

	* cdl/i2c.cdl, src/i2c.cxx, doc/i2c.sgml: I2C buses now initialize
	at a fixed priority CYG_INIT_BUS_I2C, instead of a configurable
	priority with default CYG_INIT_DRIVERS.

	doc/i2c.sgml: remove a spurious & in the bitbang description.
	
Index: cdl/i2c.cdl
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/i2c/current/cdl/i2c.cdl,v
retrieving revision 1.3
diff -u -p -r1.3 i2c.cdl
--- cdl/i2c.cdl	29 Jan 2009 17:49:47 -0000	1.3
+++ cdl/i2c.cdl	9 Feb 2009 22:19:49 -0000
@@ -59,19 +59,6 @@ cdl_package CYGPKG_IO_I2C {
         be written and how I2C devices should be defined. There is also
         support for bit-banged I2C buses."
 
-    cdl_option CYGNUM_I2C_INIT_PRIORITY {
-	display		"I2C initialization priority"
-	flavor		data
-	default_value	{ "CYG_INIT_DRIVERS" }
-
-	description "
-            The generic I2C package will initialize each I2C bus during
-            system startup, using a prioritized static constructor. This
-            option controls the priority that is used. The default value,
-            CYG_INIT_DRIVERS, means that I2C buses get initialized early
-            on."
-    }
-
     cdl_component CYGPKG_IO_I2C_OPTIONS {
         display "I2C build options"
         flavor  none
Index: src/i2c.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/i2c/current/src/i2c.cxx,v
retrieving revision 1.4
diff -u -p -r1.4 i2c.cxx
--- src/i2c.cxx	29 Jan 2009 17:49:47 -0000	1.4
+++ src/i2c.cxx	9 Feb 2009 22:21:19 -0000
@@ -71,10 +71,6 @@
 // then all required code and data should get included, otherwise it
 // will all be elided.
 //
-// The init priority is configurable, defaulting to CYG_INIT_DRIVERS.
-// Arguably it should happen a bit earlier to allow other drivers to
-// perform I2C operations, but there is no CYG_INIT_BUS.
-//
 // All I2C buses are kept in a table, so that the init code can
 // iterate through each one.
 
@@ -87,7 +83,7 @@ class cyg_i2c_init {
     cyg_i2c_init();
 };
 
-static cyg_i2c_init cyg_i2c_init_object CYGBLD_ATTRIB_INIT_PRI(CYGNUM_I2C_INIT_PRIORITY);
+static cyg_i2c_init cyg_i2c_init_object CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_BUS_I2C);
 
 cyg_i2c_init::cyg_i2c_init()
 {
Index: doc/i2c.sgml
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/i2c/current/doc/i2c.sgml,v
retrieving revision 1.4
diff -u -p -r1.4 i2c.sgml
--- doc/i2c.sgml	29 Jan 2009 17:49:47 -0000	1.4
+++ doc/i2c.sgml	9 Feb 2009 22:21:58 -0000
@@ -546,12 +546,11 @@ before the transaction is ended.
     <para>
 The generic package <varname>CYGPKG_IO_I2C</varname> arranges for all
 I2C bus devices to be initialized via a single prioritized C++ static
-constructor. Usually this constructor will run early on during system
-startup, before any application code. The default priority is
-<literal>CYG_INIT_DRIVERS</literal>, but this can be changed via the
-configuration option <varname>CYGNUM_I2C_INIT_PRIORITY</varname>.
-Other code should not try to access any of the I2C devices until after
-the buses have been initialized.
+constructor. This constructor will run early on during system startup,
+before any application code, with priority
+<literal>CYG_INIT_BUS_I2C</literal>. Other code should not try to
+access any of the I2C devices until after the buses have been
+initialized.
     </para>
   </refsect1>
 
@@ -730,7 +729,7 @@ hal_alaia_i2c_bitbang(cyg_i2c_bus* bus, 
     return result;
 }
 
-CYG_I2C_BITBANG_BUS(&amp;hal_alaia_i2c_bus, &amp;hal_alaia_i2c_bitbang);
+CYG_I2C_BITBANG_BUS(hal_alaia_i2c_bus, &amp;hal_alaia_i2c_bitbang);
     </programlisting>
     <para>
 This gives a structure <varname>hal_alaia_i2c_bus</varname> which can
@@ -768,9 +767,8 @@ The bitbang function should support the 
         <term><literal>CYG_I2C_BITBANG_INIT</literal></term>
         <listitem><para>
 This will be called during system initialization, as a side effect of
-a prioritized C++ static constructor. By default this constructor will
-run at <literal>CYG_INIT_DRIVERS</literal> priority. The bitbang
-function should ensure that both SCL and SDA are driven high.
+a prioritized C++ static constructor. The bitbang function should
+ensure that both SCL and SDA are driven high.
         </para></listitem>
       </varlistentry>
       <varlistentry>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]