Exemple #1
0
static void receive_chars(struct m68k_serial *info, unsigned short rx)
{
	struct tty_struct *tty = info->tty;
	m68328_uart *uart = &uart_addr[info->line];
	unsigned char ch, flag;

	/*
	 * This do { } while() loop will get ALL chars out of Rx FIFO
         */
#ifndef CONFIG_XCOPILOT_BUGS
	do {
#endif
		ch = GET_FIELD(rx, URX_RXDATA);

		if(info->is_cons) {
			if(URX_BREAK & rx) { /* whee, break received */
				status_handle(info, rx);
				return;
#ifdef CONFIG_MAGIC_SYSRQ
			} else if (ch == 0x10) { /* ^P */
				show_state();
				show_free_areas(0);
				show_buffers();
/*				show_net_buffers(); */
				return;
			} else if (ch == 0x12) { /* ^R */
				emergency_restart();
				return;
#endif /* CONFIG_MAGIC_SYSRQ */
			}
		}

		if(!tty)
			goto clear_and_exit;

		flag = TTY_NORMAL;

		if(rx & URX_PARITY_ERROR) {
			flag = TTY_PARITY;
			status_handle(info, rx);
		} else if(rx & URX_OVRUN) {
			flag = TTY_OVERRUN;
			status_handle(info, rx);
		} else if(rx & URX_FRAME_ERROR) {
			flag = TTY_FRAME;
			status_handle(info, rx);
		}
		tty_insert_flip_char(tty, ch, flag);
#ifndef CONFIG_XCOPILOT_BUGS
	} while((rx = uart->urx.w) & URX_DATA_READY);
#endif

	tty_schedule_flip(tty);

clear_and_exit:
	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;
}
static _INLINE_ void receive_chars(struct bf535_serial *info, struct pt_regs *regs, unsigned short rx)
{
	struct tty_struct *tty = info->tty;
	unsigned char ch;
	int idx = info->hub2;

	/*
	 * This do { } while() loop will get ALL chars out of Rx FIFO 
         */
	do {
		ch = (unsigned char) rx;
	
		if(info->is_cons) {
			if (UART_LSR(idx) & UART_LSR_BI){ /* break received */ 
				status_handle(info, UART_LSR(idx));
				return;
			} else if (ch == 0x10) { /* ^P */
				show_state();
				show_free_areas();
				show_buffers();
/*				show_net_buffers(); */
				return;
			} else if (ch == 0x12) { /* ^R */
				machine_restart(NULL);
				return;
			}
		}

		if(!tty){
			printk("no tty\n");
			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(UART_LSR(idx) & UART_LSR_PE) {
			*tty->flip.flag_buf_ptr++ = TTY_PARITY;
			status_handle(info, UART_LSR(idx));
		} else if(UART_LSR(idx) & UART_LSR_OE) {
			*tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
			status_handle(info, UART_LSR(idx));
		} else if(UART_LSR(idx) & UART_LSR_FE) {
			*tty->flip.flag_buf_ptr++ = TTY_FRAME;
			status_handle(info, UART_LSR(idx));
		} else {
			*tty->flip.flag_buf_ptr++ = 0; /* XXX */
		}

		tty->flip.count++;
                *tty->flip.char_buf_ptr++ = ch;

		ACCESS_PORT_IER(idx) /* change access to port data */
		rx = UART_RBR(idx);
	} while(UART_LSR(idx) & UART_LSR_DR);

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

clear_and_exit:
	return;
}
Exemple #4
0
static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *regs, unsigned short rx)
{
	struct tty_struct *tty = info->tty;
	m68328_uart *uart = &uart_addr[info->line];
	unsigned char ch, flag;

	/*
	 * This do { } while() loop will get ALL chars out of Rx FIFO 
         */
#ifndef CONFIG_XCOPILOT_BUGS
	do {
#endif	
		ch = GET_FIELD(rx, URX_RXDATA);
	
		if(info->is_cons) {
			if(URX_BREAK & rx) { /* whee, break received */
				status_handle(info, rx);
				return;
#ifdef CONFIG_MAGIC_SYSRQ
			} else if (ch == 0x10) { /* ^P */
				show_state();
				show_free_areas();
				show_buffers();
/*				show_net_buffers(); */
				return;
			} else if (ch == 0x12) { /* ^R */
				emergency_restart();
				return;
#endif /* CONFIG_MAGIC_SYSRQ */
			}
			/* It is a 'keyboard interrupt' ;-) */
#ifdef CONFIG_CONSOLE
			wake_up(&keypress_wait);
#endif			
		}

		if(!tty)
			goto clear_and_exit;
		
		/*
		 * Make sure that we do not overflow the buffer
		 */
		if (tty_request_buffer_room(tty, 1) == 0) {
			tty_schedule_flip(tty);
			return;
		}

		flag = TTY_NORMAL;

		if(rx & URX_PARITY_ERROR) {
			flag = TTY_PARITY;
			status_handle(info, rx);
		} else if(rx & URX_OVRUN) {
			flag = TTY_OVERRUN;
			status_handle(info, rx);
		} else if(rx & URX_FRAME_ERROR) {
			flag = TTY_FRAME;
			status_handle(info, rx);
		}
		tty_insert_flip_char(tty, ch, flag);
#ifndef CONFIG_XCOPILOT_BUGS
	} while((rx = uart->urx.w) & URX_DATA_READY);
#endif

	tty_schedule_flip(tty);

clear_and_exit:
	return;
}
Exemple #5
0
static _INLINE_ void receive_chars(struct LEON_serial *info, struct pt_regs *regs, unsigned short rx)
{
	struct tty_struct *tty = info->tty;
	unsigned char ch;

	/*
	 * This do { } while() loop will get ALL chars out of Rx FIFO 
         */
	do {
		ch = leon->uartdata1;
	
		if(info->is_cons) {
			if(0 /* LEON does not report break */ & rx) { /* whee, break received */
				status_handle(info, rx);
				return;
			} else if (ch == 0x10) { /* ^P */
				show_state();
				show_free_areas();
				show_buffers();
				show_net_buffers();
				return;
			} else if (ch == 0x12) { /* ^R */
				hard_reset_now();
				return;
			}
			/* It is a 'keyboard interrupt' ;-) */
			wake_up(&keypress_wait);
		}

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

		if(rx & USTAT_PE) {
			*tty->flip.flag_buf_ptr++ = TTY_PARITY;
			status_handle(info, rx);
		} else if(rx & USTAT_OV) {
			*tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
			status_handle(info, rx);
		} else if(rx & USTAT_FE) {
			*tty->flip.flag_buf_ptr++ = TTY_FRAME;
			status_handle(info, rx);
		} else {
			*tty->flip.flag_buf_ptr++ = 0; /* XXX */
		}
                *tty->flip.char_buf_ptr++ = ch;
		tty->flip.count++;

	} while((rx = leon->uartstatus1) & USTAT_DR);

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

clear_and_exit:
	return;
}
Exemple #6
0
static _INLINE_ void receive_chars(struct m68k_serial *info, struct pt_regs *regs, unsigned short rx)
{
    struct tty_struct *tty = info->tty;
#ifndef CONFIG_XCOPILOT_BUGS
    m68328_uart *uart = &uart_addr[info->line];
#endif
    unsigned char ch;

    /*
     * This do { } while() loop will get ALL chars out of Rx FIFO
         */
#ifndef CONFIG_XCOPILOT_BUGS
    do {
#endif
        ch = GET_FIELD(rx, URX_RXDATA);

        if(info->is_cons) {
            if(URX_BREAK & rx) { /* whee, break received */
                status_handle(info, rx);
                return;
#ifdef CONFIG_MAGIC_SYSRQ
            } else if (ch == 0x10) { /* ^P */
                show_state();
                show_free_areas();
                show_buffers();
                /*				show_net_buffers(); */
                return;
            } else if (ch == 0x12) { /* ^R */
                machine_restart(NULL);
                return;
#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 & URX_PARITY_ERROR) {
            *tty->flip.flag_buf_ptr++ = TTY_PARITY;
            status_handle(info, rx);
        } else if(rx & URX_OVRUN) {
            *tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
            status_handle(info, rx);
        } else if(rx & URX_FRAME_ERROR) {
            *tty->flip.flag_buf_ptr++ = TTY_FRAME;
            status_handle(info, rx);
        } else {
            *tty->flip.flag_buf_ptr++ = 0; /* XXX */
        }
        *tty->flip.char_buf_ptr++ = ch;
        tty->flip.count++;

#ifndef CONFIG_XCOPILOT_BUGS
    } while((rx = uart->urx.w) & URX_DATA_READY);
#endif

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

clear_and_exit:
    return;
}