![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ 0002 /* 0003 * Copyright (C) 2005-2014 Intel Corporation 0004 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH 0005 * Copyright (C) 2016-2017 Intel Deutschland GmbH 0006 */ 0007 #ifndef __iwl_fw_api_cmdhdr_h__ 0008 #define __iwl_fw_api_cmdhdr_h__ 0009 0010 /** 0011 * DOC: Host command section 0012 * 0013 * A host command is a command issued by the upper layer to the fw. There are 0014 * several versions of fw that have several APIs. The transport layer is 0015 * completely agnostic to these differences. 0016 * The transport does provide helper functionality (i.e. SYNC / ASYNC mode), 0017 */ 0018 #define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f) 0019 #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8) 0020 #define SEQ_TO_INDEX(s) ((s) & 0xff) 0021 #define INDEX_TO_SEQ(i) ((i) & 0xff) 0022 #define SEQ_RX_FRAME cpu_to_le16(0x8000) 0023 0024 /* 0025 * those functions retrieve specific information from 0026 * the id field in the iwl_host_cmd struct which contains 0027 * the command id, the group id and the version of the command 0028 * and vice versa 0029 */ 0030 static inline u8 iwl_cmd_opcode(u32 cmdid) 0031 { 0032 return cmdid & 0xFF; 0033 } 0034 0035 static inline u8 iwl_cmd_groupid(u32 cmdid) 0036 { 0037 return ((cmdid & 0xFF00) >> 8); 0038 } 0039 0040 static inline u8 iwl_cmd_version(u32 cmdid) 0041 { 0042 return ((cmdid & 0xFF0000) >> 16); 0043 } 0044 0045 static inline u32 iwl_cmd_id(u8 opcode, u8 groupid, u8 version) 0046 { 0047 return opcode + (groupid << 8) + (version << 16); 0048 } 0049 0050 /* make u16 wide id out of u8 group and opcode */ 0051 #define WIDE_ID(grp, opcode) (((grp) << 8) | (opcode)) 0052 #define DEF_ID(opcode) ((1 << 8) | (opcode)) 0053 0054 /* due to the conversion, this group is special; new groups 0055 * should be defined in the appropriate fw-api header files 0056 */ 0057 #define IWL_ALWAYS_LONG_GROUP 1 0058 0059 /** 0060 * struct iwl_cmd_header - (short) command header format 0061 * 0062 * This header format appears in the beginning of each command sent from the 0063 * driver, and each response/notification received from uCode. 0064 */ 0065 struct iwl_cmd_header { 0066 /** 0067 * @cmd: Command ID: REPLY_RXON, etc. 0068 */ 0069 u8 cmd; 0070 /** 0071 * @group_id: group ID, for commands with groups 0072 */ 0073 u8 group_id; 0074 /** 0075 * @sequence: 0076 * Sequence number for the command. 0077 * 0078 * The driver sets up the sequence number to values of its choosing. 0079 * uCode does not use this value, but passes it back to the driver 0080 * when sending the response to each driver-originated command, so 0081 * the driver can match the response to the command. Since the values 0082 * don't get used by uCode, the driver may set up an arbitrary format. 0083 * 0084 * There is one exception: uCode sets bit 15 when it originates 0085 * the response/notification, i.e. when the response/notification 0086 * is not a direct response to a command sent by the driver. For 0087 * example, uCode issues REPLY_RX when it sends a received frame 0088 * to the driver; it is not a direct response to any driver command. 0089 * 0090 * The Linux driver uses the following format: 0091 * 0092 * 0:7 tfd index - position within TX queue 0093 * 8:12 TX queue id 0094 * 13:14 reserved 0095 * 15 unsolicited RX or uCode-originated notification 0096 */ 0097 __le16 sequence; 0098 } __packed; 0099 0100 /** 0101 * struct iwl_cmd_header_wide 0102 * 0103 * This header format appears in the beginning of each command sent from the 0104 * driver, and each response/notification received from uCode. 0105 * this is the wide version that contains more information about the command 0106 * like length, version and command type 0107 * 0108 * @cmd: command ID, like in &struct iwl_cmd_header 0109 * @group_id: group ID, like in &struct iwl_cmd_header 0110 * @sequence: sequence, like in &struct iwl_cmd_header 0111 * @length: length of the command 0112 * @reserved: reserved 0113 * @version: command version 0114 */ 0115 struct iwl_cmd_header_wide { 0116 u8 cmd; 0117 u8 group_id; 0118 __le16 sequence; 0119 __le16 length; 0120 u8 reserved; 0121 u8 version; 0122 } __packed; 0123 0124 /** 0125 * struct iwl_calib_res_notif_phy_db - Receive phy db chunk after calibrations 0126 * @type: type of the result - mostly ignored 0127 * @length: length of the data 0128 * @data: data, length in @length 0129 */ 0130 struct iwl_calib_res_notif_phy_db { 0131 __le16 type; 0132 __le16 length; 0133 u8 data[]; 0134 } __packed; 0135 0136 /** 0137 * struct iwl_phy_db_cmd - configure operational ucode 0138 * @type: type of the data 0139 * @length: length of the data 0140 * @data: data, length in @length 0141 */ 0142 struct iwl_phy_db_cmd { 0143 __le16 type; 0144 __le16 length; 0145 u8 data[]; 0146 } __packed; 0147 0148 /** 0149 * struct iwl_cmd_response - generic response struct for most commands 0150 * @status: status of the command asked, changes for each one 0151 */ 0152 struct iwl_cmd_response { 0153 __le32 status; 0154 }; 0155 0156 #endif /* __iwl_fw_api_cmdhdr_h__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |