Ejemplo n.º 1
0
struct port *__libnet_internal__serial_open(int portnum)
{
    struct port *p;
    int uart, baudrate, cfg;
    
    if ((portnum < 0) || (portnum >= MAX_PORT))
	return NULL;

    p = port_table[portnum];
    memset(p, 0, sizeof *p);

    if (config[portnum].baseaddr == -1) {
	dosmemget(0x400 + portnum * 2, 2, &p->baseaddr);
	if (p->baseaddr == 0)
	    p->baseaddr = fallback_baseaddr[portnum];
    }
    else {
	p->baseaddr = config[portnum].baseaddr;
    }

    uart = detect_uart(p->baseaddr);
    if (!uart)
	return NULL;

    if (uart == UART_16550A)
	enable_fifo(p);
    else 
	disable_fifo(p);

    install_isr(portnum, p, config[portnum].irq);

    set_config(p->baseaddr, config[portnum].baudrate, 
	       (config[portnum].bits 
		| config[portnum].parity 
		| config[portnum].stopbits));

    return p;
}
Ejemplo n.º 2
0
void auto_detect_uart(char *param)
{
	while(1){
		detect_uart("");
	}
}