⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wavelan.p.h

📁 GNU Mach 微内核源代码, 基于美国卡内基美隆大学的 Mach 研究项目
💻 H
📖 第 1 页 / 共 2 页
字号:
#define DEBUG_INTERRUPT_ERROR	/* problems */#undef DEBUG_CONFIG_TRACE	/* Trace the config functions */#undef DEBUG_CONFIG_INFO	/* What's going on... */#define DEBUG_CONFIG_ERRORS	/* Errors on configuration */#undef DEBUG_TX_TRACE		/* Transmission calls */#undef DEBUG_TX_INFO		/* Header of the transmited packet */#define DEBUG_TX_ERROR		/* unexpected conditions */#undef DEBUG_RX_TRACE		/* Transmission calls */#undef DEBUG_RX_INFO		/* Header of the transmited packet */#define DEBUG_RX_ERROR		/* unexpected conditions */#undef DEBUG_PACKET_DUMP	16	/* Dump packet on the screen */#undef DEBUG_IOCTL_TRACE	/* Misc call by Linux */#undef DEBUG_IOCTL_INFO		/* Various debug info */#define DEBUG_IOCTL_ERROR	/* What's going wrong */#define DEBUG_BASIC_SHOW	/* Show basic startup info */#undef DEBUG_VERSION_SHOW	/* Print version info */#undef DEBUG_PSA_SHOW		/* Dump psa to screen */#undef DEBUG_MMC_SHOW		/* Dump mmc to screen */#undef DEBUG_SHOW_UNUSED	/* Show also unused fields */#undef DEBUG_I82586_SHOW	/* Show i82586 status */#undef DEBUG_DEVICE_SHOW	/* Show device parameters *//* Options : */#define USE_PSA_CONFIG		/* Use info from the PSA */#define IGNORE_NORMAL_XMIT_ERRS	/* Don't bother with normal conditions */#undef STRUCT_CHECK		/* Verify padding of structures */#undef PSA_CRC			/* Check CRC in PSA */#undef OLDIES			/* Old code (to redo) */#undef RECORD_SNR		/* To redo */#undef EEPROM_IS_PROTECTED	/* Doesn't seem to be necessary */#define MULTICAST_AVOID		/* Avoid extra multicast (I'm sceptical) */#ifdef WIRELESS_EXT	/* If wireless extension exist in the kernel *//* Warning : these stuff will slow down the driver... */#define WIRELESS_SPY		/* Enable spying addresses */#undef HISTOGRAM		/* Enable histogram of sig level... */#endif/************************ CONSTANTS & MACROS ************************/#ifdef DEBUG_VERSION_SHOWstatic const char	*version	= "wavelan.c : v16 (wireless extensions) 17/4/97\n";#endif/* Watchdog temporisation */#define	WATCHDOG_JIFFIES	32	/* TODO: express in HZ. *//* Macro to get the number of elements in an array */#define	NELS(a)				(sizeof(a) / sizeof(a[0]))/* ------------------------ PRIVATE IOCTL ------------------------ */#define SIOCSIPQTHR	SIOCDEVPRIVATE		/* Set quality threshold */#define SIOCGIPQTHR	SIOCDEVPRIVATE + 1	/* Get quality threshold */#define SIOCSIPLTHR	SIOCDEVPRIVATE + 2	/* Set level threshold */#define SIOCGIPLTHR	SIOCDEVPRIVATE + 3	/* Get level threshold */#define SIOCSIPHISTO	SIOCDEVPRIVATE + 6	/* Set histogram ranges */#define SIOCGIPHISTO	SIOCDEVPRIVATE + 7	/* Get histogram values *//* ----------------------- VERSION SUPPORT ----------------------- *//* This ugly patch is needed to cope with old version of the kernel */#ifndef copy_from_user#define copy_from_user	memcpy_fromfs#define copy_to_user	memcpy_tofs#endif/****************************** TYPES ******************************//* Shortcuts */typedef struct device		device;typedef struct enet_statistics	en_stats;typedef struct iw_statistics	iw_stats;typedef struct iw_quality	iw_qual;typedef struct iw_freq		iw_freq;typedef struct net_local	net_local;typedef struct timer_list	timer_list;/* Basic types */typedef u_char		mac_addr[WAVELAN_ADDR_SIZE];	/* Hardware address *//* * Static specific data for the interface. * * For each network interface, Linux keep data in two structure. "device" * keep the generic data (same format for everybody) and "net_local" keep * the additional specific data. * Note that some of this specific data is in fact generic (en_stats, for * example). */struct net_local{  net_local *	next;		/* Linked list of the devices */  device *	dev;		/* Reverse link... */  en_stats	stats;		/* Ethernet interface statistics */  int		nresets;	/* Number of hw resets */  u_char	reconfig_82586;	/* Need to reconfigure the controler */  u_char	promiscuous;	/* Promiscuous mode */  int		mc_count;	/* Number of multicast addresses */  timer_list	watchdog;	/* To avoid blocking state */  u_short	hacr;		/* Current host interface state */  int		tx_n_in_use;  u_short	rx_head;  u_short	rx_last;  u_short	tx_first_free;  u_short	tx_first_in_use;#ifdef WIRELESS_EXT  iw_stats	wstats;		/* Wireless specific stats */#endif#ifdef WIRELESS_SPY  int		spy_number;		/* Number of addresses to spy */  mac_addr	spy_address[IW_MAX_SPY];	/* The addresses to spy */  iw_qual	spy_stat[IW_MAX_SPY];		/* Statistics gathered */#endif	/* WIRELESS_SPY */#ifdef HISTOGRAM  int		his_number;		/* Number of intervals */  u_char	his_range[16];		/* Boundaries of interval ]n-1; n] */  u_long	his_sum[16];		/* Sum in interval */#endif	/* HISTOGRAM */};/**************************** PROTOTYPES ****************************//* ----------------------- MISC SUBROUTINES ------------------------ */static inline unsigned long	/* flags */	wv_splhi(void);		/* Disable interrupts */static inline void	wv_splx(unsigned long);	/* ReEnable interrupts : flags */static u_char	wv_irq_to_psa(int);static int	wv_psa_to_irq(u_char);/* ------------------- HOST ADAPTER SUBROUTINES ------------------- */static inline u_short		/* data */	hasr_read(u_long);	/* Read the host interface : base address */static inline void	hacr_write(u_long,	/* Write to host interface : base address */		   u_short),	/* data */	hacr_write_slow(u_long,		   u_short),	set_chan_attn(u_long,	/* ioaddr */		      u_short),	/* hacr */	wv_hacr_reset(u_long),	/* ioaddr */	wv_16_off(u_long,	/* ioaddr */		  u_short),	/* hacr */	wv_16_on(u_long,	/* ioaddr */		 u_short),	/* hacr */	wv_ints_off(device *),	wv_ints_on(device *);/* ----------------- MODEM MANAGEMENT SUBROUTINES ----------------- */static void	psa_read(u_long,	/* Read the Parameter Storage Area */		 u_short,	/* hacr */		 int,		/* offset in PSA */		 u_char *,	/* buffer to fill */		 int),		/* size to read */	psa_write(u_long, 	/* Write to the PSA */		  u_short,	/* hacr */		  int,		/* Offset in psa */		  u_char *,	/* Buffer in memory */		  int);		/* Length of buffer */static inline void	mmc_out(u_long,		/* Write 1 byte to the Modem Manag Control */		u_short,		u_char),	mmc_write(u_long,	/* Write n bytes to the MMC */		  u_char,		  u_char *,		  int);static inline u_char		/* Read 1 byte from the MMC */	mmc_in(u_long,	       u_short);static inline void	mmc_read(u_long,	/* Read n bytes from the MMC */		 u_char,		 u_char *,		 int),	fee_wait(u_long,	/* Wait for frequency EEprom : base address */		 int,		/* Base delay to wait for */		 int);		/* Number of time to wait */static void	fee_read(u_long,	/* Read the frequency EEprom : base address */		 u_short,	/* destination offset */		 u_short *,	/* data buffer */		 int);		/* number of registers *//* ---------------------- I82586 SUBROUTINES ----------------------- */static /*inline*/ void	obram_read(u_long,	/* ioaddr */		   u_short,	/* o */		   u_char *,	/* b */		   int);	/* n */static inline void	obram_write(u_long,	/* ioaddr */		    u_short,	/* o */		    u_char *,	/* b */		    int);	/* n */static void	wv_ack(device *);static inline int	wv_synchronous_cmd(device *,			   const char *),	wv_config_complete(device *,			   u_long,			   net_local *);static int	wv_complete(device *,		    u_long,		    net_local *);static inline void	wv_82586_reconfig(device *);/* ------------------- DEBUG & INFO SUBROUTINES ------------------- */#ifdef DEBUG_I82586_SHOWstatic void	wv_scb_show(unsigned short);#endifstatic inline void	wv_init_info(device *);	/* display startup info *//* ------------------- IOCTL, STATS & RECONFIG ------------------- */static en_stats	*	wavelan_get_stats(device *);	/* Give stats /proc/net/dev */static void	wavelan_set_multicast_list(device *);/* ----------------------- PACKET RECEPTION ----------------------- */static inline void	wv_packet_read(device *,	/* Read a packet from a frame */		       u_short,		       int),	wv_receive(device *);	/* Read all packets waiting *//* --------------------- PACKET TRANSMISSION --------------------- */static inline void	wv_packet_write(device *,	/* Write a packet to the Tx buffer */			void *,			short);static int	wavelan_packet_xmit(struct sk_buff *,	/* Send a packet */			    device *);/* -------------------- HARDWARE CONFIGURATION -------------------- */static inline int	wv_mmc_init(device *),		/* Initialize the modem */	wv_ru_start(device *),		/* Start the i82586 receiver unit */	wv_cu_start(device *),		/* Start the i82586 command unit */	wv_82586_start(device *);	/* Start the i82586 */static void	wv_82586_config(device *);	/* Configure the i82586 */static inline void	wv_82586_stop(device *);static int	wv_hw_reset(device *),		/* Reset the wavelan hardware */	wv_check_ioaddr(u_long,		/* ioaddr */			u_char *);	/* mac address (read) *//* ---------------------- INTERRUPT HANDLING ---------------------- */static void	wavelan_interrupt(int,		/* Interrupt handler */			  void *,			  struct pt_regs *);static void	wavelan_watchdog(u_long);	/* Transmission watchdog *//* ------------------- CONFIGURATION CALLBACKS ------------------- */static int	wavelan_open(device *),		/* Open the device */	wavelan_close(device *),	/* Close the device */	wavelan_config(device *);	/* Configure one device */extern int	wavelan_probe(device *);	/* See Space.c *//**************************** VARIABLES ****************************//* * This is the root of the linked list of wavelan drivers * It is use to verify that we don't reuse the same base address * for two differents drivers and to make the cleanup when * removing the module. */static net_local *	wavelan_list	= (net_local *) NULL;/* * This table is used to translate the psa value to irq number * and vice versa... */static u_char	irqvals[]	={	   0,    0,    0, 0x01,	0x02, 0x04,    0, 0x08,	   0,    0, 0x10, 0x20,	0x40,    0,    0, 0x80,};/* * Table of the available i/o address (base address) for wavelan */static unsigned short	iobase[]	={#if	0  /* Leave out 0x3C0 for now -- seems to clash with some video   * controllers.   * Leave out the others too -- we will always use 0x390 and leave   * 0x300 for the Ethernet device.   * Jean II : 0x3E0 is really fine as well...   */  0x300, 0x390, 0x3E0, 0x3C0#endif	/* 0 */  0x390, 0x3E0};#ifdef	MODULE/* Name of the devices (memory allocation) */static char	devname[4][IFNAMSIZ] = { "", "", "", "" };/* Parameters set by insmod */static int	io[4]	= { 0, 0, 0, 0 };static int	irq[4]	= { 0, 0, 0, 0 };static char *	name[4] = { devname[0], devname[1], devname[2], devname[3] };#endif	/* MODULE */#endif	/* WAVELAN_P_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -