source: rtems/c/src/lib/libbsp/v850/gdbv850sim/console/console-io.c @ 6279149

4.115
Last change on this file since 6279149 was 6279149, checked in by Joel Sherrill <joel.sherrill@…>, on Oct 8, 2014 at 9:04:56 PM

Add console-polled.h and update all BSPs that should use it.

The file console-polled.h provides the prototypes for the three
required methods when implementing a single port polled console
driver. This paradigm is common on simulators and simple hardware.

+ Updated the BSPs Makefile.am to make console-polled.h available.
+ Regenerated the BSPs preinstall.sm.
+ Updated console support files to include <bsp/console-polled.h>.
+ Updated console support files to make printk() support method static.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#include <bsp.h>
11#include <bsp/console-polled.h>
12#include <rtems/libio.h>
13#include <bsp/syscall.h>
14
15/*
16 *  console_initialize_hardware
17 *
18 *  This routine initializes the console hardware.
19 */
20void console_initialize_hardware(void)
21{
22}
23
24/*
25 *  console_outbyte_polled
26 *
27 *  This routine transmits a character using polling.
28 */
29void console_outbyte_polled(
30  int  port,
31  char ch
32)
33{
34  TRAP0(SYS_write, 1, &ch, 1);
35}
36
37/*
38 *  console_inbyte_nonblocking
39 *
40 *  This routine polls for a character.
41 */
42
43int console_inbyte_nonblocking(
44  int port
45)
46{
47  char ch;
48  int  rc;
49
50  rc = TRAP0 (SYS_read, 0, &ch, 1);
51
52  if ( rc != 1 )
53    return -1;
54  return ch;
55}
56
57#include <rtems/bspIo.h>
58
59static void console_output_char(char c) { console_outbyte_polled( 0, c ); }
60
61BSP_output_char_function_type           BSP_output_char = console_output_char;
62BSP_polling_getchar_function_type       BSP_poll_char = NULL;
Note: See TracBrowser for help on using the repository browser.