source: rtems/c/src/lib/libbsp/sparc64/shared/console/conscfg.c @ f61b2f8

4.115
Last change on this file since f61b2f8 was f61b2f8, checked in by Sebastian Huber <sebastian.huber@…>, on 03/21/11 at 08:21:41

2011-03-21 Sebastian Huber <sebastian.huber@…>

PR 1770/bsps

  • shared/console/conscfg.c: Rely on default device file registration.
  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[566a1806]1/*
2 *  COPYRIGHT (c) 2010 Eugen Leontie.
3 *
4 *  The license and distribution terms for this file may be
5 *  found in the file LICENSE in this distribution or at
6 *  http://www.rtems.com/license/LICENSE.
7 *
8 *  $Id$
9 */
10
11
12#include <bsp.h>
13
14#include <libchip/serial.h>
15
16extern void ofw_write(const char *,const int );
17extern void ofw_read(void *,int );
18
19int sun4v_console_device_first_open(int major, int minor, void *arg)
20{
21        return 0;
22}
23
24static ssize_t sun4v_console_poll_write(int minor, const char *buf, size_t n)
25{
26        ofw_write(buf, n);
27        return 0;
28}
29
30void sun4v_console_deviceInitialize (int minor)
31{
32       
33}
34
35int sun4v_console_poll_read(int minor){
36        int a;
37        ofw_read(&a,1);
38        if(a!=0){
39                return a>>24;
40        }
41        return -1;
42}
43
44
45bool sun4v_console_deviceProbe (int minor){
46        return true;
47}
48
49/*
50 *  Polled mode functions
51 */
52console_fns pooled_functions={
53 sun4v_console_deviceProbe, /*bool    (*deviceProbe)(int minor);*/
54 sun4v_console_device_first_open, /*int     (*deviceFirstOpen)(int major, int minor, void *arg);*/
55 NULL, /*int     (*deviceLastClose)(int major, int minor, void *arg);*/
56 sun4v_console_poll_read, /*int     (*deviceRead)(int minor);*/
57 sun4v_console_poll_write, /*ssize_t     (*deviceWrite)(int minor, const char *buf, size_t len);*/
58 sun4v_console_deviceInitialize, /*void    (*deviceInitialize)(int minor);*/
59 NULL, /*void    (*deviceWritePolled)(int minor, char cChar);*/
60 NULL, /*int     (*deviceSetAttributes)(int minor, const struct termios *t);*/
61 NULL /*bool    deviceOutputUsesInterrupts;*/
62};
63
64console_flow sun4v_console_console_flow={
65  NULL,/*int (*deviceStopRemoteTx)(int minor);*/
66  NULL/*int (*deviceStartRemoteTx)(int minor);*/
67};
68
69
70console_tbl     Console_Port_Tbl[] = {
71{
[f61b2f8]72   NULL,                                   /* sDeviceName */
[566a1806]73   SERIAL_CUSTOM,                          /* deviceType */
74   &pooled_functions,                      /* pDeviceFns */
75   NULL,                                                        /* deviceProbe, assume it is there */
76   &sun4v_console_console_flow,             /* pDeviceFlow */
77   0,                                      /* ulMargin */
78   0,                                      /* ulHysteresis */
79   (void *) NULL,               /* NULL */ /* pDeviceParams */
80   0,                                                                      /* ulCtrlPort1 */
81   0,                                                      /* ulCtrlPort2 */
82   1,                                      /* ulDataPort */
83   NULL,                                   /* getRegister */
84   NULL,                                   /* setRegister */
85   NULL, /* unused */                      /* getData */
86   NULL, /* unused */                      /* setData */
87   0,                                              /* ulClock */
88   0                                                                       /* ulIntVector -- base for port */
89},
90};
91
92
93
94/*
95 *  Declare some information used by the console driver
96 */
97
98#define NUM_CONSOLE_PORTS 1
99
100unsigned long  Console_Port_Count = NUM_CONSOLE_PORTS;
101
102console_data  Console_Port_Data[NUM_CONSOLE_PORTS];
103
104rtems_device_minor_number  Console_Port_Minor;
105
106
107/* putchar/getchar for printk */
108
109static void bsp_out_char (char c)
110{
111  ofw_write(&c, 1);
112}
113
114BSP_output_char_function_type BSP_output_char = bsp_out_char;
115
[019fd4b]116static int bsp_in_char( void ){
117        int tmp;
118        ofw_read( &tmp, 1 ); /* blocks */
119        if( tmp != 0 ) {
120                return tmp>>24;
121        }
122        return -1;
123}
124
125BSP_polling_getchar_function_type BSP_poll_char = bsp_in_char;
126
Note: See TracBrowser for help on using the repository browser.