Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/tty/serial/   (Open Source Betriebssystem Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 22 kB image not shown  

Quelle  dz.c   Sprache: C

 
// 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
#include static ---------------

#include <linux/atomic *
#include < * {
#include <asm/bootinfo * ------------

<//interrupts>
#include <asm/dec/kn01.h>
# <sm/kn02 dz_mux* =dport-mux
 <asm/dec/machtypehjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
#status  dz_in, DZ_CSR
#include <asm

  ( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0


MODULE_DESCRIPTION
MODULE_LICENSE(  (status &( | )) == DZ_TRDYDZ_TIE


static char (mux;
static charreturn ;

struct = request_irqdport-.irq dz_interrupt
 structdz_mux
 struct uart_port
 unsigned   f ( {
};

struct dz_mux  (1 mux-;
 struct dz_port  dport[DZ_NB_PORT  printk "dz: CannotgetIRQ%!n",dport-.rq
 atomic_t   }
 atomic_t  irq_guard
 int  port_lock_irqsavedport-, flags
}java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

static*

static
{
 returnned dz_get_mctrl uart_port *uport
}

/*
 * ------------------------------------------------------------
 * 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
}

static void 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.
 * ------------------------------------------------------------
 */


static void (&>, 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.
 * ------------------------------------------------------------
 */

static inline
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.
 * ------------------------------------------------------------
 */

static inlineunsigned ) 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.
 * -------------------------------------------------------------------
 */


static unsigned int    (> & IGNPAR)==( |))
{
 /*
 * FIXME: Handle the 3100/5000 as appropriate. --macro
 */

 struct   ":Unableto MMIOresource\)
   }

ifif ret  map_guard 
,DZ_MSR) return;
   mctrl return 0;
 }

 return mctrlstatic void
}

static void dz_set_mctrl(struct uart_port *uport
{
 /*
 * FIXME: Handle the 3100/5000 as appropriate. --macro
 */

 struct static void  uport- = ;
 u16  dz_reset(dport);

 if (dport-}
  tmp = dz_in
  if/*
tmp &= ~DZ_MODEM_DTR;
else
tmp |= DZ_MODEM_DTR;
dz_out(dport, DZ_TCR, tmp);
}
}

/*
 * -------------------------------------------------------------------
 * startup ()
 *
 * various initialization tasks
 * -------------------------------------------------------------------
 */

static int  (state )
{
 struct dz_port *dport = to_dport(uport);
  dz_muxmux port-;
 unsigned long flags;  (>type! PORT_UNKNOWN& ser-! )
int;
 int ret  uart_port_unlock_irqrestore,flags
  tmp

 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. =,
 }

 uart_port_lock_irqsave=dz_release_port

 /* Enable interrupts.  */
 tmp = dz_in(dport, DZ_CSR);
 tmp| DZ_RIE ;
 dz_out(. = ,

 uart_port_unlock_irqrestore(&dport-

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.
 * -------------------------------------------------------------------
 */

static void (>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
 unsigned short 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 *
 unsigned long 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
}

static   continuejava.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
 unsigned int  > =[]
  ;

  =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
 caseThis.   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.
 */

static void 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
 unsigned long flags dz_port = &z_mux[co-];

uart_port_lock_irqsavedport->, &);
 if#ndif
  dz_start_tx>port
 else
  dz_stop_tx
 uart_port_unlock_irqrestore(struct *co *)
}


static const char *dz_type(struct uart_port *uport)
{
 return "DZ";
}

static  = 90;
{
 struct dz_mux *mux = to_dport(uportint  = ;
int;

 iounmap(uport->membase);
 uport->membase = NULL

 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
}

static int 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;
}

static void dz_config_port(struct uart_port *uport, int flags)
{
  dz_port =to_dport();

 if (flags
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;
}

static const struct uart_ops(dz_init;
 .tx_empty = dz_tx_empty,
 .get_mctrl = dz_get_mctrl,
 .set_mctrl = dz_set_mctrl,
 .stop_tx = dz_stop_tx,
 .start_tx = dz_start_tx,
 .stop_rx = dz_stop_rx,
 .break_ctl = dz_break_ctl,
 .startup = dz_startup,
 .shutdown = dz_shutdown,
 .set_termios = dz_set_termios,
 .pm  = dz_pm,
 .type  = dz_type,
 .release_port = dz_release_port,
 .request_port = dz_request_port,
 .config_port = dz_config_port,
 .verify_port = dz_verify_port,
};

static void __init dz_init_ports(void)
{
 static int first = 1;
 unsigned long base;
 int line;

 if (!first)
  return;
 first = 0;

 if (mips_machtype == MACH_DS23100 || mips_machtype == MACH_DS5100)
  base = dec_kn_slot_base + KN01_DZ11;
 else
  base = dec_kn_slot_base + KN02_DZ11;

 for (line = 0; line < DZ_NB_PORT; line++) {
  struct dz_port *dport = &dz_mux.dport[line];
  struct uart_port *uport = &dport->port;

  dport->mux = &dz_mux;

  uport->irq = dec_interrupt[DEC_IRQ_DZ11];
  uport->fifosize = 1;
  uport->iotype = UPIO_MEM;
  uport->flags = UPF_BOOT_AUTOCONF;
  uport->ops = &dz_ops;
  uport->line = line;
  uport->mapbase = base;
  uport->has_sysrq = IS_ENABLED(CONFIG_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!
 * -------------------------------------------------------------------
 */

static void dz_console_putchar(struct uart_port *uport, unsigned char ch)
{
 struct dz_port *dport = to_dport(uport);
 unsigned long flags;
 unsigned short csr, tcr, trdy, mask;
 int loops = 10000;

 uart_port_lock_irqsave(&dport->port, &flags);
 csr = dz_in(dport, DZ_CSR);
 dz_out(dport, DZ_CSR, csr & ~DZ_TIE);
 tcr = dz_in(dport, DZ_TCR);
 tcr |= 1 << dport->port.line;
 mask = tcr;
 dz_out(dport, DZ_TCR, mask);
 iob();
 uart_port_unlock_irqrestore(&dport->port, flags);

 do {
  trdy = dz_in(dport, DZ_CSR);
  if (!(trdy & DZ_TRDY))
   continue;
  trdy = (trdy & DZ_TLINE) >> 8;
  if (trdy == dport->port.line)
   break;
  mask &= ~(1 << trdy);
  dz_out(dport, DZ_TCR, mask);
  iob();
  udelay(2);
 } while (--loops);

 if (loops)    /* Cannot send otherwise. */
  dz_out(dport, DZ_TDR, ch);

 dz_out(dport, DZ_TCR, tcr);
 dz_out(dport, DZ_CSR, csr);
}

/*
 * -------------------------------------------------------------------
 * dz_console_print ()
 *
 * dz_console_print is registered for printk.
 * The console must be locked when we get here.
 * -------------------------------------------------------------------
 */

static void dz_console_print(struct console *co,
        const char *str,
        unsigned int count)
{
 struct dz_port *dport = &dz_mux.dport[co->index];
#ifdef DEBUG_DZ
 prom_printf((char *) str);
#endif
 uart_console_write(&dport->port, str, count, dz_console_putchar);
}

static int __init dz_console_setup(struct console *co, char *options)
{
 struct dz_port *dport = &dz_mux.dport[co->index];
 struct uart_port *uport = &dport->port;
 int baud = 9600;
 int bits = 8;
 int parity = 'n';
 int flow = 'n';
 int ret;

 ret = dz_map_port(uport);
 if (ret)
  return ret;

 spin_lock_init(&dport->port.lock); /* For dz_pm().  */

 dz_reset(dport);
 dz_pm(uport, 0, -1);

 if (options)
  uart_parse_options(options, &baud, &parity, &bits, &flow);

 return uart_set_options(&dport->port, co, baud, parity, bits, flow);
}

static struct uart_driver dz_reg;
static struct console dz_console = {
 .name = "ttyS",
 .write = dz_console_print,
 .device = uart_console_device,
 .setup = dz_console_setup,
 .flags = CON_PRINTBUFFER,
 .index = -1,
 .data = &dz_reg,
};

static int __init dz_serial_console_init(void)
{
 if (!IOASIC) {
  dz_init_ports();
  register_console(&dz_console);
  return 0;
 } else
  return -ENXIO;
}

console_initcall(dz_serial_console_init);

#define SERIAL_DZ_CONSOLE &dz_console
#else
#define SERIAL_DZ_CONSOLE NULL
#endif /* CONFIG_SERIAL_DZ_CONSOLE */

static struct uart_driver dz_reg = {
 .owner   = THIS_MODULE,
 .driver_name  = "serial",
 .dev_name  = "ttyS",
 .major   = TTY_MAJOR,
 .minor   = 64,
 .nr   = DZ_NB_PORT,
 .cons   = SERIAL_DZ_CONSOLE,
};

static int __init dz_init(void)
{
 int ret, i;

 if (IOASIC)
  return -ENXIO;

 printk("%s%s\n", dz_name, dz_version);

 dz_init_ports();

 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
C=97 H=91 G=93

¤ 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:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.