示例#1
0
static void status_handle(struct m68k_serial *info, unsigned short status)
{
#if 0
	if(status & DCD) {
		if((info->port.tty->termios->c_cflag & CRTSCTS) &&
		   ((info->curregs[3] & AUTO_ENAB)==0)) {
			info->curregs[3] |= AUTO_ENAB;
			info->pendregs[3] |= AUTO_ENAB;
			write_zsreg(info->m68k_channel, 3, info->curregs[3]);
		}
	} else {
		if((info->curregs[3] & AUTO_ENAB)) {
			info->curregs[3] &= ~AUTO_ENAB;
			info->pendregs[3] &= ~AUTO_ENAB;
			write_zsreg(info->m68k_channel, 3, info->curregs[3]);
		}
	}
#endif
	/* If this is console input and this is a
	 * 'break asserted' status change interrupt
	 * see if we can drop into the debugger
	 */
	if((status & URX_BREAK) && info->break_abort)
		batten_down_hatches();
	return;
}
示例#2
0
static int emulate_raw(unsigned int keycode, int down)
{
#ifdef CONFIG_MAC_EMUMOUSEBTN
	if (mac_hid_mouse_emulate_buttons(1, keycode, down))
		return 0;
#endif /* CONFIG_MAC_EMUMOUSEBTN */
#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD)
	if (!mac_hid_keyboard_sends_linux_keycodes()) {
		if (keycode > 255 || !mac_keycodes[keycode])
			return -1;
       
		handle_scancode((mac_keycodes[keycode] & 0x7f), down);
		return 0;
	}
#endif	/* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */

	if (keycode > 255 || !x86_keycodes[keycode])
		return -1; 

	if (keycode == KEY_PAUSE) {
		handle_scancode(0xe1, 1);
		handle_scancode(0x1d, down);
		handle_scancode(0x45, down);
		return 0;
	} 

	if (keycode == KEY_SYSRQ && x86_sysrq_alt) {
		handle_scancode(0x54, down);

		return 0;
	}

#ifdef CONFIG_SPARC64
	if (keycode == KEY_A && sparc_l1_a_state) {
		sparc_l1_a_state = 0;
		batten_down_hatches();
	}
#endif

	if (x86_keycodes[keycode] & 0x100)
		handle_scancode(0xe0, 1);

	handle_scancode(x86_keycodes[keycode] & 0x7f, down);

	if (keycode == KEY_SYSRQ) {
		handle_scancode(0xe0, 1);
		handle_scancode(0x37, down);
	}

	if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT)
		x86_sysrq_alt = down;
#ifdef CONFIG_SPARC64
	if (keycode == KEY_STOP)
		sparc_l1_a_state = down;
#endif

	return 0;
}
static _INLINE_ void status_handle(struct bf535_serial *info, unsigned short status)
{
	/* If this is console input and this is a
	 * 'break asserted' status change interrupt
	 * see if we can drop into the debugger
	 */
	if((status & UART_LSR_BI) && info->break_abort)
		batten_down_hatches();
	return;
}
static _INLINE_ void receive_chars(struct NIOS_serial *info, struct pt_regs *regs, unsigned short rx)
{
	struct tty_struct *tty = info->tty;
	unsigned char ch;
	np_uart *	uart= (np_uart *)(info->port);

	/*
	 * This do { } while() loop will get ALL chars out of Rx FIFO
         */
	do {
		ch = uart->np_uartrxdata;

		if(info->is_cons) {
#ifdef CONFIG_MAGIC_SYSRQ
			if(rx & np_uartstatus_brk_mask) {
				batten_down_hatches();
				return;
			} else if (ch == 0x10) { /* ^P */
				show_state();
				show_mem();
				return;
			} else if (ch == 0x12) { /* ^R */
				hard_reset_now();
				return;
#ifdef DEBUG
			} else if (ch == 0x02) { /* ^B */
				batten_down_hatches();
				return;
			} else if (ch == 0x01) { /* ^A */
				asm("trap 0");		/* Back to monitor */
				return;			/* (won't be coming back) */
#endif
			}
#endif /* CONFIG_MAGIC_SYSRQ */
		}

		if(!tty)
			goto clear_and_exit;

		/*
		 * Make sure that we do not overflow the buffer
		 */
		if (tty->flip.count >= TTY_FLIPBUF_SIZE) {
			queue_task(&tty->flip.tqueue, &tq_timer);
			return;
		}

		if(rx & np_uartstatus_pe_mask) {
			*tty->flip.flag_buf_ptr++ = TTY_PARITY;
			status_handle(info, rx);
		} else if(rx & np_uartstatus_roe_mask) {
			*tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
			status_handle(info, rx);
		} else if(rx & np_uartstatus_fe_mask) {
			*tty->flip.flag_buf_ptr++ = TTY_FRAME;
			status_handle(info, rx);
		} else if(rx & np_uartstatus_brk_mask) {
			*tty->flip.flag_buf_ptr++ = TTY_BREAK;
			status_handle(info, rx);
		} else {
			*tty->flip.flag_buf_ptr++ = 0; /* XXX */
		}
		*tty->flip.char_buf_ptr++ = ch;
		tty->flip.count++;

	} while((rx = uart->np_uartstatus) & np_uartstatus_rrdy_mask);

	queue_task(&tty->flip.tqueue, &tq_timer);

clear_and_exit:
	return;
}