[PATCH 1/2] powerpc/shared/console: Make console baud rate configurable.

dufault at hda.com dufault at hda.com
Tue Apr 27 17:40:42 UTC 2021


From: Peter Dufault <dufault at hda.com>

The "powerpc/shared/console" code has the start-up console value fixed
at 9600 baud.  This changes the hard-wired constant "9600" in the code
to the configuration setting "BSP_CONSOLE_BAUD" and adds configuration
support in both the "waf" and the legacy configuration systems.

Note that the VME BSPs beatnik, mvme3100, and mve5100 can be improved
by adding a "mvmexxxx" BSP family. This configuration change, as well
as future configuration changes, could then be made in a "grp.yml" file.
---
 bsps/powerpc/shared/console/console.c                  | 4 ++--
 bsps/powerpc/shared/console/uart.c                     | 2 +-
 c/src/lib/libbsp/powerpc/beatnik/configure.ac          | 4 ++++
 c/src/lib/libbsp/powerpc/haleakala/configure.ac        | 4 ++++
 c/src/lib/libbsp/powerpc/motorola_powerpc/configure.ac | 4 ++++
 c/src/lib/libbsp/powerpc/mvme3100/configure.ac         | 4 ++++
 c/src/lib/libbsp/powerpc/mvme5500/configure.ac         | 4 ++++
 spec/build/bsps/optconsolebaud.yml                     | 5 +++++
 spec/build/bsps/powerpc/beatnik/bspbeatnik.yml         | 2 ++
 spec/build/bsps/powerpc/haleakala/bsphaleakala.yml     | 2 ++
 spec/build/bsps/powerpc/motorola_powerpc/obj.yml       | 4 +++-
 spec/build/bsps/powerpc/mvme3100/bspmvme3100.yml       | 2 ++
 spec/build/bsps/powerpc/mvme5500/bspmvme5500.yml       | 2 ++
 13 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/bsps/powerpc/shared/console/console.c b/bsps/powerpc/shared/console/console.c
index f275683..f6c8021 100644
--- a/bsps/powerpc/shared/console/console.c
+++ b/bsps/powerpc/shared/console/console.c
@@ -153,8 +153,8 @@ static int console_first_open(int major, int minor, void *arg)
   /* must not open a minor device we have no ISR for */
   assert( minor>=0 && minor < sizeof(ttyS)/sizeof(ttyS[0]) && ttyS[minor].isr );
 
-  /* 9600-8-N-1 */
-  BSP_uart_init(minor, 9600, 0);
+  /* BSP_CONSOLE_BAUD-8-N-1 */
+  BSP_uart_init(minor, BSP_CONSOLE_BAUD, 0);
   status = BSP_uart_install_isr(minor, ttyS[minor].isr);
   if (!status) {
     printk("Error installing serial console interrupt handler for '%s'!\n",
diff --git a/bsps/powerpc/shared/console/uart.c b/bsps/powerpc/shared/console/uart.c
index 62212b9..41db52f 100644
--- a/bsps/powerpc/shared/console/uart.c
+++ b/bsps/powerpc/shared/console/uart.c
@@ -160,7 +160,7 @@ BSP_uart_init(int uart, int baud, int hwFlow)
 
   if ( (int)BSPBaseBaud <= 0 ) {
   	/* Use current divisor assuming BSPBaseBaud gives us the current speed */
-	BSPBaseBaud  = BSPBaseBaud ? -BSPBaseBaud : 9600;
+	BSPBaseBaud  = BSPBaseBaud ? -BSPBaseBaud : BSP_CONSOLE_BAUD;
 	BSPBaseBaud *= ((uread(uart, DLM) << 8) | uread(uart, DLL));
   }
 
diff --git a/c/src/lib/libbsp/powerpc/beatnik/configure.ac b/c/src/lib/libbsp/powerpc/beatnik/configure.ac
index b332aaa..584072d 100644
--- a/c/src/lib/libbsp/powerpc/beatnik/configure.ac
+++ b/c/src/lib/libbsp/powerpc/beatnik/configure.ac
@@ -34,6 +34,10 @@ Note that the policy can still be defined by the application
 CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK this feature is removed
 and a little memory is saved.])
 
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[9600])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],
+[default console baud])
+
 AC_DEFINE(__ppc_generic, 1, [PowerPC model option])
 
 # Explicitly list all Makefiles here
diff --git a/c/src/lib/libbsp/powerpc/haleakala/configure.ac b/c/src/lib/libbsp/powerpc/haleakala/configure.ac
index cf3a552..627625b 100644
--- a/c/src/lib/libbsp/powerpc/haleakala/configure.ac
+++ b/c/src/lib/libbsp/powerpc/haleakala/configure.ac
@@ -25,6 +25,10 @@ RTEMS_BSPOPTS_HELP([PPC_VECTOR_FILE_BASE],
 [This defines the base address of the exception table.
  NOTE: Vectors are actually at 0xFFF00000 but file starts at offset.])
 
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[9600])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],
+[default console baud])
+
 AC_DEFINE(ppc405, 1, [PowerPC model option])
 
 RTEMS_BSP_CLEANUP_OPTIONS
