6 #include "ft1000_ioctl.h"
7 #define FT1000_DRV_VER 0x01010403
10 #define MAX_MSG_LIMIT 200
11 #define NUM_OF_FREE_BUFFERS 1500
17 struct app_info_block
{
18 u32 nTxMsg
; // DPRAM msg sent to DSP with app_id
19 u32 nRxMsg
; // DPRAM msg rcv from dsp with app_id
20 u32 nTxMsgReject
; // DPRAM msg rejected due to DSP doorbell set
21 u32 nRxMsgMiss
; // DPRAM msg dropped due to overflow
22 struct fown_struct
*fileobject
;// Application's file object
23 u16 app_id
; // Application id
25 int NumOfMsg
; // number of messages queued up
26 wait_queue_head_t wait_dpram_msg
;
27 struct list_head app_sqlist
; // link list of msgs for applicaton on slow queue
28 } __attribute__((packed
));
31 #define DEBUG(args...) printk(KERN_INFO args)
36 #define STATUS_SUCCESS 0
37 #define STATUS_FAILURE 0x1001
39 #define FT1000_STATUS_CLOSING 0x01
41 #define LARGE_TIMEOUT 5000
43 #define DSPBCMSGID 0x10
45 /* Electrabuzz specific DPRAM mapping */
46 /* this is used by ft1000_usb driver - isn't that a bug? */
47 #undef FT1000_DPRAM_RX_BASE
48 #define FT1000_DPRAM_RX_BASE 0x1800 /* RX AREA (SlowQ) */
50 // MEMORY MAP FOR MAGNEMITE
51 /* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */
52 #undef FT1000_MAG_DSP_LED_INDX
53 #define FT1000_MAG_DSP_LED_INDX 0x1 /* dsp led status for PAD device */
54 #undef FT1000_MAG_DSP_CON_STATE_INDX
55 #define FT1000_MAG_DSP_CON_STATE_INDX 0x0 /* DSP Connection Status Info */
57 // Maximum times trying to get ASIC out of reset
58 #define MAX_ASIC_RESET_CNT 20
60 #define MAX_BUF_SIZE 4096
64 struct usb_device
*dev
;
65 struct net_device
*net
;
72 u8 tx_buf
[MAX_BUF_SIZE
];
73 u8 rx_buf
[MAX_BUF_SIZE
];
75 u8 bulk_in_endpointAddr
;
76 u8 bulk_out_endpointAddr
;
77 } __attribute__ ((packed
));
79 struct ft1000_debug_dirs
{
80 struct list_head list
;
87 struct ft1000_device
*pFt1000Dev
;
88 struct net_device_stats stats
;
90 struct task_struct
*pPollThread
;
92 unsigned char fcodeldr
;
93 unsigned char bootmode
;
94 unsigned char usbboot
;
95 unsigned short dspalive
;
108 struct ft1000_debug_dirs nodes
;
111 u8 squeseqnum
; // sequence number on slow queue
112 spinlock_t dpram_lock
;
113 spinlock_t fifo_lock
;
115 u8 DspVer
[DSPVERSZ
]; // DSP version number
116 u8 HwSerNum
[HWSERNUMSZ
]; // Hardware Serial Number
117 u8 Sku
[SKUSZ
]; // SKU
118 u8 eui64
[EUISZ
]; // EUI64
119 time_t ConTm
; // Connection Time
120 u8 ProductMode
[MODESZ
];
121 u8 RfCalVer
[CALVERSZ
];
122 u8 RfCalDate
[CALDATESZ
];
124 u16 LedStat
; //mbelian
125 u16 ConStat
; //mbelian
127 struct list_head prov_list
;
129 struct app_info_block app_info
[MAX_NUM_APP
];
132 int (*ft1000_reset
)(struct net_device
*dev
);
133 u16 DSPInfoBlk
[MAX_DSP_SESS_REC
];
135 u16 Rec
[MAX_DSP_SESS_REC
];
136 u32 MagRec
[MAX_DSP_SESS_REC
/2];
138 unsigned short tempbuf
[32];
139 char netdevname
[IFNAMSIZ
];
140 struct proc_dir_entry
*ft1000_proc_dir
; //mbelian
145 struct list_head list
;
147 } __attribute__ ((packed
));
149 int ft1000_read_register(struct ft1000_device
*ft1000dev
, u16
* Data
, u16 nRegIndx
);
150 int ft1000_write_register(struct ft1000_device
*ft1000dev
, u16 value
, u16 nRegIndx
);
151 int ft1000_read_dpram32(struct ft1000_device
*ft1000dev
, u16 indx
, u8
*buffer
, u16 cnt
);
152 int ft1000_write_dpram32(struct ft1000_device
*ft1000dev
, u16 indx
, u8
*buffer
, u16 cnt
);
153 int ft1000_read_dpram16(struct ft1000_device
*ft1000dev
, u16 indx
, u8
*buffer
, u8 highlow
);
154 int ft1000_write_dpram16(struct ft1000_device
*ft1000dev
, u16 indx
, u16 value
, u8 highlow
);
155 int fix_ft1000_read_dpram32(struct ft1000_device
*ft1000dev
, u16 indx
, u8
*buffer
);
156 int fix_ft1000_write_dpram32(struct ft1000_device
*ft1000dev
, u16 indx
, u8
*buffer
);
158 extern void *pFileStart
;
159 extern size_t FileLength
;
160 extern int numofmsgbuf
;
162 int ft1000_close (struct net_device
*dev
);
163 u16
scram_dnldr(struct ft1000_device
*ft1000dev
, void *pFileStart
, u32 FileLength
);
165 extern struct list_head freercvpool
;
166 extern spinlock_t free_buff_lock
; // lock to arbitrate free buffer list for receive command data
168 int ft1000_create_dev(struct ft1000_device
*dev
);
169 void ft1000_destroy_dev(struct net_device
*dev
);
170 extern void card_send_command(struct ft1000_device
*ft1000dev
, void *ptempbuffer
, int size
);
172 struct dpram_blk
*ft1000_get_buffer(struct list_head
*bufflist
);
173 void ft1000_free_buffer(struct dpram_blk
*pdpram_blk
, struct list_head
*plist
);
175 int dsp_reload(struct ft1000_device
*ft1000dev
);
176 int init_ft1000_netdev(struct ft1000_device
*ft1000dev
);
177 struct usb_interface
;
178 int reg_ft1000_netdev(struct ft1000_device
*ft1000dev
, struct usb_interface
*intf
);
179 int ft1000_poll(void* dev_id
);
181 int ft1000_init_proc(struct net_device
*dev
);
182 void ft1000_cleanup_proc(struct ft1000_info
*info
);