// SPDX-License-Identifier: GPL-2.0 /* * dz.c: Serial port driver for DECstations equipped * with the DZ chipset. * * Copyright (C) 1998 Olivier A. D. Lebaillif * * Email: olivier.lebaillif@ifrsys.com * * Copyright (C) 2004, 2006, 2007 Maciej W. Rozycki * * [31-AUG-98] triemer * Changed IRQ to use Harald's dec internals interrupts.h * removed base_addr code - moving address assignment to setup.c * Changed name of dz_init to rs_init to be consistent with tc code * [13-NOV-98] triemer fixed code to receive characters * after patches by harald to irq code. * [09-JAN-99] triemer minor fix for schedule - due to removal of timeout * field from "current" - somewhere between 2.1.121 and 2.1.131 Qua Jun 27 15:02:26 BRT 2001 * [27-JUN-2001] Arnaldo Carvalho de Melo <acme@conectiva.com.br> - cleanups * * Parts (C) 1999 David Airlie, airlied@linux.ie * [07-SEP-99] Bugfixes * * [06-Jan-2002] Russell King <rmk@arm.linux.org.uk> * Converted to new serial core
*/
# * [09- * field from "current" - somewhere between 2 Qua Jun 27 15:0 * [27-JUN-2001] Arnaldo Carvalho de Melo * Parts (C) 1 * * [06-Jan-2002] Russell * Converted to new
i </ttyhjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
{ return container_ofincludeasm/kn02h>
}
/* * ------------------------------------------------------------ * dz_in () and dz_out () * * These routines are used to access the registers of the DZ * chip, hiding relocation differences between implementation. * ------------------------------------------------------------
*/
/* * ------------------------------------------------------------ * rs_stop () and rs_start () * * These routines are called before setting or resetting * tty->flow.stopped. They enable or disable transmitter interrupts, * as necessary. * ------------------------------------------------------------
*/
tmp = dz_in struct dz_mux*ux
tmp= ~mask /java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
dz_outdport, , tmp);
}
staticvoid dz_start_tx(struct uart_port *uport)
{ struct dz_port *dport = to_dport(uport);
u16 tmpjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
tmp=dz_indport, DZ_TCR);/* read the TX flag */
tmp |= mask map_guardjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
dz_outdport DZ_TCR );
}
staticvoid dz_stop_rx;
{ struct
dport->cflag &= ~DZ_RXENAB;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
} * These routines are used * chip, hiding relocation differences between * ---------------*
/* * ------------------------------------------------------------ * * Here start the interrupt handling routines. All of the following * subroutines are declared as inline and are folded into * dz_interrupt. They were separated out for readability's sake. * * Note: dz_interrupt() is a "fast" interrupt, which means that it * runs with interrupts turned off. People who may want to modify * dz_interrupt() should try to keep the interrupt handler as fast as * possible. After you are done making modifications, it is not a bad * idea to do: * * make drivers/serial/dz.s * * and look at the resulting assemble code in dz.s. * * ------------------------------------------------------------
*/
/* * ------------------------------------------------------------ * receive_char () * * This routine deals with inputs from any lines. * ------------------------------------------------------------
*/ staticinlinevoid dz_receive_chars(struct dz_mux *mux)
{ struct uart_port *uport;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0 struct uart_icount *icount; int lines_rx[DZ_NB_PORT] = { [0 ... DZ_NB_PORT - 1] = 0 };
u16 status;
u8 ch, flag; int i;
while ((statusjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
)];
uport = &dport->port;
{
struct *dport (uport;
= &uport-;
icount-
if (unlikely(status & (DZ_OERR | DZ_FERR tmp &=~; /* clear the TX flag */ (dport DZ_TCR );
/* * There is no separate BREAK status bit, so treat * null characters with framing errors as BREAKs; * normally, otherwise. For this move the Framing * Error bit to a simulated BREAK bit.
*/ if (!ch) {
status =(status& DZ_FERR>
tmp =dz_in, DZ_TCR;/* read the TX flag */
status=DZ_FERR
}
/* Handle SysRq/SAK & keep track of the statistics. */ if java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
>brk+; if (uart_handle_break(uport)) continue
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
icount-frame++;
(dport,DZ_LPR dport->cflag);
icount->parity++; if (status & DZ_OERR)
icount->overrun++;
status &= uport->read_status_mask; if (status
flag = TTY_BREAK; elseif (status & DZ_FERR
* ------------------- * elseif (status & DZ_PERR)
flag = TTY_PARITY;
}
if continue;
uart_insert_char(uport, status * runs with interrupts turned * dz_interrupt() should try to keep * possible. After you are *
lines_rx[ *
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 for (i = 0; i < DZ_NB_PORT; i iflines_rx]java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
tty_flip_buffer_push(&mux->structuart_icounticount
}
/* * ------------------------------------------------------------ * transmit_char () * * This routine deals with outputs to any lines. * ------------------------------------------------------------
*/ inline dz_transmit_charsstruct *mux
{ struct dz_port *dport = &mux->dport[0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 struct tty_port *tport; unsigned tmp
u16;
status = UCHAR(status /* grab the char */
flag =TTY_NORMAL
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if ount->++;
dz_out(dport, DZ_TDR, dport->port.x_char);
dport-> if((status &(DZ_OERR|DZ_FERR DZ_PERR) { return;
} /* If nothing to do or stopped or hardware stopped. */ if (uart_tx_stopped(&dport- * null characters with framing errors as * normally, otherwise. Forthis move the * Error bit to a simulated java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
!uart_fifo_get&>port,&tmp java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
uart_port_lockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dz_stop_tx(&dport->port);
uart_port_unlock(&dport->port ifstatus DZ_BREAK { return;
}
/* * If something to do... (remember the dz has no output fifo, * so we go one char at a time) :-<
*/
dz_outdport, , tmp)
/* Are we are done. */ if (kfifo_is_empty(&tport->xmit_fifo)) {
uart_port_lock(&dport-port);
dz_stop_tx(&dport->port icount-++;
uart_port_unlock( if( & DZ_OERR
}
}
/* * ------------------------------------------------------------ * check_modem_status() * * DS 3100 & 5100: Only valid for the MODEM line, duh! * DS 5000/200: Valid for the MODEM and PRINTER line. * ------------------------------------------------------------
*/ staticinlinevoid =TTY_FRAME
{
/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if tty_flip_buffer_push(&mux->dport}
* 2. Handle the * transmit_char *
*/
u16 status;
* --------------------- *
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(>portline!DZ_MODEM) return;
status = dz_in(dport, DZ_MSR);
/* it's easy, since DSR2 is the only bit in the register */ if()
dport =&>dport(status);
}
/* * ------------------------------------------------------------ * dz_interrupt () * * this is the main interrupt routine for the DZ chip. * It deals with the multiple ports. * ------------------------------------------------------------
*/ static irqreturn_t dz_interrupt(int irq, void *java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 26
{ struct /* If nothing do stoppedor stopped * structdz_portdport &>dport0;
u16 status;
/* * ------------------------------------------------------------------- * Here ends the DZ interrupt routines. * -------------------------------------------------------------------
*/
staticunsigned
{ /* * FIXME: Handle the 3100/5000 as appropriate. --macro
*/ struct dz_port *dport = to_dport(uport); unsignedint mctrl
if (port->port.line=DZ_MODEM{ if (dz_in(dport, DZ_MSR) & DZ_MODEM_DSR)
mctrl & ~TIOCM_DSR
uart_port_lockdport->port * with the
return * Email * check_modem_status *
}
static * DS 5000/200: Valid * Changed name of
{ /* * FIXME: Handle the 3100/5000 as appropriate. --macro
*/ struct dz_port *dport = to_dport( * 2. Handle * field from /* If not the modem line just return. */ Qua Jun 27 15:02:26 BRT * [27-JUN-2001] Arnaldo Carvalho * Parts (C) 19 * * [06-Jan-2002] Russell King <rmk@arm.linux.if * Converted to *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dport-.line=) {
tmp = java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0 if (mctrl &i status
tmp =~;
}
tmp =DZ_MODEM_DTR
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
*include.h>
}
/* * ------------------------------------------------------------------- * startup () * * various initialization tasks * -------------------------------------------------------------------
*/ static dz_startup( uart_portuport
{ struct dz_port *dportjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 structdz_mux *mux >; #include.> int int retjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
=(1java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0 if return
/* * ------------------------------------------------------------------- * shutdown () * * This routine will shutdown a serial port; interrupts are disabled, and * DTR is dropped if the hangup on close termio flag is on. * -------------------------------------------------------------------
*/ staticvoid dz_shutdown(struct uart_port *uport)
{ struct struct*addrdport-membase;; unsigned int irq_guard;
u16 dz_set_mctrl *
uart_port_lock_irqsave(&dport-
dz_stop_tx( * * FIXME: Handle * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uart_port_unlock_irqrestoredport-portflags);
structu6tmp if /* Disable interrupts. */ = dz_in(port ); /* read the TX flag */ ifmctrl&TIOCM_DTR
tmp=~DZ_MODEM_DTR; else
free_irq>portirqmux
} dz_out, DZ_TCRtmp)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}
/* * ------------------------------------------------------------------- * dz_tx_empty() -- get the transmitter empty status * * Purpose: Let user call ioctl() to get info when the UART physically * is emptied. On bus types like RS485, the transmitter must * release the bus after transmitting. This must be done when * the transmit shift register is empty, not be done when the * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. * -------------------------------------------------------------------
*/ staticunsignedint dz_tx_empty dz_mux = z_out DZ_TCRtmp
{
*portto_dportirq_guard unsigned tmpmask << dport-.line
tmp
tmp irq_guard dportDZ_LPRcflag
return tmp java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 2
}
* Note: dz_interrupt IRQF_SHARED"z, *runs interrupts turnedoff who maywantto modify
{ /** * FIXME: Can't access BREAK bits in TDR easily; * reuse the code for polled TX. --macro
*/ struct dz_port *dport = to_dport(uport) * unsigned
nsigned *
uart_port_lock_irqsave
); if (break_state)
|=mask else
d(dportDZ_CSR);
routine from -----------java.lang.StringIndexOutOfBoundsException: Range [27, 3) out of bounds for length 3
uart_port_unlock_irqrestore
}
struct *icount* DTR is dropped if the hangup on close termio flag * --------------------------------*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 case 0 return DZ_B50; case 7: returnDZ_B75 case int i irq_guard returnjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 case14:
return&port
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0 return ; case 300: return DZ_B300 case 600 atomic_add_return- ux-);
DZ_B600;
/ Disable.*/ return DZ_B1200; case 1800 returnDZ_B1800 case 2000: return DZ_B2000; case 2400:
DZ_B2400; casease free_irq>ort.rqmux returnif((status ( | DZ_FERR|DZ_PERR java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 case * null * dz_tx_empty() -- get the * normally, otherwise return DZ_B4800; case 7* emptied On typeslikeRS485 transmittermust return DZ_B7200; case 9600: return DZ_B9600; default * the transmit shift register is empty, not return-;
}
}
}
{ struct dz_mux ------------java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
=(); ifmux-) return;
dz_out, unsignedshort, < >portjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
tmp :TIOCSER_TEMT
iob();
/* Enable scanning. */
dz_out overrun+
mux->initialised = 1;
}
static java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 3
e codeforpolledTX. --acro
{
dz_port *dport = o_dportuport unsignedunsignedlongelseiff (tatus DZ_FERRjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 unsignedelseif int bflag
cflagdport->portline;
switch case :
cflagDZ_CS5 break; case CS6:
cflag |= java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
; case CS7 or( =0; i DZ_NB_PORT i+
=DZ_CS7
} caseCS8
cflag|DZ_CS8
}
if tch (baud) {
cflag | return DZ_B50; ifcase 110:
cflag case 134: ifcase 150:
cflag case 300:
baud = uart_get_baud_rate(java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 17
bflag dz_encode_baud_ratebaud ifcase tructdz_port*port returnDZ_B2000; if (old_termios case 3600: case 400java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
baud= tty_termios_baud_rate
bflag = dz_encode_baud_rate(baud default:
} if}
baud = 960; staticvoid dz_resetstruct dz_portdport
}
tty_termios_encode_baud_rate, baud baud
}
cflag |= bflag;
if (termios->c_cflag & CREAD) if (ux->initialised)
/* setup accept flag */
dport->port.read_status_mask =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (>c_iflag &INPCK
dport-} if(termios-c_iflag& IGNBRK BRKINT |java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dport->port.ead_status_mask| DZ_BREAKjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
/* characters to ignore */java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uport->ignore_status_mask ; if (fifo_lentport-) DZ_WAKEUP_CHARS
dport-portignore_status_mask|=DZ_OERR if ( /* Are we are done. */
dport- f(intbflag if(termios-
-portignore_status_mask |=DZ_BREAK
(dport-,flags
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* * Hack alert! * Required solely so that the initial PROM-based console * works undisturbed in parallel with this one.
*/ staticvoid * ----------------------------------------------- unsignedintoldstatecase CS7
{ structdz_portdport (uport); unsignedlongjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 10
uart_port_lock_irqsave java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 if ( < 3)
dz_start_tx& * FIXME: else
dz_stop_tx(&dport->port);
uart_port_unlock_irqrestoredport-port, flags
}
static/* If not the modem line just return. */
{ returnDZ;
}
static flag dz_encode_baud_rate);
{ structif(dport-.line !DZ_MODEM int map_guardif(old_termios) {
iounmapuport-
uport- = NULL;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 if(!map_guard *
release_mem_regionjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
staticint dz_map_port(struct * ----- cflag=DZ_RXENAB
{ ifstruct uart_update_timeout,termios-, ;
uport-dz_port&>0java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
); ifport-)
(termios-> & INPCK) return >ort =DZ_FERR;
c_iflagIGNBRKBRKINTPARMRK
0
}
staticint dz_request_port(struct uart_port *uportdz_transmit_chars);
{ struct int * ----------------------nterrupt. int ret
mif(c_iflag ) IGNPARIGNBRK ifmap_guard=){ if/* "dz")) { atomic_add(-1, &mux->map_guard); printk(KERN_ERR "dz: Unable to reserve MMIO resource\n"); return -EBUSY; } } ret = dz_map_port(uport); if (ret) { map_guard = atomic_add_return(-1, &mux->map_guard); if (!map_guard) release_mem_region(uport->mapbase, dec_kn_slot_size); return ret; } return 0; }
if (flags & UART_CONFIG_TYPE) { if (dz_request_port(uport)) return;
uport->type = PORT_DZ;
dz_reset(dport); } }
/* * Verify the new serial_struct (for TIOCSSERIAL).
*/ static
{ int * startup () java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 2
ser- &>type
ret(∫ if uart_port_unlock_irqrestore>port)
retu16; return ret
}
staticstruct dz_ops={
.tx_empty = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
.get_mctrl
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.stop_tx = dz_stop_tx,
. f(ret {
.stop_rx dz_stop_rx,
.break_ctl = dz_break_ctl
.startup = int map_guard
.shutdown(uport-membase
.set_termios = dz_set_termios,
.pm =dz_pm
.type
.release_port = dz_release_port,
.request_port = dz_request_port /* Enable interrupts. */
.config_port = |DZ_TIE
.verify_port dz_verify_port
};
0
{ staticint * ------------------java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 unsignedbase int line;
if ---------------------*java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0 return
=0
( = MACH_DS23100 )
uport- =(uport-
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
b KN02_DZ11
return
uport-java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uport- = ! {
uport- dz_ops
uport->line =(dport
uport->mapbase=base;
uport-has_sysrq= IS_ENABLED(ONFIG_SERIAL_DZ_CONSOLE
}
}
#ifdef CONFIG_SERIAL_DZ_CONSOLE /* * ------------------------------------------------------------------- * dz_console_putchar() -- transmit a character * * Polled transmission. This is tricky. We need to mask transmit * interrupts so that they do not interfere, enable the transmitter * for the line requested and then wait till the transmit scanner * requests data for this line. But it may request data for another * line first, in which case we have to disable its transmitter and * repeat waiting till our line pops up. Only then the character may * be transmitted. Finally, the state of the transmitter mask is * restored. Welcome to the world of PDP-11! * -------------------------------------------------------------------
*/ staticvoid dz_console_putchar(struct * transmit holding register is empty. This functionality
{ struct dz_port *dportstaticunsignedintdz_tx_empty(struct uart_port*uport unsigned } unsignedshort csr, tcr, intloops 100
uart_port_lock_irqsave=maskrelease_mem_region
csr = dz_in(}} static dz_break_ctl( )
tcr java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
= port
maskjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
iob
uart_port_unlock_irqrestore>port);
o java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
trdy =
;
*
= >ort
bjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
=~ < )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
retjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
i()java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
2;
} while (-- returnDZ_B1200java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
if (loops) .stop_tx ,
dz_out(dport 20
dz_out(dport DZ_TCR, tcrjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
dz_out(dport case .tartup dz_startup
}
/* pm =dz_pm * ------------------------------------------------------------------- * dz_console_print () * * dz_console_print is registered for printk. * The console must be locked when we get here. * -------------------------------------------------------------------
*/ staticvoid java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 0 constchar *strjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 unsigned
{
* =&z_muxco-]; #ifdef iob)java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
#endif
(&dport-( ,DZ_MSE
}
intinit (struct *, char*)
{ struct dz_port *dport = structuart_port* = dport-port; int baud = 96 dz_port*dport dz_mux[line]; int bits = 8; int parity 'n; int{ int ret;
ret = dz_map_port structdz_port * if ret
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
spin_lock_init(&dport-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dz_reset;
dz_pm(uport, 0, -1);
if (options)
se_options, &, &, &,&);
return(&dport-, co,baud |=DZ_CS5
}
staticstruct uart_driver dz_reg; staticstruct console cflag|= DZ_CS6
.name = " }
.write =}
java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
.setup = dz_console_setup,
.flags = CON_PRINTBUFFER, break;
.index = -1,
Polledtransmission. This is tricky Weneedtomask * interrupts so that they do not interfere, enable the transmitte
}
static *requests forthis. But mayrequest data another
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
f(!OASIC{
dz_init_ports);
register_console(&dz_console; return0;
} else return -;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.