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 17 kB image not shown  

Quelle  mcf.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0+
/****************************************************************************/

/*
 * mcf.c -- Freescale ColdFire UART driver
 *
 * (C) Copyright 2003-2007, Greg Ungerer <gerg@uclinux.org>
 */


/****************************************************************************/

/
#include <linuxinitjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
#include <linux *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
i linux.hjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
include/.hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
include/ttyh>
#include <linux/java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
#include <linux/serial.h>
#include <linux/.h>
#include#ndif
# linux.hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
#nclude </platform_device
#unsigned   ; /
#include <asm.h
#include <asm/mcfuart.h>
<asm.h>

/****************************************************************************/

/*
 * Some boards implement the DTR/DCD lines using GPIO lines, most
 * don't. Dummy out the access macros for those that don't. Those
 * that do should define these macros somewhere in there board
 * specific inlude files.
 */

#if !defined(mcf_getppdcd)
mcf_getppdcd()()
#endif
#if
#define mcf_getppdtrp) 1
#endif
#if !defined(mcf_setppdtrstaticunsignedint(struct *port
#efine mcf_setppdtrp v)do }while)
#endif

/****************************************************************************/

/*
 * Local per-uart structure.
 */

struct mcf_uart {
 struct uart_port port;
 unsigned int  sigs;  /* Local copy of line sigs */
 unsigned char  imr;  /* Local IMR mirror */
};

/****************************************************************************/  readb> + ) &MCFUART_UIPR_CTS

static unsigned int mcf_tx_empty(struct uart_port *sigs=((port-) ?  :0java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

returnreadb>membaseMCFUART_USR  ) java.lang.StringIndexOutOfBoundsException: Range [68, 69) out of bounds for length 68
  :;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

/****************************************************************************/ )java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56

staticjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  mcf_uartpp(, struct, port;
 unsigned int  /* Manually assert RTS */MCFUART_UOP_RTS> +);

sigs(port- +)&)?
  0 : TIOCM_CTS
 sigs=(p- &TIOCM_RTS
 sigs |=
sigs(>line  )

 sigs
}

/****************************************************************************/;

static void mcf_set_mctrl(struct uart_port *
{
 structjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

 pp->sigs = sigs;
 mcf_setppdtr>, sigs))
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 writebport-+MCFUART_UOP1
 else
  writeb(MCFUART_UOP_RTS, port-
}

/****************************************************************************/flags break_state=-)

static void mcf_start_tx(struct uart_port *port)
{
  (, );

 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  /* Enable Transmitter */
 (,port-+);
  /* Manually assert RTS */
  writeb
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 > |MCFUART_UIR_TXREADY
writeb, >membase)
java.lang.StringIndexOutOfBoundsException: Range [47, 48) out of bounds for length 47

/****************************************************************************/

static void
{
 struct0

 pp-=~;
 writeb
}

/****************************************************************************/

static voidlong;
{
 struct mcf_uart

 pp->java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 writebpp-, port-membase+MCFUART_UIMR;
}

/****************************************************************************/

static void mcf_break_ctl(struct uart_port *port, int break_state)
{
 unsignedjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

 uart_port_lock_irqsaveMCFUART_UCR_CMDRESETTX> +MCFUART_UCR
 if(port );
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 else
writeb,> +);
 uart_port_unlock_irqrestore(port, flags);
}

/****************************************************************************/ lags

static int mcf_startup(structif (CONFIG_M5272
{
  mcf_uartpp(,  mcf_uart)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
long;

 uart_port_lock_irqsave(CONFIG_M5272

java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
writeb, >membase);
 writeb(MCFUART_UCR_CMDRESETTX, port->membase + else

 /* Enable the UART transmitter and receiver */
(  java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 > +)

 /* Enable RX interrupts now */
pp-  ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

(,)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42

 return 0;
}

/****************************************************************************/

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct mcf_uart  * INPCKjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 ;

 (, flags

/
 pp->imr =  =;
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 /* Disable UART transmitter and receiver */
 writeb(MCFUART_UCR_CMDRESETRX, port->membase + MCFUART_UCR);
(MCFUART_UCR_CMDRESETTX> +);

u(port);
}

/****************************************************************************/

 void( uart_portportk *,
       const struct ktermios riteb, >  )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
long;
 unsigned int(baudclkxffmembase);
#if definedwriteb  x0f> +);
 unsigned java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
unsignedmr1;

java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
static  mcf_rx_chars mcf_uart)
 baudclk = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
baudfr  ) +)  )%1java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
else
 baudclk = ((MCF_BUSCLK / baud) + 16) / 32;
#endif

 flag;
m =0

 termios-  ) {
 CS5 |;;
 case CS6>  );
 case CS7: mr1 |= MCFUART_MR1_CS7; 
 case CS8:
 :  mr1=;break
 }

