Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sh3/dev - fix \n conversion from \n\r to \r\n
details: https://anonhg.NetBSD.org/src/rev/63db0835c407
branches: trunk
changeset: 499562:63db0835c407
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Nov 22 21:14:25 2000 +0000
description:
- fix \n conversion from \n\r to \r\n
- cleanup
diffstat:
sys/arch/sh3/dev/sci.c | 103 ++++++-----------------------------------------
sys/arch/sh3/dev/scif.c | 54 ++++++------------------
2 files changed, 27 insertions(+), 130 deletions(-)
diffs (truncated from 337 to 300 lines):
diff -r c13486ad8285 -r 63db0835c407 sys/arch/sh3/dev/sci.c
--- a/sys/arch/sh3/dev/sci.c Wed Nov 22 21:14:24 2000 +0000
+++ b/sys/arch/sh3/dev/sci.c Wed Nov 22 21:14:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sci.c,v 1.10 2000/11/02 00:42:40 eeh Exp $ */
+/* $NetBSD: sci.c,v 1.11 2000/11/22 21:14:25 msaitoh Exp $ */
/*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@@ -275,11 +275,9 @@
#define USART_ON (unsigned int)~0x08
static void WaitFor __P((int));
-void PutcSci __P((unsigned char));
-void PutStrSci __P((unsigned char *));
+void sci_putc __P((unsigned char));
+unsigned char sci_getc __P((void));
int SciErrCheck __P((void));
-unsigned char GetcSci __P((void));
-int GetStrSci __P((unsigned char *, int));
/*
* WaitFor
@@ -346,14 +344,17 @@
/*
- * PutcSci
+ * sci_putc
* : unsigned char c;
*/
void
-PutcSci(c)
+sci_putc(c)
unsigned char c;
{
+ if (c == '\n')
+ sci_putc('\r');
+
/* wait for ready */
while ((SHREG_SCSSR & SCSSR_TDRE) == NULL)
;
@@ -363,35 +364,6 @@
/* clear ready flag */
SHREG_SCSSR &= ~SCSSR_TDRE;
-
- if (c == '\n') {
- while ((SHREG_SCSSR & SCSSR_TDRE) == NULL)
- ;
-
- SHREG_SCTDR = '\r';
-
- SHREG_SCSSR &= ~SCSSR_TDRE;
- }
-}
-
-/*
- * PutStrSci
- * : unsigned char *s;
- */
-void
-PutStrSci(s)
- unsigned char *s;
-{
-#if 0
- static int SciInit = 0;
- if (SciInit == 0) {
- InitializeSci(scicn_speed);
- SciInit = 1;
- }
-#endif
-
- while (*s)
- PutcSci(*s++);
}
/*
@@ -408,10 +380,10 @@
}
/*
- * GetcSci
+ * sci_getc
*/
unsigned char
-GetcSci(void)
+sci_getc(void)
{
unsigned char c, err_c;
@@ -430,32 +402,6 @@
return(c);
}
-/*
- * GetStrSci
- * : unsigned char *s;
- * : int size;
- */
-int
-GetStrSci(s, size)
- unsigned char *s;
- int size;
-{
-
- for(; size ; size--) {
- *s = GetcSci();
- if (*s & 0x80)
- return -1;
- if (*s == CR) {
- *s = 0;
- break;
- }
- s++;
- }
- if (size == 0)
- *s = 0;
- return 0;
-}
-
#if 0
#define SCI_MAX_UNITS 2
#else
@@ -586,7 +532,7 @@
/* Output the first byte of the contiguous buffer. */
{
if (sc->sc_tbc > 0) {
- PutcSci(*(sc->sc_tba));
+ sci_putc(*(sc->sc_tba));
sc->sc_tba++;
sc->sc_tbc--;
}
@@ -735,23 +681,6 @@
}
}
-int sci_getc __P((void));
-void sci_putc __P((int));
-
-int
-sci_getc()
-{
-
- return (GetcSci());
-}
-
-void
-sci_putc(int c)
-{
-
- PutcSci(c);
-}
-
int
sciopen(dev, flag, mode, p)
dev_t dev;
@@ -1457,7 +1386,7 @@
/* Output the next chunk of the contiguous buffer, if any. */
if (sc->sc_tbc > 0) {
- PutcSci(*(sc->sc_tba));
+ sci_putc(*(sc->sc_tba));
sc->sc_tba++;
sc->sc_tbc--;
} else {
@@ -1515,9 +1444,6 @@
#endif
}
-#define sci_gets GetStrSci
-#define sci_puts PutStrSci
-
void
scicninit(cp)
struct consdev *cp;
@@ -1527,9 +1453,6 @@
sciisconsole = 1;
}
-#define sci_getc GetcSci
-#define sci_putc PutcSci
-
int
scicngetc(dev)
dev_t dev;
@@ -1552,6 +1475,6 @@
int s;
s = splserial();
- sci_putc(c);
+ sci_putc((u_char)c);
splx(s);
}
diff -r c13486ad8285 -r 63db0835c407 sys/arch/sh3/dev/scif.c
--- a/sys/arch/sh3/dev/scif.c Wed Nov 22 21:14:24 2000 +0000
+++ b/sys/arch/sh3/dev/scif.c Wed Nov 22 21:14:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scif.c,v 1.13 2000/11/02 00:42:40 eeh Exp $ */
+/* $NetBSD: scif.c,v 1.14 2000/11/22 21:14:25 msaitoh Exp $ */
/*-
* Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved.
@@ -276,9 +276,9 @@
#define USART_ON (unsigned int)~0x08
static void WaitFor __P((int));
-void PutcScif __P((unsigned char));
+void scif_putc __P((unsigned char));
+unsigned char scif_getc __P((void));
int ScifErrCheck __P((void));
-unsigned char GetcScif __P((void));
/*
* WaitFor
@@ -352,15 +352,18 @@
/*
- * PutcScif
+ * scif_putc
* : unsigned char c;
*/
void
-PutcScif(c)
+scif_putc(c)
unsigned char c;
{
+ if (c == '\n')
+ scif_putc('\r');
+
/* wait for ready */
while ((SHREG_SCFDR2 & SCFDR2_TXCNT) == SCFDR2_TXF_FULL)
;
@@ -370,15 +373,6 @@
/* clear ready flag */
SHREG_SCSSR2 &= ~(SCSSR2_TDFE | SCSSR2_TEND);
-
- if (c == '\n') {
- while ((SHREG_SCFDR2 & SCFDR2_TXCNT) == SCFDR2_TXF_FULL)
- ;
-
- SHREG_SCFTDR2 = '\r';
-
- SHREG_SCSSR2 &= ~(SCSSR2_TDFE | SCSSR2_TEND);
- }
}
/*
@@ -395,12 +389,12 @@
}
/*
- * GetcScif
+ * scif_getc
*/
#if 0
/* Old code */
unsigned char
-GetcScif(void)
+scif_getc(void)
{
unsigned char c, err_c;
@@ -420,7 +414,7 @@
}
#else
unsigned char
-GetcScif(void)
+scif_getc(void)
{
unsigned char c, err_c;
@@ -582,7 +576,7 @@
n = max;
for (i = 0; i < n; i++) {
- PutcScif(*(sc->sc_tba));
+ scif_putc(*(sc->sc_tba));
sc->sc_tba++;
}
sc->sc_tbc -= n;
@@ -738,23 +732,6 @@
}
}
-int scif_getc __P((void));
-void scif_putc __P((int));
-
-int
-scif_getc()
-{
-
- return (GetcScif());
-}
-
Home |
Main Index |
Thread Index |
Old Index