4
4
#ifndef __ESP_NETWORK_ADAPTER__H
5
5
#define __ESP_NETWORK_ADAPTER__H
6
6
7
+ #include <sys/cdefs.h>
8
+
7
9
#define PRIO_Q_HIGH 0
8
10
#define PRIO_Q_MID 1
9
11
#define PRIO_Q_LOW 2
@@ -37,7 +39,7 @@ struct esp_payload_header {
37
39
uint8_t priv_pkt_type ; /* Packet type for priv interface */
38
40
};
39
41
/* Do no add anything here */
40
- } __attribute__(( packed )) ;
42
+ } __packed ;
41
43
42
44
struct ieee_mgmt_header {
43
45
uint16_t frame_control ;
@@ -46,9 +48,9 @@ struct ieee_mgmt_header {
46
48
uint8_t sa [MAC_ADDR_LEN ];
47
49
uint8_t bssid [MAC_ADDR_LEN ];
48
50
uint16_t seq_ctrl ;
49
- }__attribute__(( packed )) ;
51
+ } __packed ;
50
52
51
- enum ESP_INTERFACE_TYPE {
53
+ enum ESP_INTERFACE_TYPE {
52
54
ESP_STA_IF ,
53
55
ESP_AP_IF ,
54
56
ESP_HCI_IF ,
@@ -116,6 +118,8 @@ enum COMMAND_CODE {
116
118
CMD_STA_ASSOC ,
117
119
CMD_SET_IP_ADDR ,
118
120
CMD_SET_MCAST_MAC_ADDR ,
121
+ CMD_GET_TXPOWER ,
122
+ CMD_SET_TXPOWER ,
119
123
CMD_MAX ,
120
124
};
121
125
@@ -152,13 +156,13 @@ struct scan_request {
152
156
char ssid [MAX_SSID_LEN + 1 ];
153
157
uint8_t channel ;
154
158
uint8_t pad [2 ];
155
- }__attribute__(( packed )) ;
159
+ } __packed ;
156
160
157
161
struct cmd_config_mac_address {
158
162
struct command_header header ;
159
163
uint8_t mac_addr [MAC_ADDR_LEN ];
160
164
uint8_t pad [2 ];
161
- }__attribute__(( packed )) ;
165
+ } __packed ;
162
166
163
167
struct cmd_sta_auth {
164
168
struct command_header header ;
@@ -169,14 +173,14 @@ struct cmd_sta_auth {
169
173
uint8_t auth_data_len ;
170
174
uint8_t pad [2 ];
171
175
uint8_t auth_data [];
172
- }__attribute__(( packed )) ;
176
+ } __packed ;
173
177
174
178
struct cmd_sta_assoc {
175
179
struct command_header header ;
176
180
uint8_t assoc_ie_len ;
177
181
uint8_t pad [3 ];
178
182
uint8_t assoc_ie [];
179
- }__attribute__(( packed )) ;
183
+ } __packed ;
180
184
181
185
struct cmd_sta_connect {
182
186
struct command_header header ;
@@ -187,24 +191,24 @@ struct cmd_sta_connect {
187
191
uint8_t is_auth_open ;
188
192
uint8_t assoc_ie_len ;
189
193
uint8_t assoc_ie [];
190
- }__attribute__(( packed )) ;
194
+ } __packed ;
191
195
192
196
struct cmd_sta_disconnect {
193
197
struct command_header header ;
194
198
uint16_t reason_code ;
195
199
uint8_t pad [2 ];
196
- }__attribute__(( packed )) ;
200
+ } __packed ;
197
201
198
202
struct cmd_set_ip_addr {
199
203
struct command_header header ;
200
204
uint32_t ip ;
201
- }__attribute__(( packed )) ;
205
+ } __packed ;
202
206
203
207
struct cmd_set_mcast_mac_addr {
204
208
struct command_header header ;
205
209
uint8_t count ;
206
210
uint8_t mcast_addr [MAX_MULTICAST_ADDR_COUNT ][MAC_ADDR_LEN ];
207
- }__attribute__(( packed )) ;
211
+ } __packed ;
208
212
209
213
struct wifi_sec_key {
210
214
uint32_t algo ;
@@ -217,18 +221,23 @@ struct wifi_sec_key {
217
221
uint8_t del ;
218
222
uint8_t set_cur ;
219
223
uint8_t pad [2 ];
220
- }__attribute__((packed ));
224
+ } __packed ;
225
+
226
+ struct cmd_set_get_val {
227
+ struct command_header header ;
228
+ uint32_t value ;
229
+ } __packed ;
221
230
222
231
struct cmd_key_operation {
223
232
struct command_header header ;
224
233
struct wifi_sec_key key ;
225
- }__attribute__(( packed )) ;
234
+ } __packed ;
226
235
227
236
struct event_header {
228
237
uint8_t event_code ;
229
238
uint8_t status ;
230
239
uint16_t len ;
231
- }__attribute__(( packed )) ;
240
+ } __packed ;
232
241
233
242
struct scan_event {
234
243
struct event_header header ;
@@ -240,7 +249,7 @@ struct scan_event {
240
249
uint16_t frame_len ;
241
250
uint8_t pad [2 ];
242
251
uint8_t frame [0 ];
243
- }__attribute__(( packed )) ;
252
+ } __packed ;
244
253
245
254
struct auth_event {
246
255
struct event_header header ;
@@ -252,7 +261,7 @@ struct auth_event {
252
261
uint16_t frame_len ;
253
262
uint8_t pad [2 ];
254
263
uint8_t frame [0 ];
255
- }__attribute__(( packed )) ;
264
+ } __packed ;
256
265
257
266
struct assoc_event {
258
267
struct event_header header ;
@@ -265,32 +274,32 @@ struct assoc_event {
265
274
uint32_t rssi ;
266
275
uint64_t tsf ;
267
276
uint8_t frame [0 ];
268
- }__attribute__(( packed )) ;
277
+ } __packed ;
269
278
270
279
struct disconnect_event {
271
280
struct event_header header ;
272
281
uint8_t bssid [MAC_ADDR_LEN ];
273
282
char ssid [MAX_SSID_LEN + 1 ];
274
283
uint8_t reason ;
275
- }__attribute__(( packed )) ;
284
+ } __packed ;
276
285
277
286
struct esp_internal_bootup_event {
278
287
struct event_header header ;
279
288
uint8_t len ;
280
289
uint8_t pad [3 ];
281
290
uint8_t data [0 ];
282
- }__attribute__(( packed )) ;
291
+ } __packed ;
283
292
284
293
struct fw_version {
285
294
uint8_t major1 ;
286
295
uint8_t major2 ;
287
296
uint8_t minor ;
288
- }__attribute__(( packed )) ;
297
+ } __packed ;
289
298
290
299
struct fw_data {
291
300
struct fw_version version ;
292
301
uint32_t last_reset_reason ;
293
- }__attribute__(( packed )) ;
302
+ } __packed ;
294
303
295
304
296
305
@@ -299,7 +308,7 @@ static inline uint16_t compute_checksum(uint8_t *buf, uint16_t len)
299
308
uint16_t checksum = 0 ;
300
309
uint16_t i = 0 ;
301
310
302
- while (i < len ) {
311
+ while (i < len ) {
303
312
checksum += buf [i ];
304
313
i ++ ;
305
314
}
0 commit comments