4.115
Last change
on this file since c499856 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
Property mode set to
100644
|
File size:
1.8 KB
|
Rev | Line | |
---|
[02e708d] | 1 | /* |
---|
| 2 | * This file contains the hardware specific portions of the TTY driver |
---|
| 3 | * for the serial ports on the mcf5272 |
---|
| 4 | * |
---|
| 5 | * COPYRIGHT (c) 1989-2000. |
---|
| 6 | * On-Line Applications Research Corporation (OAR). |
---|
| 7 | * |
---|
| 8 | * The license and distribution terms for this file may be |
---|
| 9 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 10 | * http://www.rtems.org/license/LICENSE. |
---|
[02e708d] | 11 | */ |
---|
| 12 | |
---|
| 13 | #include <bsp.h> |
---|
| 14 | #include <rtems/libio.h> |
---|
| 15 | #include <mcf5272/mcf5272.h> |
---|
| 16 | |
---|
[b5e685b0] | 17 | volatile int g_cnt = 0; |
---|
[02e708d] | 18 | |
---|
| 19 | /* |
---|
| 20 | * console_initialize_hardware |
---|
| 21 | * |
---|
| 22 | * This routine initializes the console hardware. |
---|
| 23 | * |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | void console_initialize_hardware(void) |
---|
| 27 | { |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | /* |
---|
| 32 | * console_outbyte_polled |
---|
| 33 | * |
---|
| 34 | * This routine transmits a character using polling. |
---|
| 35 | */ |
---|
| 36 | |
---|
| 37 | void console_outbyte_polled( |
---|
| 38 | int port, |
---|
| 39 | char ch |
---|
| 40 | ) |
---|
| 41 | { |
---|
| 42 | uart_regs_t *uart; |
---|
| 43 | int i; |
---|
| 44 | if (port == 0) { |
---|
| 45 | uart = g_uart0_regs; |
---|
| 46 | } else { |
---|
| 47 | uart = g_uart1_regs; |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | /* wait for the fifo to make room */ |
---|
| 51 | /* while ((uart->usr & MCF5272_USR_TXRDY) == 0) { */ |
---|
| 52 | while ((uart->ucsr & MCF5272_USR_TXRDY) == 0) { |
---|
| 53 | continue; |
---|
| 54 | } |
---|
[d4b4664b] | 55 | |
---|
[02e708d] | 56 | uart->udata = ch; |
---|
| 57 | for (i = 0; i < 1000; i++) g_cnt++; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /* |
---|
[d4b4664b] | 61 | * console_inbyte_nonblocking |
---|
[02e708d] | 62 | * |
---|
| 63 | * This routine polls for a character. |
---|
| 64 | */ |
---|
| 65 | |
---|
| 66 | int console_inbyte_nonblocking( |
---|
| 67 | int port |
---|
| 68 | ) |
---|
| 69 | { |
---|
| 70 | uart_regs_t *uart; |
---|
| 71 | unsigned char c; |
---|
| 72 | |
---|
| 73 | if (port == 0) { |
---|
| 74 | uart = g_uart0_regs; |
---|
| 75 | } else { |
---|
| 76 | uart = g_uart1_regs; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | /* if (uart->usr & MCF5272_USR_RXRDY) { */ |
---|
| 80 | if (uart->ucsr & MCF5272_USR_RXRDY) { |
---|
| 81 | c = (char)uart->udata; |
---|
| 82 | return c; |
---|
| 83 | } else { |
---|
| 84 | return -1; |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | #include <rtems/bspIo.h> |
---|
| 89 | |
---|
| 90 | void mcf5272_output_char(char c) { console_outbyte_polled( 0, c ); } |
---|
| 91 | |
---|
| 92 | BSP_output_char_function_type BSP_output_char = mcf5272_output_char; |
---|
| 93 | BSP_polling_getchar_function_type BSP_poll_char = NULL; |
---|
| 94 | |
---|
Note: See
TracBrowser
for help on using the repository browser.