diff options
Diffstat (limited to 'include/linux/scc.h')
-rw-r--r-- | include/linux/scc.h | 198 |
1 files changed, 55 insertions, 143 deletions
diff --git a/include/linux/scc.h b/include/linux/scc.h index a896704e6..1ec441746 100644 --- a/include/linux/scc.h +++ b/include/linux/scc.h @@ -8,7 +8,7 @@ /* selection of hardware types */ #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */ -#define EAGLE 0x01 /* hardware type for EAGLE card */ +#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 */ @@ -22,87 +22,45 @@ enum SCC_ioctl_cmds { SIOCSCCINI, SIOCSCCCHANINI, SIOCSCCSMEM, - SIOCSCCGKISS, - SIOCSCCSKISS, + SIOCSCCGMODEM, + SIOCSCCSMODEM, SIOCSCCGSTAT, SIOCSCCCAL }; -/* Device parameter control (from WAMPES) */ - -enum L1_params { - PARAM_DATA, - PARAM_TXDELAY, - PARAM_PERSIST, - PARAM_SLOTTIME, - PARAM_TXTAIL, - PARAM_FULLDUP, - PARAM_SOFTDCD, /* was: PARAM_HW */ - PARAM_MUTE, /* ??? */ - PARAM_DTR, - PARAM_RTS, - PARAM_SPEED, - PARAM_ENDDELAY, /* ??? */ - PARAM_GROUP, - PARAM_IDLE, - PARAM_MIN, - PARAM_MAXKEY, - PARAM_WAIT, - PARAM_MAXDEFER, - PARAM_TX, - PARAM_HWEVENT = 31, - PARAM_RETURN = 255 /* reset kiss mode */ -}; - -/* fulldup parameter */ +/* magic number */ -enum FULLDUP_modes { - KISS_DUPLEX_HALF, /* normal CSMA operation */ - KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */ - KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */ - KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */ -}; +#define SCC_MAGIC 0x8530 /* ;-) */ /* misc. parameters */ #define TIMER_OFF 65535U /* to switch off timers */ -#define NO_SUCH_PARAM 65534U /* param not implemented */ - -/* HWEVENT parameter */ -enum HWEVENT_opts { - HWEV_DCD_ON, - HWEV_DCD_OFF, - HWEV_ALL_SENT -}; - -/* channel grouping */ +/* Tx/Rx clock sources */ -#define RXGROUP 0100 /* if set, only tx when all channels clear */ -#define TXGROUP 0200 /* if set, don't transmit simultaneously */ +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; -/* Tx/Rx 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 */ -enum CLOCK_sources { - CLK_DPLL, /* normal halfduplex operation */ - CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */ - CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */ - /* modems without clock regeneration */ - CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */ - /* MODEMs without clock recovery */ -}; +} Scc_trxc_pin_modes; /* Tx state */ -enum TX_state { +typedef enum { TXS_IDLE, /* Transmitter off, no data pending */ - TXS_BUSY, /* waiting for permission to send / tailtime */ + TXS_TXDELAY, /* waiting for transmitter keyed up */ TXS_ACTIVE, /* Transmitter on, sending data */ - TXS_NEWFRAME, /* reset CRC and send (next) frame */ - TXS_IDLE2, /* Transmitter on, no data pending */ - TXS_WAIT, /* Waiting for Mintime to expire */ - TXS_TIMEOUT /* We had a transmission timeout */ -}; + TXS_TAIL, /* Transmition tail time */ +} Scc_tx_states; typedef unsigned long io_port; /* type definition for an 'io port address' */ @@ -124,50 +82,22 @@ struct scc_stat { unsigned int tx_under; /* Transmitter Underruns */ unsigned int tx_state; /* Transmitter state */ - int tx_queued; /* tx frames enqueued */ - - unsigned int maxqueue; /* allocated tx_buffers */ unsigned int bufsize; /* used buffersize */ }; struct scc_modem { - long speed; /* Line speed, bps */ - char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */ - char nrz; /* NRZ instead of NRZI */ -}; - -struct scc_kiss_cmd { - int command; /* one of the KISS-Commands defined above */ - unsigned param; /* KISS-Param */ -}; - -struct scc_hw_config { - io_port data_a; /* data port channel A */ - io_port ctrl_a; /* control port channel A */ - io_port data_b; /* data port channel B */ - io_port ctrl_b; /* control port channel B */ - io_port vector_latch; /* INTACK-Latch (#) */ - io_port special; /* special function port */ - - int irq; /* irq */ - long clock; /* clock */ - char option; /* command for function port */ - - char brand; /* hardware type */ - char escc; /* use ext. features of a 8580/85180/85280 */ -}; - -/* (#) only one INTACK latch allowed. */ - - -struct scc_mem_config { - unsigned int dummy; - unsigned int bufsize; -}; - -struct scc_calibrate { - unsigned int time; - unsigned char pattern; + 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__ @@ -182,71 +112,53 @@ enum {TX_OFF, TX_ON}; /* command for scc_key_trx() */ #define RXINT 0x04 #define SPINT 0x06 -#ifdef CONFIG_SCC_DELAY -#define Inb(port) inb_p(port) -#define Outb(port, val) outb_p(val, port) -#else -#define Inb(port) inb(port) -#define Outb(port, val) outb(val, port) -#endif - -/* SCC channel control structure for KISS */ - -struct scc_kiss { - unsigned char txdelay; /* Transmit Delay 10 ms/cnt */ - unsigned char persist; /* Persistence (0-255) as a % */ - unsigned char slottime; /* Delay to wait on persistence hit */ - unsigned char tailtime; /* Delay after last byte written */ - unsigned char fulldup; /* Full Duplex mode 0=CSMA 1=DUP 2=ALWAYS KEYED */ - unsigned char waittime; /* Waittime before any transmit attempt */ - unsigned int maxkeyup; /* Maximum time to transmit (seconds) */ - unsigned char mintime; /* Minimal offtime after MAXKEYUP timeout (seconds) */ - unsigned int idletime; /* Maximum idle time in ALWAYS KEYED mode (seconds) */ - unsigned int maxdefer; /* Timer for CSMA channel busy limit */ - unsigned char tx_inhibit; /* Transmit is not allowed when set */ - unsigned char group; /* Group ID for AX.25 TX interlocking */ - unsigned char mode; /* 'normal' or 'hwctrl' mode (unused) */ - unsigned char softdcd; /* Use DPLL instead of DCD pin for carrier detect */ -}; - - /* SCC channel structure */ struct scc_channel { - int magic; /* magic word */ - 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; /* I/O address of special function port */ + io_port special_port; /* I/O address of special function port */ int irq; /* Number of Interrupt */ - char option; + 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_kiss kiss; /* control structure for KISS params */ - struct scc_stat stat; /* statistical information */ 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_<n>/channel_<k>/ */ + ctl_table modem[13]; /* /.../channel_<k>/modem/ */ + ctl_table stats[1]; /* /.../channel_<k>/stats/ */ + } proc_tables; + - struct sk_buff_head tx_queue; /* next tx buffer */ struct sk_buff *rx_buff; /* pointer to frame currently received */ struct sk_buff *tx_buff; /* pointer to frame currently transmitted */ - - /* Timer */ - struct timer_list tx_t; /* tx timer for this channel */ - struct timer_list tx_wdog; /* tx watchdogs */ + 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) */ |