[rtems commit] bsp/virtex: Add console devices only if present

Sebastian Huber sebh at rtems.org
Mon Jun 24 08:48:41 UTC 2013


Module:    rtems
Branch:    master
Commit:    0110491bd5b4c181289e4388a96862d5917c8268
Changeset: http://git.rtems.org/rtems/commit/?id=0110491bd5b4c181289e4388a96862d5917c8268

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jun 20 16:22:16 2013 +0200

bsp/virtex: Add console devices only if present

---

 .../libbsp/powerpc/virtex/console/consolelite.c    |   21 ++++++++++---------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c b/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c
index 64399fd..513d289 100644
--- a/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c
+++ b/c/src/lib/libbsp/powerpc/virtex/console/consolelite.c
@@ -271,6 +271,7 @@ console_tbl     Console_Configuration_Ports[] = {
    0,                                      /* ulClock */
    0                                       /* ulIntVector -- base for port */
 },
+#ifdef XPAR_UARTLITE_1_BASEADDR
 {
   "/dev/ttyS1",                             /* sDeviceName */
    SERIAL_CUSTOM,                           /* deviceType */
@@ -280,7 +281,7 @@ console_tbl     Console_Configuration_Ports[] = {
    16,                                     /* ulMargin */
    8,                                      /* ulHysteresis */
    (void *) NULL,               /* NULL */ /* pDeviceParams */
-   0x40610000,                             /* ulCtrlPort1 */
+   XPAR_UARTLITE_1_BASEADDR,               /* ulCtrlPort1 */
    0,                                      /* ulCtrlPort2 */
    0,                                      /* ulDataPort */
    NULL,                                   /* getRegister */
@@ -290,6 +291,8 @@ console_tbl     Console_Configuration_Ports[] = {
    0,                                      /* ulClock */
    0                                       /* ulIntVector -- base for port */
 },
+#endif
+#ifdef XPAR_UARTLITE_2_BASEADDR
 {
   "/dev/ttyS2",                             /* sDeviceName */
    SERIAL_CUSTOM,                           /* deviceType */
@@ -299,7 +302,7 @@ console_tbl     Console_Configuration_Ports[] = {
    16,                                     /* ulMargin */
    8,                                      /* ulHysteresis */
    (void *) NULL,               /* NULL */ /* pDeviceParams */
-   0x40620000,                             /* ulCtrlPort1 */
+   XPAR_UARTLITE_2_BASEADDR,               /* ulCtrlPort1 */
    0,                                      /* ulCtrlPort2 */
    0,                                      /* ulDataPort */
    NULL,                                   /* getRegister */
@@ -309,6 +312,8 @@ console_tbl     Console_Configuration_Ports[] = {
    0,                                      /* ulClock */
    0                                       /* ulIntVector -- base for port */
 },
+#endif
+#ifdef XPAR_UARTLITE_2_BASEADDR
 {
   "/dev/ttyS3",                             /* sDeviceName */
    SERIAL_CUSTOM,                           /* deviceType */
@@ -318,7 +323,7 @@ console_tbl     Console_Configuration_Ports[] = {
    16,                                     /* ulMargin */
    8,                                      /* ulHysteresis */
    (void *) NULL,               /* NULL */ /* pDeviceParams */
-   0x40630000,                             /* ulCtrlPort1 */
+   XPAR_UARTLITE_3_BASEADDR,               /* ulCtrlPort1 */
    0,                                      /* ulCtrlPort2 */
    0,                                      /* ulDataPort */
    NULL,                                   /* getRegister */
@@ -328,15 +333,11 @@ console_tbl     Console_Configuration_Ports[] = {
    0,                                      /* ulClock */
    0                                       /* ulIntVector -- base for port */
 }
+#endif
 };
 
-
-
-
-#define NUM_CONSOLE_PORTS \
-  (sizeof(Console_Configuration_Ports)/sizeof(console_tbl))
-
-unsigned long Console_Configuration_Count = NUM_CONSOLE_PORTS;
+unsigned long Console_Configuration_Count =
+  RTEMS_ARRAY_SIZE(Console_Configuration_Ports);
 
 
 #include <rtems/bspIo.h>




More information about the vc mailing list