if>  ARENB
 if>c_cflag) {
   if  }  status {
   | ;
 else
    | ;
  } else     ( &){
   if (termios->c_cflag & PARODD>.frame
   |MCFUART_MR1_PARITYODD
   ifstatus)
    mr1 |= MCFUART_MR1_PARITYEVEN;
  }
 } else {
  mr1   status)
 }

 /*
 * FIXME: port->read_status_mask and port->ignore_status_mask
 * need to be initialized based on termios settings for
 * INPCK, IGNBRK, IGNPAR, PARMRK, BRKINT
 */


 if;
  |MCFUART_MR2_STOP2
 else
 ;

java.lang.StringIndexOutOfBoundsException: Range [78, 79) out of bounds for length 78
  =MCFUART_MR1_RXRTS
  | MCFUART_MR2_TXCTS;
 }

 uart_port_lock_irqsave(port, &flags);u8
   =uart_port_tx,,
 (port- Settington)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
  mr2 pending>.  java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
}

 (,>cflag
  *pp(port mcf_uart);
 writeb(MCFUART_UCR_CMDRESETTX int;
writebMCFUART_UCR_CMDRESETMRPTR>membaseMCFUART_UCR);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 (mr2>membaseMCFUART_UMR)
 writeb((baudclk &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 writeb & 0), >membase MCFUART_UBG2)java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
if(CONFIG_M5272
 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 2
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
()java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
  port- +)
 writeb
> + )java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
(,flags
}

/****************************************************************************/

static((>,, ,UART)
{
struct port>;
  interruptn, >,>);

 while
 return>type)  ColdFire ;
  flag java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 port-.++

   /* UARTs always present */
   writeb(MCFUART_UCR_CMDRESETERRjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  >membase)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

   java.lang.StringIndexOutOfBoundsException: Range [78, 79) out of bounds for length 78
   >.brk
    if (uart_handle_break
  c;
    return;
  0
   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    port-.overrun++java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
   } else if (status MCFUART_USR_RXFRAMINGjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   /* Get mode registers */  registers

   status &= port->read_status_mask;

   r2(port-  );
   =TTY_BREAK
  else status)
    flag = TTY_PARITY;
   else if( & )
    flag | ;
  }

  if (uart_handle_sysrq_char(port, ch))
   continue;
  }
 }

 tty_flip_buffer_push(&port->state->port);
}

/****************************************************************************/

static java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
{
 struct * =>;
 bool pending
  * Define the basic

   (port,
  readb. =,
 (,>  ))java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43

/
 if (!pending & =,
 (,>membase);
}

/****************************************************************************/

static mcf_interrupt ,  *)
{
 struct  ,
struct pp(port mcf_uart);
 unsigned int isr =,
 irqreturn_t

 isrdefineARRAY_SIZE(mcf_ports)

 uart_port_lock(port);
 if (isr & MCFUART_UIR_RXREADY) {
  mcf_rx_chars
  ret =IRQ_HANDLED
 }
 isr) {
  mcf_tx_charspp
  ret
 }
 uart_port_unlock(port);

 return ret;
}

/****************************************************************************/ =&&nbsp;+>)>ort

void(struct *,int)
{
 > =;
 port- (c > +)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40

 /* Clear mask, so no surprise interrupts. */
writeb>membase);

 if (request_irq(port->irqjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 printkMCF     d"
   "interrupt vector=%
}

/****************************************************************************/

static }
{
 return (port-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

/****************************************************************************/

  (struct )
{
 /* UARTs always present */  =8
 return 0;
}

/****************************************************************************/> <)|co-=MCF_MAXPORTS

static[>].;
{
java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
}

/****************************************************************************/,,,,bits)

static (  p, serial_struct ser
{
 if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  EINVAL
 java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}

/****************************************************************************/

/* Enable or disable the RS485 support */ =
static.  mcf
        *)
{
 unsigned char mr1, mr2   ,


mr1 = readb(port->membase + MCFUART_UMR);
mr2 = readb(port->membase + MCFUART_UMR);
if (rs485->flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
/* Automatically negate RTS after TX completes */

  mr2 |= java.lang.StringIndexOutOfBoundsException: Range [1, 26) out of bounds for length 1
 }  i=0 (i <MCF_MAXPORTS&platpmapbasei+ 
  dev_dbg  = mcf_ports];
  mr2
 } port-line
  port-type;
 writeb >mapbase[i.;

return
}

static const struct serial_rs485 mcf_rs485_supported = {
 flags |,
};

/****************************************************************************/;

/*
 * Define the basic serial functions we support.
 */

const uart_ops  
 .tx_empty port- =;
 .get_mctrl = mcf_get_mctrl,
 .set_mctrl = mcf_set_mctrl,
 .start_tx = mcf_start_tx,
 .stop_tx = mcf_stop_tx,
 .stop_rx = mcf_stop_rx,
 .break_ctl = mcf_break_ctl,
 .startup = mcf_startupport- =CONFIG_SERIAL_MCF_CONSOLE
 .java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 .set_termios =java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 .java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 .request_port = java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 1
 . = ,
 config_port,
