cronyx.h
来自「基于组件方式开发操作系统的OSKIT源代码」· C头文件 代码 · 共 496 行 · 第 1/2 页
H
496 行
/* * Defines for Cronyx-Sigma adapter driver. * * Copyright (C) 1994 Cronyx Ltd. * Author: Serge Vakulenko, <vak@zebub.msk.su> * * This software is distributed with NO WARRANTIES, not even the implied * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Authors grant any other persons or organisations permission to use * or modify this software as long as this message is kept with the software, * all derivative works or modified versions. * * Version 1.9, Wed Oct 4 18:58:15 MSK 1995 *//* * Asynchronous channel mode ------------------------------------------------- *//* Parity */#define PAR_EVEN 0 /* even parity */#define PAR_ODD 1 /* odd parity *//* Parity mode */#define PARM_NOPAR 0 /* no parity */#define PARM_FORCE 1 /* force parity (odd = force 1, even = 0) */#define PARM_NORMAL 2 /* normal parity *//* Flow control transparency mode */#define FLOWCC_PASS 0 /* pass flow ctl chars as exceptions */#define FLOWCC_NOTPASS 1 /* don't pass flow ctl chars to the host *//* Stop bit length */#define STOPB_1 2 /* 1 stop bit */#define STOPB_15 3 /* 1.5 stop bits */#define STOPB_2 4 /* 2 stop bits *//* Action on break condition */#define BRK_INTR 0 /* generate an exception interrupt */#define BRK_NULL 1 /* translate to a NULL character */#define BRK_RESERVED 2 /* reserved */#define BRK_DISCARD 3 /* discard character *//* Parity/framing error actions */#define PERR_INTR 0 /* generate an exception interrupt */#define PERR_NULL 1 /* translate to a NULL character */#define PERR_IGNORE 2 /* ignore error; char passed as good data */#define PERR_DISCARD 3 /* discard error character */#define PERR_FFNULL 5 /* translate to FF NULL char */typedef struct { /* async channel option register 1 */ unsigned charlen : 4; /* character length, 5..8 */ unsigned ignpar : 1; /* ignore parity */ unsigned parmode : 2; /* parity mode */ unsigned parity : 1; /* parity */} cx_cor1_async_t;typedef struct { /* async channel option register 2 */ unsigned dsrae : 1; /* DSR automatic enable */ unsigned ctsae : 1; /* CTS automatic enable */ unsigned rtsao : 1; /* RTS automatic output enable */ unsigned rlm : 1; /* remote loopback mode enable */ unsigned zero : 1; unsigned etc : 1; /* embedded transmitter cmd enable */ unsigned ixon : 1; /* in-band XON/XOFF enable */ unsigned ixany : 1; /* XON on any character */} cx_cor2_async_t;typedef struct { /* async channel option register 3 */ unsigned stopb : 3; /* stop bit length */ unsigned zero : 1; unsigned scde : 1; /* special char detection enable */ unsigned flowct : 1; /* flow control transparency mode */ unsigned rngde : 1; /* range detect enable */ unsigned escde : 1; /* extended spec. char detect enable */} cx_cor3_async_t;typedef struct { /* async channel option register 6 */ unsigned parerr : 3; /* parity/framing error actions */ unsigned brk : 2; /* action on break condition */ unsigned inlcr : 1; /* translate NL to CR on input */ unsigned icrnl : 1; /* translate CR to NL on input */ unsigned igncr : 1; /* discard CR on input */} cx_cor6_async_t;typedef struct { /* async channel option register 7 */ unsigned ocrnl : 1; /* translate CR to NL on output */ unsigned onlcr : 1; /* translate NL to CR on output */ unsigned zero : 3; unsigned fcerr : 1; /* process flow ctl err chars enable */ unsigned lnext : 1; /* LNext option enable */ unsigned istrip : 1; /* strip 8-bit on input */} cx_cor7_async_t;typedef struct { /* async channel options */ cx_cor1_async_t cor1; /* channel option register 1 */ cx_cor2_async_t cor2; /* channel option register 2 */ cx_cor3_async_t cor3; /* option register 3 */ cx_cor6_async_t cor6; /* channel option register 6 */ cx_cor7_async_t cor7; /* channel option register 7 */ unsigned char schr1; /* special character register 1 (XON) */ unsigned char schr2; /* special character register 2 (XOFF) */ unsigned char schr3; /* special character register 3 */ unsigned char schr4; /* special character register 4 */ unsigned char scrl; /* special character range low */ unsigned char scrh; /* special character range high */ unsigned char lnxt; /* LNext character */} cx_opt_async_t;/* * HDLC channel mode --------------------------------------------------------- *//* Address field length option */#define AFLO_1OCT 0 /* address field is 1 octet in length */#define AFLO_2OCT 1 /* address field is 2 octet in length *//* Clear detect for X.21 data transfer phase */#define CLRDET_DISABLE 0 /* clear detect disabled */#define CLRDET_ENABLE 1 /* clear detect enabled *//* Addressing mode */#define ADMODE_NOADDR 0 /* no address */#define ADMODE_4_1 1 /* 4 * 1 byte */#define ADMODE_2_2 2 /* 2 * 2 byte *//* FCS append */#define FCS_NOTPASS 0 /* receive CRC is not passed to the host */#define FCS_PASS 1 /* receive CRC is passed to the host *//* CRC modes */#define CRC_INVERT 0 /* CRC is transmitted inverted (CRC V.41) */#define CRC_DONT_INVERT 1 /* CRC is not transmitted inverted (CRC-16) *//* Send sync pattern */#define SYNC_00 0 /* send 00h as pad char (NRZI encoding) */#define SYNC_AA 1 /* send AAh (Manchester/NRZ encoding) *//* FCS preset */#define FCSP_ONES 0 /* FCS is preset to all ones (CRC V.41) */#define FCSP_ZEROS 1 /* FCS is preset to all zeros (CRC-16) *//* idle mode */#define IDLE_FLAG 0 /* idle in flag */#define IDLE_MARK 1 /* idle in mark *//* CRC polynomial select */#define POLY_V41 0 /* x^16+x^12+x^5+1 (HDLC, preset to 1) */#define POLY_16 1 /* x^16+x^15+x^2+1 (bisync, preset to 0) */typedef struct { /* hdlc channel option register 1 */ unsigned ifflags : 4; /* number of inter-frame flags sent */ unsigned admode : 2; /* addressing mode */ unsigned clrdet : 1; /* clear detect for X.21 data transfer phase */ unsigned aflo : 1; /* address field length option */} cx_cor1_hdlc_t;typedef struct { /* hdlc channel option register 2 */ unsigned dsrae : 1; /* DSR automatic enable */ unsigned ctsae : 1; /* CTS automatic enable */ unsigned rtsao : 1; /* RTS automatic output enable */ unsigned zero1 : 1; unsigned crcninv : 1; /* CRC invertion option */ unsigned zero2 : 1; unsigned fcsapd : 1; /* FCS append */ unsigned zero3 : 1;} cx_cor2_hdlc_t;typedef struct { /* hdlc channel option register 3 */ unsigned padcnt : 3; /* pad character count */ unsigned idle : 1; /* idle mode */ unsigned nofcs : 1; /* FCS disable */ unsigned fcspre : 1; /* FCS preset */ unsigned syncpat : 1; /* send sync pattern */ unsigned sndpad : 1; /* send pad characters before flag enable */} cx_cor3_hdlc_t;typedef struct { /* hdlc channel options */ cx_cor1_hdlc_t cor1; /* hdlc channel option register 1 */ cx_cor2_hdlc_t cor2; /* hdlc channel option register 2 */ cx_cor3_hdlc_t cor3; /* hdlc channel option register 3 */ unsigned char rfar1; /* receive frame address register 1 */ unsigned char rfar2; /* receive frame address register 2 */ unsigned char rfar3; /* receive frame address register 3 */ unsigned char rfar4; /* receive frame address register 4 */ unsigned char cpsr; /* CRC polynomial select */} cx_opt_hdlc_t;/* * BISYNC channel mode ------------------------------------------------------- *//* Longitudinal redundancy check */#define BCC_CRC16 0 /* CRC16 is used for BCC */#define BCC_LRC 1 /* LRC is used for BCC *//* Send pad pattern */#define PAD_AA 0 /* send AAh as pad character */#define PAD_55 1 /* send 55h as pad character */typedef struct { /* channel option register 1 */ unsigned charlen : 4; /* character length, 5..8 */ unsigned ignpar : 1; /* ignore parity */ unsigned parmode : 2; /* parity mode */ unsigned parity : 1; /* parity */} cx_cor1_bisync_t;typedef struct { /* channel option register 2 */ unsigned syns : 4; /* number of extra SYN chars before a frame */ unsigned crcninv : 1; /* CRC invertion option */ unsigned ebcdic : 1; /* use EBCDIC as char set (instead of ASCII) */ unsigned bcc : 1; /* BCC append enable */ unsigned lrc : 1; /* longitudinal redundancy check */} cx_cor2_bisync_t;typedef struct { /* channel option register 3 */ unsigned padcnt : 3; /* pad character count */ unsigned idle : 1; /* idle mode */ unsigned nofcs : 1; /* FCS disable */ unsigned fcspre : 1; /* FCS preset */ unsigned padpat : 1; /* send pad pattern */ unsigned sndpad : 1; /* send pad characters before SYN enable */} cx_cor3_bisync_t;typedef struct { /* channel option register 6 */ unsigned char specterm; /* special termination character */} cx_cor6_bisync_t;typedef struct { /* bisync channel options */ cx_cor1_bisync_t cor1; /* channel option register 1 */ cx_cor2_bisync_t cor2; /* channel option register 2 */ cx_cor3_bisync_t cor3; /* channel option register 3 */ cx_cor6_bisync_t cor6; /* channel option register 6 */ unsigned char cpsr; /* CRC polynomial select */} cx_opt_bisync_t;/* * X.21 channel mode --------------------------------------------------------- *//* The number of SYN chars on receive */#define X21SYN_2 0 /* two SYN characters are required */#define X21SYN_1 1 /* one SYN character is required */typedef struct { /* channel option register 1 */ unsigned charlen : 4; /* character length, 5..8 */ unsigned ignpar : 1; /* ignore parity */ unsigned parmode : 2; /* parity mode */ unsigned parity : 1; /* parity */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?