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

5
Last change on this file since 1bc0ad2 was 1bc0ad2, checked in by Sebastian Huber <sebastian.huber@…>, on 09/08/17 at 08:38:46

Simplify and unify BSP_output_char

The BSP_output_char should output a char and not mingle with high level
processing, e.g. '\n' to '\r\n' translation. Move this translation to
rtems_putc(). Remove it from all the BSP_output_char implementations.

Close #3122.

  • Property mode set to 100644
File size: 1.5 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
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.org/license/LICENSE.
13 */
14
15#include <bsp.h>
16#include <bsp/console-polled.h>
17#include <rtems/libio.h>
18#include <libcpu/au1x00.h>
19
20/*
21 *  console_initialize_hardware
22 *
23 *  This routine initializes the console hardware.
24 *
25 */
26void console_initialize_hardware(void)
27{
28    uart0->fifoctrl = 0xf1;   /* enable fifo, max sizes */
29    au_sync();
30}
31
32
33/*
34 *  console_outbyte_polled
35 *
36 *  This routine transmits a character using polling.
37 */
38void console_outbyte_polled(
39  int  port,
40  char ch
41)
42{
43    /* wait for the fifo to make room */
44    while ((uart0->linestat & 0x20) == 0) {
45        continue;
46    }
47
48    uart0->txdata = ch;
49    au_sync();
50}
51/*
52 *  console_inbyte_nonblocking
53 *
54 *  This routine polls for a character.
55 */
56
57int console_inbyte_nonblocking(
58  int port
59)
60{
61  unsigned char c;
62
63  if (uart0->linestat & 1) {
64      c = (char)uart0->rxdata;
65      return c;
66  } else {
67      return -1;
68  }
69}
70
71#include <rtems/bspIo.h>
72
73static void csb250_output_char(char c)
74{
75    console_outbyte_polled( 0, c );
76}
77
78static int csb250_get_char(void)
79{
80  return console_inbyte_nonblocking(0);
81}
82
83BSP_output_char_function_type           BSP_output_char = csb250_output_char;
84BSP_polling_getchar_function_type       BSP_poll_char = csb250_get_char;
85
Note: See TracBrowser for help on using the repository browser.