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

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • 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-2011.
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
25#define VGA_CONSOLE_FUNCTIONS  &vgacons_fns
26#if 0
27#define COM_CONSOLE_FUNCTIONS  &ns16550_fns_polled
28#else
29#define COM_CONSOLE_FUNCTIONS  &ns16550_fns
30#endif
31
32/*
33 * Base IO for UART
34 */
35#define COM1_BASE_IO  0x3F8
36#define COM2_BASE_IO  0x3E8
37#define COM3_BASE_IO  0x2F8
38#define COM4_BASE_IO  0x2E8
39
40#define CLOCK_RATE     (115200 * 16)
41
42uint8_t com_get_register(uint32_t addr, uint8_t i)
43{
44  register uint8_t val;
45 
46  inport_byte( (addr + i),val );
47  return val;
48}
49
50void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
51{
52  outport_byte( (addr + i),val );
53}
54
55console_tbl     Console_Configuration_Ports[] = {
56  {
57    "/dev/vgacons",                        /* sDeviceName */
58    VGA_CONSOLE,                           /* deviceType */
59    VGA_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
60    vgacons_probe,                         /* deviceProbe */
61    NULL,                                  /* pDeviceFlow */
62    16,                                    /* ulMargin */
63    8,                                     /* ulHysteresis */
64    (void *) NULL,              /* NULL */ /* pDeviceParams */
65    0x00000000,                            /* ulCtrlPort1 */
66    0x00000000,                            /* ulCtrlPort2 */
67    0x00000000,                            /* ulDataPort */
68    NULL,                                  /* getRegister */
69    NULL,                                  /* setRegister */
70    NULL,/* unused */                      /* getData */
71    NULL,/* unused */                      /* setData */
72    0X0,                                   /* ulClock */
73    0x0                                     /* ulIntVector -- base for port */
74  },
75  {
76    "/dev/com1",                           /* sDeviceName */
77    SERIAL_NS16550,                        /* deviceType */
78    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
79    NULL,                                  /* deviceProbe, assume it is there */
80    NULL,                                  /* pDeviceFlow */
81    16,                                    /* ulMargin */
82    8,                                     /* ulHysteresis */
83    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
84    COM1_BASE_IO,                          /* ulCtrlPort1 */
85    0x00000000,                            /* ulCtrlPort2 */
86    COM1_BASE_IO,                          /* ulDataPort */
87    com_get_register,                      /* getRegister */
88    com_set_register,                      /* setRegister */
89    NULL,/* unused */                      /* getData */
90    NULL,/* unused */                      /* setData */
91    CLOCK_RATE,                            /* ulClock */
92    BSP_UART_COM1_IRQ                      /* ulIntVector -- base for port */
93  },
94  {
95    "/dev/com2",                           /* sDeviceName */
96    SERIAL_NS16550,                        /* deviceType */
97    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
98    NULL,                                  /* deviceProbe, assume it is there */
99    NULL,                                  /* pDeviceFlow */
100    16,                                    /* ulMargin */
101    8,                                     /* ulHysteresis */
102    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
103    COM2_BASE_IO,                          /* ulCtrlPort1 */
104    0x00000000,                            /* ulCtrlPort2 */
105    COM2_BASE_IO,                          /* ulDataPort */
106    com_get_register,                      /* getRegister */
107    com_set_register,                      /* setRegister */
108    NULL,/* unused */                      /* getData */
109    NULL,/* unused */                      /* setData */
110    CLOCK_RATE,                            /* ulClock */
111    BSP_UART_COM2_IRQ                      /* ulIntVector -- base for port */
112  },
113
114  {
115    "/dev/com3",                           /* sDeviceName */
116    SERIAL_NS16550,                        /* deviceType */
117    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
118    NULL,                                  /* deviceProbe, assume it is there */
119    NULL,                                  /* pDeviceFlow */
120    16,                                    /* ulMargin */
121    8,                                     /* ulHysteresis */
122    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
123    COM3_BASE_IO,                          /* ulCtrlPort1 */
124    0x00000000,                            /* ulCtrlPort2 */
125    COM3_BASE_IO,                          /* ulDataPort */
126    com_get_register,                      /* getRegister */
127    com_set_register,                      /* setRegister */
128    NULL,/* unused */                      /* getData */
129    NULL,/* unused */                      /* setData */
130    CLOCK_RATE,                            /* ulClock */
131    BSP_UART_COM3_IRQ                      /* ulIntVector -- base for port */
132  },
133
134  {
135    "/dev/com4",                           /* sDeviceName */
136    SERIAL_NS16550,                        /* deviceType */
137    COM_CONSOLE_FUNCTIONS,                 /* pDeviceFns */
138    NULL,                                  /* deviceProbe, assume it is there */
139    NULL,                                  /* pDeviceFlow */
140    16,                                    /* ulMargin */
141    8,                                     /* ulHysteresis */
142    (void *) 9600,         /* Baud Rate */ /* pDeviceParams */
143    COM4_BASE_IO,                          /* ulCtrlPort1 */
144    0x00000000,                            /* ulCtrlPort2 */
145    COM4_BASE_IO,                          /* ulDataPort */
146    com_get_register,                      /* getRegister */
147    com_set_register,                      /* setRegister */
148    NULL,/* unused */                      /* getData */
149    NULL,/* unused */                      /* setData */
150    CLOCK_RATE,                            /* ulClock */
151    BSP_UART_COM4_IRQ                      /* ulIntVector -- base for port */
152  },
153
154};
155
156/*
157 *  Define a variable that contains the number of statically configured
158 *  console devices.
159 */
160unsigned long  Console_Configuration_Count = \
161    (sizeof(Console_Configuration_Ports)/sizeof(console_tbl));
Note: See TracBrowser for help on using the repository browser.