File indexing completed on 2025-05-11 08:24:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef __Z85C30_P_H
0027 #define __Z85C30_P_H
0028
0029 #ifdef __cplusplus
0030 extern "C" {
0031 #endif
0032
0033
0034
0035
0036
0037
0038 #define Z85C30_STATIC
0039
0040
0041
0042
0043
0044
0045 #define SCC_WR0_SEL_WR0 0x00
0046 #define SCC_WR0_SEL_WR1 0x01
0047 #define SCC_WR0_SEL_WR2 0x02
0048 #define SCC_WR0_SEL_WR3 0x03
0049 #define SCC_WR0_SEL_WR4 0x04
0050 #define SCC_WR0_SEL_WR5 0x05
0051 #define SCC_WR0_SEL_WR6 0x06
0052 #define SCC_WR0_SEL_WR7 0x07
0053 #define SCC_WR0_SEL_WR8 0x08
0054 #define SCC_WR0_SEL_WR9 0x09
0055 #define SCC_WR0_SEL_WR10 0x0a
0056 #define SCC_WR0_SEL_WR11 0x0b
0057 #define SCC_WR0_SEL_WR12 0x0c
0058 #define SCC_WR0_SEL_WR13 0x0d
0059 #define SCC_WR0_SEL_WR14 0x0e
0060 #define SCC_WR0_SEL_WR15 0x0f
0061 #define SCC_WR0_SEL_RD0 0x00
0062 #define SCC_WR0_SEL_RD1 0x01
0063 #define SCC_WR0_SEL_RD2 0x02
0064 #define SCC_WR0_SEL_RD3 0x03
0065 #define SCC_WR0_SEL_RD4 0x04
0066 #define SCC_WR0_SEL_RD5 0x05
0067 #define SCC_WR0_SEL_RD6 0x06
0068 #define SCC_WR0_SEL_RD7 0x07
0069 #define SCC_WR0_SEL_RD8 0x08
0070 #define SCC_WR0_SEL_RD9 0x09
0071 #define SCC_WR0_SEL_RD10 0x0a
0072 #define SCC_WR0_SEL_RD11 0x0b
0073 #define SCC_WR0_SEL_RD12 0x0c
0074 #define SCC_WR0_SEL_RD13 0x0d
0075 #define SCC_WR0_SEL_RD14 0x0e
0076 #define SCC_WR0_SEL_RD15 0x0f
0077 #define SCC_WR0_NULL_CODE 0x00
0078 #define SCC_WR0_RST_INT 0x10
0079 #define SCC_WR0_SEND_ABORT 0x18
0080 #define SCC_WR0_EN_INT_RX 0x20
0081 #define SCC_WR0_RST_TX_INT 0x28
0082 #define SCC_WR0_ERR_RST 0x30
0083 #define SCC_WR0_RST_HI_IUS 0x38
0084 #define SCC_WR0_RST_RX_CRC 0x40
0085 #define SCC_WR0_RST_TX_CRC 0x80
0086 #define SCC_WR0_RST_TX_UND 0xc0
0087
0088
0089
0090
0091
0092
0093
0094 #define SCC_WR1_EXT_INT_EN 0x01
0095 #define SCC_WR1_TX_INT_EN 0x02
0096 #define SCC_WR1_PARITY 0x04
0097 #define SCC_WR1_RX_INT_DIS 0x00
0098 #define SCC_WR1_RX_INT_FIR 0x08
0099 #define SCC_WR1_INT_ALL_RX 0x10
0100 #define SCC_WR1_RX_INT_SPE 0x18
0101 #define SCC_WR1_RDMA_RECTR 0x20
0102 #define SCC_WR1_RDMA_FUNC 0x40
0103 #define SCC_WR1_RDMA_EN 0x80
0104
0105 #define SCC_ENABLE_ALL_INTR \
0106 (SCC_WR1_EXT_INT_EN | SCC_WR1_TX_INT_EN | SCC_WR1_INT_ALL_RX)
0107
0108 #define SCC_DISABLE_ALL_INTR 0x00
0109
0110 #define SCC_ENABLE_ALL_INTR_EXCEPT_TX \
0111 (SCC_WR1_EXT_INT_EN | SCC_WR1_INT_ALL_RX)
0112
0113
0114
0115
0116 #define SCC_WR3_RX_EN 0x01
0117 #define SCC_WR3_SYNC_CHAR 0x02
0118 #define SCC_WR3_ADR_SEARCH 0x04
0119 #define SCC_WR3_RX_CRC_EN 0x08
0120 #define SCC_WR3_ENTER_HUNT 0x10
0121 #define SCC_WR3_AUTO_EN 0x20
0122 #define SCC_WR3_RX_5_BITS 0x00
0123 #define SCC_WR3_RX_7_BITS 0x40
0124 #define SCC_WR3_RX_6_BITS 0x80
0125 #define SCC_WR3_RX_8_BITS 0xc0
0126
0127
0128
0129
0130 #define SCC_WR4_PAR_EN 0x01
0131 #define SCC_WR4_PAR_EVEN 0x02
0132 #define SCC_WR4_SYNC_EN 0x00
0133 #define SCC_WR4_1_STOP 0x04
0134 #define SCC_WR4_2_STOP 0x0c
0135 #define SCC_WR4_8_SYNC 0x00
0136 #define SCC_WR4_16_SYNC 0x10
0137 #define SCC_WR4_SDLC 0x20
0138 #define SCC_WR4_EXT_SYNC 0x30
0139 #define SCC_WR4_1_CLOCK 0x00
0140 #define SCC_WR4_16_CLOCK 0x40
0141 #define SCC_WR4_32_CLOCK 0x80
0142 #define SCC_WR4_64_CLOCK 0xc0
0143
0144
0145
0146
0147 #define SCC_WR5_TX_CRC_EN 0x01
0148 #define SCC_WR5_RTS 0x02
0149 #define SCC_WR5_SDLC 0x04
0150 #define SCC_WR5_TX_EN 0x08
0151 #define SCC_WR5_SEND_BRK 0x10
0152
0153 #define SCC_WR5_TX_5_BITS 0x00
0154 #define SCC_WR5_TX_7_BITS 0x20
0155 #define SCC_WR5_TX_6_BITS 0x40
0156 #define SCC_WR5_TX_8_BITS 0x60
0157 #define SCC_WR5_DTR 0x80
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171 #define SCC_WR9_VIS 0x01
0172 #define SCC_WR9_NV 0x02
0173 #define SCC_WR9_DLC 0x04
0174 #define SCC_WR9_MIE 0x08
0175 #define SCC_WR9_STATUS_HI 0x10
0176 #define SCC_WR9_NO_RST 0x00
0177 #define SCC_WR9_CH_B_RST 0x40
0178 #define SCC_WR9_CH_A_RST 0x80
0179 #define SCC_WR9_HDWR_RST 0xc0
0180
0181
0182
0183
0184 #define SCC_WR10_6_BIT_SYNC 0x01
0185 #define SCC_WR10_LOOP_MODE 0x02
0186 #define SCC_WR10_ABORT_UND 0x04
0187 #define SCC_WR10_MARK_IDLE 0x08
0188 #define SCC_WR10_ACT_POLL 0x10
0189 #define SCC_WR10_NRZ 0x00
0190 #define SCC_WR10_NRZI 0x20
0191 #define SCC_WR10_FM1 0x40
0192 #define SCC_WR10_FM0 0x60
0193 #define SCC_WR10_CRC_PRESET 0x80
0194
0195
0196
0197
0198 #define SCC_WR11_OUT_XTAL 0x00
0199 #define SCC_WR11_OUT_TX_CLK 0x01
0200 #define SCC_WR11_OUT_BR_GEN 0x02
0201 #define SCC_WR11_OUT_DPLL 0x03
0202 #define SCC_WR11_TRXC_OI 0x04
0203 #define SCC_WR11_TX_RTXC 0x00
0204 #define SCC_WR11_TX_TRXC 0x08
0205 #define SCC_WR11_TX_BR_GEN 0x10
0206 #define SCC_WR11_TX_DPLL 0x18
0207 #define SCC_WR11_RX_RTXC 0x00
0208 #define SCC_WR11_RX_TRXC 0x20
0209 #define SCC_WR11_RX_BR_GEN 0x40
0210 #define SCC_WR11_RX_DPLL 0x60
0211 #define SCC_WR11_RTXC_XTAL 0x80
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222 #define SCC_WR14_BR_EN 0x01
0223 #define SCC_WR14_BR_SRC 0x02
0224 #define SCC_WR14_DTR_FUNC 0x04
0225 #define SCC_WR14_AUTO_ECHO 0x08
0226 #define SCC_WR14_LCL_LOOP 0x10
0227 #define SCC_WR14_NULL 0x00
0228 #define SCC_WR14_SEARCH 0x20
0229 #define SCC_WR14_RST_CLK 0x40
0230 #define SCC_WR14_DIS_DPLL 0x60
0231 #define SCC_WR14_SRC_BR 0x80
0232 #define SCC_WR14_SRC_RTXC 0xa0
0233 #define SCC_WR14_FM_MODE 0xc0
0234 #define SCC_WR14_NRZI 0xe0
0235
0236
0237
0238
0239 #define SCC_WR15_ZERO_CNT 0x02
0240 #define SCC_WR15_CD_IE 0x08
0241 #define SCC_WR15_SYNC_IE 0x10
0242 #define SCC_WR15_CTS_IE 0x20
0243 #define SCC_WR15_TX_UND_IE 0x40
0244 #define SCC_WR15_BREAK_IE 0x80
0245
0246
0247
0248
0249 #define SCC_RR0_RX_AVAIL 0x01
0250 #define SCC_RR0_ZERO_CNT 0x02
0251 #define SCC_RR0_TX_EMPTY 0x04
0252 #define SCC_RR0_CD 0x08
0253 #define SCC_RR0_SYNC 0x10
0254 #define SCC_RR0_CTS 0x20
0255 #define SCC_RR0_TX_UND 0x40
0256 #define SCC_RR0_BREAK 0x80
0257
0258
0259
0260 #define SCC_RR1_ALL_SENT 0x01
0261 #define SCC_RR1_RES_CD_2 0x02
0262 #define SCC_RR1_RES_CD_1 0x01
0263 #define SCC_RR1_RES_CD_0 0x08
0264 #define SCC_RR1_PAR_ERR 0x10
0265 #define SCC_RR1_RX_OV_ERR 0x20
0266 #define SCC_RR1_CRC_ERR 0x40
0267 #define SCC_RR1_END_FRAME 0x80
0268
0269
0270
0271
0272
0273
0274
0275 #define SCC_RR3_B_EXT_IP 0x01
0276 #define SCC_RR3_B_TX_IP 0x02
0277 #define SCC_RR3_B_RX_IP 0x04
0278 #define SCC_RR3_A_EXT_IP 0x08
0279 #define SCC_RR3_A_TX_IP 0x10
0280 #define SCC_RR3_A_RX_IP 0x20
0281
0282
0283
0284
0285
0286
0287
0288 #define SCC_RR10_ON_LOOP 0x02
0289 #define SCC_RR10_LOOP_SEND 0x10
0290 #define SCC_RR10_2_CLK_MIS 0x40
0291 #define SCC_RR10_1_CLK_MIS 0x80
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302 #define SCC_RR15_ZERO_CNT 0x02
0303 #define SCC_RR15_CD_IE 0x08
0304 #define SCC_RR15_SYNC_IE 0x10
0305 #define SCC_RR15_CTS_IE 0x20
0306 #define SCC_RR15_TX_UND_IE 0x40
0307 #define SCC_RR15_BREAK_IE 0x80
0308
0309 typedef struct _z85c30_context
0310 {
0311 uint8_t ucModemCtrl;
0312 } z85c30_context;
0313
0314
0315
0316
0317
0318
0319
0320
0321 #define Z85C30_Baud( _clock, _baud_rate ) \
0322 ( ((_clock) /( 16 * 2 * _baud_rate)) - 2)
0323
0324 #define Z85C30_Status_Is_RX_character_available(_status) \
0325 ((_status) & SCC_RR0_RX_AVAIL)
0326
0327 #define Z85C30_Status_Is_TX_buffer_empty(_status) \
0328 ((_status) & SCC_RR0_TX_EMPTY)
0329
0330 #define Z85C30_Status_Is_CTS_asserted(_status) \
0331 ((_status) & SCC_RR0_CTS)
0332
0333 #define Z85C30_Status_Is_break_abort(_status) \
0334 ((_status) & SCC_RR0_BREAK)
0335
0336
0337
0338
0339
0340 Z85C30_STATIC void z85c30_initialize_port(
0341 int minor
0342 );
0343
0344 Z85C30_STATIC void z85c30_init(int minor);
0345
0346 Z85C30_STATIC int z85c30_set_attributes(
0347 int minor,
0348 const struct termios *t
0349 );
0350
0351 Z85C30_STATIC int z85c30_open(
0352 int major,
0353 int minor,
0354 void * arg
0355 );
0356
0357 Z85C30_STATIC int z85c30_close(
0358 int major,
0359 int minor,
0360 void * arg
0361 );
0362
0363 Z85C30_STATIC void z85c30_write_polled(
0364 int minor,
0365 char cChar
0366 );
0367
0368 Z85C30_STATIC int z85c30_assert_RTS(
0369 int minor
0370 );
0371
0372 Z85C30_STATIC int z85c30_negate_RTS(
0373 int minor
0374 );
0375
0376 Z85C30_STATIC int z85c30_assert_DTR(
0377 int minor
0378 );
0379
0380 Z85C30_STATIC int z85c30_negate_DTR(
0381 int minor
0382 );
0383
0384 Z85C30_STATIC void z85c30_initialize_interrupts(int minor);
0385
0386 Z85C30_STATIC ssize_t z85c30_write_support_int(
0387 int minor,
0388 const char *buf,
0389 size_t len
0390 );
0391
0392 Z85C30_STATIC ssize_t z85c30_write_support_polled(
0393 int minor,
0394 const char *buf,
0395 size_t len
0396 );
0397
0398 Z85C30_STATIC int z85c30_inbyte_nonblocking_polled(
0399 int minor
0400 );
0401
0402 Z85C30_STATIC void z85c30_enable_interrupts(
0403 int minor,
0404 int interrupt_mask
0405 );
0406
0407 Z85C30_STATIC void z85c30_process(
0408 int minor,
0409 uint8_t ucIntPend
0410 );
0411
0412 Z85C30_STATIC rtems_isr z85c30_isr(
0413 rtems_vector_number vector
0414 );
0415
0416 #ifdef __cplusplus
0417 }
0418 #endif
0419
0420 #endif