[rtems commit] arm/tms570: sci context has to be writable because it holds state variable.

Sebastian Huber sebh at rtems.org
Wed Feb 4 18:37:43 UTC 2015


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

Author:    Pavel Pisa <pisa at cmp.felk.cvut.cz>
Date:      Wed Feb  4 18:20:27 2015 +0100

arm/tms570: sci context has to be writable because it holds state variable.

The structure tms570_sci_context holds state variable
tx_chars_in_hw which holds if and how many characters
(in the optional FIFO support for some Ti SCIs) are submitted
into hardware.

When field is not writable then code breaks when RTEMS
is build for Flash area.

The problem found and analyzed by Martin Galvan from tallertechnologies.

Signed-off-by: Pavel Pisa <pisa at cmp.felk.cvut.cz>

---

 c/src/lib/libbsp/arm/tms570/console/tms570-sci.c        | 6 +++---
 c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c b/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
index 3f10300..d78cf20 100644
--- a/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
+++ b/c/src/lib/libbsp/arm/tms570/console/tms570-sci.c
@@ -40,7 +40,7 @@
  *
  * Definitions of all serial drivers
  */
-const tms570_sci_context driver_context_table[] = {
+tms570_sci_context driver_context_table[] = {
   {
     .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("TMS570 SCI1"),
     .device_name = "/dev/console",
@@ -91,7 +91,7 @@ rtems_device_driver console_initialize(
     minor < RTEMS_ARRAY_SIZE(driver_context_table);
     ++minor
   ) {
-    const tms570_sci_context *ctx = &driver_context_table[minor];
+    tms570_sci_context *ctx = &driver_context_table[minor];
 
     /*
      * Install this device in the file system and Termios.  In order
@@ -105,7 +105,7 @@ rtems_device_driver console_initialize(
         minor,
         handler,
 	NULL,
-        RTEMS_DECONST(rtems_termios_device_context *, &ctx->base)
+        &ctx->base
     );
     if ( sc != RTEMS_SUCCESSFUL ) {
       bsp_fatal(BSP_FATAL_CONSOLE_NO_DEV);
diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h b/c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h
index f32eaea..1d9eaa7 100644
--- a/c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h
+++ b/c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h
@@ -47,7 +47,7 @@ extern const rtems_termios_device_handler tms570_sci_handler_polled;
 
 extern const rtems_termios_device_handler tms570_sci_handler_interrupt;
 
-extern const tms570_sci_context driver_context_table[];
+extern tms570_sci_context driver_context_table[];
 
 /** @} */
 



More information about the vc mailing list