__initfunc(int sun_kbd_init(void)) { int i, opt_node; struct kbd_struct kbd0; extern struct tty_driver console_driver; kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; kbd0.ledmode = LED_SHOW_FLAGS; kbd0.lockstate = KBD_DEFLOCK; kbd0.slockstate = 0; kbd0.modeflags = KBD_DEFMODE; kbd0.kbdmode = VC_XLATE; for (i = 0 ; i < MAX_NR_CONSOLES ; i++) kbd_table[i] = kbd0; ttytab = console_driver.table; kd_mksound = sunkbd_kd_mksound; /* XXX Check keyboard-click? property in 'options' PROM node XXX */ if(sparc_cpu_model != sun4) { opt_node = prom_getchild(prom_root_node); opt_node = prom_searchsiblings(opt_node, "options"); i = prom_getintdefault(opt_node, "keyboard-click?", -1); if(i != -1) sunkbd_clickp = 1; else sunkbd_clickp = 0; } else { sunkbd_clickp = 0; } init_bh(KEYBOARD_BH, kbd_bh); mark_bh(KEYBOARD_BH); return 0; }
/* xmbrs_init inits the driver */ static int __init xmbrs_init(void) { struct xmb_serial *info; unsigned long flags; int i; init_bh(SERIAL_BH, do_serial_bh); show_serial_version(); /* Initialize the tty_driver structure */ memset(&xmbrs_serial_driver, 0, sizeof(struct tty_driver)); xmbrs_serial_driver.magic = TTY_DRIVER_MAGIC; xmbrs_serial_driver.name = "ttyS"; xmbrs_serial_driver.major = TTY_MAJOR; xmbrs_serial_driver.minor_start = 64; xmbrs_serial_driver.num = NR_PORTS; xmbrs_serial_driver.type = TTY_DRIVER_TYPE_SERIAL; xmbrs_serial_driver.subtype = SERIAL_TYPE_NORMAL; xmbrs_serial_driver.init_termios = tty_std_termios; xmbrs_serial_driver.init_termios.c_cflag = xmbrs_console_cbaud | CS8 | CREAD | HUPCL | CLOCAL; xmbrs_serial_driver.flags = TTY_DRIVER_REAL_RAW; xmbrs_serial_driver.refcount = &xmbrs_serial_refcount; xmbrs_serial_driver.table = xmbrs_serial_table; xmbrs_serial_driver.termios = xmbrs_serial_termios; xmbrs_serial_driver.termios_locked = xmbrs_serial_termios_locked; xmbrs_serial_driver.open = xmbrs_open; xmbrs_serial_driver.close = xmbrs_close; xmbrs_serial_driver.write = xmbrs_write; xmbrs_serial_driver.flush_chars = xmbrs_flush_chars; xmbrs_serial_driver.write_room = xmbrs_write_room; xmbrs_serial_driver.chars_in_buffer = xmbrs_chars_in_buffer; xmbrs_serial_driver.flush_buffer = xmbrs_flush_buffer; xmbrs_serial_driver.ioctl = xmbrs_ioctl; xmbrs_serial_driver.throttle = xmbrs_throttle; xmbrs_serial_driver.unthrottle = xmbrs_unthrottle; xmbrs_serial_driver.set_termios = xmbrs_set_termios; xmbrs_serial_driver.stop = xmbrs_stop; xmbrs_serial_driver.start = xmbrs_start; xmbrs_serial_driver.hangup = xmbrs_hangup; xmbrs_serial_driver.read_proc = xmbrs_readproc; xmbrs_serial_driver.wait_until_sent = xmbrs_wait_until_sent; xmbrs_serial_driver.driver_name = "serial"; /* * The callout device is just like normal device except for * major number and the subtype code. */ xmbrs_callout_driver = xmbrs_serial_driver; xmbrs_callout_driver.name = "cua"; xmbrs_callout_driver.major = TTYAUX_MAJOR; xmbrs_callout_driver.subtype = SERIAL_TYPE_CALLOUT; xmbrs_callout_driver.read_proc = 0; xmbrs_callout_driver.proc_entry = 0; if (tty_register_driver(&xmbrs_serial_driver)) { printk("%s: Couldn't register serial driver\n",__FUNCTION__); return(-EBUSY); } if (tty_register_driver(&xmbrs_callout_driver)) { printk("%s: Couldn't register callout driver\n",__FUNCTION__); return(-EBUSY); } save_flags_cli(flags); /* * Configure all the attached serial ports. */ for (i = 0, info = xmbrs_table; (i < NR_PORTS); i++, info++) { info->magic = SERIAL_MAGIC; info->line = i; info->tty = 0; info->custom_divisor = 16; info->close_delay = 50; info->closing_wait = 3000; info->x_char = 0; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios = xmbrs_callout_driver.init_termios; info->normal_termios = xmbrs_serial_driver.init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); xmbrs_irqinit(info); printk("%s%d at 0x%04x (irq = %d)", xmbrs_serial_driver.name, info->line, info->addr, info->irq); printk(" is a Microblaze UARTlite\n"); } restore_flags(flags); return 0; }
/* rs_init inits the driver */ static int __init rs_nios_init(void) { int flags; struct NIOS_serial *info; int i; /* Setup base handler, and timer table. */ init_bh(SERIAL_BH, do_serial_bh); show_serial_version(); /* Initialize the tty_driver structure */ /* SPARC: Not all of this is exactly right for us. */ memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; serial_driver.name = "ttyS"; serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = NR_PORTS; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; serial_driver.init_termios = tty_std_termios; serial_driver.init_termios.c_cflag = B115200 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver.flags = TTY_DRIVER_REAL_RAW; serial_driver.refcount = &serial_refcount; serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; serial_driver.open = rs_open; serial_driver.close = rs_close; serial_driver.write = rs_write; serial_driver.flush_chars = rs_flush_chars; serial_driver.write_room = rs_write_room; serial_driver.chars_in_buffer = rs_chars_in_buffer; serial_driver.flush_buffer = rs_flush_buffer; serial_driver.ioctl = rs_ioctl; serial_driver.throttle = rs_throttle; serial_driver.unthrottle = rs_unthrottle; serial_driver.set_termios = rs_set_termios; serial_driver.stop = rs_stop; serial_driver.start = rs_start; serial_driver.hangup = rs_hangup; serial_driver.set_ldisc = rs_set_ldisc; /* * The callout device is just like normal device except for * major number and the subtype code. */ callout_driver = serial_driver; callout_driver.name = "cua"; callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) panic("Couldn't register serial driver\n"); if (tty_register_driver(&callout_driver)) panic("Couldn't register callout driver\n"); save_flags(flags); cli(); /* * Configure all the attached serial ports. */ for (i = 0, info = nios_soft; (i < NR_PORTS); i++, info++) { info->magic = SERIAL_MAGIC; info->tty = 0; info->custom_divisor = 16; info->close_delay = 50; info->closing_wait = 3000; info->x_char = 0; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios =callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); info->line = i; printk("%s%d (irq = %d) is a builtin NIOS UART\n", serial_driver.name, info->line, info->irq); // rs_setsignals(info, 0, 0); if (request_irq(info->irq, rs_interrupt, 0, "NIOS serial", info)) panic("Unable to attach NIOS serial interrupt\n"); } restore_flags(flags); return 0; }
/* rs_init inits the driver */ int rsLEON_init(void) { int flags; struct LEON_serial *info; /* Setup base handler, and timer table. */ init_bh(SERIAL_BH, do_serial_bh); timer_table[RS_TIMER].fn = rs_timer; timer_table[RS_TIMER].expires = 0; #if 0 timer_active |= 1 << RS_TIMER; #endif show_serial_version(); /* Initialize the tty_driver structure */ /* SPARC: Not all of this is exactly right for us. */ memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; serial_driver.name = "ttyS"; serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = 1; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; serial_driver.init_termios = tty_std_termios; serial_driver.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver.flags = TTY_DRIVER_REAL_RAW; serial_driver.refcount = &serial_refcount; serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; serial_driver.open = rs_open; serial_driver.close = rs_close; serial_driver.write = rs_write; serial_driver.flush_chars = rs_flush_chars; serial_driver.write_room = rs_write_room; serial_driver.chars_in_buffer = rs_chars_in_buffer; serial_driver.flush_buffer = rs_flush_buffer; serial_driver.ioctl = rs_ioctl; serial_driver.throttle = rs_throttle; serial_driver.unthrottle = rs_unthrottle; serial_driver.set_termios = rs_set_termios; serial_driver.stop = rs_stop; serial_driver.start = rs_start; serial_driver.hangup = rs_hangup; serial_driver.set_ldisc = rs_set_ldisc; /* * The callout device is just like normal device except for * major number and the subtype code. */ callout_driver = serial_driver; callout_driver.name = "cua"; callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) panic("Couldn't register serial driver\n"); if (tty_register_driver(&callout_driver)) panic("Couldn't register callout driver\n"); save_flags(flags); cli(); info = &LEON_soft; info->magic = SERIAL_MAGIC; info->port = 1; info->tty = 0; info->irq = 3; info->custom_divisor = 16; info->close_delay = 50; info->closing_wait = 3000; info->x_char = 0; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios =callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; info->open_wait = 0; info->close_wait = 0; info->line = 0; info->is_cons = 1; /* Means shortcuts work */ printk("%s%d (irq = %d) is a builtin LEON UART\n", serial_driver.name, info->line, info->irq); if (request_irq(info->irq, rs_interrupt, 0, "LEON serial", NULL)) panic("Unable to attach LEON serial interrupt\n"); restore_flags(flags); return 0; }
/* rs_init inits the driver */ static int __init rs68328_init(void) { int flags, i; struct m68k_serial *info; /* Setup base handler, and timer table. */ init_bh(SERIAL_BH, do_serial_bh); show_serial_version(); /* Initialize the tty_driver structure */ /* SPARC: Not all of this is exactly right for us. */ memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; serial_driver.name = "ttyS"; serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = NR_PORTS; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; serial_driver.init_termios = tty_std_termios; serial_driver.init_termios.c_cflag = m68328_console_cbaud | CS8 | CREAD | HUPCL | CLOCAL; serial_driver.flags = TTY_DRIVER_REAL_RAW; serial_driver.refcount = &serial_refcount; serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; serial_driver.open = rs_open; serial_driver.close = rs_close; serial_driver.write = rs_write; serial_driver.flush_chars = rs_flush_chars; serial_driver.write_room = rs_write_room; serial_driver.chars_in_buffer = rs_chars_in_buffer; serial_driver.flush_buffer = rs_flush_buffer; serial_driver.ioctl = rs_ioctl; serial_driver.throttle = rs_throttle; serial_driver.unthrottle = rs_unthrottle; serial_driver.set_termios = rs_set_termios; serial_driver.stop = rs_stop; serial_driver.start = rs_start; serial_driver.hangup = rs_hangup; serial_driver.set_ldisc = rs_set_ldisc; /* * The callout device is just like normal device except for * major number and the subtype code. */ callout_driver = serial_driver; callout_driver.name = "cua"; callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) panic("Couldn't register serial driver\n"); if (tty_register_driver(&callout_driver)) panic("Couldn't register callout driver\n"); save_flags(flags); cli(); for(i=0; i<NR_PORTS; i++) { info = &m68k_soft[i]; info->magic = SERIAL_MAGIC; info->port = &uart_addr[i]; info->tty = 0; info->irq = uart_irqs[i]; info->custom_divisor = 16; info->close_delay = 50; info->closing_wait = 3000; info->x_char = 0; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios =callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); info->line = i; info->is_cons = 1; /* Means shortcuts work */ printk("%s%d at 0x%08x (irq = %d)", serial_driver.name, info->line, info->port, info->irq); printk(" is a builtin MC68328 UART\n"); IRQ_ports[info->irq] = info; /* waste of space */ #ifdef CONFIG_M68VZ328 if (i > 0) PJSEL &= 0xCF; /* PSW enable second port output */ #endif if (request_irq(uart_irqs[i], rs_interrupt, IRQ_FLG_STD, "M68328_UART", NULL)) panic("Unable to attach 68328 serial interrupt\n"); #ifdef CONFIG_PM serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback); if (serial_pm[i]) serial_pm[i]->data = info; #endif } restore_flags(flags); return 0; }
int gbatxt_init(void) { struct gbatxt_serial *info; unsigned long flags; int i; #if 0 /* Setup base handler, and timer table. */ init_bh(CM206_BH, do_serial_bh); timer_table[RS_TIMER].fn = gbatxt_timer; timer_table[RS_TIMER].expires = 0; #endif show_serial_version(); /* Initialize the tty_driver structure */ memset(&gbatxt_serial_driver, 0, sizeof(struct tty_driver)); gbatxt_serial_driver.magic = TTY_DRIVER_MAGIC; gbatxt_serial_driver.name = "ttyS"; gbatxt_serial_driver.major = TTY_MAJOR; gbatxt_serial_driver.minor_start = 64; gbatxt_serial_driver.num = NR_PORTS; gbatxt_serial_driver.type = TTY_DRIVER_TYPE_SERIAL; gbatxt_serial_driver.subtype = SERIAL_TYPE_NORMAL; gbatxt_serial_driver.init_termios = tty_std_termios; gbatxt_serial_driver.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; gbatxt_serial_driver.flags = TTY_DRIVER_REAL_RAW; gbatxt_serial_driver.refcount = &gbatxt_serial_refcount; gbatxt_serial_driver.table = gbatxt_serial_table; gbatxt_serial_driver.termios = gbatxt_serial_termios; gbatxt_serial_driver.termios_locked = gbatxt_serial_termios_locked; gbatxt_serial_driver.open = gbatxt_open; gbatxt_serial_driver.close = gbatxt_close; gbatxt_serial_driver.write = gbatxt_write; gbatxt_serial_driver.flush_chars = gbatxt_flush_chars; gbatxt_serial_driver.write_room = gbatxt_write_room; gbatxt_serial_driver.chars_in_buffer = gbatxt_chars_in_buffer; gbatxt_serial_driver.flush_buffer = gbatxt_flush_buffer; gbatxt_serial_driver.ioctl = gbatxt_ioctl; gbatxt_serial_driver.throttle = gbatxt_throttle; gbatxt_serial_driver.unthrottle = gbatxt_unthrottle; gbatxt_serial_driver.set_termios = gbatxt_set_termios; gbatxt_serial_driver.stop = gbatxt_stop; gbatxt_serial_driver.start = gbatxt_start; gbatxt_serial_driver.hangup = gbatxt_hangup; /* * The callout device is just like normal device except for * major number and the subtype code. */ gbatxt_callout_driver = gbatxt_serial_driver; gbatxt_callout_driver.name = "cua"; gbatxt_callout_driver.major = TTYAUX_MAJOR; gbatxt_callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&gbatxt_serial_driver)) panic("Couldn't register serial driver\n"); if (tty_register_driver(&gbatxt_callout_driver)) panic("Couldn't register callout driver\n"); save_flags(flags); cli(); /* * Configure all the attached serial ports. */ for (i = 0, info = gbatxt_table; (i < NR_PORTS); i++, info++) { info->magic = SERIAL_MAGIC; info->line = i; info->tty = 0; info->custom_divisor = 16; info->close_delay = 50; info->closing_wait = 3000; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios = gbatxt_callout_driver.init_termios; info->normal_termios = gbatxt_serial_driver.init_termios; info->open_wait = 0; info->close_wait = 0; gbatxt_setsignals(info, 0, 0); gbatxt_irqinit(info); printk("%s%d", gbatxt_serial_driver.name, info->line); printk(" is a GBA console\n"); } restore_flags(flags); return 0; }
int __init dz_init(void) { int i; long flags; struct dz_serial *info; /* Setup base handler, and timer table. */ init_bh(SERIAL_BH, do_serial_bh); show_serial_version(); memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; #if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) serial_driver.name = "ttyS"; #else serial_driver.name = "tts/%d"; #endif serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = DZ_NB_PORT; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; serial_driver.init_termios = tty_std_termios; serial_driver.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS; serial_driver.refcount = &serial_refcount; serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; serial_driver.open = dz_open; serial_driver.close = dz_close; serial_driver.write = dz_write; serial_driver.flush_chars = dz_flush_chars; serial_driver.write_room = dz_write_room; serial_driver.chars_in_buffer = dz_chars_in_buffer; serial_driver.flush_buffer = dz_flush_buffer; serial_driver.ioctl = dz_ioctl; serial_driver.throttle = dz_throttle; serial_driver.unthrottle = dz_unthrottle; serial_driver.send_xchar = dz_send_xchar; serial_driver.set_termios = dz_set_termios; serial_driver.stop = dz_stop; serial_driver.start = dz_start; serial_driver.hangup = dz_hangup; /* * The callout device is just like normal device except for * major number and the subtype code. */ callout_driver = serial_driver; #if (LINUX_VERSION_CODE > 0x2032D && defined(CONFIG_DEVFS_FS)) callout_driver.name = "cua"; #else callout_driver.name = "cua/%d"; #endif callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) panic("Couldn't register serial driver"); if (tty_register_driver(&callout_driver)) panic("Couldn't register callout driver"); save_flags(flags); cli(); for (i = 0; i < DZ_NB_PORT; i++) { info = &multi[i]; lines[i] = info; info->magic = SERIAL_MAGIC; if (mips_machtype == MACH_DS23100 || mips_machtype == MACH_DS5100) info->port = (unsigned long) KN01_DZ11_BASE; else info->port = (unsigned long) KN02_DZ11_BASE; info->line = i; info->tty = 0; info->close_delay = 50; info->closing_wait = 3000; info->x_char = 0; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios = callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); /* * If we are pointing to address zero then punt - not correctly * set up in setup.c to handle this. */ if (!info->port) return 0; printk("ttyS%02d at 0x%08x (irq = %d)\n", info->line, info->port, dec_interrupt[DEC_IRQ_DZ11]); tty_register_devfs(&serial_driver, 0, serial_driver.minor_start + info->line); tty_register_devfs(&callout_driver, 0, callout_driver.minor_start + info->line); } /* reset the chip */ #ifndef CONFIG_SERIAL_DEC_CONSOLE dz_out(info, DZ_CSR, DZ_CLR); while (dz_in(info, DZ_CSR) & DZ_CLR); iob(); /* enable scanning */ dz_out(info, DZ_CSR, DZ_MSE); #endif /* order matters here... the trick is that flags is updated... in request_irq - to immediatedly obliterate it is unwise. */ restore_flags(flags); if (request_irq(dec_interrupt[DEC_IRQ_DZ11], dz_interrupt, SA_INTERRUPT, "DZ", lines[0])) panic("Unable to register DZ interrupt"); return 0; }
static int __init rs_cnxt_init(void) { int flags; struct cnxt_serial *info; /* Setup base handler, and timer table. */ init_bh(SERIAL_BH, do_serial_bh); /* Initialize the tty_driver structure */ memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; serial_driver.name = "ttyS"; serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = 1; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; serial_driver.init_termios = tty_std_termios; serial_driver.init_termios.c_cflag = B57600 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver.flags = TTY_DRIVER_REAL_RAW; serial_driver.refcount = &serial_refcount; serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; serial_driver.open = rs_open; serial_driver.close = rs_close; serial_driver.write = rs_write; serial_driver.put_char = rs_put_char; serial_driver.flush_chars = rs_flush_chars; serial_driver.write_room = rs_write_room; serial_driver.chars_in_buffer = rs_chars_in_buffer; serial_driver.flush_buffer = rs_flush_buffer; serial_driver.ioctl = rs_ioctl; serial_driver.throttle = rs_throttle; serial_driver.unthrottle = rs_unthrottle; serial_driver.set_termios = rs_set_termios; serial_driver.stop = rs_stop; serial_driver.start = rs_start; serial_driver.hangup = rs_hangup; serial_driver.set_ldisc = rs_set_ldisc; /* * The callout device is just like normal device except for * major number and the subtype code. */ callout_driver = serial_driver; callout_driver.name = "cua"; callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) panic("Couldn't register serial driver\n"); if (tty_register_driver(&callout_driver)) panic("Couldn't register callout driver\n"); save_flags(flags); cli(); info = &uart_info; info->magic = SERIAL_MAGIC; info->uart = (struct uart_regs*)UART0_Base_Addr; info->port = UART0_Base_Addr; info->tty = 0; info->irq = CNXT_INT_LVL_GPIO; info->custom_divisor = 16; info->close_delay = 50; info->closing_wait = 3000; info->x_char = 0; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios =callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); info->line = 0; info->is_cons = 1; /* Means shortcuts work */ printk("%s%d at 0x%08x (irq = %d)", serial_driver.name, info->line, info->port, info->irq); printk(" is a 16c550 UART\n"); printk("info = %08x\n",info); #if DEBUG_CONSOLE_ON_UART_2 SetGPIOIntEnable( GPIO25, IRQ_OFF ); SetGPIOInputEnable( GPIO25, GP_INPUTOFF ); #endif SetGPIOIntEnable(GPIOINT_UART1, IRQ_OFF); SetGPIODir( GPIOINT_UART1, GP_INPUT ); SetGPIOIntPolarity (GPIOINT_UART1, GP_IRQ_POL_POSITIVE); SetGPIOInputEnable( GPIOINT_UART1, GP_INPUTON ); GPIO_SetGPIOIRQRoutine(GPIOINT_UART1, GPIOB25_Handler); SetGPIOIntEnable(GPIOINT_UART1, IRQ_ON); restore_flags(flags); return 0; }
/* * The serial driver boot-time initialization code! */ int rs_init(void) { int i; struct async_struct * info; init_bh(SERIAL_BH, do_serial_bh); timer_table[RS_TIMER].expires = 0; show_serial_version(); /* Initialize the tty_driver structure */ memset(&serial_driver, 0, sizeof(struct tty_driver)); serial_driver.magic = TTY_DRIVER_MAGIC; serial_driver.name = "ttyS"; serial_driver.major = TTY_MAJOR; serial_driver.minor_start = 64; serial_driver.num = NR_PORTS; serial_driver.type = TTY_DRIVER_TYPE_SERIAL; serial_driver.subtype = SERIAL_TYPE_NORMAL; serial_driver.init_termios = tty_std_termios; serial_driver.init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; serial_driver.flags = TTY_DRIVER_REAL_RAW; serial_driver.refcount = &serial_refcount; serial_driver.table = serial_table; serial_driver.termios = serial_termios; serial_driver.termios_locked = serial_termios_locked; serial_driver.open = rs_open; serial_driver.close = rs_close; serial_driver.write = rs_write; serial_driver.put_char = rs_put_char; serial_driver.flush_chars = rs_flush_chars; serial_driver.write_room = rs_write_room; serial_driver.chars_in_buffer = rs_chars_in_buffer; serial_driver.flush_buffer = rs_flush_buffer; serial_driver.ioctl = rs_ioctl; serial_driver.throttle = rs_throttle; serial_driver.unthrottle = rs_unthrottle; serial_driver.set_termios = rs_set_termios; serial_driver.stop = rs_stop; serial_driver.start = rs_start; serial_driver.hangup = rs_hangup; /* * The callout device is just like normal device except for * major number and the subtype code. */ callout_driver = serial_driver; callout_driver.name = "cua"; callout_driver.major = TTYAUX_MAJOR; callout_driver.subtype = SERIAL_TYPE_CALLOUT; if (tty_register_driver(&serial_driver)) panic("Couldn't register serial driver\n"); if (tty_register_driver(&callout_driver)) panic("Couldn't register callout driver\n"); for (i = 0, info = rs_table; i < NR_PORTS; i++,info++) { info->magic = SERIAL_MAGIC; info->line = i; info->tty = 0; info->close_delay = 5*HZ/10; info->closing_wait = 30*HZ; info->event = 0; info->count = 0; info->blocked_open = 0; info->tqueue.routine = do_softint; info->tqueue.data = info; info->tqueue_hangup.routine = do_serial_hangup; info->tqueue_hangup.data = info; info->callout_termios =callout_driver.init_termios; info->normal_termios = serial_driver.init_termios; info->open_wait = 0; info->close_wait = 0; } return 0; }