change log for rtems (2011-02-28)

rtems-vc at rtems.org rtems-vc at rtems.org
Mon Feb 28 16:10:31 UTC 2011


 *sh*:
2011-02-28	Sebastian Huber <sebastian.huber at embedded-brains.de>

	* console.c: Register also normal device file of the console device.
	Call initialization before the device file registration.

M  1.184  c/src/lib/libbsp/shared/ChangeLog
M   1.15  c/src/lib/libbsp/shared/console.c

diff -u rtems/c/src/lib/libbsp/shared/ChangeLog:1.183 rtems/c/src/lib/libbsp/shared/ChangeLog:1.184
--- rtems/c/src/lib/libbsp/shared/ChangeLog:1.183	Wed Feb  9 00:36:52 2011
+++ rtems/c/src/lib/libbsp/shared/ChangeLog	Mon Feb 28 09:11:48 2011
@@ -1,3 +1,8 @@
+2011-02-28	Sebastian Huber <sebastian.huber at embedded-brains.de>
+
+	* console.c: Register also normal device file of the console device.
+	Call initialization before the device file registration.
+
 2011-02-09	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* timerstub.c: Include <rtems/btimer.h>.

diff -u rtems/c/src/lib/libbsp/shared/console.c:1.14 rtems/c/src/lib/libbsp/shared/console.c:1.15
--- rtems/c/src/lib/libbsp/shared/console.c:1.14	Tue Feb  1 09:48:26 2011
+++ rtems/c/src/lib/libbsp/shared/console.c	Mon Feb 28 09:11:48 2011
@@ -16,6 +16,7 @@
 
 #include <bsp.h>
 #include <rtems/libio.h>
+#include <rtems/console.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <termios.h>
@@ -216,77 +217,44 @@
 
 rtems_device_driver console_initialize(
   rtems_device_major_number  major,
-  rtems_device_minor_number  minor_arg,
+  rtems_device_minor_number  minor,
   void                      *arg
 )
 {
-  rtems_status_code          status;
-  rtems_device_minor_number  minor;
-
-  /*
-   * initialize the termio interface.
-   */
+  rtems_status_code sc = RTEMS_SUCCESSFUL;
+  bool first = true;
 
   rtems_termios_initialize();
 
-  for (minor=0; minor < Console_Port_Count ; minor++) {
-    /*
-     * First perform the configuration dependent probe, then the
-     * device dependent probe
-     */
+  for (minor = 0; minor < Console_Port_Count; ++minor) {
+    const console_tbl *device = &Console_Port_Tbl [minor];
 
-    if ((!Console_Port_Tbl[minor].deviceProbe ||
-         Console_Port_Tbl[minor].deviceProbe(minor)) &&
-         Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor)) {
-      /*
-       * Use this device for the console
-       */
-      break;
+    if (
+      (device->deviceProbe == NULL || device->deviceProbe(minor))
+        && device->pDeviceFns->deviceProbe(minor)
+    ) {
+      device->pDeviceFns->deviceInitialize(minor);
+      if (first) {
+        first = false;
+        Console_Port_Minor = minor;
+        sc = rtems_io_register_name(CONSOLE_DEVICE_NAME, major, minor);
+        if (sc != RTEMS_SUCCESSFUL) {
+          rtems_fatal_error_occurred(sc);
+        }
+      }
+      sc = rtems_io_register_name(device->sDeviceName, major, minor);
+      if (sc != RTEMS_SUCCESSFUL) {
+        rtems_fatal_error_occurred(sc);
+      }
     }
   }
-  if ( minor == Console_Port_Count ) {
+
+  if (first) {
     /*
      * Failed to find a working device
      */
     rtems_fatal_error_occurred(RTEMS_IO_ERROR);
   }
 
-  Console_Port_Minor=minor;
-
-  /*
-   * Register Device Names
-   */
-  status = rtems_io_register_name("/dev/console", major, Console_Port_Minor );
-  if (status != RTEMS_SUCCESSFUL) {
-    rtems_fatal_error_occurred(status);
-  }
-  Console_Port_Tbl[minor].pDeviceFns->deviceInitialize(Console_Port_Minor);
-
-  for (minor++;minor<Console_Port_Count;minor++) {
-    /*
-     * First perform the configuration dependent probe, then the
-     * device dependent probe
-     */
-
-    if ( (!Console_Port_Tbl[minor].deviceProbe ||
-         Console_Port_Tbl[minor].deviceProbe(minor)) &&
-         Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor)) {
-      status = rtems_io_register_name(
-        Console_Port_Tbl[minor].sDeviceName,
-        major,
-        minor );
-      if (status != RTEMS_SUCCESSFUL) {
-        rtems_fatal_error_occurred(status);
-      }
-
-      /*
-       * Initialize the hardware device.
-       */
-
-      Console_Port_Tbl[minor].pDeviceFns->deviceInitialize(minor);
-
-    }
-  }
-
   return RTEMS_SUCCESSFUL;
 }



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110228/d45f61b7/attachment-0001.html>


More information about the vc mailing list