Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[pandora-kernel.git] / drivers / staging / ft1000 / ft1000-usb / ft1000_ioctl.h
1 //---------------------------------------------------------------------------
2 // FT1000 driver for Flarion Flash OFDM NIC Device
3 //
4 // Copyright (C) 2002 Flarion Technologies, All rights reserved.
5 //
6 // This program is free software; you can redistribute it and/or modify it
7 // under the terms of the GNU General Public License as published by the Free
8 // Software Foundation; either version 2 of the License, or (at your option) any
9 // later version. This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 // or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12 // more details. You should have received a copy of the GNU General Public
13 // License along with this program; if not, write to the
14 // Free Software Foundation, Inc., 59 Temple Place -
15 // Suite 330, Boston, MA 02111-1307, USA.
16 //---------------------------------------------------------------------------
17 //
18 // File:         ft1000_ioctl.h
19 //
20 // Description:    Common structures and defines relating to IOCTL
21 //
22 // History:
23 // 11/5/02    Whc                Created.
24 //
25 //---------------------------------------------------------------------------//---------------------------------------------------------------------------
26 #ifndef _FT1000IOCTLH_
27 #define _FT1000IOCTLH_
28
29 #define DSPVERSZ                4
30 #define HWSERNUMSZ              16
31 #define SKUSZ                   20
32 #define EUISZ                   8
33 #define CALVERSZ                2
34 #define CALDATESZ               6
35
36 #define MAX_DNLD_BLKSZ          1024
37
38 // Standard Flarion Pseudo header
39 struct pseudo_hdr {
40    unsigned short    length;           //length of msg body
41    unsigned char     source;           //source address (0x10=Host 0x20=DSP)
42    unsigned char     destination;      //destination address (refer to source address)
43    unsigned char     portdest;         //destination port id
44                                        //    0x00=Driver
45                                        //    0x10=Application Broadcast
46                                        //    0x20=Network Stack
47                                        //    0x80=Dsp OAM
48                                        //    0x90=Dsp Airlink
49                                        //    0xa0=Dsp Loader
50                                        //    0xb0=Dsp MIP
51    unsigned char     portsrc;          //source port id (refer to portdest)
52    unsigned short    sh_str_id;        //stream id (Not applicable on Mobile)
53    unsigned char     control;          //stream id (Not applicable on Mobile)
54    unsigned char     rsvd1;            //reserved
55    unsigned char     seq_num;          //sequence number
56    unsigned char     rsvd2;            //reserved
57    unsigned short    qos_class;        //Quality of Service class (Not applicable on Mobile)
58    unsigned short    checksum;         //Psuedo header checksum
59 } __attribute__ ((packed));
60
61 typedef struct _IOCTL_GET_VER
62 {
63     unsigned long drv_ver;
64 } __attribute__ ((packed)) IOCTL_GET_VER, *PIOCTL_GET_VER;
65
66 //Data structure for Dsp statistics
67 typedef struct _IOCTL_GET_DSP_STAT
68 {
69     unsigned char DspVer[DSPVERSZ];        // DSP version number
70     unsigned char HwSerNum[HWSERNUMSZ];    // Hardware Serial Number
71     unsigned char Sku[SKUSZ];              // SKU
72     unsigned char eui64[EUISZ];            // EUI64
73     unsigned short ConStat;                // Connection Status
74                                 //    Bits 0-3 = Connection Status Field
75                                 //               0000=Idle (Disconnect)
76                                 //               0001=Searching
77                                 //               0010=Active (Connected)
78                                 //               0011=Waiting for L2 down
79                                 //               0100=Sleep
80     unsigned short LedStat;                // Led Status
81                                 //    Bits 0-3   = Signal Strength Field
82                                 //                 0000 = -105dBm to -92dBm
83                                 //                 0001 = -92dBm to -85dBm
84                                 //                 0011 = -85dBm to -75dBm
85                                 //                 0111 = -75dBm to -50dBm
86                                 //                 1111 = -50dBm to 0dBm
87                                 //    Bits 4-7   = Reserved
88                                 //    Bits 8-11  = SNR Field
89                                 //                 0000 = <2dB
90                                 //                 0001 = 2dB to 8dB
91                                 //                 0011 = 8dB to 15dB
92                                 //                 0111 = 15dB to 22dB
93                                 //                 1111 = >22dB
94                                 //    Bits 12-15 = Reserved
95     unsigned long nTxPkts;                // Number of packets transmitted from host to dsp
96     unsigned long nRxPkts;                // Number of packets received from dsp to host
97     unsigned long nTxBytes;               // Number of bytes transmitted from host to dsp
98     unsigned long nRxBytes;               // Number of bytes received from dsp to host
99     unsigned long ConTm;                  // Current session connection time in seconds
100     unsigned char CalVer[CALVERSZ];       // Proprietary Calibration Version
101     unsigned char CalDate[CALDATESZ];     // Proprietary Calibration Date
102 } __attribute__ ((packed)) IOCTL_GET_DSP_STAT, *PIOCTL_GET_DSP_STAT;
103
104 //Data structure for Dual Ported RAM messaging between Host and Dsp
105 typedef struct _IOCTL_DPRAM_BLK
106 {
107     unsigned short total_len;
108         struct pseudo_hdr pseudohdr;
109     unsigned char buffer[1780];
110 } __attribute__ ((packed)) IOCTL_DPRAM_BLK, *PIOCTL_DPRAM_BLK;
111
112 typedef struct _IOCTL_DPRAM_COMMAND
113 {
114     unsigned short extra;
115     IOCTL_DPRAM_BLK dpram_blk;
116 } __attribute__ ((packed)) IOCTL_DPRAM_COMMAND, *PIOCTL_DPRAM_COMMAND;
117
118 //
119 // Custom IOCTL command codes
120 //
121 #define FT1000_MAGIC_CODE      'F'
122
123 #define IOCTL_REGISTER_CMD                                      0
124 #define IOCTL_SET_DPRAM_CMD                                     3
125 #define IOCTL_GET_DPRAM_CMD                                     4
126 #define IOCTL_GET_DSP_STAT_CMD      6
127 #define IOCTL_GET_VER_CMD           7
128 #define IOCTL_CONNECT               10
129 #define IOCTL_DISCONNECT            11
130
131 #define IOCTL_FT1000_GET_DSP_STAT _IOR (FT1000_MAGIC_CODE, IOCTL_GET_DSP_STAT_CMD, sizeof(IOCTL_GET_DSP_STAT) )
132 #define IOCTL_FT1000_GET_VER _IOR (FT1000_MAGIC_CODE, IOCTL_GET_VER_CMD, sizeof(IOCTL_GET_VER) )
133 #define IOCTL_FT1000_CONNECT _IOW (FT1000_MAGIC_CODE, IOCTL_CONNECT, 0 )
134 #define IOCTL_FT1000_DISCONNECT _IOW (FT1000_MAGIC_CODE, IOCTL_DISCONNECT, 0 )
135 #define IOCTL_FT1000_SET_DPRAM _IOW (FT1000_MAGIC_CODE, IOCTL_SET_DPRAM_CMD, sizeof(IOCTL_DPRAM_BLK) )
136 #define IOCTL_FT1000_GET_DPRAM _IOR (FT1000_MAGIC_CODE, IOCTL_GET_DPRAM_CMD, sizeof(IOCTL_DPRAM_BLK) )
137 #define IOCTL_FT1000_REGISTER  _IOW (FT1000_MAGIC_CODE, IOCTL_REGISTER_CMD, sizeof(unsigned short *) )
138 #endif // _FT1000IOCTLH_
139