Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Serial Drivers

8.153 visualizaciones

Publicado el

Serial Drivers

Publicado en: Tecnología
  • Sé el primero en comentar

Serial Drivers

  1. 1. © 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Serial Drivers
  2. 2. 2© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? Serial Prologue UART TTY Driver Use Case TTY Serial Subsystem Low Level Driver API UART Data Structures
  3. 3. 3© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Serial Prologue Typically known as RS232 protocol But, it covers many more. Namely, Infrared (back bone is RS232) RS485 (industry enhanced RS232) Serial Modem Console … From Linux kernel's perspective Serial Drivers provides a generic abstract view to the user for all of these
  4. 4. 4© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. UART UART - Universal Asynchronous receiver transmitter Converts the parallel data from the CPU to serial data to be transmitted on lines Data Frame contains 5 to 9 data bits, start bit, 1 or more stop bits, an option parity bit
  5. 5. 5© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. TTY Driver Use Case Terminal Physical Line UART UART Driver Line Discipline TTY Driver User Process User Process User Process KernelHardware Software
  6. 6. 6© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. TTY Serial Subsystem N_TTY (n_tty.c) N_IRDA (irtty_sir.c) TTY Core (tty_io.c) serial_core.c usb-serial.c (Core Module) omap-serial.c USB-Serial Converter Driver User Applications (System Call Interface) Line Discipline Layer TTY Layer Low-level Driver Layer Physical Devices like Infrared, UART, USB-Serial Converter
  7. 7. 7© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Low-level (UART) Driver related Data Structures & APIs Data Structures struct uart_driver struct uart_port struct uart_ops APIs int uart_register_driver(struct uart_driver *); int uart_unregister_driver(struct uart_driver *); int uart_add_one_port(struct uart_driver *, struct uart_port); int uart_remove_one_port(struct uart_driver *, struct uart_port); Typically implemented as a platform driver Header: <linux/serial_core.h>
  8. 8. 8© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. UART Driver structure struct uart_driver struct module *owner; const char *driver_name; /* Name */ const char *dev_name; /* dev node names */ int major; /* Major number */ int minor; /* Minor number */ struct tty_driver *tty_driver; /* tty driver */
  9. 9. 9© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. UART Port structure struct uart_port spinlock_t lock; /* lock */ unsigned int iobase; /* in/out[bwl] */ unsigned char __iomem *membase; /* I/O membase */ unsigned int irq; /* irq number */ unsigned int uartclk; /* base uart clock */ unsigned char fifosize; /* tx fifo size */ unsigned char x_char; /* flow control */
  10. 10. 10© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. UART Operations structure struct uart_ops uint (*tx_empty)(struct uart_port *); /* Is TX FIFO empty? */ void (*set_mctrl)(struct uart_port *, unsigned int mctrl); /* Set modem control params */ uint (*get_mctrl)(struct uart_port *); /* Get modem control params */ void (*stop_tx)(struct uart_port *); /* Stop xmission */ void (*start_tx)(struct uart_port *); /* Start xmission */ void (*shutdown)(struct uart_port *); /* Disable the port */ void (*set_termios)(struct uart_port *, struct termios *new, struct termios *old); /* Terminal interface parameters */ void (*config_port) (struct uart_port *, int);
  11. 11. 11© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. TTY Driver related Data Structures & APIs Header: <linux/tty.h> Data Structures struct tty_struct struct tty_flip_buffer struct tty_driver APIs int tty_register_driver(struct tty_driver *); int tty_unregister_driver(struct tty_driver *); struct device *tty_register_device(struct tty_driver *, unsigned, struct device); void tty_unregister_device(struct tty_driver *, unsigned);
  12. 12. 12© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What all have we learnt? Serial Prologue UART TTY Driver Use Case TTY Serial Subsystem Low Level Driver API UART Data Structures
  13. 13. 13© 2010-17 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?

×