. =,
 (mcf_driver)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43

   mcf_portsjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

 ()

/****************************************************************************/
#if .  =mcf_remove,
/****************************************************************************/

static void mcf_console_putc(struct console *co, const char c)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 struct uart_port* =&mcf_ports>index>;
 int i;

 for (i = 0; (i < 0x10000); i++) {
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 break
 }
writebport-  )
 for=;( < x10000+){
  if (readb rc
  reak
}
}

/****************************************************************************/&)

r 0
{
 for ( count s+java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
(;
  *=\)
   mcf_console_putc
}


/****************************************************************************/java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

static int __init mcf_console_setup(struct console *co, char *options)
{
 struct uart_port *port;
 int baud = CONFIG_SERIAL_MCF_BAUDRATE;
 int bits = 8;
 int parity = 'n';
 int flow = 'n';

 if ((co->index < 0) || (co->index >= MCF_MAXPORTS))
  co->index = 0;
 port = &mcf_ports[co->index].port;
 if (port->membase == 0)
  return -ENODEV;

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

 return uart_set_options(port, co, baud, parity, bits, flow);
}

/****************************************************************************/

static struct uart_driver mcf_driver;

static struct console mcf_console = {
 .name  = "ttyS",
 .write  = mcf_console_write,
 .device  = uart_console_device,
 .setup  = mcf_console_setup,
 .flags  = CON_PRINTBUFFER,
 .index  = -1,
 .data  = &mcf_driver,
};

static int __init mcf_console_init(void)
{
 register_console(&mcf_console);
 return 0;
}

console_initcall(mcf_console_init);

#define MCF_CONSOLE &mcf_console

/****************************************************************************/
#else
/****************************************************************************/

#define MCF_CONSOLE NULL

/****************************************************************************/
#endif /* CONFIG_SERIAL_MCF_CONSOLE */
/****************************************************************************/

/*
 * Define the mcf UART driver structure.
 */

static struct uart_driver mcf_driver = {
 .owner  = THIS_MODULE,
 .driver_name = "mcf",
 .dev_name = "ttyS",
 .major  = TTY_MAJOR,
 .minor  = 64,
 .nr  = MCF_MAXPORTS,
 .cons  = MCF_CONSOLE,
};

/****************************************************************************/

static int mcf_probe(struct platform_device *pdev)
{
 struct mcf_platform_uart *platp = dev_get_platdata(&pdev->dev);
 struct uart_port *port;
 int i;

 for (i = 0; ((i < MCF_MAXPORTS) && (platp[i].mapbase)); i++) {
  port = &mcf_ports[i].port;

  port->line = i;
  port->type = PORT_MCF;
  port->mapbase = platp[i].mapbase;
  port->membase = (platp[i].membase) ? platp[i].membase :
   (unsigned char __iomem *) platp[i].mapbase;
  port->dev = &pdev->dev;
  port->iotype = SERIAL_IO_MEM;
  port->irq = platp[i].irq;
  port->uartclk = MCF_BUSCLK;
  port->ops = &mcf_uart_ops;
  port->flags = UPF_BOOT_AUTOCONF;
  port->rs485_config = mcf_config_rs485;
  port->rs485_supported = mcf_rs485_supported;
  port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MCF_CONSOLE);

  uart_add_one_port(&mcf_driver, port);
 }

 return 0;
}

/****************************************************************************/

static void mcf_remove(struct platform_device *pdev)
{
 struct uart_port *port;
 int i;

 for (i = 0; (i < MCF_MAXPORTS); i++) {
  port = &mcf_ports[i].port;
  if (port)
   uart_remove_one_port(&mcf_driver, port);
 }
}

/****************************************************************************/

static struct platform_driver mcf_platform_driver = {
 .probe  = mcf_probe,
 .remove  = mcf_remove,
 .driver  = {
  .name = "mcfuart",
 },
};

/****************************************************************************/

static int __init mcf_init(void)
{
 int rc;

 printk("ColdFire internal UART serial driver\n");

 rc = uart_register_driver(&mcf_driver);
 if (rc)
  return rc;
 rc = platform_driver_register(&mcf_platform_driver);
 if (rc) {
  uart_unregister_driver(&mcf_driver);
  return rc;
 }
 return 0;
}

/****************************************************************************/

static void __exit mcf_exit(void)
{
 platform_driver_unregister(&mcf_platform_driver);
 uart_unregister_driver(&mcf_driver);
}

/****************************************************************************/

module_init(mcf_init);
module_exit(mcf_exit);

MODULE_AUTHOR("Greg Ungerer ");
MODULE_DESCRIPTION("Freescale ColdFire UART driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:mcfuart");

/****************************************************************************/

Messung V0.5
C=93 H=92 G=92

¤ Dauer der Verarbeitung: 0.6 Sekunden  ¤

*© Formatika GbR, Deutschland






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.