]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
Merge remote-tracking branch 'asoc/fix/si476x' into asoc-next
[karo-tx-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 } __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_debug_dirs {
59         struct list_head list;
60         struct dentry *dent;
61         struct dentry *file;
62         int int_number;
63 };
64
65 struct ft1000_usb {
66         struct usb_device *dev;
67         struct net_device *net;
68
69         u32 status;
70
71         struct urb *rx_urb;
72         struct urb *tx_urb;
73
74         u8 tx_buf[MAX_BUF_SIZE];
75         u8 rx_buf[MAX_BUF_SIZE];
76
77         u8 bulk_in_endpointAddr;
78         u8 bulk_out_endpointAddr;
79
80         struct task_struct *pPollThread;
81         unsigned char fcodeldr;
82         unsigned char bootmode;
83         unsigned char usbboot;
84         unsigned short dspalive;
85         bool fProvComplete;
86         bool fCondResetPend;
87         bool fAppMsgPend;
88         int DeviceCreated;
89         int NetDevRegDone;
90         u8 CardNumber;
91         u8 DeviceName[15];
92         struct ft1000_debug_dirs nodes;
93         spinlock_t fifo_lock;
94         int appcnt;
95         struct app_info_block app_info[MAX_NUM_APP];
96         u16 DrvMsgPend;
97         unsigned short tempbuf[32];
98 } __packed;
99
100
101 struct dpram_blk {
102         struct list_head list;
103         u16 *pbuffer;
104 } __packed;
105
106 int ft1000_read_register(struct ft1000_usb *ft1000dev,
107                         u16 *Data, u16 nRegIndx);
108 int ft1000_write_register(struct ft1000_usb *ft1000dev,
109                         u16 value, u16 nRegIndx);
110 int ft1000_read_dpram32(struct ft1000_usb *ft1000dev,
111                         u16 indx, u8 *buffer, u16 cnt);
112 int ft1000_write_dpram32(struct ft1000_usb *ft1000dev,
113                         u16 indx, u8 *buffer, u16 cnt);
114 int ft1000_read_dpram16(struct ft1000_usb *ft1000dev,
115                         u16 indx, u8 *buffer, u8 highlow);
116 int ft1000_write_dpram16(struct ft1000_usb *ft1000dev,
117                         u16 indx, u16 value, u8 highlow);
118 int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev,
119                         u16 indx, u8 *buffer);
120 int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev,
121                         u16 indx, u8 *buffer);
122
123 extern void *pFileStart;
124 extern size_t FileLength;
125 extern int numofmsgbuf;
126
127 int ft1000_close(struct net_device *dev);
128 u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
129                 u32  FileLength);
130
131 extern struct list_head freercvpool;
132
133 extern spinlock_t free_buff_lock;   /* lock to arbitrate free buffer list for receive command data */
134
135 int ft1000_create_dev(struct ft1000_usb *dev);
136 void ft1000_destroy_dev(struct net_device *dev);
137 extern void card_send_command(struct ft1000_usb *ft1000dev,
138                                 void *ptempbuffer, int size);
139
140 struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
141 void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
142
143 int dsp_reload(struct ft1000_usb *ft1000dev);
144 int init_ft1000_netdev(struct ft1000_usb *ft1000dev);
145 struct usb_interface;
146 int reg_ft1000_netdev(struct ft1000_usb *ft1000dev,
147                         struct usb_interface *intf);
148 int ft1000_poll(void *dev_id);
149
150 int ft1000_init_proc(struct net_device *dev);
151 void ft1000_cleanup_proc(struct ft1000_info *info);
152
153
154
155 #endif