Home | History | Annotate | Line # | Download | only in ic
clmpccreg.h revision 1.2
      1 /*  $NetBSD: clmpccreg.h,v 1.2 1999/08/01 09:35:05 scw Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Steve C. Woodford.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*
     40  * Register definitions for the Cirrus Logic CD2400/CD2401
     41  * Four Channel Multi-Protocol Communications Controller.
     42  *
     43  * The values defined here are based on the August 1993 data book.
     44  * At the present time, this driver supports non-DMA async. mode only.
     45  */
     46 
     47 #ifndef __clmpccreg_h
     48 #define __clmpccreg_h
     49 
     50 /*
     51  * Register offsets depend on the level on the chip's BYTESWAP pin.
     52  * When BYTESWAP is low, Motorola byte alignment is in effect.
     53  * Otherwise, Intel byte alignment is in effect.
     54  * The values given here assume BYTESWAP is low. See 'sc_byteswap'
     55  * <dev/ic/clmpccvar.h>.
     56  */
     57 
     58 /* Number of bytes of FIFO (Rx & Tx) */
     59 #define CLMPCC_FIFO_DEPTH   16
     60 
     61 /* Global Registers */
     62 #define CLMPCC_REG_GFRCR    0x81    /* Global Firmware Revision Code Register */
     63 #define CLMPCC_REG_CAR      0xee    /* Channel Access Register */
     64 
     65 /* Option Registers */
     66 #define CLMPCC_REG_CMR      0x1b    /* Channel Mode Register */
     67 #define CLMPCC_REG_COR1     0x10    /* Channel Option Register #1 */
     68 #define CLMPCC_REG_COR2     0x17    /* Channel Option Register #2 */
     69 #define CLMPCC_REG_COR3     0x16    /* Channel Option Register #3 */
     70 #define CLMPCC_REG_COR4     0x15    /* Channel Option Register #4 */
     71 #define CLMPCC_REG_COR5     0x14    /* Channel Option Register #5 */
     72 #define CLMPCC_REG_COR6     0x18    /* Channel Option Register #6 */
     73 #define CLMPCC_REG_COR7     0x07    /* Channel Option Register #7 */
     74 #define CLMPCC_REG_SCHR1    0x1f    /* Special Character Register #1 */
     75 #define CLMPCC_REG_SCHR2    0x1e    /* Special Character Register #2 */
     76 #define CLMPCC_REG_SCHR3    0x1d    /* Special Character Register #3 */
     77 #define CLMPCC_REG_SCHR4    0x1c    /* Special Character Register #4 */
     78 #define CLMPCC_REG_SCRl     0x23    /* Special Character Range (low) */
     79 #define CLMPCC_REG_SCRh     0x22    /* Special Character Range (high) */
     80 #define CLMPCC_REG_LNXT     0x2e    /* LNext Character */
     81 #define CLMPCC_REG_RFAR1    0x1f    /* Receive Frame Address Register #1 */
     82 #define CLMPCC_REG_RFAR2    0x1e    /* Receive Frame Address Register #2 */
     83 #define CLMPCC_REG_RFAR3    0x1d    /* Receive Frame Address Register #3 */
     84 #define CLMPCC_REG_RFAR4    0x1c    /* Receive Frame Address Register #4 */
     85 #define CLMPCC_REG_CPSR     0xd6    /* CRC Polynomial Select Register */
     86 
     87 /* Bit Rate and Clock Option Registers */
     88 #define CLMPCC_REG_RBPR     0xcb    /* Receive Baud Rate Period Register */
     89 #define CLMPCC_REG_RCOR     0xc8    /* Receive Clock Options Register */
     90 #define CLMPCC_REG_TBPR     0xc3    /* Transmit Baud Rate Period Register */
     91 #define CLMPCC_REG_TCOR     0xc0    /* Transmit Clock Options Register */
     92 
     93 /* Channel Command and Status Registers */
     94 #define CLMPCC_REG_CCR      0x13    /* Channel Command Register */
     95 #define CLMPCC_REG_STCR     0x12    /* Special Transmit Command Register */
     96 #define CLMPCC_REG_CSR      0x1a    /* Channel Status Register */
     97 #define CLMPCC_REG_MSVR     0xde    /* Modem Signal Value Register */
     98 #define CLMPCC_REG_MSVR_RTS 0xde    /* Modem Signal Value Register (RTS) */
     99 #define CLMPCC_REG_MSVR_DTR 0xdf    /* Modem Signal Value Register (DTR) */
    100 
    101 /* Interrupt Registers */
    102 #define CLMPCC_REG_LIVR     0x09    /* Local Interrupt Vector Register */
    103 #define CLMPCC_REG_IER      0x11    /* Interrupt Enable Register */
    104 #define CLMPCC_REG_LICR     0x26    /* Local Interrupting Channel Register */
    105 #define CLMPCC_REG_STK      0xe2    /* Stack Register */
    106 
    107 /* Receive Interrupt Registers */
    108 #define CLMPCC_REG_RPILR    0xe1    /* Receive Priority Interrupt Level Reg */
    109 #define CLMPCC_REG_RIR      0xed    /* Receive Interrupt Register */
    110 #define CLMPCC_REG_RISR     0x88    /* Receive Interrupt Status Reg (16-bits) */
    111 #define CLMPCC_REG_RISRl    0x89    /* Receive Interrupt Status Reg (low) */
    112 #define CLMPCC_REG_RISRh    0x88    /* Receive Interrupt Status Reg (high) */
    113 #define CLMPCC_REG_RFOC     0x30    /* Receive FIFO Output Count */
    114 #define CLMPCC_REG_RDR      0xf8    /* Receive Data Register */
    115 #define CLMPCC_REG_REOIR    0x84    /* Receive End of Interrupt Register */
    116 
    117 /* Transmit Interrupt Registers */
    118 #define CLMPCC_REG_TPILR    0xe0    /* Transmit Priority Interrupt Level Reg */
    119 #define CLMPCC_REG_TIR      0xec    /* Transmit Interrupt Register */
    120 #define CLMPCC_REG_TISR     0x8a    /* Transmit Interrupt Status Register */
    121 #define CLMPCC_REG_TFTC     0x80    /* Transmit FIFO Transfer Count */
    122 #define CLMPCC_REG_TDR      0xf8    /* Transmit Data Register */
    123 #define CLMPCC_REG_TEOIR    0x85    /* Transmit End of Interrupt Register */
    124 
    125 /* Modem Interrupt Registers */
    126 #define CLMPCC_REG_MPILR    0xe3    /* Modem Priority Interrupt Level Reg */
    127 #define CLMPCC_REG_MIR      0xef    /* Modem Interrupt Register */
    128 #define CLMPCC_REG_MISR     0x8b    /* Modem (/Timer) Interrupt Status Reg */
    129 #define CLMPCC_REG_MEOIR    0x86    /* Modem End of Interrupt Register */
    130 
    131 /* DMA Registers */
    132 #define CLMPCC_REG_DMR      0xf6    /* DMA Mode Register (write only) */
    133 #define CLMPCC_REG_BERCNT   0x8e    /* Bus Error Retry Count */
    134 #define CLMPCC_REG_DMABSTS  0x19    /* DMA Buffer Status */
    135 
    136 /* DMA Receive Registers */
    137 #define CLMPCC_REG_ARBADRL  0x42    /* A Receive Buffer Address Lower (word) */
    138 #define CLMPCC_REG_ARBADRU  0x40    /* A Receive Buffer Address Upper (word) */
    139 #define CLMPCC_REG_BRBADRL  0x46    /* B Receive Buffer Address Lower (word) */
    140 #define CLMPCC_REG_BRBADRU  0x44    /* B Receive Buffer Address Upper (16bit) */
    141 #define CLMPCC_REG_ARBCNT   0x4a    /* A Receive Buffer Byte Count (word) */
    142 #define CLMPCC_REG_BRBCNT   0x48    /* B Receive Buffer Byte Count (word) */
    143 #define CLMPCC_REG_ARBSTS   0x4f    /* A Receive Buffer Status */
    144 #define CLMPCC_REG_BRBSTS   0x4e    /* B Receive Buffer Status */
    145 #define CLMPCC_REG_RCBADRL  0x3e    /* Receive Current Buff Addr Lower (word) */
    146 #define CLMPCC_REG_RCBADRU  0x3c    /* Receive Current Buff Addr Upper (word) */
    147 
    148 /* DMA Transmit Registers */
    149 #define CLMPCC_REG_ATBADRL  0x52    /* A Transmit Buffer Address Lower (word) */
    150 #define CLMPCC_REG_ATBADRU  0x50    /* A Transmit Buffer Address Upper (word) */
    151 #define CLMPCC_REG_BTBADRL  0x56    /* B Transmit Buffer Address Lower (word) */
    152 #define CLMPCC_REG_BTBADRU  0x54    /* B Transmit Buffer Address Upper (word) */
    153 #define CLMPCC_REG_ATBCNT   0x5a    /* A Transmit Buffer Byte Count (word) */
    154 #define CLMPCC_REG_BTBCNT   0x58    /* B Transmit Buffer Byte Count (word) */
    155 #define CLMPCC_REG_ATBSTS   0x5f    /* A Transmit Buffer Status */
    156 #define CLMPCC_REG_BTBSTS   0x5e    /* B Transmit Buffer Status */
    157 #define CLMPCC_REG_TCBADRL  0x3a    /* Transmit Current Buf Addr Lower (word) */
    158 #define CLMPCC_REG_TCBADRU  0x38    /* Transmit Current Buf Addr Upper (word) */
    159 
    160 /* Timer Registers */
    161 #define CLMPCC_REG_TPR      0xda    /* Timer Period Register */
    162 #define CLMPCC_REG_RTPR     0x24    /* Receive Timeout Period Register (word) */
    163 #define CLMPCC_REG_RTPRl    0x25    /* Receive Timeout Period Register (low) */
    164 #define CLMPCC_REG_RTPRh    0x24    /* Receive Timeout Period Register (high) */
    165 #define CLMPCC_REG_GT1      0x2a    /* General Timer 1 (word) */
    166 #define CLMPCC_REG_GT1l     0x2b    /* General Timer 1 (low) */
    167 #define CLMPCC_REG_GT1h     0x2a    /* General Timer 1 (high) */
    168 #define CLMPCC_REG_GT2      0x29    /* General Timer 2 */
    169 #define CLMPCC_REG_TTR      0x29    /* Transmit Timer Register */
    170 
    171 
    172 /* Channel Access Register */
    173 #define CLMPCC_CAR_MASK         0x03        /* Channel bit mask */
    174 
    175 /* Channel Mode Register */
    176 #define CLMPCC_CMR_RX_INT       (0 << 7)    /* Rx using interrupts */
    177 #define CLMPCC_CMR_RX_DMA       (1 << 7)    /* Rx using DMA */
    178 #define CLMPCC_CMR_TX_INT       (0 << 6)    /* Tx using interrupts */
    179 #define CLMPCC_CMR_TX_DMA       (1 << 6)    /* Tx using DMA */
    180 #define CLMPCC_CMR_HDLC         0x00        /* Select HDLC mode */
    181 #define CLMPCC_CMR_BISYNC       0x01        /* Select Bisync mode */
    182 #define CLMPCC_CMR_ASYNC        0x02        /* Select async mode */
    183 #define CLMPCC_CMR_X21          0x03        /* Select X.21 mode */
    184 
    185 /* Channel Option Register #1 (Async options) */
    186 #define CLMPCC_COR1_EVEN_PARITY (0 << 7)    /* Even parity */
    187 #define CLMPCC_COR1_ODD_PARITY  (1 << 7)    /* Odd parity */
    188 #define CLMPCC_COR1_NO_PARITY   (0 << 5)    /* No parity */
    189 #define CLMPCC_COR1_FORCE_PAR   (1 << 5)    /* Force parity */
    190 #define CLMPCC_COR1_NORM_PARITY (2 << 5)    /* Normal parity */
    191 #define CLMPCC_COR1_CHECK_PAR   (0 << 4)    /* Check parity */
    192 #define CLMPCC_COR1_IGNORE_PAR  (1 << 4)    /* Ignore parity */
    193 #define CLMPCC_COR1_CHAR_5BITS  0x04        /* 5 bits per character */
    194 #define CLMPCC_COR1_CHAR_6BITS  0x05        /* 6 bits per character */
    195 #define CLMPCC_COR1_CHAR_7BITS  0x06        /* 7 bits per character */
    196 #define CLMPCC_COR1_CHAR_8BITS  0x07        /* 8 bits per character */
    197 
    198 /* Channel Option Register #2 (Async options) */
    199 #define CLMPCC_COR2_IXM         (1 << 7)    /* Implied XON mode */
    200 #define CLMPCC_COR2_TxIBE       (1 << 6)    /* Transmit In-Band Flow Control */
    201 #define CLMPCC_COR2_ETC         (1 << 5)    /* Embedded Tx Command Enable */
    202 #define CLMPCC_COR2_RLM         (1 << 3)    /* Remote Loopback Mode */
    203 #define CLMPCC_COR2_RtsAO       (1 << 2)    /* RTS Automatic Output Enable */
    204 #define CLMPCC_COR2_CtsAE       (1 << 1)    /* CTS Automatic Enable */
    205 #define CLMPCC_COR2_DsrAE       (1 << 1)    /* DSR Automatic Enable */
    206 
    207 /* Channel Option Register #3 (Async options) */
    208 #define CLMPCC_COR3_ESCDE       (1 << 7)    /* Ext Special Char Detect Enab */
    209 #define CLMPCC_COR3_RngDE       (1 << 6)    /* Range Detect Enable */
    210 #define CLMPCC_COR3_FCT         (1 << 5)    /* Flow Ctrl Transparency Mode */
    211 #define CLMPCC_COR3_SCDE        (1 << 4)    /* Special Character Detection */
    212 #define CLMPCC_COR3_SpIstp      (1 << 3)    /* Special Character I Strip */
    213 #define CLMPCC_COR3_STOP_1      0x02        /* 1 Stop Bit */
    214 #define CLMPCC_COR3_STOP_1_5    0x03        /* 1.5 Stop Bits */
    215 #define CLMPCC_COR3_STOP_2      0x04        /* 2 Stop Bits */
    216 
    217 /* Channel Option Register #4 */
    218 #define CLMPCC_COR4_DSRzd       (1 << 7)    /* Detect 1->0 transition on DSR */
    219 #define CLMPCC_COR4_CDzd        (1 << 6)    /* Detect 1->0 transition on CD */
    220 #define CLMPCC_COR4_CTSzd       (1 << 5)    /* Detect 1->0 transition on CTS */
    221 #define CLMPCC_COR4_FIFO_MASK   0x0f        /* FIFO Threshold bits */
    222 #define CLMPCC_COR4_FIFO_LOW	1
    223 #define CLMPCC_COR4_FIFO_MED	4
    224 #define CLMPCC_COR4_FIFO_HIGH	8
    225 
    226 /* Channel Option Register #5 */
    227 #define CLMPCC_COR5_DSRod       (1 << 7)    /* Detect 0->1 transition on DSR */
    228 #define CLMPCC_COR5_CDod        (1 << 6)    /* Detect 0->1 transition on CD */
    229 #define CLMPCC_COR5_CTSod       (1 << 5)    /* Detect 0->1 transition on CTS */
    230 #define CLMPCC_COR5_FLOW_MASK   0x0f        /* Rx Flow Control FIFO Threshold */
    231 #define CLMPCC_COR5_FLOW_NORM	8
    232 
    233 /* Channel Option Register #6 (Async options) */
    234 #define CLMPCC_COR6_RX_CRNL     0x00        /* No special action on CR or NL */
    235 #define CLMPCC_COR6_BRK_EXCEPT  (0 << 3)    /* Exception interrupt on BREAK */
    236 #define CLMPCC_COR6_BRK_2_NULL  (1 << 3)    /* Translate BREAK to NULL char */
    237 #define CLMPCC_COR6_BRK_DISCARD (3 << 3)    /* Discard BREAK characters */
    238 #define CLMPCC_COR6_PF_EXCEPT   0x00        /* Exception irq on parity/frame */
    239 #define CLMPCC_COR6_PF_2_NULL   0x01        /* Translate parity/frame to NULL */
    240 #define CLMPCC_COR6_PF_IGNORE   0x02        /* Ignore error */
    241 #define CLMPCC_COR6_PF_DISCARD  0x03        /* Discard character */
    242 #define CLMPCC_COR6_PF_TRANS    0x05        /* Translate to FF NULL + char */
    243 
    244 /* Channel Option Register #7 (Async options) */
    245 #define CLMPCC_COR7_ISTRIP      (1 << 7)    /* Strip MSB */
    246 #define CLMPCC_COR7_LNE         (1 << 6)    /* Enable LNext Option */
    247 #define CLMPCC_COR7_FCERR       (1 << 5)    /* Flow Control on Error Char */
    248 #define CLMPCC_COR7_TX_CRNL     0x00        /* No special action on NL or CR */
    249 
    250 /* Receive Clock Options Register */
    251 #define CLMPCC_RCOR_CLK(x)	(x)
    252 #define CLMPCC_RCOR_TLVAL       (1 << 7)    /* Transmit Line Value */
    253 #define CLMPCC_RCOR_DPLL_ENABLE (1 << 5)    /* Phase Locked Loop Enable */
    254 #define CLMPCC_RCOR_DPLL_NRZ    (0 << 3)    /* PLL runs in NRZ mode */
    255 #define CLMPCC_RCOR_DPLL_NRZI   (1 << 3)    /* PLL runs in NRZI mode */
    256 #define CLMPCC_RCOR_DPLL_MAN    (2 << 3)    /* PLL runs in Manchester mode */
    257 #define CLMPCC_RCOR_CLK_0       0x0         /* Rx Clock Source 'Clk0' */
    258 #define CLMPCC_RCOR_CLK_1       0x1         /* Rx Clock Source 'Clk1' */
    259 #define CLMPCC_RCOR_CLK_2       0x2         /* Rx Clock Source 'Clk2' */
    260 #define CLMPCC_RCOR_CLK_3       0x3         /* Rx Clock Source 'Clk3' */
    261 #define CLMPCC_RCOR_CLK_4       0x4         /* Rx Clock Source 'Clk4' */
    262 #define CLMPCC_RCOR_CLK_EXT     0x6         /* Rx Clock Source 'External' */
    263 
    264 /* Transmit Clock Options Register */
    265 #define CLMPCC_TCOR_CLK(x)	((x) << 5)
    266 #define CLMPCC_TCOR_CLK_0       (0 << 5)    /* Tx Clock Source 'Clk0' */
    267 #define CLMPCC_TCOR_CLK_1       (1 << 5)    /* Tx Clock Source 'Clk1' */
    268 #define CLMPCC_TCOR_CLK_2       (2 << 5)    /* Tx Clock Source 'Clk2' */
    269 #define CLMPCC_TCOR_CLK_3       (3 << 5)    /* Tx Clock Source 'Clk3' */
    270 #define CLMPCC_TCOR_CLK_4       (4 << 5)    /* Tx Clock Source 'Clk4' */
    271 #define CLMPCC_TCOR_CLK_EXT     (6 << 5)    /* Tx Clock Source 'External' */
    272 #define CLMPCC_TCOR_CLK_RX      (7 << 5)    /* Tx Clock Source 'Same as Rx' */
    273 #define CLMPCC_TCOR_EXT_1X      (1 << 3)    /* Times 1 External Clock */
    274 #define CLMPCC_TCOR_LOCAL_LOOP  (1 << 1)    /* Enable Local Loopback */
    275 
    276 /* Special Transmit Command Register */
    277 #define	CLMPCC_STCR_SSPC(n)	((n) & 0x7) /* Send special character 'n' */
    278 #define CLMPCC_STCR_SND_SPC	(1 << 3)    /* Initiate send special char */
    279 #define	CLMPCC_STCR_APPEND_COMP	(1 << 5)    /* Append complete (Async DMA) */
    280 #define CLMPCC_STCR_ABORT_TX	(1 << 6)    /* Abort Tx (HDLC Mode only) */
    281 
    282 /* Channel Command Register */
    283 #define CLMPCC_CCR_T0_CLEAR     0x40        /* Type 0: Clear Channel */
    284 #define CLMPCC_CCR_T0_INIT      0x20        /* Type 0: Initialise Channel */
    285 #define CLMPCC_CCR_T0_RESET_ALL 0x10        /* Type 0: Reset All */
    286 #define CLMPCC_CCR_T0_TX_EN     0x08        /* Type 0: Transmitter Enable */
    287 #define CLMPCC_CCR_T0_TX_DIS    0x04        /* Type 0: Transmitter Disable */
    288 #define CLMPCC_CCR_T0_RX_EN     0x02        /* Type 0: Receiver Enable */
    289 #define CLMPCC_CCR_T0_RX_DIS    0x01        /* Type 0: Receiver Disable */
    290 #define CLMPCC_CCR_T1_CLR_TMR1  0xc0        /* Type 1: Clear Timer 1 */
    291 #define CLMPCC_CCR_T1_CLR_TMR2  0xa0        /* Type 1: Clear Timer 5 */
    292 #define CLMPCC_CCR_T1_CLR_RECV  0x90        /* Type 1: Clear Receiver */
    293 
    294 /* Channel Status Register (Async Mode) */
    295 #define CLMPCC_CSR_RX_ENABLED   (1 << 7)    /* Receiver Enabled */
    296 #define CLMPCC_CSR_RX_FLOW_OFF  (1 << 6)    /* Receive Flow Off */
    297 #define CLMPCC_CSR_RX_FLOW_ON   (1 << 5)    /* Receive Flow On */
    298 #define CLMPCC_CSR_TX_ENABLED   (1 << 3)    /* Transmitter Enabled */
    299 #define CLMPCC_CSR_TX_FLOW_OFF  (1 << 2)    /* Transmit Flow Off */
    300 #define CLMPCC_CSR_TX_FLOW_ON   (1 << 1)    /* Transmit Flow On */
    301 
    302 /* Modem Signal Value Register */
    303 #define CLMPCC_MSVR_DSR         (1 << 7)    /* Current State of DSR Input */
    304 #define CLMPCC_MSVR_CD          (1 << 6)    /* Current State of CD Input */
    305 #define CLMPCC_MSVR_CTS         (1 << 5)    /* Current State of CTS Input */
    306 #define CLMPCC_MSVR_DTR_OPT     (1 << 4)    /* DTR Option Select */
    307 #define CLMPCC_MSVR_PORT_ID     (1 << 2)    /* Device Type (2400 / 2401) */
    308 #define CLMPCC_MSVR_DTR         (1 << 1)    /* Current State of DTR Output */
    309 #define CLMPCC_MSVR_RTS         (1 << 0)    /* Current State of RTS Output */
    310 
    311 /* Local Interrupt Vector Register */
    312 #define CLMPCC_LIVR_TYPE_MASK	0x03	    /* Type of Interrupt */
    313 #define CLMPCC_LIVR_EXCEPTION	0x0	    /* Exception (DMA Completion) */
    314 #define CLMPCC_LIVR_MODEM	0x1	    /* Modem Signal Change */
    315 #define CLMPCC_LIVR_TX		0x2	    /* Transmit Data Interrupt */
    316 #define CLMPCC_LIVR_RX		0x3	    /* Receive Data Interrupt */
    317 
    318 /* Interrupt Enable Register */
    319 #define CLMPCC_IER_MODEM        (1 << 7)    /* Modem Pin Change Detect */
    320 #define CLMPCC_IER_RET          (1 << 5)    /* Receive Exception Timeout */
    321 #define CLMPCC_IER_RX_FIFO      (1 << 3)    /* Rx FIFO Threshold Reached */
    322 #define CLMPCC_IER_TIMER        (1 << 2)    /* General Timer(s) Timeout */
    323 #define CLMPCC_IER_TX_EMPTY     (1 << 1)    /* Tx Empty */
    324 #define CLMPCC_IER_TX_FIFO      (1 << 0)    /* Tx FIFO Threshold Reached */
    325 
    326 /* Local Interrupting Channel Register */
    327 #define CLMPCC_LICR_MASK	0x0c	    /* Mask for channel number */
    328 #define CLMPCC_LICR_CHAN(v)	(((v) & CLMPCC_LICR_MASK) >> 2)
    329 
    330 /* Receive Interrupt Register */
    331 #define CLMPCC_RIR_REN		(1 << 7)    /* Receive Enable */
    332 #define CLMPCC_RIR_RACT		(1 << 6)    /* Receive Active */
    333 #define CLMPCC_RIR_REOI		(1 << 5)    /* Receive End of Interrupt */
    334 #define CLMPCC_RIR_RCVT_MASK	0x0c
    335 #define CLMPCC_RIR_RCN_MASK	0x03
    336 
    337 /* Receive Interrupt Status Register, Low (Async option) */
    338 #define CLMPCC_RISR_TIMEOUT	(1 << 7)    /* Rx FIFO Empty and Timeout */
    339 #define CLMPCC_RISR_OVERRUN	(1 << 3)    /* Rx Overrun Error */
    340 #define CLMPCC_RISR_PARITY	(1 << 2)    /* Rx Parity Error */
    341 #define CLMPCC_RISR_FRAMING	(1 << 1)    /* Rx Framing Error */
    342 #define CLMPCC_RISR_BREAK	(1 << 0)    /* BREAK Detected */
    343 
    344 /* Receive FIFO Counter Register */
    345 #define CLMPCC_RFOC_MASK	0x1f	    /* Mask for valid bits */
    346 
    347 /* Receive End of Interrupt Register */
    348 #define CLMPCC_REOIR_TERMBUFF	(1 << 7)    /* Terminate Current DMA Buffer */
    349 #define CLMPCC_REOIR_DIS_EX_CHR	(1 << 6)    /* Discard Exception Char (DMA) */
    350 #define CLMPCC_REOIR_TMR2_SYNC	(1 << 5)    /* Set Timer 2 in Sync Mode */
    351 #define CLMPCC_REOIR_TMR1_SYNC	(1 << 4)    /* Set Timer 1 in Sync Mode */
    352 #define CLMPCC_REOIR_NO_TRANS	(1 << 3)    /* No Transfer of Data */
    353 
    354 /* Transmit Interrupt Register */
    355 #define CLMPCC_TIR_TEN		(1 << 7)    /* Transmit Enable */
    356 #define CLMPCC_TIR_TACT		(1 << 6)    /* Transmit Active */
    357 #define CLMPCC_TIR_TEOI		(1 << 5)    /* Transmit End of Interrupt */
    358 #define CLMPCC_TIR_TCVT_MASK	0x0c
    359 #define CLMPCC_TIR_TCN_MASK	0x03
    360 
    361 /* Transmit Interrupt Status Register (Async option) */
    362 #define CLMPCC_TISR_BERR	(1 << 7)    /* Bus Error (DMA) */
    363 #define CLMPCC_TISR_EOF		(1 << 6)    /* Transmit End of Frame (DMA) */
    364 #define CLMPCC_TISR_EOB		(1 << 5)    /* Transmit End of Buffer (DMA) */
    365 #define CLMPCC_TISR_UNDERRUN	(1 << 4)    /* Transmit Underrun (sync only) */
    366 #define CLMPCC_TISR_BUFF_ID	(1 << 3)    /* Buffer that has exception */
    367 #define CLMPCC_TISR_TX_EMPTY	(1 << 1)    /* Transmitter Empty */
    368 #define CLMPCC_TISR_TX_FIFO	(1 << 0)    /* Transmit FIFO Below Threshold */
    369 
    370 /* Transmit FIFO Transfer Count Register */
    371 #define CLMPCC_TFTC_MASK	0x1f	    /* Mask for valid bits */
    372 
    373 /* Transmit End of Interrupt Register */
    374 #define CLMPCC_TEOIR_TERMBUFF	(1 << 7)    /* Terminate Current DMA Buffer */
    375 #define CLMPCC_TEOIR_END_OF_FRM	(1 << 6)    /* End of Frame (sync mode) */
    376 #define CLMPCC_TEOIR_TMR2_SYNC	(1 << 5)    /* Set Timer 2 in Sync Mode */
    377 #define CLMPCC_TEOIR_TMR1_SYNC	(1 << 4)    /* Set Timer 1 in Sync Mode */
    378 #define CLMPCC_TEOIR_NO_TRANS	(1 << 3)    /* No Transfer of Data */
    379 
    380 /* Modem Interrupt Register */
    381 #define CLMPCC_MIR_MEN		(1 << 7)    /* Modem Enable */
    382 #define CLMPCC_MIR_MACT		(1 << 6)    /* Modem Active */
    383 #define CLMPCC_MIR_MEOI		(1 << 5)    /* Modem End of Interrupt */
    384 #define CLMPCC_MIR_MCVT_MASK	0x0c
    385 #define CLMPCC_MIR_MCN_MASK	0x03
    386 
    387 /* Modem/Timer Interrupt Status Register */
    388 #define CLMPCC_MISR_DSR		(1 << 7)    /* DSR Changed State */
    389 #define CLMPCC_MISR_CD		(1 << 6)    /* CD Changed State */
    390 #define CLMPCC_MISR_CTS		(1 << 5)    /* CTS Changed State */
    391 #define CLMPCC_MISR_TMR2	(1 << 1)    /* Timer 2 Timed Out */
    392 #define CLMPCC_MISR_TMR1	(1 << 0)    /* Timer 1 Timed Out */
    393 
    394 /* Modem End of Interrupt Register */
    395 #define CLMPCC_MEOIR_TMR2_SYNC	(1 << 5)    /* Set Timer 2 in Sync Mode */
    396 #define CLMPCC_MEOIR_TMR1_SYNC	(1 << 4)    /* Set Timer 1 in Sync Mode */
    397 
    398 /* Default value for CLMPCC_REG_RTPRl */
    399 #define CLMPCC_RTPR_DEFAULT	2	    /* 2mS timeout period */
    400 
    401 /*
    402  * Return a value for the Receive Timer Prescaler register
    403  * for a given clock rate and number of milliseconds.
    404  * The minimum recommended value for this register is 0x0a.
    405  */
    406 #define CLMPCC_MSEC_TO_TPR(c,m)	(((((c)/2048)/(1000/(m))) > 0x0a) ?	\
    407 				  (((c)/2048)/(1000/(m))) : 0x0a)
    408 
    409 #endif  /* __clmpccreg_h */
    410