summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2002-03-08 12:12:46 +0000
committernyan <nyan@FreeBSD.org>2002-03-08 12:12:46 +0000
commita3f87581b9f85585a53a537d8cb92cf7f6b89e80 (patch)
tree1d68188e03cfa6ade8218a4128cd17c6ff90563f /sys/pc98
parent0e60fb334d8aa971ba676796d24d7b70218dceab (diff)
downloadFreeBSD-src-a3f87581b9f85585a53a537d8cb92cf7f6b89e80.zip
FreeBSD-src-a3f87581b9f85585a53a537d8cb92cf7f6b89e80.tar.gz
- The pc98_ttspeedtab() function returns an error status instead of a divisor,
and sets a divisor to the third argument. - The second argument of the pc98_set_baud_rate() function is changed from int to u_int.
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/cbus/sio.c32
-rw-r--r--sys/pc98/pc98/sio.c32
2 files changed, 32 insertions, 32 deletions
diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c
index 9d05403..4a455e3 100644
--- a/sys/pc98/cbus/sio.c
+++ b/sys/pc98/cbus/sio.c
@@ -472,10 +472,10 @@ static int com_tiocm_get __P((struct com_s *com));
static int com_tiocm_get_delta __P((struct com_s *com));
static void pc98_msrint_start __P((dev_t dev));
static void com_cflag_and_speed_set __P((struct com_s *com, int cflag, int speed));
-static int pc98_ttspeedtab __P((struct com_s *com, int speed));
+static int pc98_ttspeedtab __P((struct com_s *com, int speed, u_int *divisor));
static int pc98_get_modem_status __P((struct com_s *com));
static timeout_t pc98_check_msr;
-static void pc98_set_baud_rate __P((struct com_s *com, int count));
+static void pc98_set_baud_rate __P((struct com_s *com, u_int count));
static void pc98_i8251_reset __P((struct com_s *com, int mode, int command));
static void pc98_disable_i8251_interrupt __P((struct com_s *com, int mod));
static void pc98_enable_i8251_interrupt __P((struct com_s *com, int mod));
@@ -3210,8 +3210,7 @@ comparam(tp, t)
cfcr = 0;
if (IS_8251(com->pc98_if_type)) {
- divisor = (int) pc98_ttspeedtab(com, t->c_ospeed);
- if ((int)divisor < 0)
+ if (pc98_ttspeedtab(com, t->c_ospeed, &divisor) != 0)
return (EINVAL);
} else {
#endif
@@ -4736,11 +4735,12 @@ pc98_check_sysclock(void)
static void
com_cflag_and_speed_set( struct com_s *com, int cflag, int speed)
{
- int cfcr=0, count;
+ int cfcr=0;
int previnterrupt;
+ u_int count;
- count = pc98_ttspeedtab( com, speed );
- if ( count < 0 ) return;
+ if (pc98_ttspeedtab(com, speed, &count) != 0)
+ return;
previnterrupt = pc98_check_i8251_interrupt(com);
pc98_disable_i8251_interrupt( com, IEN_Tx|IEN_TxEMP|IEN_Rx );
@@ -4788,7 +4788,7 @@ com_cflag_and_speed_set( struct com_s *com, int cflag, int speed)
}
static int
-pc98_ttspeedtab(struct com_s *com, int speed)
+pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor)
{
int if_type, effect_sp, count = -1, mod;
@@ -4829,12 +4829,10 @@ pc98_ttspeedtab(struct com_s *com, int speed)
case COM_IF_IND_SS_2:
case COM_IF_PIO9032B_1:
case COM_IF_PIO9032B_2:
- if ( speed == 0 ) return 0;
count = ttspeedtab( speed, if_8251_type[if_type].speedtab );
break;
case COM_IF_B98_01_1:
case COM_IF_B98_01_2:
- if ( speed == 0 ) return 0;
count = ttspeedtab( speed, if_8251_type[if_type].speedtab );
#ifdef B98_01_OLD
if (count == 0 || count == 1) {
@@ -4845,11 +4843,15 @@ pc98_ttspeedtab(struct com_s *com, int speed)
break;
}
- return count;
+ if (count < 0)
+ return count;
+
+ *divisor = (u_int) count;
+ return 0;
}
static void
-pc98_set_baud_rate( struct com_s *com, int count )
+pc98_set_baud_rate( struct com_s *com, u_int count )
{
int if_type, io, s;
@@ -4867,11 +4869,9 @@ pc98_set_baud_rate( struct com_s *com, int count )
}
}
- if ( count < 0 ) {
- printf( "[ Illegal count : %d ]", count );
- return;
- } else if ( count == 0 )
+ if (count == 0)
return;
+
/* set i8253 */
s = splclock();
if (count != 3)
diff --git a/sys/pc98/pc98/sio.c b/sys/pc98/pc98/sio.c
index 9d05403..4a455e3 100644
--- a/sys/pc98/pc98/sio.c
+++ b/sys/pc98/pc98/sio.c
@@ -472,10 +472,10 @@ static int com_tiocm_get __P((struct com_s *com));
static int com_tiocm_get_delta __P((struct com_s *com));
static void pc98_msrint_start __P((dev_t dev));
static void com_cflag_and_speed_set __P((struct com_s *com, int cflag, int speed));
-static int pc98_ttspeedtab __P((struct com_s *com, int speed));
+static int pc98_ttspeedtab __P((struct com_s *com, int speed, u_int *divisor));
static int pc98_get_modem_status __P((struct com_s *com));
static timeout_t pc98_check_msr;
-static void pc98_set_baud_rate __P((struct com_s *com, int count));
+static void pc98_set_baud_rate __P((struct com_s *com, u_int count));
static void pc98_i8251_reset __P((struct com_s *com, int mode, int command));
static void pc98_disable_i8251_interrupt __P((struct com_s *com, int mod));
static void pc98_enable_i8251_interrupt __P((struct com_s *com, int mod));
@@ -3210,8 +3210,7 @@ comparam(tp, t)
cfcr = 0;
if (IS_8251(com->pc98_if_type)) {
- divisor = (int) pc98_ttspeedtab(com, t->c_ospeed);
- if ((int)divisor < 0)
+ if (pc98_ttspeedtab(com, t->c_ospeed, &divisor) != 0)
return (EINVAL);
} else {
#endif
@@ -4736,11 +4735,12 @@ pc98_check_sysclock(void)
static void
com_cflag_and_speed_set( struct com_s *com, int cflag, int speed)
{
- int cfcr=0, count;
+ int cfcr=0;
int previnterrupt;
+ u_int count;
- count = pc98_ttspeedtab( com, speed );
- if ( count < 0 ) return;
+ if (pc98_ttspeedtab(com, speed, &count) != 0)
+ return;
previnterrupt = pc98_check_i8251_interrupt(com);
pc98_disable_i8251_interrupt( com, IEN_Tx|IEN_TxEMP|IEN_Rx );
@@ -4788,7 +4788,7 @@ com_cflag_and_speed_set( struct com_s *com, int cflag, int speed)
}
static int
-pc98_ttspeedtab(struct com_s *com, int speed)
+pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor)
{
int if_type, effect_sp, count = -1, mod;
@@ -4829,12 +4829,10 @@ pc98_ttspeedtab(struct com_s *com, int speed)
case COM_IF_IND_SS_2:
case COM_IF_PIO9032B_1:
case COM_IF_PIO9032B_2:
- if ( speed == 0 ) return 0;
count = ttspeedtab( speed, if_8251_type[if_type].speedtab );
break;
case COM_IF_B98_01_1:
case COM_IF_B98_01_2:
- if ( speed == 0 ) return 0;
count = ttspeedtab( speed, if_8251_type[if_type].speedtab );
#ifdef B98_01_OLD
if (count == 0 || count == 1) {
@@ -4845,11 +4843,15 @@ pc98_ttspeedtab(struct com_s *com, int speed)
break;
}
- return count;
+ if (count < 0)
+ return count;
+
+ *divisor = (u_int) count;
+ return 0;
}
static void
-pc98_set_baud_rate( struct com_s *com, int count )
+pc98_set_baud_rate( struct com_s *com, u_int count )
{
int if_type, io, s;
@@ -4867,11 +4869,9 @@ pc98_set_baud_rate( struct com_s *com, int count )
}
}
- if ( count < 0 ) {
- printf( "[ Illegal count : %d ]", count );
- return;
- } else if ( count == 0 )
+ if (count == 0)
return;
+
/* set i8253 */
s = splclock();
if (count != 3)
OpenPOWER on IntegriCloud