/* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */ #ifndef _SCC_H #define _SCC_H #include /* selection of hardware types */ #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ #define EAGLE 0x01 /* hardware type for EAGLE card */ #define PC100 0x02 /* hardware type for PC100 card */ #define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */ #define DRSI 0x08 /* hardware type for DRSI PC*Packet card */ #define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */ /* DEV ioctl() commands */ enum SCC_ioctl_cmds { SIOCSCCRESERVED = SIOCDEVPRIVATE, SIOCSCCCFG, SIOCSCCINI, SIOCSCCCHANINI, SIOCSCCSMEM, SIOCSCCGMODEM, SIOCSCCSMODEM, SIOCSCCGSTAT, SIOCSCCCAL }; /* magic number */ #define SCC_MAGIC 0x8530 /* ;-) */ /* misc. parameters */ #define TIMER_OFF 65535U /* to switch off timers */ /* Tx/Rx clock sources */ typedef enum { CLOCK_SOURCE_RTxC, /* use RTxC pin */ CLOCK_SOURCE_TRxC, /* use TRxC pin */ CLOCK_SOURCE_BRG, /* use baud rate generator */ CLOCK_SOURCE_DPLL /* use DPLL */ } Scc_clock_sources; typedef enum { TRXCP_MODE_IN, /* TRxC pin is input */ TRXCP_MODE_TXC_OUT, /* TRxC bears Tx clock */ TRXCP_MODE_BRG_OUT, /* TRxC bears BRG output */ TRXCP_MODE_DPLL_OUT /* TRxC bears DPLL */ } Scc_trxc_pin_modes; /* Tx state */ typedef enum { TXS_IDLE, /* Transmitter off, no data pending */ TXS_TXDELAY, /* waiting for transmitter keyed up */ TXS_ACTIVE, /* Transmitter on, sending data */ TXS_TAIL, /* Transmition tail time */ } Scc_tx_states; typedef unsigned long io_port; /* type definition for an 'io port address' */ /* SCC statistical information */ struct scc_stat { long rxints; /* Receiver interrupts */ long txints; /* Transmitter interrupts */ long exints; /* External/status interrupts */ long spints; /* Special receiver interrupts */ long txframes; /* Packets sent */ long rxframes; /* Number of Frames Actually Received */ long rxerrs; /* CRC Errors */ long txerrs; /* KISS errors */ unsigned int nospace; /* "Out of buffers" */ unsigned int rx_over; /* Receiver Overruns */ unsigned int tx_under; /* Transmitter Underruns */ unsigned int tx_state; /* Transmitter state */ unsigned int bufsize; /* used buffersize */ }; struct scc_modem { int rx_speed; /* Line speed, bps */ int tx_speed; int rx_clock_source; /* see CLOCK_sources above */ int tx_clock_source; /* dito */ int trxc_pin_mode; /* see TRXCP_modes above */ int nrz_mode; /* 0 = NRZ, 1 = NRZI */ int tx_delay; /* tx delay in msec */ int tx_tail; /* tx tail time in msec */ int fullduplex; /* Duplex mode: 0 = "halfduplex", 1 = "fullduplex" */ int trx_feedback; /* TRX feeds transmit signal back to RxD */ int tx_inhibit; /* Transmit is not allowed when set */ int softdcd; /* Use DPLL instead of DCD pin for carrier detect */ }; #ifdef __KERNEL__ enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */ /* Vector masks in RR2B */ #define VECTOR_MASK 0x06 #define TXINT 0x00 #define EXINT 0x02 #define RXINT 0x04 #define SPINT 0x06 /* SCC channel structure */ struct scc_channel { int init; /* channel exists? */ struct net_device *dev; /* link to device control structure */ struct net_device_stats dev_stat;/* device statistics */ struct ax25_dev ax25dev; char * proc_dev_name; /* points to dev->name or NULL */ char brand; /* manufacturer of the board */ long clock; /* used clock */ io_port ctrl; /* I/O address of CONTROL register */ io_port data; /* I/O address of DATA register */ io_port special_port; /* I/O address of special function port */ int irq; /* Number of Interrupt */ char special_option; char enhanced; /* Enhanced SCC support */ unsigned char wreg[16]; /* Copy of last written value in WRx */ unsigned char status; /* Copy of R0 at last external interrupt */ unsigned char dcd; /* DCD status */ struct scc_modem modem; /* modem information */ struct scc_stat stat; /* statistical information */ struct { spinlock_t hwaccess; /* hardware access */ spinlock_t timer; /* timer functions */ spinlock_t kick_tx; /* start of transmission */ } spinlocks; struct { ctl_table channel[6]; /* /.../chip_/channel_/ */ ctl_table modem[13]; /* /.../channel_/modem/ */ ctl_table stats[1]; /* /.../channel_/stats/ */ } proc_tables; struct sk_buff *rx_buff; /* pointer to frame currently received */ struct sk_buff *tx_buff; /* pointer to frame currently transmitted */ struct sk_buff *tx_new; /* next transmit buffer */ struct timer_list tx_timer; /* Tx delay & tail timer */ }; int scc_init(void); #endif /* defined(__KERNEL__) */ #endif /* defined(_SCC_H) */