Hi,
I am currently developing a low level serial driver to be registered with serial_core.c (in latest 2.6. kernel source), and I have a couple of questions about it.
Should serial_core.c be compiled with my driver? In the Makefile, should there be something like... ?
obj-m := serial_core.o myserial.o
And also, what does the algorithm of this code means (also found in drivers/serial/uart00.c of latest 2.6 kernel source)?
Code:
59 static void uart_tx_chars(struct uart_port *port)
60 {
61 struct circ_buf *xmit = &port->info->xmit;
62 int count;
63
64 if (port->x_char) {
65 pr_debug("wrote %2x", port->x_char);
66 port->icount.tx++;
67 port->x_char = 0;
68 return;
69 }
70 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
71 tiny_stop_tx(port);
72 return;
73 }
74
75 count = port->fifosize >> 1;
76 do {
77
78 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
79 port->icount.tx++;
80 if (uart_circ_empty(xmit))
81 break;
82 } while (--count > 0);
83
84 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
85 uart_write_wakeup(port);
86
87 if (uart_circ_empty(xmit))
88 tiny_stop_tx(port);
89 }
what is the purpose of shifting in "count = port->fifosize >> 1"?
Thanks!