Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
host.h
Go to the documentation of this file.
1 /*
2  * This file function prototypes, data structure
3  * and definitions for all the host/station commands
4  */
5 
6 #ifndef _LBS_HOST_H_
7 #define _LBS_HOST_H_
8 
9 #include "types.h"
10 #include "defs.h"
11 
12 #define DEFAULT_AD_HOC_CHANNEL 6
13 
14 #define CMD_OPTION_WAITFORRSP 0x0002
15 
16 /* Host command IDs */
17 
18 /*
19  * Return command are almost always the same as the host command, but with
20  * bit 15 set high. There are a few exceptions, though...
21  */
22 #define CMD_RET(cmd) (0x8000 | cmd)
23 
24 /* Return command convention exceptions: */
25 #define CMD_RET_802_11_ASSOCIATE 0x8012
26 
27 /* Command codes */
28 #define CMD_GET_HW_SPEC 0x0003
29 #define CMD_EEPROM_UPDATE 0x0004
30 #define CMD_802_11_RESET 0x0005
31 #define CMD_802_11_SCAN 0x0006
32 #define CMD_802_11_GET_LOG 0x000b
33 #define CMD_MAC_MULTICAST_ADR 0x0010
34 #define CMD_802_11_AUTHENTICATE 0x0011
35 #define CMD_802_11_EEPROM_ACCESS 0x0059
36 #define CMD_802_11_ASSOCIATE 0x0050
37 #define CMD_802_11_SET_WEP 0x0013
38 #define CMD_802_11_GET_STAT 0x0014
39 #define CMD_802_3_GET_STAT 0x0015
40 #define CMD_802_11_SNMP_MIB 0x0016
41 #define CMD_MAC_REG_MAP 0x0017
42 #define CMD_BBP_REG_MAP 0x0018
43 #define CMD_MAC_REG_ACCESS 0x0019
44 #define CMD_BBP_REG_ACCESS 0x001a
45 #define CMD_RF_REG_ACCESS 0x001b
46 #define CMD_802_11_RADIO_CONTROL 0x001c
47 #define CMD_802_11_RF_CHANNEL 0x001d
48 #define CMD_802_11_RF_TX_POWER 0x001e
49 #define CMD_802_11_RSSI 0x001f
50 #define CMD_802_11_RF_ANTENNA 0x0020
51 #define CMD_802_11_PS_MODE 0x0021
52 #define CMD_802_11_DATA_RATE 0x0022
53 #define CMD_RF_REG_MAP 0x0023
54 #define CMD_802_11_DEAUTHENTICATE 0x0024
55 #define CMD_802_11_REASSOCIATE 0x0025
56 #define CMD_MAC_CONTROL 0x0028
57 #define CMD_802_11_AD_HOC_START 0x002b
58 #define CMD_802_11_AD_HOC_JOIN 0x002c
59 #define CMD_802_11_QUERY_TKIP_REPLY_CNTRS 0x002e
60 #define CMD_802_11_ENABLE_RSN 0x002f
61 #define CMD_802_11_SET_AFC 0x003c
62 #define CMD_802_11_GET_AFC 0x003d
63 #define CMD_802_11_DEEP_SLEEP 0x003e
64 #define CMD_802_11_AD_HOC_STOP 0x0040
65 #define CMD_802_11_HOST_SLEEP_CFG 0x0043
66 #define CMD_802_11_WAKEUP_CONFIRM 0x0044
67 #define CMD_802_11_HOST_SLEEP_ACTIVATE 0x0045
68 #define CMD_802_11_BEACON_STOP 0x0049
69 #define CMD_802_11_MAC_ADDRESS 0x004d
70 #define CMD_802_11_LED_GPIO_CTRL 0x004e
71 #define CMD_802_11_BAND_CONFIG 0x0058
72 #define CMD_GSPI_BUS_CONFIG 0x005a
73 #define CMD_802_11D_DOMAIN_INFO 0x005b
74 #define CMD_802_11_KEY_MATERIAL 0x005e
75 #define CMD_802_11_SLEEP_PARAMS 0x0066
76 #define CMD_802_11_INACTIVITY_TIMEOUT 0x0067
77 #define CMD_802_11_SLEEP_PERIOD 0x0068
78 #define CMD_802_11_TPC_CFG 0x0072
79 #define CMD_802_11_PA_CFG 0x0073
80 #define CMD_802_11_FW_WAKE_METHOD 0x0074
81 #define CMD_802_11_SUBSCRIBE_EVENT 0x0075
82 #define CMD_802_11_RATE_ADAPT_RATESET 0x0076
83 #define CMD_802_11_TX_RATE_QUERY 0x007f
84 #define CMD_GET_TSF 0x0080
85 #define CMD_BT_ACCESS 0x0087
86 #define CMD_FWT_ACCESS 0x0095
87 #define CMD_802_11_MONITOR_MODE 0x0098
88 #define CMD_MESH_ACCESS 0x009b
89 #define CMD_MESH_CONFIG_OLD 0x00a3
90 #define CMD_MESH_CONFIG 0x00ac
91 #define CMD_SET_BOOT2_VER 0x00a5
92 #define CMD_FUNC_INIT 0x00a9
93 #define CMD_FUNC_SHUTDOWN 0x00aa
94 #define CMD_802_11_BEACON_CTRL 0x00b0
95 
96 /* For the IEEE Power Save */
97 #define PS_MODE_ACTION_ENTER_PS 0x0030
98 #define PS_MODE_ACTION_EXIT_PS 0x0031
99 #define PS_MODE_ACTION_SLEEP_CONFIRMED 0x0034
100 
101 #define CMD_ENABLE_RSN 0x0001
102 #define CMD_DISABLE_RSN 0x0000
103 
104 #define CMD_ACT_GET 0x0000
105 #define CMD_ACT_SET 0x0001
106 
107 /* Define action or option for CMD_802_11_SET_WEP */
108 #define CMD_ACT_ADD 0x0002
109 #define CMD_ACT_REMOVE 0x0004
110 
111 #define CMD_TYPE_WEP_40_BIT 0x01
112 #define CMD_TYPE_WEP_104_BIT 0x02
113 
114 #define CMD_NUM_OF_WEP_KEYS 4
115 
116 #define CMD_WEP_KEY_INDEX_MASK 0x3fff
117 
118 /* Define action or option for CMD_802_11_SCAN */
119 #define CMD_BSS_TYPE_BSS 0x0001
120 #define CMD_BSS_TYPE_IBSS 0x0002
121 #define CMD_BSS_TYPE_ANY 0x0003
122 
123 /* Define action or option for CMD_802_11_SCAN */
124 #define CMD_SCAN_TYPE_ACTIVE 0x0000
125 #define CMD_SCAN_TYPE_PASSIVE 0x0001
126 
127 #define CMD_SCAN_RADIO_TYPE_BG 0
128 
129 #define CMD_SCAN_PROBE_DELAY_TIME 0
130 
131 /* Define action or option for CMD_MAC_CONTROL */
132 #define CMD_ACT_MAC_RX_ON 0x0001
133 #define CMD_ACT_MAC_TX_ON 0x0002
134 #define CMD_ACT_MAC_LOOPBACK_ON 0x0004
135 #define CMD_ACT_MAC_WEP_ENABLE 0x0008
136 #define CMD_ACT_MAC_INT_ENABLE 0x0010
137 #define CMD_ACT_MAC_MULTICAST_ENABLE 0x0020
138 #define CMD_ACT_MAC_BROADCAST_ENABLE 0x0040
139 #define CMD_ACT_MAC_PROMISCUOUS_ENABLE 0x0080
140 #define CMD_ACT_MAC_ALL_MULTICAST_ENABLE 0x0100
141 #define CMD_ACT_MAC_STRICT_PROTECTION_ENABLE 0x0400
142 
143 /* Event flags for CMD_802_11_SUBSCRIBE_EVENT */
144 #define CMD_SUBSCRIBE_RSSI_LOW 0x0001
145 #define CMD_SUBSCRIBE_SNR_LOW 0x0002
146 #define CMD_SUBSCRIBE_FAILCOUNT 0x0004
147 #define CMD_SUBSCRIBE_BCNMISS 0x0008
148 #define CMD_SUBSCRIBE_RSSI_HIGH 0x0010
149 #define CMD_SUBSCRIBE_SNR_HIGH 0x0020
150 
151 #define RADIO_PREAMBLE_LONG 0x00
152 #define RADIO_PREAMBLE_SHORT 0x02
153 #define RADIO_PREAMBLE_AUTO 0x04
154 
155 /* Define action or option for CMD_802_11_RF_CHANNEL */
156 #define CMD_OPT_802_11_RF_CHANNEL_GET 0x00
157 #define CMD_OPT_802_11_RF_CHANNEL_SET 0x01
158 
159 /* Define action or option for CMD_802_11_DATA_RATE */
160 #define CMD_ACT_SET_TX_AUTO 0x0000
161 #define CMD_ACT_SET_TX_FIX_RATE 0x0001
162 #define CMD_ACT_GET_TX_RATE 0x0002
163 
164 /* Options for CMD_802_11_FW_WAKE_METHOD */
165 #define CMD_WAKE_METHOD_UNCHANGED 0x0000
166 #define CMD_WAKE_METHOD_COMMAND_INT 0x0001
167 #define CMD_WAKE_METHOD_GPIO 0x0002
168 
169 /* Object IDs for CMD_802_11_SNMP_MIB */
170 #define SNMP_MIB_OID_BSS_TYPE 0x0000
171 #define SNMP_MIB_OID_OP_RATE_SET 0x0001
172 #define SNMP_MIB_OID_BEACON_PERIOD 0x0002 /* Reserved on v9+ */
173 #define SNMP_MIB_OID_DTIM_PERIOD 0x0003 /* Reserved on v9+ */
174 #define SNMP_MIB_OID_ASSOC_TIMEOUT 0x0004 /* Reserved on v9+ */
175 #define SNMP_MIB_OID_RTS_THRESHOLD 0x0005
176 #define SNMP_MIB_OID_SHORT_RETRY_LIMIT 0x0006
177 #define SNMP_MIB_OID_LONG_RETRY_LIMIT 0x0007
178 #define SNMP_MIB_OID_FRAG_THRESHOLD 0x0008
179 #define SNMP_MIB_OID_11D_ENABLE 0x0009
180 #define SNMP_MIB_OID_11H_ENABLE 0x000A
181 
182 /* Define action or option for CMD_BT_ACCESS */
184  /* The bt commands start at 5 instead of 1 because the old dft commands
185  * are mapped to 1-4. These old commands are no longer maintained and
186  * should not be called.
187  */
194 };
195 
196 /* Define action or option for CMD_FWT_ACCESS */
207 };
208 
209 /* Define action or option for CMD_802_11_HOST_SLEEP_CFG */
215 };
216 
217 /* Define action or option for CMD_MESH_ACCESS */
235 };
236 
237 /* Define actions and types for CMD_MESH_CONFIG */
243 };
244 
251  CMD_TYPE_MESH_GET_MESH_IE, /* GET_DEFAULTS is superset of GET_MESHIE */
252 };
253 
254 /* Card Event definition */
255 #define MACREG_INT_CODE_TX_PPA_FREE 0
256 #define MACREG_INT_CODE_TX_DMA_DONE 1
257 #define MACREG_INT_CODE_LINK_LOST_W_SCAN 2
258 #define MACREG_INT_CODE_LINK_LOST_NO_SCAN 3
259 #define MACREG_INT_CODE_LINK_SENSED 4
260 #define MACREG_INT_CODE_CMD_FINISHED 5
261 #define MACREG_INT_CODE_MIB_CHANGED 6
262 #define MACREG_INT_CODE_INIT_DONE 7
263 #define MACREG_INT_CODE_DEAUTHENTICATED 8
264 #define MACREG_INT_CODE_DISASSOCIATED 9
265 #define MACREG_INT_CODE_PS_AWAKE 10
266 #define MACREG_INT_CODE_PS_SLEEP 11
267 #define MACREG_INT_CODE_MIC_ERR_MULTICAST 13
268 #define MACREG_INT_CODE_MIC_ERR_UNICAST 14
269 #define MACREG_INT_CODE_WM_AWAKE 15
270 #define MACREG_INT_CODE_DEEP_SLEEP_AWAKE 16
271 #define MACREG_INT_CODE_ADHOC_BCN_LOST 17
272 #define MACREG_INT_CODE_HOST_AWAKE 18
273 #define MACREG_INT_CODE_STOP_TX 19
274 #define MACREG_INT_CODE_START_TX 20
275 #define MACREG_INT_CODE_CHANNEL_SWITCH 21
276 #define MACREG_INT_CODE_MEASUREMENT_RDY 22
277 #define MACREG_INT_CODE_WMM_CHANGE 23
278 #define MACREG_INT_CODE_BG_SCAN_REPORT 24
279 #define MACREG_INT_CODE_RSSI_LOW 25
280 #define MACREG_INT_CODE_SNR_LOW 26
281 #define MACREG_INT_CODE_MAX_FAIL 27
282 #define MACREG_INT_CODE_RSSI_HIGH 28
283 #define MACREG_INT_CODE_SNR_HIGH 29
284 #define MACREG_INT_CODE_MESH_AUTO_STARTED 35
285 #define MACREG_INT_CODE_FIRMWARE_READY 48
286 
287 
288 /* 802.11-related definitions */
289 
290 /* TxPD descriptor */
291 struct txpd {
292  /* union to cope up with later FW revisions */
293  union {
294  /* Current Tx packet status */
296  struct {
297  /* BSS type: client, AP, etc. */
299  /* BSS number */
301  /* Reserved */
303  } bss;
304  } u;
305  /* Tx control */
308  /* Tx packet length */
310  /* First 2 byte of destination MAC address */
312  /* Last 4 byte of destination MAC address */
314  /* Pkt Priority */
316  /* Pkt Trasnit Power control */
318  /* Amount of time the packet has been queued (units = 2ms) */
320  /* reserved */
322 } __packed;
323 
324 /* RxPD Descriptor */
325 struct rxpd {
326  /* union to cope up with later FW revisions */
327  union {
328  /* Current Rx packet status */
330  struct {
331  /* BSS type: client, AP, etc. */
333  /* BSS number */
335  } __packed bss;
336  } __packed u;
337 
338  /* SNR */
340 
341  /* Tx control */
343 
344  /* Pkt length */
346 
347  /* Noise Floor */
349 
350  /* Rx Packet Rate */
352 
353  /* Pkt addr */
355 
356  /* Next Rx RxPD addr */
358 
359  /* Pkt Priority */
362 } __packed;
363 
364 struct cmd_header {
369 } __packed;
370 
371 /* Generic structure to hold all key types. */
372 struct enc_key {
374  u16 flags; /* KEY_INFO_* from defs.h */
375  u16 type; /* KEY_TYPE_* from defs.h */
376  u8 key[32];
377 };
378 
379 /* lbs_offset_value */
383 } __packed;
384 
385 #define MAX_11D_TRIPLETS 83
386 
389 
392 } __packed;
393 
395  struct cmd_header hdr;
396 
399 } __packed;
400 
401 /*
402  * Define data structure for CMD_GET_HW_SPEC
403  * This structure defines the response for the GET_HW_SPEC command
404  */
406  struct cmd_header hdr;
407 
408  /* HW Interface version number */
410  /* HW version number */
412  /* Max number of TxPD FW can handle */
414  /* Max no of Multicast address */
416  /* MAC address */
418 
419  /* region Code */
421 
422  /* Number of antenna used */
424 
425  /* FW release number, example 0x01030304 = 2.3.4p1 */
427 
428  /* Base Address of TxPD queue */
430  /* Read Pointer of RxPd queue */
432 
433  /* Write Pointer of RxPd queue */
435 
436  /*FW/HW capability */
438 } __packed;
439 
441  struct cmd_header hdr;
442 
445 
446  /* A TLV to the CMD_802_11_SUBSCRIBE_EVENT command can contain a
447  * number of TLVs. From the v5.1 manual, those TLVs would add up to
448  * 40 bytes. However, future firmware might add additional TLVs, so I
449  * bump this up a bit.
450  */
451  uint8_t tlv[128];
452 } __packed;
453 
454 /*
455  * This scan handle Country Information IE(802.11d compliant)
456  * Define data structure for CMD_802_11_SCAN
457  */
459  struct cmd_header hdr;
460 
464 } __packed;
465 
467  struct cmd_header hdr;
468 
472 } __packed;
473 
475  struct cmd_header hdr;
476 
490 } __packed;
491 
493  struct cmd_header hdr;
496 } __packed;
497 
499  struct cmd_header hdr;
503 } __packed;
504 
506  struct cmd_header hdr;
507 
511 } __packed;
512 
514  struct cmd_header hdr;
515 
518 } __packed;
519 
521  struct cmd_header hdr;
522 
523  u8 bssid[6];
528  u8 iebuf[512]; /* Enough for required and most optional IEs */
529 } __packed;
530 
532  struct cmd_header hdr;
533 
537  u8 iebuf[512];
538 } __packed;
539 
541  struct cmd_header hdr;
542 
543  /* ACT_ADD, ACT_REMOVE or ACT_ENABLE */
545 
546  /* key Index selected for Tx */
548 
549  /* 40, 128bit or TXWEP */
552 } __packed;
553 
555  struct cmd_header hdr;
556 
560  u8 value[128];
561 } __packed;
562 
564  struct cmd_header hdr;
565 
568  union {
569  u8 bbp_rf; /* for BBP and RF registers */
570  __le32 mac; /* for MAC registers */
571  } value;
572 } __packed;
573 
575  struct cmd_header hdr;
576 
579 } __packed;
580 
582  struct cmd_header hdr;
583 
587 } __packed;
588 
590  struct cmd_header hdr;
591 
592  /* ACT_GET/ACT_SET */
594 
595  /* Sleep clock error in ppm */
597 
598  /* Wakeup offset in usec */
600 
601  /* Clock stabilization time in usec */
603 
604  /* control periodic calibration */
606 
607  /* control the use of external sleep clock */
609 
610  /* reserved field, should be set to zero */
612 } __packed;
613 
615  struct cmd_header hdr;
616 
619  __le16 rftype; /* unused */
620  __le16 reserved; /* unused */
621  u8 channellist[32]; /* unused */
622 } __packed;
623 
625  struct cmd_header hdr;
626 
627  /*
628  * request: number of beacons (N) to average the SNR and NF over
629  * response: SNR of most recent beacon
630  */
632 
633  /*
634  * The following fields are only set in the response.
635  * In the request these are reserved and should be set to 0.
636  */
637  __le16 nf; /* most recent beacon noise floor */
638  __le16 avg_snr; /* average SNR weighted by N from request */
639  __le16 avg_nf; /* average noise floor weighted by N from request */
640 } __packed;
641 
643  struct cmd_header hdr;
644 
647 } __packed;
648 
650  struct cmd_header hdr;
651 
656 } __packed;
657 
658 /* MONITOR_MODE only exists in OLPC v5 firmware */
660  struct cmd_header hdr;
661 
664 } __packed;
665 
667  struct cmd_header hdr;
668 
671 } __packed;
672 
674  struct cmd_header hdr;
675 
678 } __packed;
679 
681  struct cmd_header hdr;
682 
684 
685  /*
686  * Interval for keepalive in PS mode:
687  * 0x0000 = don't change
688  * 0x001E = firmware default
689  * 0xFFFF = disable
690  */
692 
693  /*
694  * Number of DTIM intervals to wake up for:
695  * 0 = don't change
696  * 1 = firmware default
697  * 5 = max
698  */
700 
703 
704  /*
705  * AdHoc awake period (FW v9+ only):
706  * 0 = don't change
707  * 1 = always awake (IEEE standard behavior)
708  * 2 - 31 = sleep for (n - 1) periods and awake for 1 period
709  * 32 - 254 = invalid
710  * 255 = sleep at each ATIM
711  */
713 } __packed;
714 
716  struct cmd_header hdr;
717 
723 } __packed;
724 
726  struct cmd_header hdr;
727 
731 } __packed;
732 
734  struct cmd_header hdr;
738 } __packed;
739 
741  struct cmd_header hdr;
742 
746  u8 dtimperiod; /* Reserved on v9 and later */
751  __le16 probedelay; /* Reserved on v9 and later */
755 } __packed;
756 
758  struct cmd_header hdr;
759 
760  u8 pad[3];
762 } __packed;
763 
778 
779  /*
780  * DO NOT ADD ANY FIELDS TO THIS STRUCTURE. It is used below in the
781  * Adhoc join command and will cause a binary layout mismatch with
782  * the firmware
783  */
784 } __packed;
785 
787  struct cmd_header hdr;
788 
790  __le16 failtimeout; /* Reserved on v9 and later */
791  __le16 probedelay; /* Reserved on v9 and later */
792 } __packed;
793 
795  struct cmd_header hdr;
796 } __packed;
797 
799  struct cmd_header hdr;
800 
803 } __packed;
804 
806  /* type ID */
808 
809  /* length of Payload */
811 
812  /* type of key: WEP=0, TKIP=1, AES=2 */
814 
815  /* key control Info specific to a keytypeid */
817 
818  /* length of key */
820 
821  /* key material of size keylen */
822  u8 key[32];
823 } __packed;
824 
825 #define MAX_WOL_RULES 16
826 
835 } __packed;
836 
837 struct wol_config {
843 } __packed;
844 
846  struct cmd_header hdr;
851 } __packed;
852 
853 
854 
856  struct cmd_header hdr;
857 
860 } __packed;
861 
863  struct cmd_header hdr;
867  /* firmware says it returns a maximum of 20 bytes */
868 #define LBS_EEPROM_READ_LEN 20
870 } __packed;
871 
873  struct cmd_header hdr;
874 
881 } __packed;
882 
883 
885  struct cmd_header hdr;
886 
892 } __packed;
893 
894 
896  struct cmd_header hdr;
897 
900  u8 data[256];
901 } __packed;
902 
903 /* Automatic Frequency Control */
905  struct cmd_header hdr;
906 
908  union {
909  struct {
912  };
913  struct {
914  __le16 timing_offset; /* signed */
915  __le16 carrier_offset; /* signed */
916  };
917  };
918 } __packed;
919 
922 } __packed;
923 
926 } __packed;
927 
929  struct cmd_header hdr;
930 
935 } __packed;
936 
938  struct cmd_header hdr;
939 
957 } __packed;
958 
960  struct cmd_header hdr;
961 
966  u8 data[128]; /* last position reserved */
967 } __packed;
968 
970  struct cmd_header hdr;
971 
973  __le32 data[32]; /* last position reserved */
974 } __packed;
975 
976 /* Number of stats counters returned by the firmware */
977 #define MESH_STATS_NUM 8
978 #endif