nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | #ifndef _FWCUTTER_H_ |
2 | #define _FWCUTTER_H_ |
||
3 | |||
4 | #define FW_FLAG_LE 0x01 /* little endian? convert */ |
||
5 | #define FW_FLAG_V4 0x02 /* b43 vs. b43legacy */ |
||
6 | #define FW_FLAG_UNSUPPORTED 0x04 /* not supported/working */ |
||
7 | |||
8 | #define fwcutter_stringify_1(x) #x |
||
9 | #define fwcutter_stringify(x) fwcutter_stringify_1(x) |
||
10 | #define FWCUTTER_VERSION fwcutter_stringify(FWCUTTER_VERSION_) |
||
11 | |||
12 | #undef ARRAY_SIZE |
||
13 | #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) |
||
14 | |||
15 | typedef uint16_t be16_t; /* Big-endian 16bit */ |
||
16 | typedef uint32_t be32_t; /* Big-endian 32bit */ |
||
17 | |||
18 | #if defined(__DragonFly__) || defined(__FreeBSD__) |
||
19 | #define bswap_16 bswap16 |
||
20 | #define bswap_32 bswap32 |
||
21 | #endif |
||
22 | |||
23 | #define ARG_MATCH 0 |
||
24 | #define ARG_NOMATCH 1 |
||
25 | #define ARG_ERROR -1 |
||
26 | |||
27 | enum fwcutter_mode { |
||
28 | FWCM_EXTRACT = 0, /* default */ |
||
29 | FWCM_LIST, |
||
30 | FWCM_IDENTIFY, |
||
31 | }; |
||
32 | |||
33 | struct cmdline_args { |
||
34 | const char *infile; |
||
35 | const char *target_dir; |
||
36 | enum fwcutter_mode mode; |
||
37 | int unsupported; |
||
38 | }; |
||
39 | |||
40 | struct insn { |
||
41 | uint32_t opcode; |
||
42 | uint16_t op1, op2, op3; |
||
43 | }; |
||
44 | |||
45 | /* The IV how it's done in the binary driver files. */ |
||
46 | struct iv { |
||
47 | be16_t reg, size; |
||
48 | be32_t val; |
||
49 | } __attribute__((__packed__)); |
||
50 | |||
51 | enum extract_type { |
||
52 | EXT_UNDEFINED, /* error catcher */ |
||
53 | EXT_UCODE_1, /* rev <= 4 ucode */ |
||
54 | EXT_UCODE_2, /* rev 5..14 ucode */ |
||
55 | EXT_UCODE_3, /* rev >= 15 ucode */ |
||
56 | EXT_PCM, /* "pcm" values */ |
||
57 | EXT_IV, /* initial values */ |
||
58 | }; |
||
59 | |||
60 | struct extract { |
||
61 | const char *name; |
||
62 | const uint32_t offset; |
||
63 | const uint32_t length; |
||
64 | const enum extract_type type; |
||
65 | }; |
||
66 | |||
67 | #define EXTRACT_LIST_END { .name = NULL, } |
||
68 | |||
69 | struct file { |
||
70 | const char *name; |
||
71 | const char *ucode_version; |
||
72 | const char *md5; |
||
73 | const struct extract *extract; |
||
74 | const uint32_t flags; |
||
75 | }; |
||
76 | |||
77 | /* The header that's put in to every .fw file */ |
||
78 | struct fw_header { |
||
79 | /* Type of the firmware data */ |
||
80 | uint8_t type; |
||
81 | /* Version number of the firmware data format */ |
||
82 | uint8_t ver; |
||
83 | uint8_t __padding[2]; |
||
84 | /* Size of the data. For ucode and PCM this is in bytes. |
||
85 | * For IV this is in number-of-ivs. */ |
||
86 | be32_t size; |
||
87 | } __attribute__((__packed__)); |
||
88 | |||
89 | #define FW_TYPE_UCODE 'u' |
||
90 | #define FW_TYPE_PCM 'p' |
||
91 | #define FW_TYPE_IV 'i' |
||
92 | |||
93 | #define FW_HDR_VER 0x01 |
||
94 | |||
95 | /* The IV in the .fw file */ |
||
96 | struct b43_iv { |
||
97 | be16_t offset_size; |
||
98 | union { |
||
99 | be16_t d16; |
||
100 | be32_t d32; |
||
101 | } data __attribute__((__packed__)); |
||
102 | } __attribute__((__packed__)); |
||
103 | |||
104 | #define FW_IV_OFFSET_MASK 0x7FFF |
||
105 | #define FW_IV_32BIT 0x8000 |
||
106 | |||
107 | |||
108 | #endif /* _FWCUTTER_H_ */ |