staging: ft1000-usb: Remove name comments from ft1000_usb.h.
[cascardo/linux.git] / drivers / staging / ft1000 / ft1000-usb / ft1000_usb.h
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
16 struct app_info_block {
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
23         int DspBCMsgFlag;
24         int NumOfMsg;                   // number of messages queued up
25         wait_queue_head_t wait_dpram_msg;
26         struct list_head app_sqlist;   // link list of msgs for applicaton on slow queue
27 } __attribute__((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 LARGE_TIMEOUT   5000
40
41 #define DSPBCMSGID              0x10
42
43 /* Electrabuzz specific DPRAM mapping */
44 /* this is used by ft1000_usb driver - isn't that a bug? */
45 #undef FT1000_DPRAM_RX_BASE
46 #define FT1000_DPRAM_RX_BASE    0x1800  /* RX AREA (SlowQ) */
47
48 // MEMORY MAP FOR MAGNEMITE
49 /* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */
50 #undef FT1000_MAG_DSP_LED_INDX
51 #define FT1000_MAG_DSP_LED_INDX         0x1     /* dsp led status for PAD device */
52 #undef FT1000_MAG_DSP_CON_STATE_INDX
53 #define FT1000_MAG_DSP_CON_STATE_INDX   0x0     /* DSP Connection Status Info */
54
55 // Maximum times trying to get ASIC out of reset
56 #define MAX_ASIC_RESET_CNT      20
57
58 #define MAX_BUF_SIZE            4096
59
60 struct ft1000_device
61 {
62         struct usb_device *dev;
63         struct net_device *net;
64
65         u32 status;
66
67         struct urb *rx_urb;
68         struct urb *tx_urb;
69
70         u8 tx_buf[MAX_BUF_SIZE];
71         u8 rx_buf[MAX_BUF_SIZE];
72
73         u8 bulk_in_endpointAddr;
74         u8 bulk_out_endpointAddr;
75 } __attribute__ ((packed));
76
77 struct ft1000_debug_dirs {
78         struct list_head list;
79         struct dentry *dent;
80         struct dentry *file;
81         int int_number;
82 };
83
84 struct ft1000_info {
85         struct ft1000_device *pFt1000Dev;
86         struct net_device_stats stats;
87
88         struct task_struct *pPollThread;
89
90         unsigned char fcodeldr;
91         unsigned char bootmode;
92         unsigned char usbboot;
93         unsigned short dspalive;
94         u16 ASIC_ID;
95         bool fProvComplete;
96         bool fCondResetPend;
97         bool fAppMsgPend;
98         u16 DrvErrNum;
99         u16 AsicID;
100         int DspAsicReset;
101         int DeviceCreated;
102         int CardReady;
103         int NetDevRegDone;
104         u8 CardNumber;
105         u8 DeviceName[15];
106         struct ft1000_debug_dirs nodes;
107         int registered;
108         int mediastate;
109         u8 squeseqnum;                 // sequence number on slow queue
110         spinlock_t dpram_lock;
111         spinlock_t fifo_lock;
112         u16 fifo_cnt;
113         u8 DspVer[DSPVERSZ];        // DSP version number
114         u8 HwSerNum[HWSERNUMSZ];    // Hardware Serial Number
115         u8 Sku[SKUSZ];              // SKU
116         u8 eui64[EUISZ];            // EUI64
117         time_t ConTm;               // Connection Time
118         u8 ProductMode[MODESZ];
119         u8 RfCalVer[CALVERSZ];
120         u8 RfCalDate[CALDATESZ];
121         u16 DSP_TIME[4];
122         u16 LedStat;
123         u16 ConStat;
124         u16 ProgConStat;
125         struct list_head prov_list;
126         int appcnt;
127         struct app_info_block app_info[MAX_NUM_APP];
128         u16 DSPInfoBlklen;
129         u16 DrvMsgPend;
130         int (*ft1000_reset)(struct net_device *dev);
131         u16 DSPInfoBlk[MAX_DSP_SESS_REC];
132         union {
133                 u16 Rec[MAX_DSP_SESS_REC];
134                 u32 MagRec[MAX_DSP_SESS_REC/2];
135         } DSPSess;
136         unsigned short tempbuf[32];
137         char netdevname[IFNAMSIZ];
138         struct proc_dir_entry *ft1000_proc_dir;
139 };
140
141
142 struct dpram_blk {
143         struct list_head list;
144         u16 *pbuffer;
145 } __attribute__ ((packed));
146
147 int ft1000_read_register(struct ft1000_device *ft1000dev, u16* Data, u16 nRegIndx);
148 int ft1000_write_register(struct ft1000_device *ft1000dev, u16 value, u16 nRegIndx);
149 int ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt);
150 int ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u16 cnt);
151 int ft1000_read_dpram16(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer, u8 highlow);
152 int ft1000_write_dpram16(struct ft1000_device *ft1000dev, u16 indx, u16 value, u8 highlow);
153 int fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer);
154 int fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, u16 indx, u8 *buffer);
155
156 extern void *pFileStart;
157 extern size_t FileLength;
158 extern int numofmsgbuf;
159
160 int ft1000_close (struct net_device *dev);
161 u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, u32  FileLength);
162
163 extern struct list_head freercvpool;
164 extern spinlock_t free_buff_lock;   // lock to arbitrate free buffer list for receive command data
165
166 int ft1000_create_dev(struct ft1000_device *dev);
167 void ft1000_destroy_dev(struct net_device *dev);
168 extern void card_send_command(struct ft1000_device *ft1000dev, void *ptempbuffer, int size);
169
170 struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
171 void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
172
173 int dsp_reload(struct ft1000_device *ft1000dev);
174 int init_ft1000_netdev(struct ft1000_device *ft1000dev);
175 struct usb_interface;
176 int reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *intf);
177 int ft1000_poll(void* dev_id);
178
179 int ft1000_init_proc(struct net_device *dev);
180 void ft1000_cleanup_proc(struct ft1000_info *info);
181
182
183
184 #endif