📄 iwl-commands.h
字号:
#define AC_NUM 4/* * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) */struct iwl_qosparam_cmd { __le32 qos_flags; struct iwl_ac_qos ac[AC_NUM];} __attribute__ ((packed));/****************************************************************************** * (3) * Add/Modify Stations Commands & Responses: * *****************************************************************************//* * Multi station support */#define IWL_AP_ID 0#define IWL_MULTICAST_ID 1#define IWL_STA_ID 2#define IWL3945_BROADCAST_ID 24#define IWL3945_STATION_COUNT 25#define IWL4965_BROADCAST_ID 31#define IWL4965_STATION_COUNT 32#define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/#define IWL_INVALID_STATION 255#if IWL == 3945#define STA_FLG_TX_RATE_MSK __constant_cpu_to_le32(1<<2);#endif#define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1<<8);#define STA_CONTROL_MODIFY_MSK 0x01/* key flags __le16*/#define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x7)#define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0)#define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x1)#define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x2)#define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x3)#define STA_KEY_FLG_KEYID_POS 8#define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800)/* modify flags */#define STA_MODIFY_KEY_MASK 0x01#define STA_MODIFY_TID_DISABLE_TX 0x02#define STA_MODIFY_TX_RATE_MSK 0x04#define STA_MODIFY_ADDBA_TID_MSK 0x08#define STA_MODIFY_DELBA_TID_MSK 0x10#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))/* * Antenna masks: * bit14:15 01 B inactive, A active * 10 B active, A inactive * 11 Both active */#define RATE_MCS_ANT_A_POS 14#define RATE_MCS_ANT_B_POS 15#define RATE_MCS_ANT_A_MSK 0x4000#define RATE_MCS_ANT_B_MSK 0x8000#define RATE_MCS_ANT_AB_MSK 0xc000struct iwl_keyinfo { __le16 key_flags; u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ u8 reserved1; __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ __le16 reserved2; u8 key[16]; /* 16-byte unicast decryption key */} __attribute__ ((packed));struct sta_id_modify { u8 addr[ETH_ALEN]; __le16 reserved1; u8 sta_id; u8 modify_mask; __le16 reserved2;} __attribute__ ((packed));/* * REPLY_ADD_STA = 0x18 (command) */struct iwl_addsta_cmd { u8 mode; u8 reserved[3]; struct sta_id_modify sta; struct iwl_keyinfo key; __le32 station_flags; __le32 station_flags_msk; __le16 tid_disable_tx;#if IWL == 3945 __le16 rate_n_flags;#else __le16 reserved1;#endif u8 add_immediate_ba_tid; u8 remove_immediate_ba_tid; __le16 add_immediate_ba_ssn;#if IWL == 4965 __le32 reserved2;#endif} __attribute__ ((packed));/* * REPLY_ADD_STA = 0x18 (response) */struct iwl_add_sta_resp { u8 status;} __attribute__ ((packed));#define ADD_STA_SUCCESS_MSK 0x1/****************************************************************************** * (4) * Rx Responses: * *****************************************************************************/struct iwl_rx_frame_stats { u8 phy_count; u8 id; u8 rssi; u8 agc; __le16 sig_avg; __le16 noise_diff; u8 payload[0];} __attribute__ ((packed));struct iwl_rx_frame_hdr { __le16 channel; __le16 phy_flags; u8 reserved1; u8 rate; __le16 len; u8 payload[0];} __attribute__ ((packed));#define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0)#define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1)#define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0)#define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1)#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2)#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3)#define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0)#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)struct iwl_rx_frame_end { __le32 status; __le64 timestamp; __le32 beacon_timestamp;} __attribute__ ((packed));/* * REPLY_3945_RX = 0x1b (response only, not a command) * * NOTE: DO NOT dereference from casts to this structure * It is provided only for calculating minimum data set size. * The actual offsets of the hdr and end are dynamic based on * stats.phy_count */struct iwl_rx_frame { struct iwl_rx_frame_stats stats; struct iwl_rx_frame_hdr hdr; struct iwl_rx_frame_end end;} __attribute__ ((packed));/* Fixed (non-configurable) rx data from phy */#define RX_PHY_FLAGS_ANTENNAE_OFFSET (4)#define RX_PHY_FLAGS_ANTENNAE_MASK (0x70)#define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */#define IWL_AGC_DB_POS (7)struct iwl4965_rx_non_cfg_phy { __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ u8 pad[0];} __attribute__ ((packed));/* * REPLY_4965_RX = 0xc3 (response only, not a command) * Used only for legacy (non 11n) frames. */#define RX_RES_PHY_CNT 14struct iwl4965_rx_phy_res { u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ u8 stat_id; /* configurable DSP phy data set ID */ u8 reserved1; __le64 timestamp; /* TSF at on air rise */ __le32 beacon_time_stamp; /* beacon at on-air rise */ __le16 phy_flags; /* general phy flags: band, modulation, ... */ __le16 channel; /* channel number */ __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ __le32 reserved2; __le32 rate_n_flags; __le16 byte_count; /* frame's byte-count */ __le16 reserved3;} __attribute__ ((packed));struct iwl4965_rx_mpdu_res_start { __le16 byte_count; __le16 reserved;} __attribute__ ((packed));/****************************************************************************** * (5) * Tx Commands & Responses: * *****************************************************************************//* Tx flags */#define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1)#define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2)#define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3)#define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4)#define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6)#define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7)#define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00)#define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8)#define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9)/* ucode ignores BT priority for this frame */#define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12)/* ucode overrides sequence control */#define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13)/* signal that this frame is non-last MPDU */#define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14)/* calculate TSF in outgoing frame */#define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16)/* activate TX calibration. */#define TX_CMD_FLG_CALIB_MSK __constant_cpu_to_le32(1 << 17)/* signals that 2 bytes pad was inserted after the MAC header */#define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)/* HCCA-AP - disable duration overwriting. */#define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)/* * TX command security control */#define TX_CMD_SEC_WEP 0x01#define TX_CMD_SEC_CCM 0x02#define TX_CMD_SEC_TKIP 0x03#define TX_CMD_SEC_MSK 0x03#define TX_CMD_SEC_SHIFT 6#define TX_CMD_SEC_KEY128 0x08/* * TX command Frame life time */struct iwl_dram_scratch { u8 try_cnt; u8 bt_kill_cnt; __le16 reserved;} __attribute__ ((packed));/* * REPLY_TX = 0x1c (command) */struct iwl_tx_cmd { __le16 len; __le16 next_frame_len; __le32 tx_flags;#if IWL == 3945 u8 rate; u8 sta_id; u8 tid_tspec;#elif IWL == 4965 struct iwl_dram_scratch scratch; __le32 rate_n_flags; u8 sta_id;#endif u8 sec_ctl;#if IWL == 4965 u8 initial_rate_index; u8 reserved;#endif u8 key[16];#if IWL == 3945 union { u8 byte[8]; __le16 word[4]; __le32 dw[2]; } tkip_mic; __le32 next_frame_info;#elif IWL == 4965 __le16 next_frame_flags; __le16 reserved2;#endif union { __le32 life_time; __le32 attempt; } stop_time;#if IWL == 3945 u8 supp_rates[2];#elif IWL == 4965 __le32 dram_lsb_ptr; u8 dram_msb_ptr;#endif u8 rts_retry_limit; /*byte 50 */ u8 data_retry_limit; /*byte 51 */#if IWL == 4965 u8 tid_tspec;#endif union { __le16 pm_frame_timeout; __le16 attempt_duration; } timeout; __le16 driver_txop; u8 payload[0]; struct ieee80211_hdr hdr[0];} __attribute__ ((packed));/* TX command response is sent after *all* transmission attempts. * * NOTES: * * TX_STATUS_FAIL_NEXT_FRAG * * If the fragment flag in the MAC header for the frame being transmitted * is set and there is insufficient time to transmit the next frame, the * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. * * TX_STATUS_FIFO_UNDERRUN * * Indicates the host did not provide bytes to the FIFO fast enough while * a TX was in progress. * * TX_STATUS_FAIL_MGMNT_ABORT * * This status is only possible if the ABORT ON MGMT RX parameter was * set to true with the TX command. * * If the MSB of the status parameter is set then an abort sequence is * required. This sequence consists of the host activating the TX Abort * control line, and then waiting for the TX Abort command response. This * indicates that a the device is no longer in a transmit state, and that the * command FIFO has been cleared. The host must then deactivate the TX Abort * control line. Receiving is still allowed in this case. */enum { TX_STATUS_SUCCESS = 0x01, TX_STATUS_DIRECT_DONE = 0x02, TX_STATUS_FAIL_SHORT_LIMIT = 0x82, TX_STATUS_FAIL_LONG_LIMIT = 0x83, TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, TX_STATUS_FAIL_MGMNT_ABORT = 0x85, TX_STATUS_FAIL_NEXT_FRAG = 0x86, TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, TX_STATUS_FAIL_DEST_PS = 0x88, TX_STATUS_FAIL_ABORTED = 0x89, TX_STATUS_FAIL_BT_RETRY = 0x8a, TX_STATUS_FAIL_STA_INVALID = 0x8b, TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, TX_STATUS_FAIL_TID_DISABLE = 0x8d, TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, TX_STATUS_FAIL_TX_LOCKED = 0x90, TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,};#define TX_PACKET_MODE_REGULAR 0x0000#define TX_PACKET_MODE_BURST_SEQ 0x0100#define TX_PACKET_MODE_BURST_FIRST 0x0200enum { TX_POWER_PA_NOT_ACTIVE = 0x0,};enum { TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ TX_STATUS_DELAY_MSK = 0x00000040, TX_STATUS_ABORT_MSK = 0x00000080, TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ TX_RESERVED = 0x00780000, /* bits 19:22 */ TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */};/* ******************************* * TX aggregation state ******************************* */enum { AGG_TX_STATE_TRANSMITTED = 0x00, AGG_TX_STATE_UNDERRUN_MSK = 0x01, AGG_TX_STATE_BT_PRIO_MSK = 0x02, AGG_TX_STATE_FEW_BYTES_MSK = 0x04, AGG_TX_STATE_ABORT_MSK = 0x08, AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, AGG_TX_STATE_SCD_QUERY_MSK = 0x80, AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, AGG_TX_STATE_RESPONSE_MSK = 0x1ff, AGG_TX_STATE_DUMP_TX_MSK = 0x200, AGG_TX_STATE_DELAY_TX_MSK = 0x400};#define AGG_TX_STATE_LAST_SENT_MSK \(AGG_TX_STATE_LAST_SENT_TTL_MSK | \ AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ AGG_TX_STATE_LAST_SENT_BT_KILL_MSK)#define AGG_TX_STATE_TRY_CNT_POS 12#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -