4.104.115
Last change
on this file since 38386473 was
94bbe857,
checked in by Joel Sherrill <joel.sherrill@…>, on 05/09/07 at 17:49:53
|
2007-05-09 Joel Sherrill <joel.sherrill@…>
- console/debugputs.c, include/bsp.h, leon_smc91111/leon_smc91111.c,
startup/spurious.c: Remove debug print methods that are redundant
with prntk and replace their use with printk.
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | /* |
---|
2 | * This file contains the TTY driver for the serial ports on the LEON. |
---|
3 | * |
---|
4 | * This driver uses the termios pseudo driver. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-1999. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #include <bsp.h> |
---|
17 | #include <rtems/libio.h> |
---|
18 | #include <stdlib.h> |
---|
19 | #include <assert.h> |
---|
20 | |
---|
21 | /* |
---|
22 | * console_outbyte_polled |
---|
23 | * |
---|
24 | * This routine transmits a character using polling. |
---|
25 | */ |
---|
26 | |
---|
27 | void console_outbyte_polled( |
---|
28 | int port, |
---|
29 | unsigned char ch |
---|
30 | ) |
---|
31 | { |
---|
32 | if ( port == 0 ) { |
---|
33 | while ( (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_THE) == 0 ); |
---|
34 | LEON_REG.UART_Channel_1 = (unsigned int) ch; |
---|
35 | return; |
---|
36 | } |
---|
37 | |
---|
38 | while ( (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_THE) == 0 ); |
---|
39 | LEON_REG.UART_Channel_2 = (unsigned int) ch; |
---|
40 | } |
---|
41 | |
---|
42 | /* |
---|
43 | * console_inbyte_nonblocking |
---|
44 | * |
---|
45 | * This routine polls for a character. |
---|
46 | */ |
---|
47 | |
---|
48 | int console_inbyte_nonblocking( int port ) |
---|
49 | { |
---|
50 | |
---|
51 | switch (port) { |
---|
52 | |
---|
53 | case 0: |
---|
54 | if (LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_ERR) { |
---|
55 | LEON_REG.UART_Status_1 = ~LEON_REG_UART_STATUS_ERR; |
---|
56 | } |
---|
57 | |
---|
58 | if ((LEON_REG.UART_Status_1 & LEON_REG_UART_STATUS_DR) == 0) |
---|
59 | return -1; |
---|
60 | return (int) LEON_REG.UART_Channel_1; |
---|
61 | return 1; |
---|
62 | |
---|
63 | case 1: |
---|
64 | if (LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_ERR) { |
---|
65 | LEON_REG.UART_Status_2 = ~LEON_REG_UART_STATUS_ERR; |
---|
66 | } |
---|
67 | |
---|
68 | if ((LEON_REG.UART_Status_2 & LEON_REG_UART_STATUS_DR) == 0) |
---|
69 | return -1; |
---|
70 | return (int) LEON_REG.UART_Channel_2; |
---|
71 | |
---|
72 | default: |
---|
73 | assert( 0 ); |
---|
74 | } |
---|
75 | |
---|
76 | return -1; |
---|
77 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.