diff options
Diffstat (limited to 'c/src/lib/libcpu/sh/sh7045/sci')
-rw-r--r-- | c/src/lib/libcpu/sh/sh7045/sci/sci.c | 18 | ||||
-rw-r--r-- | c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c | 7 |
2 files changed, 14 insertions, 11 deletions
diff --git a/c/src/lib/libcpu/sh/sh7045/sci/sci.c b/c/src/lib/libcpu/sh/sh7045/sci/sci.c index 690035a687..143fc1bb94 100644 --- a/c/src/lib/libcpu/sh/sh7045/sci/sci.c +++ b/c/src/lib/libcpu/sh/sh7045/sci/sci.c @@ -72,9 +72,9 @@ #define SH_SCI_BASE_0 SCI_SMR0 #define SH_SCI_BASE_1 SCI_SMR1 -#define SH_SCI_DEF_COMM_0 B9600 | CS8 -#define SH_SCI_DEF_COMM_1 B38400 | CS8 -/* #define SH_SCI_DEF_COMM_1 B9600 | CS8 */ +#define SH_SCI_DEF_COMM_0 CS8, B9600 +#define SH_SCI_DEF_COMM_1 CS8, B38400 +/* #define SH_SCI_DEF_COMM_1 CS8, B9600 */ struct scidev_t { char * name; @@ -82,6 +82,7 @@ struct scidev_t { rtems_device_minor_number minor; unsigned short opened; tcflag_t cflags; + speed_t spd; } sci_device[SCI_MINOR_DEVICES] = { { "/dev/sci0", SH_SCI_BASE_0, 0, 0, SH_SCI_DEF_COMM_0 }, @@ -96,15 +97,16 @@ static sci_setup_t sio_param[2]; /* Translate termios' tcflag_t into sci settings */ static int _sci_set_cflags( struct scidev_t *sci_dev, - tcflag_t c_cflag + tcflag_t c_cflag, + speed_t spd ) { uint8_t smr; uint8_t brr; - if ( c_cflag & CBAUD ) + if ( spd ) { - if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 ) + if ( _sci_get_brparms( spd, &smr, &brr ) != 0 ) return -1; } @@ -351,7 +353,7 @@ rtems_device_driver sh_sci_open( /* set up SCI registers */ write8(0x00, sci_device[minor].addr + SCI_SCR); /* Clear SCR */ /* set SMR and BRR */ - _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags ); + _sci_set_cflags( &sci_device[minor], sci_device[minor].cflags, sci_device[minor].spd ); for (a=0; a < 10000L; a++) { /* Delay */ __asm__ volatile ("nop"); @@ -526,7 +528,7 @@ static ssize_t _sh_sci_poll_write(int minor, const char *buf, size_t len) */ static int _sh_sci_set_attributes( int minor, const struct termios *t) { - return _sci_set_cflags( &sci_device[ minor ], t->c_cflag); + return _sci_set_cflags( &sci_device[ minor ], t->c_cflag, t->c_ospeed); } diff --git a/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c b/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c index db9040e409..5d588065af 100644 --- a/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c +++ b/c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c @@ -59,7 +59,7 @@ * Automatically generated function imported from scitab.rel */ extern int _sci_get_brparms( - tcflag_t cflag, + speed_t spd, unsigned char *smr, unsigned char *brr ); @@ -77,9 +77,10 @@ int sh_sci_set_attributes( int a; tcflag_t c_cflag = t->c_cflag; + speed_t spd = t->c_ospeed; - if ( c_cflag & CBAUD ) { - if ( _sci_get_brparms( c_cflag, &smr, &brr ) != 0 ) + if ( spd ) { + if ( _sci_get_brparms( spd, &smr, &brr ) != 0 ) return -1 ; } |