Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ft1000_usb.h
Go to the documentation of this file.
1 #ifndef _FT1000_USB_H_
2 #define _FT1000_USB_H_
3 
4 #include "../ft1000.h"
5 #include "ft1000_ioctl.h"
6 #define FT1000_DRV_VER 0x01010403
7 
8 #define MAX_NUM_APP 6
9 #define MAX_MSG_LIMIT 200
10 #define NUM_OF_FREE_BUFFERS 1500
11 
12 #define PSEUDOSZ 16
13 
14 #define SUCCESS 0x00
15 
17  u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */
18  u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */
19  u32 nTxMsgReject; /* DPRAM msg rejected due to DSP doorbell set */
20  u32 nRxMsgMiss; /* DPRAM msg dropped due to overflow */
21  struct fown_struct *fileobject;/* Application's file object */
22  u16 app_id; /* Application id */
24  int NumOfMsg; /* number of messages queued up */
26  struct list_head app_sqlist; /* link list of msgs for applicaton on slow queue */
27 } __packed;
28 
29 #define DEBUG(args...) printk(KERN_INFO args)
30 
31 #define FALSE 0
32 #define TRUE 1
33 
34 #define STATUS_SUCCESS 0
35 #define STATUS_FAILURE 0x1001
36 
37 #define FT1000_STATUS_CLOSING 0x01
38 
39 #define DSPBCMSGID 0x10
40 
41 /* Electrabuzz specific DPRAM mapping */
42 /* this is used by ft1000_usb driver - isn't that a bug? */
43 #undef FT1000_DPRAM_RX_BASE
44 #define FT1000_DPRAM_RX_BASE 0x1800 /* RX AREA (SlowQ) */
45 
46 /* MEMORY MAP FOR MAGNEMITE */
47 /* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */
48 #undef FT1000_MAG_DSP_LED_INDX
49 #define FT1000_MAG_DSP_LED_INDX 0x1 /* dsp led status for PAD device */
50 #undef FT1000_MAG_DSP_CON_STATE_INDX
51 #define FT1000_MAG_DSP_CON_STATE_INDX 0x0 /* DSP Connection Status Info */
52 
53 /* Maximum times trying to get ASIC out of reset */
54 #define MAX_ASIC_RESET_CNT 20
55 
56 #define MAX_BUF_SIZE 4096
57 
58 struct ft1000_device {
59  struct usb_device *dev;
60  struct net_device *net;
61 
63 
64  struct urb *rx_urb;
65  struct urb *tx_urb;
66 
69 
72 } __packed;
73 
75  struct list_head list;
76  struct dentry *dent;
77  struct dentry *file;
79 };
80 
81 struct ft1000_info {
83  struct net_device_stats stats;
84 
86 
87  unsigned char fcodeldr;
88  unsigned char bootmode;
89  unsigned char usbboot;
90  unsigned short dspalive;
95  u16 DrvErrNum;
96  u16 AsicID;
99  int CardReady;
104  int registered;
105  int mediastate;
106  u8 squeseqnum; /* sequence number on slow queue */
109  u16 fifo_cnt;
110  u8 DspVer[DSPVERSZ]; /* DSP version number */
111  u8 HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
112  u8 Sku[SKUSZ]; /* SKU */
113  u8 eui64[EUISZ]; /* EUI64 */
114  time_t ConTm; /* Connection Time */
118  u16 DSP_TIME[4];
119  u16 LedStat;
120  u16 ConStat;
122  struct list_head prov_list;
123  int appcnt;
127  int (*ft1000_reset)(struct net_device *dev);
129  union {
132  } DSPSess;
133  unsigned short tempbuf[32];
134  char netdevname[IFNAMSIZ];
136 };
137 
138 
139 struct dpram_blk {
140  struct list_head list;
142 } __packed;
143 
144 int ft1000_read_register(struct ft1000_device *ft1000dev,
145  u16 *Data, u16 nRegIndx);
146 int ft1000_write_register(struct ft1000_device *ft1000dev,
147  u16 value, u16 nRegIndx);
148 int ft1000_read_dpram32(struct ft1000_device *ft1000dev,
149  u16 indx, u8 *buffer, u16 cnt);
150 int ft1000_write_dpram32(struct ft1000_device *ft1000dev,
151  u16 indx, u8 *buffer, u16 cnt);
152 int ft1000_read_dpram16(struct ft1000_device *ft1000dev,
153  u16 indx, u8 *buffer, u8 highlow);
154 int ft1000_write_dpram16(struct ft1000_device *ft1000dev,
155  u16 indx, u16 value, u8 highlow);
156 int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev,
157  u16 indx, u8 *buffer);
158 int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev,
159  u16 indx, u8 *buffer);
160 
161 extern void *pFileStart;
162 extern size_t FileLength;
163 extern int numofmsgbuf;
164 
165 int ft1000_close(struct net_device *dev);
166 u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart,
167  u32 FileLength);
168 
169 extern struct list_head freercvpool;
170 
171 extern spinlock_t free_buff_lock; /* lock to arbitrate free buffer list for receive command data */
172 
173 int ft1000_create_dev(struct ft1000_device *dev);
174 void ft1000_destroy_dev(struct net_device *dev);
175 extern void card_send_command(struct ft1000_device *ft1000dev,
176  void *ptempbuffer, int size);
177 
178 struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
179 void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
180 
181 int dsp_reload(struct ft1000_device *ft1000dev);
182 int init_ft1000_netdev(struct ft1000_device *ft1000dev);
183 struct usb_interface;
184 int reg_ft1000_netdev(struct ft1000_device *ft1000dev,
185  struct usb_interface *intf);
186 int ft1000_poll(void *dev_id);
187 
188 int ft1000_init_proc(struct net_device *dev);
189 void ft1000_cleanup_proc(struct ft1000_info *info);
190 
191 
192 
193 #endif