OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [armnommu/] [drivers/] [char/] [trioserial.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1622 jcastillo
/* trioserial.h: Definitions for the Aplio TRIO serial driver.
2
 *
3
 * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
4
 *                     D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>,
5
 *                     The Silver Hammer Group, Ltd.
6
 *
7
 * Based on:
8
 *
9
 * drivers/char/68328serial.h
10
 *
11
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
12
 */
13
 
14
#ifndef _TRIO_SERIAL_H
15
#define _TRIO_SERIAL_H
16
 
17
#include <linux/config.h>
18
#include <asm/page.h>
19
#include <asm/arch-trio/hardware.h>
20
 
21
struct serial_struct {
22
        int     type;
23
        int     line;
24
        int     port;
25
        int     irq;
26
        int     flags;
27
        int     xmit_fifo_size;
28
        int     custom_divisor;
29
        int     baud_base;
30
        unsigned short  close_delay;
31
        char    reserved_char[2];
32
        int     hub6;  /* FIXME: We don't have AT&T Hub6 boards! */
33
        unsigned short  closing_wait; /* time to wait before closing */
34
        unsigned short  closing_wait2; /* no longer used... */
35
        int     reserved[4];
36
};
37
 
38
/*
39
 * For the close wait times, 0 means wait forever for serial port to
40
 * flush its output.  65535 means don't wait at all.
41
 */
42
#define S_CLOSING_WAIT_INF      0
43
#define S_CLOSING_WAIT_NONE     65535
44
 
45
/*
46
 * Definitions for S_struct (and serial_struct) flags field
47
 */
48
#define S_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
49
                                   on the callout port */
50
#define S_FOURPORT  0x0002      /* Set OU1, OUT2 per AST Fourport settings */
51
#define S_SAK   0x0004  /* Secure Attention Key (Orange book) */
52
#define S_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
53
 
54
#define S_SPD_MASK      0x0030
55
#define S_SPD_HI        0x0010  /* Use 56000 instead of 38400 bps */
56
 
57
#define S_SPD_VHI       0x0020  /* Use 115200 instead of 38400 bps */
58
#define S_SPD_CUST      0x0030  /* Use user-specified divisor */
59
 
60
#define S_SKIP_TEST     0x0040 /* Skip UART test during autoconfiguration */
61
#define S_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
62
#define S_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
63
#define S_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
64
#define S_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
65
 
66
#define S_FLAGS 0x0FFF  /* Possible legal S flags */
67
#define S_USR_MASK 0x0430       /* Legal flags that non-privileged
68
                                 * users can set or reset */
69
 
70
/* Internal flags used only by kernel/chr_drv/serial.c */
71
#define S_INITIALIZED   0x80000000 /* Serial port was initialized */
72
#define S_CALLOUT_ACTIVE        0x40000000 /* Call out device is active */
73
#define S_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
74
#define S_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
75
#define S_CLOSING               0x08000000 /* Serial port is closing */
76
#define S_CTS_FLOW              0x04000000 /* Do CTS flow control */
77
#define S_CHECK_CD              0x02000000 /* i.e., CLOCAL */
78
 
79
/* Software state per channel */
80
 
81
#ifdef __KERNEL__
82
/*
83
 * This is our internal structure for each serial port's state.
84
 *
85
 * Many fields are paralleled by the structure used by the serial_struct
86
 * structure.
87
 *
88
 * For definitions of the flags field, see tty.h
89
 */
90
 
91
struct trio_serial {
92
        char soft_carrier;  /* Use soft carrier on this channel */
93
        char break_abort;   /* Is serial console in, so process brk/abrt */
94
#if 0
95
        char cons_keyb;     /* Channel runs the keyboard */
96
        char cons_mouse;    /* Channel runs the mouse */
97
        char kgdb_channel;  /* Kgdb is running on this channel */
98
#endif
99
        char is_cons;       /* Is this our console. */
100
 
101
        /* We need to know the current clock divisor
102
         * to read the bps rate the chip has currently
103
         * loaded.
104
         */
105
        unsigned char clk_divisor;  /* May be 1, 16, 32, or 64 */
106
        int baud;
107
        int                     magic;
108
        int                     baud_base;
109
        int                     port;
110
        int                     irq;
111
        int                     irqmask;
112
        int                     flags;          /* defined in tty.h */
113
        int                     type;           /* UART type */
114
        int                     use_ints;
115
        struct uart_regs        *uart;
116
        struct tty_struct       *tty;
117
        int                     read_status_mask;
118
        int                     ignore_status_mask;
119
        int                     timeout;
120
        int                     xmit_fifo_size;
121
        int                     custom_divisor;
122
        int                     x_char; /* xon/xoff character */
123
        int                     close_delay;
124
        unsigned short          closing_wait;
125
        unsigned short          closing_wait2;
126
        unsigned long           event;
127
        unsigned long           last_active;
128
        int                     line;
129
        int                     count;      /* # of fd on device */
130
        int                     blocked_open; /* # of blocked opens */
131
        long                    session; /* Session of opening process */
132
        long                    pgrp; /* pgrp of opening process */
133
        unsigned char           *xmit_buf;
134
        unsigned char           *rx_buf;
135
        int                     xmit_head;
136
        int                     xmit_tail;
137
        int                     xmit_cnt;
138
        struct tq_struct        tqueue;
139
        struct tq_struct        tqueue_hangup;
140
        struct termios          normal_termios;
141
        struct termios          callout_termios;
142
        struct wait_queue       *open_wait;
143
        struct wait_queue       *close_wait;
144
};
145
 
146
 
147
#define SERIAL_MAGIC 0x5301
148
 
149
/*
150
 * The size of the serial xmit buffer is 1 page, or 4096 bytes
151
 */
152
#define SERIAL_XMIT_SIZE        PAGE_SIZE
153
#define SERIAL_RX_SIZE          PAGE_SIZE
154
 
155
/*
156
 * Events are used to schedule things to happen at timer-interrupt
157
 * time, instead of at rs interrupt time.
158
 */
159
#define RS_EVENT_WRITE_WAKEUP   0
160
 
161
#endif /* __KERNEL__ */
162
 
163
#if defined(CONFIG_M68328) || defined(CONFIG_M68EZ328)
164
 
165
#define BASE 0xfffff900
166
#define VSP(X) (*(volatile unsigned short *)(X))
167
#define VCP(X) (*(volatile unsigned char *)(X))
168
 
169
/* UART status and control */
170
#define USTCNT VSP(BASE)
171
#define USTCNT_EN               (1 << 15)
172
#define USTCNT_RXEN     (1 << 14)
173
#define USTCNT_TXEN     (1 << 13)
174
#define USTCNT_CLKMODE  (1 << 12)
175
#define USTCNT_PARITY   (1 << 11)
176
#define USTCNT_ODDEVEN  (1 << 10)
177
#define USTCNT_STOP     (1 <<  9)
178
#define USTCNT_WLEN     (1 <<  8)
179
 
180
#define USTCNT_CTSEN    (1 <<  6)
181
#define USTCNT_RXFULLEN (1 <<  5)
182
#define USTCNT_RXHALFEN (1 <<  4)
183
#define USTCNT_READYEN  (1 <<  3)
184
#define USTCNT_TXEMPTYEN        (1 <<  2)
185
#define USTCNT_TXHALFEN (1 <<  1)
186
#define USTCNT_TXAVAILEN        (1 <<  0)
187
 
188
/* UART baud control */
189
#define UBAUD VSP(BASE+2)
190
#define UBAUD_GPIOF     (1 << 15)
191
#define UBAUD_GPIOSC    (1 << 14)
192
#define UBAUD_GPIODDR   (1 << 13)
193
#define UBAUD_GPIOSRC   (1 << 12)
194
#define UBAUD_BAUDSRC   (1 << 11)
195
#define UBAUD_DIVMASK   (0x7 << 8)
196
#define UBAUD_GETDIV(X) ((0x7 & (X)) >> 8)
197
#define UBAUD_SETDIV(X) ((0x7 & (X)) << 8)
198
#define UBAUD_PRESCALEMASK      (0x3f << 0)
199
#define UBAUD_PRESCALE(X)       ((0x3f & (X)) << 0)
200
 
201
/* UART RX and status */
202
#define URX VSP(BASE + 4)
203
#define URX_FIFOFULL    (1<<15)
204
#define URX_FIFOHALF    (1<<14)
205
#define URX_DATARDY     (1<<13)
206
#define URX_OVERRUN     (1<<11)
207
#define URX_FRAMEERR    (1<<10)
208
#define URX_BREAK       (1<< 9)
209
#define URX_PARITYERR   (1<< 8)
210
#define URX_CHARSTAT    (URX_OVERRUN |URX_FRAMEERR |URX_BREAK |URX_PARITYERR)
211
#define URX_CHARMASK    (0xff << 0)
212
#define URX_CHAR(X)     ((0xff & (X)) << 0)
213
 
214
/* UART TX and status */
215
#define UTX VCP(BASE + 6)
216
#define UTX_FIFOEMPTY   (1<< 7)
217
#define UTX_FIFOHALF    (1<< 6)
218
#define UTX_TXAVAIL     (1<< 5)
219
#define UTX_SENDBREAK   (1<< 4)
220
#define UTX_IGNCTS      (1<< 3)
221
#define UTX_CTSSTAT     (1<< 1)
222
#define UTX_CTSDELTA    (1<< 0)
223
 
224
#define UTX_CHARMASK    (0xff << 0)
225
#define UTX_CHAR VCP(BASE + 7)
226
 
227
/* UART misc */
228
#define UMISC VSP(BASE + 8)
229
#define UMISC_CLKSRC    (1<<14)
230
#define UMISC_GENPTERR  (1<<13)
231
#define UMISC_LOOP      (1<<12)
232
#define UMISC_RTSCTL    (1<< 7)
233
#define UMISC_RTS       (1<< 6)
234
#define UMISC_IRDAEN    (1<< 5)
235
#define UMISC_LOOPIR    (1<< 4)
236
#define UMISC_RXPOL     (1<< 3)
237
#define UMISC_TXPOL     (1<< 2)
238
#endif /* CONFIG_MC68328 */
239
 
240
#endif /* !(_MC683XX_SERIAL_H) */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.