developer | b11a539 | 2022-03-31 00:34:47 +0800 | [diff] [blame] | 1 | // SPDX-License-Identifier: ISC |
| 2 | /* Copyright (C) 2020 Felix Fietkau <nbd@nbd.name> */ |
| 3 | #ifndef __MT76_TEST_H |
| 4 | #define __MT76_TEST_H |
| 5 | |
| 6 | #include <stdbool.h> |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | #include <linux/nl80211.h> |
| 10 | #include <unl.h> |
| 11 | |
| 12 | #include "../testmode.h" |
| 13 | |
| 14 | #ifndef ARRAY_SIZE |
| 15 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) |
| 16 | #endif |
| 17 | |
| 18 | #ifndef DIV_ROUND_UP |
| 19 | #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
| 20 | #endif |
| 21 | |
| 22 | #define EEPROM_FILE_PATH_FMT "/tmp/mt76-test-%s" |
| 23 | #define EEPROM_PART_SIZE 20480 |
| 24 | |
| 25 | struct nl_msg; |
| 26 | struct nlattr; |
| 27 | |
| 28 | struct tm_field { |
| 29 | const char *name; |
| 30 | const char *prefix; |
| 31 | |
| 32 | bool (*parse)(const struct tm_field *field, int idx, struct nl_msg *msg, |
| 33 | const char *val); |
| 34 | void (*print)(const struct tm_field *field, struct nlattr *attr); |
| 35 | |
| 36 | union { |
| 37 | struct { |
| 38 | const char * const *enum_str; |
| 39 | int enum_len; |
| 40 | }; |
| 41 | struct { |
| 42 | bool (*parse2)(const struct tm_field *field, int idx, |
| 43 | struct nl_msg *msg, const char *val); |
| 44 | void (*print2)(const struct tm_field *field, |
| 45 | struct nlattr *attr); |
| 46 | }; |
| 47 | struct { |
| 48 | void (*print_extra)(const struct tm_field *field, |
| 49 | struct nlattr **tb); |
| 50 | const struct tm_field *fields; |
| 51 | struct nla_policy *policy; |
| 52 | int len; |
| 53 | }; |
| 54 | }; |
| 55 | }; |
| 56 | |
| 57 | extern struct unl unl; |
| 58 | extern const struct tm_field msg_field; |
| 59 | extern unsigned char *eeprom_data; |
| 60 | |
| 61 | void usage(void); |
| 62 | int mt76_eeprom(int phy, int argc, char **argv); |
| 63 | int mt76_fwlog(const char *phyname, int argc, char **argv); |
| 64 | |
| 65 | #endif |