linux/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h
<<
>>
Prefs
   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
  16struct 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
  58struct ft1000_debug_dirs {
  59        struct list_head list;
  60        struct dentry *dent;
  61        struct dentry *file;
  62        int int_number;
  63};
  64
  65struct 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
 101struct dpram_blk {
 102        struct list_head list;
 103        u16 *pbuffer;
 104} __packed;
 105
 106int ft1000_read_register(struct ft1000_usb *ft1000dev,
 107                        u16 *Data, u16 nRegIndx);
 108int ft1000_write_register(struct ft1000_usb *ft1000dev,
 109                        u16 value, u16 nRegIndx);
 110int ft1000_read_dpram32(struct ft1000_usb *ft1000dev,
 111                        u16 indx, u8 *buffer, u16 cnt);
 112int ft1000_write_dpram32(struct ft1000_usb *ft1000dev,
 113                        u16 indx, u8 *buffer, u16 cnt);
 114int ft1000_read_dpram16(struct ft1000_usb *ft1000dev,
 115                        u16 indx, u8 *buffer, u8 highlow);
 116int ft1000_write_dpram16(struct ft1000_usb *ft1000dev,
 117                        u16 indx, u16 value, u8 highlow);
 118int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev,
 119                        u16 indx, u8 *buffer);
 120int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev,
 121                        u16 indx, u8 *buffer);
 122
 123extern void *pFileStart;
 124extern size_t FileLength;
 125extern int numofmsgbuf;
 126
 127int ft1000_close(struct net_device *dev);
 128u16 scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
 129                u32  FileLength);
 130
 131extern struct list_head freercvpool;
 132
 133extern spinlock_t free_buff_lock;   /* lock to arbitrate free buffer list for receive command data */
 134
 135int ft1000_create_dev(struct ft1000_usb *dev);
 136void ft1000_destroy_dev(struct net_device *dev);
 137extern void card_send_command(struct ft1000_usb *ft1000dev,
 138                                void *ptempbuffer, int size);
 139
 140struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
 141void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
 142
 143int dsp_reload(struct ft1000_usb *ft1000dev);
 144int init_ft1000_netdev(struct ft1000_usb *ft1000dev);
 145struct usb_interface;
 146int reg_ft1000_netdev(struct ft1000_usb *ft1000dev,
 147                        struct usb_interface *intf);
 148int ft1000_poll(void *dev_id);
 149
 150int ft1000_init_proc(struct net_device *dev);
 151void ft1000_cleanup_proc(struct ft1000_info *info);
 152
 153
 154
 155#endif
 156