diff --git a/c/src/lib/libbsp/powerpc/motorola_powerpc/configure.ac b/c/src/lib/libbsp/powerpc/motorola_powerpc/configure.ac
index 8b79309..56d550c 100644
--- a/c/src/lib/libbsp/powerpc/motorola_powerpc/configure.ac
+++ b/c/src/lib/libbsp/powerpc/motorola_powerpc/configure.ac
@@ -33,6 +33,10 @@ Note that the policy can still be defined by the application
 CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK this feature is removed
 and a little memory is saved.])
 
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[9600])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],
+[default console baud])
+
 RTEMS_BSPOPTS_SET([mvme2100],[mvme2100],[1])
 RTEMS_BSPOPTS_SET([mvme2100],[*],[])
 RTEMS_BSPOPTS_HELP([mvme2100],
diff --git a/c/src/lib/libbsp/powerpc/mvme3100/configure.ac b/c/src/lib/libbsp/powerpc/mvme3100/configure.ac
index 8b9a04f..cf35fd1 100644
--- a/c/src/lib/libbsp/powerpc/mvme3100/configure.ac
+++ b/c/src/lib/libbsp/powerpc/mvme3100/configure.ac
@@ -33,6 +33,10 @@ Note that the policy can still be defined by the application
 CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK this feature is removed
 and a little memory is saved.])
 
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[9600])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],
+[default console baud])
+
 AC_DEFINE(__ppc_generic, 1, [PowerPC model option])
 
 RTEMS_BSP_CLEANUP_OPTIONS
diff --git a/c/src/lib/libbsp/powerpc/mvme5500/configure.ac b/c/src/lib/libbsp/powerpc/mvme5500/configure.ac
index a1910ca..76ce405 100644
--- a/c/src/lib/libbsp/powerpc/mvme5500/configure.ac
+++ b/c/src/lib/libbsp/powerpc/mvme5500/configure.ac
@@ -33,6 +33,10 @@ Note that the policy can still be defined by the application
 CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK this feature is removed
 and a little memory is saved.])
 
+RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[9600])
+RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],
+[default console baud])
+
 AC_DEFINE(mpc7455, 1, [PowerPC model option])
 
 RTEMS_BSP_CLEANUP_OPTIONS
diff --git a/spec/build/bsps/optconsolebaud.yml b/spec/build/bsps/optconsolebaud.yml
index 3fe1eee..684c820 100644
--- a/spec/build/bsps/optconsolebaud.yml
+++ b/spec/build/bsps/optconsolebaud.yml
@@ -11,6 +11,11 @@ default-by-variant:
   variants:
   - m68k/m5484FireEngine
   - powerpc/hsc_cm01
+  - powerpc/beatnik
+  - powerpc/haleakala
+  - powerpc/motorola_powerpc
+  - powerpc/mvme3100
+  - powerpc/mvme5500
 - value: 19200
   variants:
   - m68k/COBRA5475
diff --git a/spec/build/bsps/powerpc/beatnik/bspbeatnik.yml b/spec/build/bsps/powerpc/beatnik/bspbeatnik.yml
index 83a1f09..ab9c8e6 100644
--- a/spec/build/bsps/powerpc/beatnik/bspbeatnik.yml
+++ b/spec/build/bsps/powerpc/beatnik/bspbeatnik.yml
@@ -41,6 +41,8 @@ links:
 - role: build-dependency
   uid: abi
 - role: build-dependency
+  uid: ../../optconsolebaud
+- role: build-dependency
   uid: optsbrk
 - role: build-dependency
   uid: ../crti
diff --git a/spec/build/bsps/powerpc/haleakala/bsphaleakala.yml b/spec/build/bsps/powerpc/haleakala/bsphaleakala.yml
index 66e3b05..b45da01 100644
--- a/spec/build/bsps/powerpc/haleakala/bsphaleakala.yml
+++ b/spec/build/bsps/powerpc/haleakala/bsphaleakala.yml
@@ -37,6 +37,8 @@ links:
 - role: build-dependency
   uid: abi
 - role: build-dependency
+  uid: ../../optconsolebaud
+- role: build-dependency
   uid: optsprg
 - role: build-dependency
   uid: optvecbase
diff --git a/spec/build/bsps/powerpc/motorola_powerpc/obj.yml b/spec/build/bsps/powerpc/motorola_powerpc/obj.yml
index e278c11..d81ded3 100644
--- a/spec/build/bsps/powerpc/motorola_powerpc/obj.yml
+++ b/spec/build/bsps/powerpc/motorola_powerpc/obj.yml
@@ -20,7 +20,9 @@ install:
   source:
   - bsps/powerpc/motorola_powerpc/start/linkcmds
   - bsps/powerpc/shared/start/linkcmds.share
-links: []
+links:
+- role: build-dependency
+  uid: ../../optconsolebaud
 source:
 - bsps/powerpc/motorola_powerpc/console/polled_io.c
 - bsps/powerpc/motorola_powerpc/start/bspreset.c
diff --git a/spec/build/bsps/powerpc/mvme3100/bspmvme3100.yml b/spec/build/bsps/powerpc/mvme3100/bspmvme3100.yml
index 3ae4aa6..66fe09a 100644
--- a/spec/build/bsps/powerpc/mvme3100/bspmvme3100.yml
+++ b/spec/build/bsps/powerpc/mvme3100/bspmvme3100.yml
@@ -40,6 +40,8 @@ links:
 - role: build-dependency
   uid: abi
 - role: build-dependency
+  uid: ../../optconsolebaud
+- role: build-dependency
   uid: optsbrk
 - role: build-dependency
   uid: start
diff --git a/spec/build/bsps/powerpc/mvme5500/bspmvme5500.yml b/spec/build/bsps/powerpc/mvme5500/bspmvme5500.yml
index 8a3375a..bac1cf1 100644
--- a/spec/build/bsps/powerpc/mvme5500/bspmvme5500.yml
+++ b/spec/build/bsps/powerpc/mvme5500/bspmvme5500.yml
@@ -48,6 +48,8 @@ links:
 - role: build-dependency
   uid: abi
 - role: build-dependency
+  uid: ../../optconsolebaud
+- role: build-dependency
   uid: optsbrk
 - role: build-dependency
   uid: start
-- 
1.8.3.1



More information about the devel mailing list