]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/ic/via6522reg.h
Fix ipfw invalid mbuf handling.
[FreeBSD/FreeBSD.git] / sys / dev / ic / via6522reg.h
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright 2004 by Peter Grehan. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  * 3. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * $FreeBSD$
30  */
31
32 #ifndef _VIA6522REG_H_
33 #define _VIA6522REG_H_
34
35 /* Registers */
36 #define REG_OIRB        0       /* Input/output register B */
37 #define REG_OIRA        1       /* Input/output register A */
38 #define REG_DDRB        2       /* Data direction register B */
39 #define REG_DDRA        3       /* Data direction register A */
40 #define REG_T1CL        4       /* T1 low-order latch/low-order counter */
41 #define REG_T1CH        5       /* T1 high-order counter */
42 #define REG_T1LL        6       /* T1 low-order latches */
43 #define REG_T1LH        7       /* T1 high-order latches */
44 #define REG_T2CL        8       /* T2 low-order latch/low-order counter */
45 #define REG_T2CH        9       /* T2 high-order counter */
46 #define REG_SR          10      /* Shift register */
47 #define REG_ACR         11      /* Auxiliary control register */
48 #define REG_PCR         12      /* Peripheral control register */
49 #define REG_IFR         13      /* Interrupt flag register */
50 #define REG_IER         14      /* Interrupt-enable register */
51 #define REG_OIRA_NH     15      /* Input/output register A: no handshake */
52
53
54 /* Auxiliary control register (11) */
55 #define ACR_SR_NONE     0x0     /* Disabled */
56 #define ACR_SR_DIR      0x4     /* Bit for shift-register direction 1=out */
57 #define ACR_SRI_T2      0x1     /* Shift in under control of T2 */
58 #define ACR_SRI_PHI2    0x2     /*   "    "   "     "      " PHI2 */
59 #define ACR_SRI_EXTCLK  0x3     /*   "    "   "     "      " external clk */
60 #define ACR_SRO         0x4     /* Shift out free running at T2 rate */
61 #define ACR_SRO_T2      0x5     /* Shift out under control of T2 */
62 #define ACR_SRO_PHI2    0x6     /*   "    "   "     "      "  PHI2 */
63 #define ACR_SRO_EXTCLK  0x7     /*   "    "   "     "      "  external clk */
64
65 #define ACR_T1_SHIFT    5       /* bits 7-5 */
66 #define ACR_SR_SHIFT    2       /* bits 4-2 */
67
68
69 /* Peripheral control register (12) */
70 #define PCR_INTCNTL     0x01    /* interrupt active edge: +ve=1, -ve=0 */
71
72 #define PCR_CNTL_MASK   0x3     /* 3 bits */
73 #define PCR_CNTL_NEDGE  0x0     /* Input - negative active edge */
74 #define PCR_CNTL_INEDGE 0x1     /* Interrupt - negative active edge */
75 #define PCR_CNTL_PEDGE  0x2     /* Input - positive active edge */
76 #define PCR_CNTL_IPEDGE 0x3     /* Interrupt - positive active edge */
77 #define PCR_CNTL_HSHAKE 0x4     /* Handshake output */
78 #define PCR_CNTL_PULSE  0x5     /* Pulse output */
79 #define PCR_CNTL_LOW    0x6     /* Low output */
80 #define PCR_CNTL_HIGH   0x7     /* High output */
81
82 #define PCR_CB2_SHIFT   5       /* bits 7-5 */
83 #define PCR_CB1_SHIFT   4       /* bit 4 */
84 #define PCR_CA2_SHIFT   1       /* bits 3-1 */
85 #define PCR_CA1_SHIFT   0       /* bit 0 */
86
87 /* Interrupt flag register (13) */
88 #define IFR_CA2         0x01
89 #define IFR_CA1         0x02
90 #define IFR_SR          0x04
91 #define IFR_CB2         0x08
92 #define IFR_CB1         0x10
93 #define IFR_T2          0x20
94 #define IFR_T1          0x40
95 #define IFR_IRQB        0x80    /* status of IRQB output pin */
96
97 /* Interrupt enable register (14) */
98 #define IER_CA2         IFR_CA2
99 #define IER_CA1         IFR_CA1
100 #define IER_SR          IFR_SR
101 #define IER_CB2         IFR_CB2
102 #define IER_CB1         IFR_CB1
103 #define IER_T2          IFR_T2
104 #define IER_T1          IFR_T1
105 #define IER_IRQB        IFR_IRQB
106
107 #endif /* _VIA6522REG_H_ */