Ticket #1370: rtems-PR#1370-mvme167-bsp-console.diff

File rtems-PR#1370-mvme167-bsp-console.diff, 2.2 KB (added by strauman, on Feb 17, 2009 at 5:16:09 PM)

Proposed fix

Line 
1Index: c/src/lib/libbsp/m68k/mvme167/console/console.c
2===================================================================
3RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/m68k/mvme167/console/console.c,v
4retrieving revision 1.13
5diff -c -r1.13 console.c
6*** c/src/lib/libbsp/m68k/mvme167/console/console.c     5 Sep 2008 08:43:44 -0000       1.13
7--- c/src/lib/libbsp/m68k/mvme167/console/console.c     4 Feb 2009 21:58:29 -0000
8***************
9*** 161,166 ****
10--- 161,175 ----
11  static void _BSP_output_char( char c );
12  BSP_output_char_function_type BSP_output_char = _BSP_output_char;
13 
14+ /* '\r' character in memory. This used to live on
15+  * the stack but storing the '\r' character is
16+  * optimized away by gcc-4.3.2 (since it seems to
17+  * be unused [only referenced from inline assembly
18+  * code in _167Bug_pollWrite()]).
19+  * Hence we make it a global constant.
20+  */
21+ static const char cr_char = '\r';
22+
23  /* Channel info */
24  /* static */ volatile struct {
25    void *tty;                    /* Really a struct rtems_termios_tty * */
26***************
27*** 1366,1377 ****
28  {
29    rtems_libio_rw_args_t *rw_args = arg;
30    uint32_t   i;
31-   char cr ='\r';
32 
33    for( i = 0; i < rw_args->count; i++ ) {
34      _167Bug_pollWrite(minor, &(rw_args->buffer[i]), 1);
35      if ( rw_args->buffer[i] == '\n' )
36!       _167Bug_pollWrite(minor, &cr, 1);
37    }
38    rw_args->bytes_moved = i;
39    return RTEMS_SUCCESSFUL;
40--- 1375,1385 ----
41  {
42    rtems_libio_rw_args_t *rw_args = arg;
43    uint32_t   i;
44 
45    for( i = 0; i < rw_args->count; i++ ) {
46      _167Bug_pollWrite(minor, &(rw_args->buffer[i]), 1);
47      if ( rw_args->buffer[i] == '\n' )
48!       _167Bug_pollWrite(minor, &cr_char, 1);
49    }
50    rw_args->bytes_moved = i;
51    return RTEMS_SUCCESSFUL;
52***************
53*** 1385,1391 ****
54  void _BSP_output_char(char c)
55  {
56    rtems_device_minor_number printk_minor;
57-   char cr ='\r';
58 
59    /*
60     *  Can't rely on console_initialize having been called before this function
61--- 1393,1398 ----
62***************
63*** 1399,1405 ****
64 
65    _167Bug_pollWrite(printk_minor, &c, 1);
66    if ( c == '\n' )
67!       _167Bug_pollWrite(printk_minor, &cr, 1);
68  }
69 
70  /*
71--- 1406,1412 ----
72 
73    _167Bug_pollWrite(printk_minor, &c, 1);
74    if ( c == '\n' )
75!       _167Bug_pollWrite(printk_minor, &cr_char, 1);
76  }
77 
78  /*