source: rtems/c/src/lib/libbsp/i386/pc386/console/conscfg.c @ 4977f07e

4.115
Last change on this file since 4977f07e was 4977f07e, checked in by Joel Sherrill <joel.sherrill@…>, on 10/09/14 at 17:56:18

i386/pc386: Eliminate multiple warnings

  • Property mode set to 100644
File size: 6.6 KB
Line 
1/*
2 *  This file contains the libchip configuration information
3 *  to instantiate the libchip driver for the VGA console
4 *  and serial ports on a PC.
5 */
6
7/*
8 *  COPYRIGHT (c) 1989-2014.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.org/license/LICENSE.
14 */
15
16#include <unistd.h> /* write */
17
18#include <bsp.h>
19#include <libchip/serial.h>
20#include <libchip/ns16550.h>
21#include "vgacons.h"
22#include <bsp/irq.h>
23#include <rtems/pci.h>
24#include <bsp/rtd316.h>
25
26#define VGA_CONSOLE_FUNCTIONS  &vgacons_fns
27#if 0
28#define COM_CONSOLE_FUNCTIONS  &ns16550_fns_polled
29#else
30#define COM_CONSOLE_FUNCTIONS  &ns16550_fns
31#endif
32
33/*
34 * Base IO for UART
35 */
36#define COM1_BASE_IO  0x3F8
37#define COM2_BASE_IO  0x3E8
38#define COM3_BASE_IO  0x2F8
39#define COM4_BASE_IO  0x2E8
40
41#define CLOCK_RATE     (115200 * 16)
42
43static uint8_t com_get_register(uint32_t addr, uint8_t i)
44{
45  register uint8_t val;
46 
47  inport_byte( (addr + i),val );
48  return val;
49}
50
51static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
52{
53  outport_byte( (addr + i),val );
54}
55
56console_tbl     Console_Configuration_Ports[] = {
57  {
58    "/dev/vgacons",                        /* sDeviceName */
59    VGA_CONSOLE,                           /* deviceType */
60    VGA_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
61    vgacons_probe,                         /* deviceProbe */
62    NULL,                                  /* pDeviceFlow */
63    16,                                    /* ulMargin */
64    8,                                     /* ulHysteresis */
65    (void *) NULL,              /* NULL */ /* pDeviceParams */
66    0x00000000,                            /* ulCtrlPort1 */
67    0x00000000,                            /* ulCtrlPort2 */
68    0x00000000,                            /* ulDataPort */
69    NULL,                                  /* getRegister */
70    NULL,                                  /* setRegister */
71    NULL,/* unused */                      /* getData */
72    NULL,/* unused */                      /* setData */
73    0X0,                                   /* ulClock */
74    0x0                                     /* ulIntVector -- base for port */
75  },
76  {
77    "/dev/com1",                           /* sDeviceName */
78    SERIAL_NS16550,                        /* deviceType */
79    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
80    NULL,                                  /* deviceProbe, assume it is there */
81    NULL,                                  /* pDeviceFlow */
82    16,                                    /* ulMargin */
83    8,                                     /* ulHysteresis */
84    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
85    COM1_BASE_IO,                          /* ulCtrlPort1 */
86    0x00000000,                            /* ulCtrlPort2 */
87    COM1_BASE_IO,                          /* ulDataPort */
88    com_get_register,                      /* getRegister */
89    com_set_register,                      /* setRegister */
90    NULL,/* unused */                      /* getData */
91    NULL,/* unused */                      /* setData */
92    CLOCK_RATE,                            /* ulClock */
93    BSP_UART_COM1_IRQ                      /* ulIntVector -- base for port */
94  },
95  {
96    "/dev/com2",                           /* sDeviceName */
97    SERIAL_NS16550,                        /* deviceType */
98    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
99    NULL,                                  /* deviceProbe, assume it is there */
100    NULL,                                  /* pDeviceFlow */
101    16,                                    /* ulMargin */
102    8,                                     /* ulHysteresis */
103    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
104    COM2_BASE_IO,                          /* ulCtrlPort1 */
105    0x00000000,                            /* ulCtrlPort2 */
106    COM2_BASE_IO,                          /* ulDataPort */
107    com_get_register,                      /* getRegister */
108    com_set_register,                      /* setRegister */
109    NULL,/* unused */                      /* getData */
110    NULL,/* unused */                      /* setData */
111    CLOCK_RATE,                            /* ulClock */
112    BSP_UART_COM2_IRQ                      /* ulIntVector -- base for port */
113  },
114
115  {
116    "/dev/com3",                           /* sDeviceName */
117    SERIAL_NS16550,                        /* deviceType */
118    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
119    NULL,                                  /* deviceProbe, assume it is there */
120    NULL,                                  /* pDeviceFlow */
121    16,                                    /* ulMargin */
122    8,                                     /* ulHysteresis */
123    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
124    COM3_BASE_IO,                          /* ulCtrlPort1 */
125    0x00000000,                            /* ulCtrlPort2 */
126    COM3_BASE_IO,                          /* ulDataPort */
127    com_get_register,                      /* getRegister */
128    com_set_register,                      /* setRegister */
129    NULL,/* unused */                      /* getData */
130    NULL,/* unused */                      /* setData */
131    CLOCK_RATE,                            /* ulClock */
132    BSP_UART_COM3_IRQ                      /* ulIntVector -- base for port */
133  },
134
135  {
136    "/dev/com4",                           /* sDeviceName */
137    SERIAL_NS16550,                        /* deviceType */
138    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
139    NULL,                                  /* deviceProbe, assume it is there */
140    NULL,                                  /* pDeviceFlow */
141    16,                                    /* ulMargin */
142    8,                                     /* ulHysteresis */
143    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
144    COM4_BASE_IO,                          /* ulCtrlPort1 */
145    0x00000000,                            /* ulCtrlPort2 */
146    COM4_BASE_IO,                          /* ulDataPort */
147    com_get_register,                      /* getRegister */
148    com_set_register,                      /* setRegister */
149    NULL,/* unused */                      /* getData */
150    NULL,/* unused */                      /* setData */
151    CLOCK_RATE,                            /* ulClock */
152    BSP_UART_COM4_IRQ                      /* ulIntVector -- base for port */
153  },
154
155};
156
157/*
158 *  Define a variable that contains the number of statically configured
159 *  console devices.
160 */
161unsigned long  Console_Configuration_Count = \
162    (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
Note: See TracBrowser for help on using the repository browser.