📄 pc300.h
字号:
ucchar offset; /* 1 for T1, 0 for E1 */ ucchar full_bandwidth; ucchar xmb_cause; ucchar multiframe_mode; /* Statistics */ ucshort pden; /* Pulse Density violation count */ ucshort los; /* Loss of Signal count */ ucshort losr; /* Loss of Signal recovery count */ ucshort lfa; /* Loss of frame alignment count */ ucshort farec; /* Frame Alignment Recovery count */ ucshort lmfa; /* Loss of multiframe alignment count */ ucshort ais; /* Remote Alarm indication Signal count */ ucshort sec; /* One-second timer */ ucshort es; /* Errored second */ ucshort rai; /* remote alarm received */ ucshort bec; ucshort fec; ucshort cvc; ucshort cec; ucshort ebc; /* Status */ ucchar red_alarm; ucchar blue_alarm; ucchar loss_fa; ucchar yellow_alarm; ucchar loss_mfa; ucchar prbs;} falc_t;typedef struct falc_status { ucchar sync; /* If true FALC is synchronized */ ucchar red_alarm; ucchar blue_alarm; ucchar loss_fa; ucchar yellow_alarm; ucchar loss_mfa; ucchar prbs;} falc_status_t;typedef struct rsv_x21_status { ucchar dcd; ucchar dsr; ucchar cts; ucchar rts; ucchar dtr;} rsv_x21_status_t;typedef struct pc300stats { int hw_type; uclong line_on; uclong line_off; struct net_device_stats gen_stats; falc_t te_stats;} pc300stats_t;typedef struct pc300status { int hw_type; rsv_x21_status_t gen_status; falc_status_t te_status;} pc300status_t;typedef struct pc300loopback { char loop_type; char loop_on;} pc300loopback_t;typedef struct pc300patterntst { char patrntst_on; /* 0 - off; 1 - on; 2 - read num_errors */ ucshort num_errors;} pc300patterntst_t;typedef struct pc300dev { void *if_ptr; /* General purpose pointer */ struct pc300ch *chan; ucchar trace_on; uclong line_on; /* DCD(X.21, RSV) / sync(TE) change counters */ uclong line_off;#ifdef __KERNEL__ char name[16]; struct net_device *dev; void *private; struct sk_buff *tx_skb; union { /* This union has all the protocol-specific structures */ struct ppp_device pppdev; }ifu;#ifdef CONFIG_PC300_MLPPP void *cpc_tty; /* information to PC300 TTY driver */#endif#endif /* __KERNEL__ */}pc300dev_t;typedef struct pc300hw { int type; /* RSV, X21, etc. */ int bus; /* Bus (PCI, PMC, etc.) */ int nchan; /* number of channels */ int irq; /* interrupt request level */ uclong clock; /* Board clock */ ucchar cpld_id; /* CPLD ID (TE only) */ ucshort cpld_reg1; /* CPLD reg 1 (TE only) */ ucshort cpld_reg2; /* CPLD reg 2 (TE only) */ ucshort gpioc_reg; /* PLX GPIOC reg */ ucshort intctl_reg; /* PLX Int Ctrl/Status reg */ uclong iophys; /* PLX registers I/O base */ uclong iosize; /* PLX registers I/O size */ uclong plxphys; /* PLX registers MMIO base (physical) */ uclong plxbase; /* PLX registers MMIO base (virtual) */ uclong plxsize; /* PLX registers MMIO size */ uclong scaphys; /* SCA registers MMIO base (physical) */ uclong scabase; /* SCA registers MMIO base (virtual) */ uclong scasize; /* SCA registers MMIO size */ uclong ramphys; /* On-board RAM MMIO base (physical) */ uclong rambase; /* On-board RAM MMIO base (virtual) */ uclong alloc_ramsize; /* RAM MMIO size allocated by the PCI bridge */ uclong ramsize; /* On-board RAM MMIO size */ uclong falcphys; /* FALC registers MMIO base (physical) */ uclong falcbase; /* FALC registers MMIO base (virtual) */ uclong falcsize; /* FALC registers MMIO size */} pc300hw_t;typedef struct pc300chconf { sync_serial_settings phys_settings; /* Clock type/rate (in bps), loopback mode */ raw_hdlc_proto proto_settings; /* Encoding, parity (CRC) */ uclong media; /* HW media (RS232, V.35, etc.) */ uclong proto; /* Protocol (PPP, X.25, etc.) */ ucchar monitor; /* Monitor mode (0 = off, !0 = on) */ /* TE-specific parameters */ ucchar lcode; /* Line Code (AMI, B8ZS, etc.) */ ucchar fr_mode; /* Frame Mode (ESF, D4, etc.) */ ucchar lbo; /* Line Build Out */ ucchar rx_sens; /* Rx Sensitivity (long- or short-haul) */ uclong tslot_bitmap; /* bit[i]=1 => timeslot _i_ is active */} pc300chconf_t;typedef struct pc300ch { struct pc300 *card; int channel; pc300dev_t d; pc300chconf_t conf; ucchar tx_first_bd; /* First TX DMA block descr. w/ data */ ucchar tx_next_bd; /* Next free TX DMA block descriptor */ ucchar rx_first_bd; /* First free RX DMA block descriptor */ ucchar rx_last_bd; /* Last free RX DMA block descriptor */ ucchar nfree_tx_bd; /* Number of free TX DMA block descriptors */ falc_t falc; /* FALC structure (TE only) */} pc300ch_t;typedef struct pc300 { pc300hw_t hw; /* hardware config. */ pc300ch_t chan[PC300_MAXCHAN];#ifdef __KERNEL__ spinlock_t card_lock;#endif /* __KERNEL__ */} pc300_t;typedef struct pc300conf { pc300hw_t hw; pc300chconf_t conf;} pc300conf_t;/* DEV ioctl() commands */#define N_SPPP_IOCTLS 2enum pc300_ioctl_cmds { SIOCCPCRESERVED = (SIOCDEVPRIVATE + N_SPPP_IOCTLS), SIOCGPC300CONF, SIOCSPC300CONF, SIOCGPC300STATUS, SIOCGPC300FALCSTATUS, SIOCGPC300UTILSTATS, SIOCGPC300UTILSTATUS, SIOCSPC300TRACE, SIOCSPC300LOOPBACK, SIOCSPC300PATTERNTEST,};/* Loopback types - PC300/TE boards */enum pc300_loopback_cmds { PC300LOCLOOP = 1, PC300REMLOOP, PC300PAYLOADLOOP, PC300GENLOOPUP, PC300GENLOOPDOWN,};/* Control Constant Definitions */#define PC300_RSV 0x01#define PC300_X21 0x02#define PC300_TE 0x03#define PC300_PCI 0x00#define PC300_PMC 0x01#define PC300_LC_AMI 0x01#define PC300_LC_B8ZS 0x02#define PC300_LC_NRZ 0x03#define PC300_LC_HDB3 0x04/* Framing (T1) */#define PC300_FR_ESF 0x01#define PC300_FR_D4 0x02#define PC300_FR_ESF_JAPAN 0x03/* Framing (E1) */#define PC300_FR_MF_CRC4 0x04#define PC300_FR_MF_NON_CRC4 0x05#define PC300_FR_UNFRAMED 0x06#define PC300_LBO_0_DB 0x00#define PC300_LBO_7_5_DB 0x01#define PC300_LBO_15_DB 0x02#define PC300_LBO_22_5_DB 0x03#define PC300_RX_SENS_SH 0x01#define PC300_RX_SENS_LH 0x02#define PC300_TX_TIMEOUT (2*HZ)#define PC300_TX_QUEUE_LEN 100#define PC300_DEF_MTU 1600#ifdef __KERNEL__/* Function Prototypes */int dma_buf_write(pc300_t *, int, ucchar *, int);int dma_buf_read(pc300_t *, int, struct sk_buff *);void tx_dma_start(pc300_t *, int);void rx_dma_start(pc300_t *, int);void tx_dma_stop(pc300_t *, int);void rx_dma_stop(pc300_t *, int);int cpc_queue_xmit(struct sk_buff *, struct net_device *);void cpc_net_rx(struct net_device *);void cpc_sca_status(pc300_t *, int);int cpc_change_mtu(struct net_device *, int);int cpc_ioctl(struct net_device *, struct ifreq *, int);int ch_config(pc300dev_t *);int rx_config(pc300dev_t *);int tx_config(pc300dev_t *);void cpc_opench(pc300dev_t *);void cpc_closech(pc300dev_t *);int cpc_open(struct net_device *dev);int cpc_close(struct net_device *dev);int cpc_set_media(hdlc_device *, int);#endif /* __KERNEL__ */#endif /* _PC300_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -