RTEMS 6.1-rc1
mc68681.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 *
5 * COPYRIGHT (c) 1989-1999.
6 * On-Line Applications Research Corporation (OAR).
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef _MC68681_H_
31#define _MC68681_H_
32
33#include <rtems/termiostypes.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/*
40 * These are just used in the interface between this driver and
41 * the read/write register routines when accessing the first
42 * control port.
43 */
44
45#define MC68681_STATUS 1
46#define MC68681_RX_BUFFER 3
47
48#define MC68681_MODE 0
49#define MC68681_CLOCK_SELECT 1
50#define MC68681_COMMAND 2
51#define MC68681_TX_BUFFER 3
52
53/*
54 * Data Port bit map configuration
55 *
56 * D0 : Baud Rate Set Selection
57 * D1 - D2 : Extended Baud Rate Setting
58 */
59
60#define MC68681_DATA_BAUD_RATE_SET_1 0 /* ACR[7] = 0 */
61#define MC68681_DATA_BAUD_RATE_SET_2 1 /* ACR[7] = 1 */
62
63#define MC68681_XBRG_IGNORED (0 << 1)
64#define MC68681_XBRG_ENABLED (1 << 1)
65#define MC68681_XBRG_DISABLED (2 << 1)
66#define MC68681_XBRG_MASK (3 << 1)
67
68/*
69 * Custom baud rate table information
70 */
71
72typedef unsigned char mc68681_baud_t;
73typedef mc68681_baud_t mc68681_baud_table_t[RTEMS_TERMIOS_NUMBER_BAUD_RATES];
74
75#define MC68681_BAUD_NOT_VALID 0xFF
76
77extern mc68681_baud_t
78 mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES];
79
80
81/*
82 * Driver function table
83 */
84
85extern const console_fns mc68681_fns;
86extern const console_fns mc68681_fns_polled;
87
88/*
89 * Default register access routines
90 */
91
92uint8_t mc68681_get_register( /* registers are at 1 byte boundaries */
93 uintptr_t ulCtrlPort, /* and accessed as bytes */
94 uint8_t ucRegNum
95);
96
97void mc68681_set_register(
98 uintptr_t ulCtrlPort,
99 uint8_t ucRegNum,
100 uint8_t ucData
101);
102
103uint8_t mc68681_get_register_2( /* registers are at 2 byte boundaries */
104 uintptr_t ulCtrlPort, /* and accessed as bytes */
105 uint8_t ucRegNum
106);
107
108void mc68681_set_register_2(
109 uintptr_t ulCtrlPort,
110 uint8_t ucRegNum,
111 uint8_t ucData
112);
113
114uint8_t mc68681_get_register_4( /* registers are at 4 byte boundaries */
115 uintptr_t ulCtrlPort, /* and accessed as bytes */
116 uint8_t ucRegNum
117);
118
119void mc68681_set_register_4(
120 uintptr_t ulCtrlPort,
121 uint8_t ucRegNum,
122 uint8_t ucData
123);
124
125uint8_t mc68681_get_register_8( /* registers are at 8 byte boundaries */
126 uintptr_t ulCtrlPort, /* and accessed as bytes */
127 uint8_t ucRegNum
128);
129
130void mc68681_set_register_8(
131 uintptr_t ulCtrlPort,
132 uint8_t ucRegNum,
133 uint8_t ucData
134);
135
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* _MC68681_H_ */
Definition: serial.h:95