RTEMS  5.0.0
serial.h
Go to the documentation of this file.
1 
8 /*
9  * This file contains the TTY driver table definition
10  *
11  * This driver uses the termios pseudo driver.
12  *
13  * COPYRIGHT (c) 1989-1999.
14  * On-Line Applications Research Corporation (OAR).
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 #ifndef __LIBCHIP_SERIAL_h
22 #define __LIBCHIP_SERIAL_h
23 
24 #include <termios.h>
25 
26 #include <rtems.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /*
33  * Types for get and set register routines
34  */
35 
42 typedef uint8_t (*getRegister_f)(uintptr_t port, uint8_t reg);
43 
51 typedef void (*setRegister_f)(uintptr_t port, uint8_t reg, uint8_t value);
52 
59 typedef uint8_t (*getData_f)(uintptr_t port);
60 
67 typedef void (*setData_f)(uintptr_t port, uint8_t value);
68 
76 typedef struct _console_fns {
77  bool (*deviceProbe)(int minor);
78  int (*deviceFirstOpen)(int major, int minor, void *arg);
79  int (*deviceLastClose)(int major, int minor, void *arg);
80  int (*deviceRead)(int minor);
81  ssize_t (*deviceWrite)(int minor, const char *buf, size_t len);
82  void (*deviceInitialize)(int minor);
83  void (*deviceWritePolled)(int minor, char cChar);
84  int (*deviceSetAttributes)(int minor, const struct termios *t);
85  bool deviceOutputUsesInterrupts;
86 } console_fns;
87 
94 typedef struct _console_flow {
95  int (*deviceStopRemoteTx)(int minor);
96  int (*deviceStartRemoteTx)(int minor);
97 } console_flow;
98 
99 
104 typedef enum {
105  SERIAL_MC68681, /* Motorola MC68681 or Exar 88681 */
106  SERIAL_NS16550, /* National Semiconductor NS16550 */
107  SERIAL_NS16550_WITH_FDR, /* National Semiconductor NS16550
108  with Fractional Divider Register (FDR) */
109  SERIAL_Z85C30, /* Zilog Z85C30 */
110  SERIAL_CUSTOM /* BSP specific driver */
111 } console_devs;
112 
117 typedef struct _console_tbl {
119  const char *sDeviceName;
124  console_devs deviceType;
130  bool (*deviceProbe)(int minor);
138  const console_flow *pDeviceFlow;
149  uint32_t ulMargin;
157  uint32_t ulHysteresis;
166  uint32_t ulCtrlPort1;
170  uint32_t ulCtrlPort2;
172  uint32_t ulDataPort;
174  getRegister_f getRegister;
176  setRegister_f setRegister;
179  /* This is the routine used to write the data register (TX). */
180  setData_f setData;
182  uint32_t ulClock;
184  unsigned int ulIntVector;
185 } console_tbl;
186 
190 typedef struct _console_data {
191  void *termios_data;
192  volatile bool bActive;
195 } console_data;
196 
205 extern unsigned long Console_Port_Count;
206 
215 extern unsigned long Console_Configuration_Count;
216 
221 
222 extern rtems_device_minor_number Console_Port_Minor;
223 
229 void bsp_console_select(void);
230 
231 #ifdef __cplusplus
232 }
233 #endif
234 
235 #endif
Definition: serial.h:190
const console_flow * pDeviceFlow
Definition: serial.h:138
void * pDeviceContext
Definition: serial.h:194
uint32_t ulCtrlPort2
Definition: serial.h:170
void bsp_console_select(void)
Selects the minor number of the console device.
Definition: console_select.c:81
uint8_t(* getData_f)(uintptr_t port)
Definition: serial.h:59
console_devs
Definition: serial.h:104
struct _console_data console_data
void * pDeviceParams
Definition: serial.h:162
console_tbl Console_Configuration_Ports[]
Definition: console-config.c:68
console_data * Console_Port_Data
Definition: legacy-console.c:33
unsigned int ulIntVector
Definition: serial.h:184
Definition: serial.h:94
Definition: serial.h:117
uint32_t ulCtrlPort1
Definition: serial.h:166
struct _console_tbl console_tbl
uint32_t ulHysteresis
Definition: serial.h:157
console_devs deviceType
Definition: serial.h:124
getData_f getData
Definition: serial.h:178
void(* setData_f)(uintptr_t port, uint8_t value)
Definition: serial.h:67
unsigned long Console_Port_Count
Definition: legacy-console.c:31
uint32_t ulMargin
Definition: serial.h:149
Definition: serial.h:76
unsigned long Console_Configuration_Count
Definition: console-config.c:89
const char * sDeviceName
Definition: serial.h:119
uint32_t ulClock
Definition: serial.h:182
const console_fns * pDeviceFns
Definition: serial.h:126
console_tbl ** Console_Port_Tbl
Definition: legacy-console.c:32
uint32_t ulDataPort
Definition: serial.h:172