Changeset 1fefc719 in rtems
- Timestamp:
- 03/09/17 17:51:47 (7 years ago)
- Branches:
- 5, master
- Children:
- 6e2e1299
- Parents:
- fd9fb21
- git-author:
- Martin Aberg <maberg@…> (03/09/17 17:51:47)
- git-committer:
- Daniel Hellstrom <daniel@…> (05/02/17 10:34:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/lib/libbsp/sparc/shared/uart/apbuart_cons.c
rfd9fb21 r1fefc719 51 51 extern struct apbuart_regs *dbg_uart; /* The debug UART */ 52 52 53 /* Probed hardware capabilities */ 54 enum { 55 CAP_FIFO = 0x01, /* FIFO available */ 56 CAP_DI = 0x02, /* RX delayed interrupt available */ 57 }; 53 58 struct apbuart_priv { 54 59 struct console_dev condev; … … 59 64 volatile int sending; 60 65 int mode; 66 int cap; 61 67 }; 62 68 … … 187 193 }; 188 194 195 /* 196 * APBUART hardware instantiation is flexible. Probe features here and driver 197 * can select appropriate routines for the hardware. probecap() return value 198 * is a CAP_ bitmask. 199 */ 200 static int probecap(struct apbuart_regs *regs) 201 { 202 int cap = 0; 203 204 /* Probe FIFO */ 205 if (regs->ctrl & APBUART_CTRL_FA) { 206 cap |= CAP_FIFO; 207 208 /* Probe RX delayed interrupt */ 209 regs->ctrl |= APBUART_CTRL_DI; 210 if (regs->ctrl & APBUART_CTRL_DI) { 211 regs->ctrl &= ~APBUART_CTRL_DI; 212 cap |= CAP_DI; 213 } 214 } 215 216 return cap; 217 } 218 189 219 int apbuart_init1(struct drvmgr_dev *dev) 190 220 { … … 254 284 255 285 priv->regs->ctrl = db; 286 287 priv->cap = probecap(priv->regs); 256 288 257 289 /* The system console and Debug console may depend on this device, so … … 418 450 if (uart->mode != TERMIOS_POLLED) { 419 451 int ret; 452 uint32_t ctrl; 420 453 421 454 /* Register interrupt and enable it */ … … 428 461 429 462 uart->sending = 0; 463 430 464 /* Turn on RX interrupts */ 431 uart->regs->ctrl |= APBUART_CTRL_RI; 465 ctrl = uart->regs->ctrl; 466 ctrl |= APBUART_CTRL_RI; 467 if (uart->cap & CAP_DI) { 468 /* Use RX FIFO interrupt only if delayed interrupt available. */ 469 ctrl |= (APBUART_CTRL_DI | APBUART_CTRL_RF); 470 } 471 uart->regs->ctrl = ctrl; 432 472 } 433 473 … … 447 487 /* Turn off RX interrupts */ 448 488 rtems_termios_device_lock_acquire(base, &lock_context); 449 uart->regs->ctrl &= ~(APBUART_CTRL_RI );489 uart->regs->ctrl &= ~(APBUART_CTRL_RI | APBUART_CTRL_RF); 450 490 rtems_termios_device_lock_release(base, &lock_context); 451 491
Note: See TracChangeset
for help on using the changeset viewer.