Driver/tiny_serial/tiny_set_termios()

Last-modified: 2007-09-20 (木) 15:12:57
参照 p.571

142 :static void tiny_set_termios(struct uart_port *port,
143 : struct termios *new, struct termios *old)
144 :{
145 : int baud, quot, cflag = new->c_cflag;
146 : /* get the byte size */
147 : switch (cflag & CSIZE) {

data bitのチェック

148 : case CS5:
149 : printk(KERN_DEBUG " - data bits = 5\n");
150 : break;
151 : case CS6:
152 : printk(KERN_DEBUG " - data bits = 6\n");
153 : break;
154 : case CS7:
155 : printk(KERN_DEBUG " - data bits = 7\n");
156 : break;
157 : default: // CS8
158 : printk(KERN_DEBUG " - data bits = 8\n");
159 : break;
160 : }
161 :
162 : /* determine the parity */
163 : if (cflag & PARENB)
164 : if (cflag & PARODD)
165 : pr_debug(" - parity = odd\n");
166 : else
167 : pr_debug(" - parity = even\n");
168 : else
169 : pr_debug(" - parity = none\n");
170 :
171 : /* figure out the stop bits requested */
172 : if (cflag & CSTOPB)
173 : pr_debug(" - stop bits = 2\n");
174 : else
175 : pr_debug(" - stop bits = 1\n");
176 :
177 : /* figure out the flow control settings */
178 : if (cflag & CRTSCTS)
179 : pr_debug(" - RTS/CTS is enabled\n");
180 : else
181 : pr_debug(" - RTS/CTS is disabled\n");
182 :
183 : /* Set baud rate */
184 : baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16);
185 : quot = uart_get_divisor(port, baud);
186 :
187 : //UART_PUT_DIV_LO(port, (quot & 0xff));
188 : //UART_PUT_DIV_HI(port, ( (quot & 0xf00) > > 8));
189 :}
190 :
290 :