source: rtems/c/src/lib/libbsp/mips/csb350/console/console-io.c @ e5ef747

4.104.114.84.95
Last change on this file since e5ef747 was e5ef747, checked in by Joel Sherrill <joel.sherrill@…>, on 03/12/07 at 11:17:51

2007-03-12 Joel Sherrill <joel@…>

  • clock/clockdrv.c, console/console-io.c, include/bsp.h, network/network.c, start/start.S, startup/bspclean.c, startup/bspstart.c, timer/timer.c: Correct license URL and/or fix mistake in copyright notice. Both of these mistakes appear to be from code submitted after these changes were made previously.
  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  This file contains the hardware specific portions of the TTY driver
3 *  for the serial ports on the csb350.
4 *
5 *  Logic based on the jmr3904-io.c file in newlib 1.8.2
6 *
7 *  COPYRIGHT (c) 1989-2000.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id$
15 */
16
17#include <bsp.h>
18#include <rtems/libio.h>
19#include <libcpu/au1x00.h>
20
21/*
22 *  console_initialize_hardware
23 *
24 *  This routine initializes the console hardware.
25 *
26 */
27
28void console_initialize_hardware(void)
29{
30    uart0->fifoctrl = 0xf1;   /* enable fifo, max sizes */
31    au_sync();
32}
33
34
35/*
36 *  console_outbyte_polled
37 *
38 *  This routine transmits a character using polling.
39 */
40
41void console_outbyte_polled(
42  int  port,
43  char ch
44)
45{
46    /* wait for the fifo to make room */
47    while ((uart0->linestat & 0x20) == 0) {
48        continue;
49    }
50   
51    uart0->txdata = ch;
52    au_sync();
53}
54
55/*
56 *  console_inbyte_nonblocking
57 *
58 *  This routine polls for a character.
59 */
60
61int console_inbyte_nonblocking(
62  int port
63)
64{
65  unsigned char c;
66
67  if (uart0->linestat & 1) {
68      c = (char)uart0->rxdata;
69      return c;
70  } else {
71      return -1;
72  }
73}
74
75#include <rtems/bspIo.h>
76
77void csb250_output_char(char c)
78{
79    console_outbyte_polled( 0, c );
80    if (c == '\n') {
81        console_outbyte_polled( 0, '\r' );
82    }
83}
84
85BSP_output_char_function_type           BSP_output_char = csb250_output_char;
86BSP_polling_getchar_function_type       BSP_poll_char = NULL;
87
Note: See TracBrowser for help on using the repository browser.