1/*---------------------------------------------------------------------------
2   FT1000 driver for Flarion Flash OFDM NIC Device
3
4   Copyright (C) 2002 Flarion Technologies, All rights reserved.
5
6   This program is free software; you can redistribute it and/or modify it
7   under the terms of the GNU General Public License as published by the Free
8   Software Foundation; either version 2 of the License, or (at your option) any
9   later version. This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12   more details. You should have received a copy of the GNU General Public
13   License along with this program; if not, write to the
14   Free Software Foundation, Inc., 59 Temple Place -
15   Suite 330, Boston, MA 02111-1307, USA.
16---------------------------------------------------------------------------
17   Description:    Common structures and defines
18---------------------------------------------------------------------------*/
19#ifndef _FT1000H_
20#define _FT1000H_
21
22#include "../ft1000.h"
23
24#define FT1000_DRV_VER 0x01010300
25
26#define FT1000_DPRAM_BASE	0x0000	/* Dual Port RAM starting offset */
27
28/* Maximum number of occurrence of pseudo header errors before resetting PC Card. */
29#define MAX_PH_ERR	300
30
31#define SUCCESS	0x00
32#define FAILURE	0x01
33
34struct ft1000_info {
35	struct net_device_stats stats;
36	u16 DrvErrNum;
37	u16 AsicID;
38	int PktIntfErr;
39	int CardReady;
40	int registered;
41	int mediastate;
42	u16 packetseqnum;
43	u8 squeseqnum;			/* sequence number on slow queue */
44	spinlock_t dpram_lock;
45	u16 fifo_cnt;
46	u8 DspVer[DSPVERSZ];		/* DSP version number */
47	u8 HwSerNum[HWSERNUMSZ];	/* Hardware Serial Number */
48	u8 Sku[SKUSZ];			/* SKU */
49	u8 eui64[EUISZ];		/* EUI64 */
50	time_t ConTm;			/* Connection Time */
51	u16 LedStat;
52	u16 ConStat;
53	u16 ProgConStat;
54	u8 ProductMode[MODESZ];
55	u8 RfCalVer[CALVERSZ];
56	u8 RfCalDate[CALDATESZ];
57	u16 DSP_TIME[4];
58	struct list_head prov_list;
59	u16 DSPInfoBlklen;
60	int (*ft1000_reset)(void *);
61	void *link;
62	u16 DSPInfoBlk[MAX_DSP_SESS_REC];
63	union {
64		u16 Rec[MAX_DSP_SESS_REC];
65		u32 MagRec[MAX_DSP_SESS_REC/2];
66	} DSPSess;
67	struct proc_dir_entry *proc_ft1000;
68	char netdevname[IFNAMSIZ];
69};
70
71struct pcmcia_device;
72struct net_device;
73extern struct net_device *init_ft1000_card(struct pcmcia_device *link,
74						void *ft1000_reset);
75extern void stop_ft1000_card(struct net_device *dev);
76extern int card_download(struct net_device *dev, const u8 *pFileStart,
77			size_t FileLength);
78extern void ft1000InitProc(struct net_device *dev);
79extern void ft1000CleanupProc(struct net_device *dev);
80
81extern u16 ft1000_read_dpram(struct net_device *dev, int offset);
82extern void card_bootload(struct net_device *dev);
83extern u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index);
84extern u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset);
85void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value);
86
87/* Read the value of a given ASIC register. */
88static inline u16 ft1000_read_reg(struct net_device *dev, u16 offset)
89{
90	return inw(dev->base_addr + offset);
91}
92
93/* Set the value of a given ASIC register. */
94static inline void ft1000_write_reg(struct net_device *dev, u16 offset, u16 value)
95{
96	outw(value, dev->base_addr + offset);
97}
98
99#endif
100