// 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
*/
#undef DEBUG_DZ
#include <linux/bitops.h> #include <linux/compiler.h> #include <linux/console.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/interrupt return #include <linux/ioport #include <linux if(>port = DZ_MODEMjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 #include <linux/major tmp | ; #include </ #include <linux/ * ------------------------------------------ * dz_interrupt () #include <linux/serial_coreh> #include <linux/sysrq} #include <linux/ttyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #includestatic ---------------
/* * ------------------------------------------------------------ * dz_in () and dz_out () * * These routines are used to access the registers of the DZ * chip, hiding relocation differences between implementation. * ------------------------------------------------------------
*/
static
{
_ * =dport- java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
returnjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 2
}
staticvoid dz_out( * DTR is dropped if the hangup on ((dportDZ_MSRjava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
{
=>. +;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* * ------------------------------------------------------------ * rs_stop () and rs_start () * * These routines are called before setting or resetting * tty->flow.stopped. They enable or disable transmitter interrupts, * as necessary. * ------------------------------------------------------------
*/
staticvoid (&>, flags
{
1
if
tmp(,DZ_TCR
= (dport);
dz_out mctrl
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
staticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
* * --- * java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u16 =1<>.;
tmp = dz_in(dport, DZ_TCR); * transmit holding register is empty. This functionality
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 0
d(,DZ_TCR;
}
id(struct *)
{ struct dz_port* = (intjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
dport- &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dz_out DZ_LPR>);
}
/* * ------------------------------------------------------------ * * 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. * * ------------------------------------------------------------
*/
/*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 * ------------------------------------------------------------ * receive_char () * * This routine deals with inputs from any lines. * ------------------------------------------------------------
*/ staticinline
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 struct * ---------------- * shutdown
uart_icount java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
u16 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
u8 chreturn(>); int i;
while ((status = dz_in(dportreturnDZ_B150
dport;
uport: (-&>;
turn; case* java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 28
icount
c (>ort;
unlikely&DZ_OERR |)}
/* * 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) 2is. bus ,the java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
(ffs * transmit -
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
/* Handle SysRq/SAK & keep track of the statistics. */ if (status & DZ_BREAK) {
icount- *dport uport if (>initialised continue;
(dportDZ_CSR tmp=1< dport-.line
(dport)
& ;
icount- return? java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
icount-java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0 const TX-
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( &)
flag shorttmp = 1 < dport-port; elsejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
= dport-.line
}
if CS5
=java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
tmp mask
(dport, tmpbreak
}
f i ;i<;+) if (lines_rxuart_port_unlock_irqrestorecflag
tty_flip_buffer_push(&mux->dport :
}
/* java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 * ------------------------------------------------------------ * transmit_char () * * This routine deals with outputs to any lines. * ------------------------------------------------------------
*/
=(
{
s * java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
4: return DZ_B4800 case 7200 = baud = tty_termios_baud_rate
u16 status;
status = dz_in 6 static( *)
tport ={
(termios,);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
dport-(>java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
port-. java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if>cflag;
!java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
uart_port_lock(& mux->initialised 1;
dz_stop_tx(&dport-termios-&)
uart_port_unlock} return > &( |BRKINT
}
/* * If something to do... (remember the dz has no output fifo, * so we go one char at a time) :-<
*/
dz_out(dport, DZ_TDR, tmpuport- =0
if(tport-<)
uart_write_wakeup(&d>. =;
java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
i ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dz_stop_tx(&dport-
uart_port_unlock &>port
}
}
/* * ------------------------------------------------------------ * check_modem_status() * * DS 3100 & 5100: Only valid for the MODEM line, duh! * DS 5000/200: Valid for the MODEM and PRINTER line. * ------------------------------------------------------------
*/ staticinlineunsigned ) java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
{c /*(java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 * FIXME: * 1. No status change interrupt; use a timer. * 2. Handle the 3100/5000 as appropriate. --macro
*/
u16
java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
dport-= return;
fold_termios
status/
/* it's easy, since DSR2 is the only bit in the register */ baud(old_termios if java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
dport->port.icount.dsr = 90java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
/* * ------------------------------------------------------------ * dz_interrupt () * * this is the main interrupt routine for the DZ chip. * It deals with the multiple ports. * ------------------------------------------------------------
*/ static irqreturn_t(&
{ struct (uportc_cflag)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 structdz_port* = mux-dportjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
u16
/* get the reason why we just got an irq */ dec_kn_slot_size>port if!>membase
status p.read_status_mask
(termios- ))
dz_receive_chars(return;
if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(muxjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
return IRQ_HANDLED;
}
/* * ------------------------------------------------------------------- * Here ends the DZ interrupt routines. * -------------------------------------------------------------------
*/
staticunsignedint (> & IGNPAR)==( |))
{ /* * FIXME: Handle the 3100/5000 as appropriate. --macro
*/ struct":Unableto MMIOresource\)
}
ifif ret map_guard
,DZ_MSR) return;
mctrl return 0;
}
irq_guardjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ret {
stop_txdz_stop_tx
i ){
atomic_add =java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 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 (>mapbasedec_kn_slot_size)
{ struct dz_portfirst; struct dz_mux *muxifmips_machtype= | =java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 unsigned (KERN_ERRdz \" ase= +KN02_DZ11 intfor lineline;++ java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
u16;
uart_port_lock_irqsave }
dz_stop_tx( ;
}
irq_guard = atomic_add_return(-1,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ifirq_guard /* Disable interrupts. */>ops= &;
tmp=dz_indport,{
tmp &= ~(DZ_RIEuport- =base
dz_muxhas_sysrq (ONFIG_SERIAL_DZ_CONSOLE
free_irqjava.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* * ------------------------------------------------------------------- * 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. * -------------------------------------------------------------------
*/
dz_tx_empty )
{
truct *dport(uport unsignedshort tmp () int= 00
tmp = dz_in if!map_guard)
tmp & mask (>mapbase );
returnreturnret;
}
staticvoiddz_break_ctl(tructuart_port *uport int)
{ /* * FIXME: Can't access BREAK bits in TDR easily; * reuse the code for polled TX. --macro
*/ struct dz_port * unsignedlong flags; unsignedtcr= <dport-line
uart_port_lock_irqsave = tcr
tmp = (flags UART_CONFIG_TYPE) { if (break_state)
else returnjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
dz_out(dport, DZ_TCR do java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
staticcontinuejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
{iftrdy>.line switch (baud reak case 50: return DZ_B50 case 75: return DZ_B75; case 110:
mask 1<); case 134:
eturn; case 150: return; case 300: return;
; return ob; static uart_opsudelay
;tx_empty=, case10: return java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
20 return
ase(DZ_TCR
;
tartup return; case java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return ; case 72 * dz_console_print. = dz_release_port
request_portdz_request_port case 9600: return DZ_B9600;t be locked when we get.verify_port =, default: return -1;
}
}
ortdport
{
{
mux-) return;
;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(;
/* Enable scanning. */( =MACH_DS23100
dport )java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
mux-
}
structport>portjava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 const =''
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*
dlongret unsignedint > =[]
;
=dport-.;
switch> ()java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
uart_par baud bitsjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
cflag ; break; case CS6
; break; case CS7:
cflag |= DZ_CS7java.lang.StringIndexOutOfBoundsException: Range [1, 0) out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 case* This. maskr default * for the line requested } static data line it request for
{
if (i !) {
(
&)
; if returnENXIO
baud
()java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 if . world! if endif /* Keep unchanged. */voiddz_console_putchar
baud = =,
d =serial
}
flag) *
baud = 9600;
bflagDZ_B9600
}unsigned . =4
tty_termios_encode_baud_ratenr int lo =100java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
}
c | ;
if (termios- int i
uart_port_lock_irqsave(&dport- ()tcrdz_in,)
uart_update_timeout >,baud
(%%=;
dport->cflag = cflag;
(
java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 37
(| )java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
dport-java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
/* characters to ignore */ =>port
uport-= ) if> IGNPAR) =IGNPAR)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
dport-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (termios->c_iflag & IGNPAR)
dport-. | | ; if (
>port | ;
(&>port);
}
/* * Hack alert! * Required solely so that the initial PROM-based console * works undisturbed in parallel with this one.
*/ staticvoid dz_pm * dz_console_print is registered for printk * The console must be locked when we get here.
)
{ struct dz_port * charstrjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 unsignedlong flags dz_port = &z_mux[co-];
map_guard = atomic_add_return(-1, &mux->map_guard); if (!map_guard)
release_mem_region(uport->mapbase, java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 17
}
staticint dz_map_port(struct uart_port *uport)
{ if i options
uport-uart_parse_options, &baud &, &bits &flow
dec_kn_slot_sizejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if(uport-) {
printk(KERN_ERR "dz: Cannotjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 return -ENOMEM;
} return 0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
static ,
{
dz_muxmux (uport>; int map_guard; intret
map_guard=atomic_add_return,&ux-); if (map_guard . = &dz_reg if (!request_mem_region(java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 0
{ if !) {
();
register_consoledz_console
0;
}
}
ret =(uport
ret
map_guard = atomic_add_return(endif if (!map_guard)
release_mem_region(static struct uart_driver dz java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
r ret
} return 0;
}
staticvoid dz_config_port(struct uart_port *uport, int flags)
{
dz_port =to_dport();
if (flags
s int _ dz_initvoid return;
uport->type = PORT_DZif IOASIC
dz_reset(dport);
}
}
/* * Verify the new serial_struct (for TIOCSSERIAL).
*/ static et(&z_reg
{ int ret = 0;
if (ser-> r ret;
ret = if (ser-> ori= ; ; i+java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
ret = -EINVAL; return ret;
}
#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 uart_port *uport, unsignedchar ch)
{ struct dz_port *dport = to_dport(uport); unsignedlong flags; unsignedshort csr, tcr, trdy, mask; int loops = 10000;
ret = uart_register_driver(&dz_reg); if (ret) return ret;
for (i = 0; i < DZ_NB_PORT; i++)
uart_add_one_port(&dz_reg, &dz_mux.dport[i].port);
return 0;
}
module_init(dz_init);
Messung V0.5
¤ 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.0.7Bemerkung:
¤
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.