// include/linux/serial_core.h
// uart 驱动结构体
struct uart_driver {                                                            
    struct module       *owner;                                                    
    const char      *driver_name; // 驱动名字                                              
    const char      *dev_name;    // 设备名字                                   
    int          major;          //  主设备号                                   
    int          minor;          //  次设备号                                   
    int          nr;                                                            
    struct console      *cons;    // 看似控制台结构体                                              
    /*                                                                          
     * these are private; the low level driver should not                       
     * touch these; they should be initialised to NULL                          
     */                                                                         
    struct uart_state   *state;    // 状态结构体                                             
    struct tty_driver   *tty_driver; // tty 驱动结构体                                           
};  
struct uart_port {                                                              
    spinlock_t      lock;           /* port lock */                             
    unsigned long       iobase;         /* in/out[bwl] */                       
    unsigned char __iomem   *membase;       /* read/write[bwl] */               
    unsigned int        (*serial_in)(struct uart_port *, int);                  
    void            (*serial_out)(struct uart_port *, int, int);                
    void            (*set_termios)(struct uart_port *,                          
                           struct ktermios *new,                            
                           struct ktermios *old);                           
    void            (*set_mctrl)(struct uart_port *, unsigned int);             
    int         (*startup)(struct uart_port *port);                             
    void            (*shutdown)(struct uart_port *port);                        
    void            (*throttle)(struct uart_port *port);                        
    void            (*unthrottle)(struct uart_port *port);                      
    int         (*handle_irq)(struct uart_port *);                              
    void            (*pm)(struct uart_port *, unsigned int state,               
                  unsigned int old);                                        
    void            (*handle_break)(struct uart_port *);                        
    int         (*rs485_config)(struct uart_port *,                             
                    struct serial_rs485 *rs485);                            
    unsigned int        irq;            /* irq number */                        
    unsigned long       irqflags;       /* irq flags  */                        
    unsigned int        uartclk;        /* base uart clock */                   
    unsigned int        fifosize;       /* tx fifo size */                      
    unsigned char       x_char;         /* xon/xoff char */                     
    unsigned char       regshift;       /* reg offset shift */                  
    unsigned char       iotype;         /* io access style */                   
    unsigned char       unused1;                                                
#define UPIO_PORT       (SERIAL_IO_PORT)    /* 8b I/O port access */            
#define UPIO_HUB6       (SERIAL_IO_HUB6)    /* Hub6 ISA card */                 
#define UPIO_MEM        (SERIAL_IO_MEM)     /* 8b MMIO access */                
#define UPIO_MEM32      (SERIAL_IO_MEM32)   /* 32b little endian */             
#define UPIO_AU         (SERIAL_IO_AU)      /* Au1x00 and RT288x type IO */