RTEMS 6.1-rc2
Loading...
Searching...
No Matches
serial.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
10/*
11 * This file contains the TTY driver table definition
12 *
13 * This driver uses the termios pseudo driver.
14 *
15 * COPYRIGHT (c) 1989-1999.
16 * On-Line Applications Research Corporation (OAR).
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 * notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 * notice, this list of conditions and the following disclaimer in the
25 * documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGE.
38 */
39
40#ifndef __LIBCHIP_SERIAL_h
41#define __LIBCHIP_SERIAL_h
42
43#include <termios.h>
44
45#include <rtems.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/*
52 * Types for get and set register routines
53 */
54
61typedef uint8_t (*getRegister_f)(uintptr_t port, uint8_t reg);
62
70typedef void (*setRegister_f)(uintptr_t port, uint8_t reg, uint8_t value);
71
78typedef uint8_t (*getData_f)(uintptr_t port);
79
86typedef void (*setData_f)(uintptr_t port, uint8_t value);
87
95typedef struct _console_fns {
96 bool (*deviceProbe)(int minor);
97 int (*deviceFirstOpen)(int major, int minor, void *arg);
98 int (*deviceLastClose)(int major, int minor, void *arg);
99 int (*deviceRead)(int minor);
100 ssize_t (*deviceWrite)(int minor, const char *buf, size_t len);
101 void (*deviceInitialize)(int minor);
102 void (*deviceWritePolled)(int minor, char cChar);
103 int (*deviceSetAttributes)(int minor, const struct termios *t);
104 bool deviceOutputUsesInterrupts;
106
113typedef struct _console_flow {
114 int (*deviceStopRemoteTx)(int minor);
115 int (*deviceStartRemoteTx)(int minor);
117
118
123typedef enum {
124 SERIAL_MC68681, /* Motorola MC68681 or Exar 88681 */
125 SERIAL_NS16550, /* National Semiconductor NS16550 */
126 SERIAL_NS16550_WITH_FDR, /* National Semiconductor NS16550
127 with Fractional Divider Register (FDR) */
128 SERIAL_Z85C30, /* Zilog Z85C30 */
129 SERIAL_CUSTOM /* BSP specific driver */
131
136typedef struct _console_tbl {
138 const char *sDeviceName;
149 bool (*deviceProbe)(int minor);
168 uint32_t ulMargin;
176 uint32_t ulHysteresis;
185 uint32_t ulCtrlPort1;
189 uint32_t ulCtrlPort2;
191 uint32_t ulDataPort;
193 getRegister_f getRegister;
195 setRegister_f setRegister;
198 /* This is the routine used to write the data register (TX). */
199 setData_f setData;
201 uint32_t ulClock;
203 unsigned int ulIntVector;
205
209typedef struct _console_data {
210 void *termios_data;
211 volatile bool bActive;
215
224extern unsigned long Console_Port_Count;
225
234extern unsigned long Console_Configuration_Count;
235
240
241extern rtems_device_minor_number Console_Port_Minor;
242
248void bsp_console_select(void);
249
250#ifdef __cplusplus
251}
252#endif
253
254#endif
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:115
This header file defines the RTEMS Classic API.
console_devs
Definition: serial.h:123
unsigned long Console_Port_Count
Definition: legacy-console.c:50
struct _console_data console_data
console_tbl ** Console_Port_Tbl
Definition: legacy-console.c:51
unsigned long Console_Configuration_Count
Definition: console-config.c:89
console_data * Console_Port_Data
Definition: legacy-console.c:52
struct _console_tbl console_tbl
uint8_t(* getData_f)(uintptr_t port)
Definition: serial.h:78
console_tbl Console_Configuration_Ports[]
Definition: console-config.c:68
void bsp_console_select(void)
Selects the minor number of the console device.
Definition: console_select.c:237
void(* setData_f)(uintptr_t port, uint8_t value)
Definition: serial.h:86
Definition: serial.h:209
void * pDeviceContext
Definition: serial.h:213
Definition: serial.h:113
Definition: serial.h:95
Definition: serial.h:136
uint32_t ulClock
Definition: serial.h:201
setRegister_f setRegister
Definition: serial.h:195
void * pDeviceParams
Definition: serial.h:181
uint32_t ulCtrlPort1
Definition: serial.h:185
uint32_t ulDataPort
Definition: serial.h:191
const console_flow * pDeviceFlow
Definition: serial.h:157
unsigned int ulIntVector
Definition: serial.h:203
uint32_t ulMargin
Definition: serial.h:168
uint32_t ulCtrlPort2
Definition: serial.h:189
bool(* deviceProbe)(int minor)
Definition: serial.h:149
getData_f getData
Definition: serial.h:197
uint32_t ulHysteresis
Definition: serial.h:176
getRegister_f getRegister
Definition: serial.h:193
console_devs deviceType
Definition: serial.h:143
const console_fns * pDeviceFns
Definition: serial.h:145
const char * sDeviceName
Definition: serial.h:138