Changeset 6fe6d017 in rtems
- Timestamp:
- 11/26/13 07:56:08 (10 years ago)
- Branches:
- 4.11, 5, master
- Children:
- 1d5d6de
- Parents:
- 1e744ef
- git-author:
- Sebastian Huber <sebastian.huber@…> (11/26/13 07:56:08)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (02/04/14 13:54:27)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/sparc/leon3/console/console.c
r1e744ef r6fe6d017 83 83 static int uarts = 0; 84 84 85 static struct apbuart_priv *leon3_console_get_uart(int minor) 86 { 87 struct apbuart_priv *uart; 88 89 if (minor == 0) 90 uart = &apbuarts[syscon_uart_index]; 91 else 92 uart = &apbuarts[minor - 1]; 93 94 return uart; 95 } 96 85 97 #if CONSOLE_USE_INTERRUPTS 86 98 … … 116 128 static int leon3_console_write_support(int minor, const char *buf, size_t len) 117 129 { 118 struct apbuart_priv *uart ;130 struct apbuart_priv *uart = leon3_console_get_uart(minor); 119 131 int sending; 120 121 if (minor == 0)122 uart = &apbuarts[syscon_uart_index];123 else124 uart = &apbuarts[minor - 1];125 132 126 133 if (len > 0) { … … 158 165 ssize_t console_write_polled(int minor, const char *buf, size_t len) 159 166 { 160 int nwrite = 0, port; 161 162 if (minor == 0) 163 port = syscon_uart_index; 164 else 165 port = minor - 1; 167 struct apbuart_priv *uart = leon3_console_get_uart(minor); 168 int nwrite = 0; 166 169 167 170 while (nwrite < len) { 168 apbuart_outbyte_polled( apbuarts[port].regs, *buf++, 1, 0);171 apbuart_outbyte_polled(uart->regs, *buf++, 1, 0); 169 172 nwrite++; 170 173 } … … 174 177 int console_pollRead(int minor) 175 178 { 176 int port; 177 178 if (minor == 0) 179 port = syscon_uart_index; 180 else 181 port = minor - 1; 182 183 return apbuart_inbyte_nonblocking(apbuarts[port].regs); 179 struct apbuart_priv *uart = leon3_console_get_uart(minor); 180 181 return apbuart_inbyte_nonblocking(uart->regs); 184 182 } 185 183 … … 196 194 int console_set_attributes(int minor, const struct termios *t) 197 195 { 196 struct apbuart_priv *uart = leon3_console_get_uart(minor); 198 197 unsigned int scaler; 199 198 unsigned int ctrl; 200 199 int baud; 201 struct apbuart_priv *uart;202 200 203 201 switch (t->c_cflag & CSIZE) { … … 211 209 break; 212 210 } 213 214 if (minor == 0)215 uart = &apbuarts[syscon_uart_index];216 else217 uart = &apbuarts[minor - 1];218 211 219 212 /* … … 372 365 static int leon3_console_first_open(int major, int minor, void *arg) 373 366 { 374 struct apbuart_priv *uart; 367 struct apbuart_priv *uart = leon3_console_get_uart(minor); 368 369 #if CONSOLE_USE_INTERRUPTS 375 370 rtems_status_code sc; 376 371 377 if (minor == 0)378 uart = &apbuarts[syscon_uart_index];379 else380 uart = &apbuarts[minor - 1];381 382 #if CONSOLE_USE_INTERRUPTS383 372 uart->cookie = leon3_console_get_tty(arg); 384 373 … … 408 397 { 409 398 struct rtems_termios_tty *tty = leon3_console_get_tty(arg); 410 struct apbuart_priv *uart ;399 struct apbuart_priv *uart = leon3_console_get_uart(minor); 411 400 rtems_interrupt_level level; 412 413 if (minor == 0)414 uart = &apbuarts[syscon_uart_index];415 else416 uart = &apbuarts[minor - 1];417 401 418 402 /* Turn off RX interrupts */
Note: See TracChangeset
for help on using the changeset viewer.