split sscomintr() to sscomtxintr() and sscomrxintr().
This commit is contained in:
parent
5b3551df93
commit
eb6fd47108
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: sscom.c,v 1.8 2003/07/15 00:24:49 lukem Exp $ */
|
||||
/* $NetBSD: sscom.c,v 1.9 2003/07/31 19:08:10 bsh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Fujitsu Component Limited
|
||||
* Copyright (c) 2002 Genetec Corporation
|
||||
* Copyright (c) 2002, 2003 Fujitsu Component Limited
|
||||
* Copyright (c) 2002, 2003 Genetec Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -109,7 +109,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.8 2003/07/15 00:24:49 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.9 2003/07/31 19:08:10 bsh Exp $");
|
||||
|
||||
#include "opt_sscom.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -279,15 +279,14 @@ void sscom_kgdb_putc (void *, int);
|
||||
|
||||
|
||||
static __inline void
|
||||
sscom_output_chunk( struct sscom_softc *sc )
|
||||
__sscom_output_chunk(struct sscom_softc *sc, int ufstat)
|
||||
{
|
||||
int n, space;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
bus_space_handle_t ioh = sc->sc_ioh;
|
||||
|
||||
n = sc->sc_tbc;
|
||||
space = 16 - ((bus_space_read_2(iot, ioh, SSCOM_UFSTAT) &
|
||||
UFSTAT_TXCOUNT) >> UFSTAT_TXCOUNT_SHIFT);
|
||||
space = 16 - ((ufstat & UFSTAT_TXCOUNT) >> UFSTAT_TXCOUNT_SHIFT);
|
||||
|
||||
if (n > space)
|
||||
n = space;
|
||||
@ -299,7 +298,14 @@ sscom_output_chunk( struct sscom_softc *sc )
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sscom_output_chunk(struct sscom_softc *sc)
|
||||
{
|
||||
int ufstat = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SSCOM_UFSTAT);
|
||||
|
||||
if (!(ufstat & UFSTAT_TXFULL))
|
||||
__sscom_output_chunk(sc, ufstat);
|
||||
}
|
||||
|
||||
int
|
||||
sscomspeed(long speed, long frequency)
|
||||
@ -949,7 +955,7 @@ tiocm_to_sscom(struct sscom_softc *sc, u_long how, int ttybits)
|
||||
break;
|
||||
|
||||
case TIOCMSET:
|
||||
CLR(sc->sc_umcon, UMCON_DTR|UMCON_RTS);
|
||||
CLR(sc->sc_umcon, UMCON_DTR);
|
||||
SET(sc->sc_umcon, sscombits);
|
||||
break;
|
||||
}
|
||||
@ -1548,7 +1554,7 @@ sscomsoft(void *arg)
|
||||
|
||||
|
||||
int
|
||||
sscomintr(void *arg)
|
||||
sscomrxintr(void *arg)
|
||||
{
|
||||
struct sscom_softc *sc = arg;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
@ -1576,6 +1582,7 @@ sscomintr(void *arg)
|
||||
|
||||
if ( (ufstat & (UFSTAT_RXCOUNT|UFSTAT_RXFULL)) &&
|
||||
!ISSET(sc->sc_rx_flags, RX_IBUF_OVERFLOWED)) {
|
||||
|
||||
while (cc > 0) {
|
||||
int cn_trapped = 0;
|
||||
|
||||
@ -1647,11 +1654,12 @@ sscomintr(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
msts = sc->read_modem_status(sc);
|
||||
delta = msts ^ sc->sc_msts;
|
||||
sc->sc_msts = msts;
|
||||
|
||||
#if 0
|
||||
#ifdef notyet
|
||||
/*
|
||||
* Pulse-per-second (PSS) signals on edge of DCD?
|
||||
* Process these even if line discipline is ignoring DCD.
|
||||
@ -1739,32 +1747,72 @@ sscomintr(void *arg)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* See if data can be transmitted as well. Schedule tx
|
||||
* done event if no data left and tty was marked busy.
|
||||
} while (0);
|
||||
|
||||
SSCOM_UNLOCK(sc);
|
||||
|
||||
/* Wake up the poller. */
|
||||
softintr_schedule(sc->sc_si);
|
||||
|
||||
#if NRND > 0 && defined(RND_COM)
|
||||
rnd_add_uint32(&sc->rnd_source, iir | rsr);
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
sscomtxintr(void *arg)
|
||||
{
|
||||
struct sscom_softc *sc = arg;
|
||||
bus_space_tag_t iot = sc->sc_iot;
|
||||
bus_space_handle_t ioh = sc->sc_ioh;
|
||||
uint16_t ufstat;
|
||||
|
||||
if (SSCOM_ISALIVE(sc) == 0)
|
||||
return 0;
|
||||
|
||||
SSCOM_LOCK(sc);
|
||||
|
||||
ufstat = bus_space_read_2(iot, ioh, SSCOM_UFSTAT);
|
||||
|
||||
/*
|
||||
* If we've delayed a parameter change, do it
|
||||
* now, and restart * output.
|
||||
*/
|
||||
if (sc->sc_heldchange && (ufstat & UFSTAT_TXCOUNT) == 0) {
|
||||
/* XXX: we should check transmitter empty also */
|
||||
sscom_loadchannelregs(sc);
|
||||
sc->sc_heldchange = 0;
|
||||
sc->sc_tbc = sc->sc_heldtbc;
|
||||
sc->sc_heldtbc = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* See if data can be transmitted as well. Schedule tx
|
||||
* done event if no data left and tty was marked busy.
|
||||
*/
|
||||
if (!ISSET(ufstat,UFSTAT_TXFULL)) {
|
||||
/*
|
||||
* Output the next chunk of the contiguous
|
||||
* buffer, if any.
|
||||
*/
|
||||
if (!ISSET(ufstat,UFSTAT_TXFULL)) {
|
||||
/*
|
||||
* Output the next chunk of the contiguous
|
||||
* buffer, if any.
|
||||
if (sc->sc_tbc > 0) {
|
||||
__sscom_output_chunk(sc, ufstat);
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Disable transmit sscompletion
|
||||
* interrupts if necessary.
|
||||
*/
|
||||
if (sc->sc_tbc > 0) {
|
||||
sscom_output_chunk(sc);
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* Disable transmit sscompletion
|
||||
* interrupts if necessary.
|
||||
*/
|
||||
if (sc->sc_hwflags & SSCOM_HW_TXINT)
|
||||
sscom_disable_txint(sc);
|
||||
if (sc->sc_tx_busy) {
|
||||
sc->sc_tx_busy = 0;
|
||||
sc->sc_tx_done = 1;
|
||||
}
|
||||
if (sc->sc_hwflags & SSCOM_HW_TXINT)
|
||||
sscom_disable_txint(sc);
|
||||
if (sc->sc_tx_busy) {
|
||||
sc->sc_tx_busy = 0;
|
||||
sc->sc_tx_done = 1;
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
}
|
||||
|
||||
SSCOM_UNLOCK(sc);
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: sscom_s3c2800.c,v 1.4 2003/07/15 00:24:49 lukem Exp $ */
|
||||
/* $NetBSD: sscom_s3c2800.c,v 1.5 2003/07/31 19:08:10 bsh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Fujitsu Component Limited
|
||||
* Copyright (c) 2002 Genetec Corporation
|
||||
* Copyright (c) 2002, 2003 Fujitsu Component Limited
|
||||
* Copyright (c) 2002, 2003 Genetec Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sscom_s3c2800.c,v 1.4 2003/07/15 00:24:49 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sscom_s3c2800.c,v 1.5 2003/07/31 19:08:10 bsh Exp $");
|
||||
|
||||
#include "opt_sscom.h"
|
||||
#include "opt_ddb.h"
|
||||
@ -99,29 +99,6 @@ sscom_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
return unit == 0 || unit == 1;
|
||||
}
|
||||
|
||||
int tx_int(void *);
|
||||
int rx_int(void *);
|
||||
int err_int(void *);
|
||||
|
||||
int
|
||||
tx_int(void *arg)
|
||||
{
|
||||
return sscomintr(arg);
|
||||
}
|
||||
|
||||
int
|
||||
rx_int(void *arg)
|
||||
{
|
||||
return sscomintr(arg);
|
||||
}
|
||||
|
||||
int
|
||||
err_int(void *arg)
|
||||
{
|
||||
return sscomintr(arg);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sscom_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
@ -147,11 +124,11 @@ sscom_attach(struct device *parent, struct device *self, void *aux)
|
||||
printf("\n");
|
||||
|
||||
s3c2800_intr_establish(s3c2800_uart_config[unit].tx_int,
|
||||
IPL_SERIAL, IST_LEVEL, tx_int, sc);
|
||||
IPL_SERIAL, IST_LEVEL, sscomtxintr, sc);
|
||||
s3c2800_intr_establish(s3c2800_uart_config[unit].rx_int,
|
||||
IPL_SERIAL, IST_LEVEL, rx_int, sc);
|
||||
IPL_SERIAL, IST_LEVEL, sscomrxintr, sc);
|
||||
s3c2800_intr_establish(s3c2800_uart_config[unit].err_int,
|
||||
IPL_SERIAL, IST_LEVEL, err_int, sc);
|
||||
IPL_SERIAL, IST_LEVEL, sscomrxintr, sc);
|
||||
sscom_disable_txrxint(sc);
|
||||
|
||||
sscom_attach_subr(sc);
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: sscom_var.h,v 1.3 2003/06/23 11:01:09 martin Exp $ */
|
||||
/* $NetBSD: sscom_var.h,v 1.4 2003/07/31 19:08:10 bsh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Fujitsu Component Limited
|
||||
* Copyright (c) 2002 Genetec Corporation
|
||||
* Copyright (c) 2002, 2003 Fujitsu Component Limited
|
||||
* Copyright (c) 2002, 2003 Genetec Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -227,7 +227,8 @@ int sscomparam(struct tty *, struct termios *);
|
||||
int sscomread(dev_t, struct uio *, int);
|
||||
void sscom_config(struct sscom_softc *);
|
||||
|
||||
int sscomintr(void *);
|
||||
int sscomtxintr(void *);
|
||||
int sscomrxintr(void *);
|
||||
|
||||
int sscom_cnattach(bus_space_tag_t, const struct sscom_uart_info *,
|
||||
int, int, tcflag_t);
|
||||
|
Loading…
Reference in New Issue
Block a user