void ADSL_DisableIRQ1_2(void) { register UINT32 temp; if (pF2_IRQ1_ISR == 0 && pF2_IRQ2_ISR == 0) return; temp = intLock(); #ifdef LEVEL_MODE_ADSL DisableInterruptCount++; if (pF2_IRQ1_ISR) SetGPIOIntEnable(GPIOINT_F2_IRQ1, 0); if (pF2_IRQ2_ISR) SetGPIOIntEnable(GPIOINT_F2_IRQ2, 0); /* Indicate start of critical section for debug */ SetGPIOF2PCS(TRUE); intUnlock(temp); #else /* LEVEL_MODE_ADSL */ oldValue[DisableInterruptCount]=temp; if (DisableInterruptCount == 0) /* Indicate start of critical section for debug */ SetGPIOF2PCS(TRUE); DisableInterruptCount++; #endif /* LEVEL_MODE_ADSL */ }
void ADSL_EnableIRQ1_2(void) { register UINT32 temp; if (pF2_IRQ1_ISR == 0 && pF2_IRQ2_ISR == 0) return; temp= intLock(); #ifdef LEVEL_MODE_ADSL if (DisableInterruptCount) DisableInterruptCount--; if (DisableInterruptCount == 0) { /* Indicate out of critical section for debug */ SetGPIOF2PCS(FALSE); if (pF2_IRQ1_ISR) SetGPIOIntEnable(GPIOINT_F2_IRQ1, 1); if (pF2_IRQ2_ISR) SetGPIOIntEnable(GPIOINT_F2_IRQ2, 1); } intUnlock(temp); #else /* LEVEL_MODE_ADSL */ if (DisableInterruptCount == 0) { intUnlock(temp); return; } DisableInterruptCount--; if (DisableInterruptCount == 0) /* Indicate out of critical section for debug */ SetGPIOF2PCS(FALSE); /* Allow for nesting, push values onto a stack */ intUnlock(temp); intUnlock(oldValue[DisableInterruptCount]); #endif /* LEVEL_MODE_ADSL */ }
/* * This routine is called whenever a serial port is opened. It * enables interrupts for a serial port, linking in its S structure into * the IRQ chain. It also performs the serial-specific * initialization for the tty structure. */ int rs_open(struct tty_struct *tty, struct file * filp) { int retval, line; struct cnxt_serial *info; line = MINOR(tty->device) - tty->driver.minor_start; if (line != 0) /* we have exactly one */ return -ENODEV; info = &uart_info; if (serial_paranoia_check(info, tty->device, "rs_open")) return -ENODEV; info->count++; tty->driver_data = info; info->tty = tty; /* * Start up serial port */ retval = startup(info); if (retval) return retval; retval = block_til_ready(tty, filp, info); if (retval) { printk("rs_open returning after block_til_ready with %d\n", retval); return retval; } if ((info->count == 1) && (info->flags & S_SPLIT_TERMIOS)) { if (tty->driver.subtype == SERIAL_TYPE_NORMAL) *tty->termios = info->normal_termios; else *tty->termios = info->callout_termios; change_speed(info); } info->session = current->session; info->pgrp = current->pgrp; // Enable GPIO interrupt line for console uart SetGPIOIntEnable(GPIOINT_UART1, IRQ_ON); return 0; }
/* Showtime code registers callbacks */ void SetF2Interrupts(void (*(pIRQ1))(void *),void (*(pIRQ2))(void *), void *pContext) { UINT32 OldLevel = 0; OldLevel = intLock(); pFalconContext = pContext ; if (pIRQ1) { pF2_IRQ1_ISR= pIRQ1; GPIO_SetGPIOIRQRoutine(GPIOINT_F2_IRQ1, GPIOB10_Handler); SetGPIOInputEnable( GPIOINT_F2_IRQ1, GP_INPUTON ); SetGPIOIntEnable(GPIOINT_F2_IRQ1, IRQ_OFF); #ifdef LEVEL_MODE_ADSL SetGPIOIntMode (GPIOINT_F2_IRQ1, GP_IRQ_MODE_LEVEL); #endif SetGPIOIntPolarity (GPIOINT_F2_IRQ1, GP_IRQ_POL_NEGATIVE); SetGPIOIntEnable(GPIOINT_F2_IRQ1, IRQ_ON); } else { SetGPIOIntEnable(GPIOINT_F2_IRQ1, IRQ_OFF); ClearGPIOIntStatus(GPIOINT_F2_IRQ1); pF2_IRQ1_ISR= pIRQ1; } if (pIRQ2) { pF2_IRQ2_ISR= pIRQ2; GPIO_SetGPIOIRQRoutine(GPIOINT_F2_IRQ2, GPIOB11_Handler); SetGPIOInputEnable( GPIOINT_F2_IRQ2, GP_INPUTON ); SetGPIOIntEnable(GPIOINT_F2_IRQ2, IRQ_OFF); #ifdef LEVEL_MODE_ADSL SetGPIOIntMode (GPIOINT_F2_IRQ2, GP_IRQ_MODE_LEVEL); #endif SetGPIOIntPolarity (GPIOINT_F2_IRQ2, GP_IRQ_POL_NEGATIVE); SetGPIOIntEnable(GPIOINT_F2_IRQ2, IRQ_ON); } else { SetGPIOIntEnable(GPIOINT_F2_IRQ2, IRQ_OFF); ClearGPIOIntStatus(GPIOINT_F2_IRQ2); pF2_IRQ2_ISR= pIRQ2; } intUnlock(OldLevel); }
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; }