0001
0002 #ifndef _SUNZILOG_H
0003 #define _SUNZILOG_H
0004
0005 struct zilog_channel {
0006 volatile unsigned char control;
0007 volatile unsigned char __pad1;
0008 volatile unsigned char data;
0009 volatile unsigned char __pad2;
0010 };
0011
0012 struct zilog_layout {
0013 struct zilog_channel channelB;
0014 struct zilog_channel channelA;
0015 };
0016
0017 #define NUM_ZSREGS 17
0018 #define R7p 16
0019
0020
0021
0022
0023 #define BRG_TO_BPS(brg, freq) ((freq) / 2 / ((brg) + 2))
0024 #define BPS_TO_BRG(bps, freq) ((((freq) + (bps)) / (2 * (bps))) - 2)
0025
0026
0027
0028 #define FLAG 0x7e
0029
0030
0031 #define R0 0
0032 #define R1 1
0033 #define R2 2
0034 #define R3 3
0035 #define R4 4
0036 #define R5 5
0037 #define R6 6
0038 #define R7 7
0039 #define R8 8
0040 #define R9 9
0041 #define R10 10
0042 #define R11 11
0043 #define R12 12
0044 #define R13 13
0045 #define R14 14
0046 #define R15 15
0047
0048 #define NULLCODE 0
0049 #define POINT_HIGH 0x8
0050 #define RES_EXT_INT 0x10
0051 #define SEND_ABORT 0x18
0052 #define RES_RxINT_FC 0x20
0053 #define RES_Tx_P 0x28
0054 #define ERR_RES 0x30
0055 #define RES_H_IUS 0x38
0056
0057 #define RES_Rx_CRC 0x40
0058 #define RES_Tx_CRC 0x80
0059 #define RES_EOM_L 0xC0
0060
0061
0062
0063 #define EXT_INT_ENAB 0x1
0064 #define TxINT_ENAB 0x2
0065 #define PAR_SPEC 0x4
0066
0067 #define RxINT_DISAB 0
0068 #define RxINT_FCERR 0x8
0069 #define INT_ALL_Rx 0x10
0070 #define INT_ERR_Rx 0x18
0071 #define RxINT_MASK 0x18
0072
0073 #define WT_RDY_RT 0x20
0074 #define WT_FN_RDYFN 0x40
0075 #define WT_RDY_ENAB 0x80
0076
0077
0078
0079
0080
0081 #define RxENAB 0x1
0082 #define SYNC_L_INH 0x2
0083 #define ADD_SM 0x4
0084 #define RxCRC_ENAB 0x8
0085 #define ENT_HM 0x10
0086 #define AUTO_ENAB 0x20
0087 #define Rx5 0x0
0088 #define Rx7 0x40
0089 #define Rx6 0x80
0090 #define Rx8 0xc0
0091 #define RxN_MASK 0xc0
0092
0093
0094
0095 #define PAR_ENAB 0x1
0096 #define PAR_EVEN 0x2
0097
0098 #define SYNC_ENAB 0
0099 #define SB1 0x4
0100 #define SB15 0x8
0101 #define SB2 0xc
0102
0103 #define MONSYNC 0
0104 #define BISYNC 0x10
0105 #define SDLC 0x20
0106 #define EXTSYNC 0x30
0107
0108 #define X1CLK 0x0
0109 #define X16CLK 0x40
0110 #define X32CLK 0x80
0111 #define X64CLK 0xC0
0112 #define XCLK_MASK 0xC0
0113
0114
0115
0116 #define TxCRC_ENAB 0x1
0117 #define RTS 0x2
0118 #define SDLC_CRC 0x4
0119 #define TxENAB 0x8
0120 #define SND_BRK 0x10
0121 #define Tx5 0x0
0122 #define Tx7 0x20
0123 #define Tx6 0x40
0124 #define Tx8 0x60
0125 #define TxN_MASK 0x60
0126 #define DTR 0x80
0127
0128
0129
0130
0131
0132
0133 #define AUTO_TxFLAG 1
0134 #define AUTO_EOM_RST 2
0135 #define AUTOnRTS 4
0136 #define RxFIFO_LVL 8
0137 #define nDTRnREQ 0x10
0138 #define TxFIFO_LVL 0x20
0139 #define EXT_RD_EN 0x40
0140
0141
0142
0143
0144 #define VIS 1
0145 #define NV 2
0146 #define DLC 4
0147 #define MIE 8
0148 #define STATHI 0x10
0149 #define SWIACK 0x20
0150 #define NORESET 0
0151 #define CHRB 0x40
0152 #define CHRA 0x80
0153 #define FHWRES 0xc0
0154
0155
0156 #define BIT6 1
0157 #define LOOPMODE 2
0158 #define ABUNDER 4
0159 #define MARKIDLE 8
0160 #define GAOP 0x10
0161 #define NRZ 0
0162 #define NRZI 0x20
0163 #define FM1 0x40
0164 #define FM0 0x60
0165 #define CRCPS 0x80
0166
0167
0168 #define TRxCXT 0
0169 #define TRxCTC 1
0170 #define TRxCBR 2
0171 #define TRxCDP 3
0172 #define TRxCOI 4
0173 #define TCRTxCP 0
0174 #define TCTRxCP 8
0175 #define TCBR 0x10
0176 #define TCDPLL 0x18
0177 #define RCRTxCP 0
0178 #define RCTRxCP 0x20
0179 #define RCBR 0x40
0180 #define RCDPLL 0x60
0181 #define RTxCX 0x80
0182
0183
0184
0185
0186
0187
0188 #define BRENAB 1
0189 #define BRSRC 2
0190 #define DTRREQ 4
0191 #define AUTOECHO 8
0192 #define LOOPBAK 0x10
0193 #define SEARCH 0x20
0194 #define RMC 0x40
0195 #define DISDPLL 0x60
0196 #define SSBR 0x80
0197 #define SSRTxC 0xa0
0198 #define SFMM 0xc0
0199 #define SNRZI 0xe0
0200
0201
0202 #define WR7pEN 1
0203 #define ZCIE 2
0204 #define FIFOEN 4
0205 #define DCDIE 8
0206 #define SYNCIE 0x10
0207 #define CTSIE 0x20
0208 #define TxUIE 0x40
0209 #define BRKIE 0x80
0210
0211
0212
0213 #define Rx_CH_AV 0x1
0214 #define ZCOUNT 0x2
0215 #define Tx_BUF_EMP 0x4
0216 #define DCD 0x8
0217 #define SYNC 0x10
0218 #define CTS 0x20
0219 #define TxEOM 0x40
0220 #define BRK_ABRT 0x80
0221
0222
0223 #define ALL_SNT 0x1
0224
0225 #define RES3 0x8
0226 #define RES4 0x4
0227 #define RES5 0xc
0228 #define RES6 0x2
0229 #define RES7 0xa
0230 #define RES8 0x6
0231 #define RES18 0xe
0232 #define RES28 0x0
0233
0234 #define PAR_ERR 0x10
0235 #define Rx_OVR 0x20
0236 #define CRC_ERR 0x40
0237 #define END_FR 0x80
0238
0239
0240 #define CHB_Tx_EMPTY 0x00
0241 #define CHB_EXT_STAT 0x02
0242 #define CHB_Rx_AVAIL 0x04
0243 #define CHB_SPECIAL 0x06
0244 #define CHA_Tx_EMPTY 0x08
0245 #define CHA_EXT_STAT 0x0a
0246 #define CHA_Rx_AVAIL 0x0c
0247 #define CHA_SPECIAL 0x0e
0248 #define STATUS_MASK 0x0e
0249
0250
0251 #define CHBEXT 0x1
0252 #define CHBTxIP 0x2
0253 #define CHBRxIP 0x4
0254 #define CHAEXT 0x8
0255 #define CHATxIP 0x10
0256 #define CHARxIP 0x20
0257
0258
0259
0260
0261
0262
0263
0264
0265 #define ONLOOP 2
0266 #define LOOPSEND 0x10
0267 #define CLK2MIS 0x40
0268 #define CLK1MIS 0x80
0269
0270
0271
0272
0273
0274
0275
0276
0277 #define ZS_CLEARERR(channel) do { sbus_writeb(ERR_RES, &channel->control); \
0278 udelay(5); } while(0)
0279
0280 #define ZS_CLEARSTAT(channel) do { sbus_writeb(RES_EXT_INT, &channel->control); \
0281 udelay(5); } while(0)
0282
0283 #define ZS_CLEARFIFO(channel) do { sbus_readb(&channel->data); \
0284 udelay(2); \
0285 sbus_readb(&channel->data); \
0286 udelay(2); \
0287 sbus_readb(&channel->data); \
0288 udelay(2); } while(0)
0289
0290 #endif