fwcutter: Update .gitignore
[b43-tools.git] / ssb_sprom / ssb_sprom.h
1 /*
2
3   Broadcom Sonics Silicon Backplane bus SPROM data modification tool
4
5   Copyright (c) 2006-2007 Michael Buesch <mb@bu3sch.de>
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2 of the License, or
10   (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program; see the file COPYING.  If not, write to
19   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20   Boston, MA 02110-1301, USA.
21
22 */
23
24 #ifndef SSB_SPROMTOOL_H_
25 #define SSB_SPROMTOOL_H_
26
27 #include "utils.h"
28
29
30 #define SPROM_SIZE              128 /* bytes */
31 #define SPROM4_SIZE             440
32
33 enum valuetype {
34         VAL_RAW,
35
36         VAL_ET0PHY,
37         VAL_ET1PHY,
38         VAL_ET0MDC,
39         VAL_ET1MDC,
40         VAL_BREV,
41         VAL_ANTBG0,
42         VAL_ANTBG1,
43         VAL_ANTBG2,
44         VAL_ANTBG3,
45         VAL_ANTA0,
46         VAL_ANTA1,
47         VAL_ANTA2,
48         VAL_ANTA3,
49         VAL_ANTGBG,
50         VAL_ANTGA,
51         VAL_ANTG0,
52         VAL_ANTG1,
53         VAL_ANTG2,
54         VAL_ANTG3,
55         VAL_TPI2G0,
56         VAL_TPI2G1,
57         VAL_TPI5GM0,
58         VAL_TPI5GM1,
59         VAL_TPI5GL0,
60         VAL_TPI5GL1,
61         VAL_TPI5GH0,
62         VAL_TPI5GH1,
63         VAL_2CCKPO,
64         VAL_2OFDMPO,
65         VAL_5MPO,
66         VAL_5LPO,
67         VAL_5HPO,
68         VAL_2MCSPO,
69         VAL_5MMCSPO,
70         VAL_5LMCSPO,
71         VAL_5HMCSPO,
72         VAL_CCDPO,
73         VAL_STBCPO,
74         VAL_BW40PO,
75         VAL_BWDUPPO,
76         VAL_5HPAM,
77         VAL_5LPAM,
78         VAL_PA0B0,
79         VAL_PA0B1,
80         VAL_PA0B2,
81         VAL_PA0B3,
82         VAL_PA1B0,
83         VAL_PA1B1,
84         VAL_PA1B2,
85         VAL_PA1B3,
86         VAL_5MPA0,
87         VAL_5MPA1,
88         VAL_5MPA2,
89         VAL_5MPA3,
90         VAL_5LPA0,
91         VAL_5LPA1,
92         VAL_5LPA2,
93         VAL_5LPA3,
94         VAL_5HPA0,
95         VAL_5HPA1,
96         VAL_5HPA2,
97         VAL_5HPA3,
98         VAL_LED0,
99         VAL_LED1,
100         VAL_LED2,
101         VAL_LED3,
102         VAL_MAXPBG,
103         VAL_MAXPA,
104         VAL_ITSSIBG,
105         VAL_ITSSIA,
106         VAL_BGMAC,
107         VAL_ETMAC,
108         VAL_AMAC,
109         VAL_SUBP,
110         VAL_SUBV,
111         VAL_PPID,
112         VAL_BFLHI,
113         VAL_BFL,
114         VAL_REGREV,
115         VAL_LOC,
116  VAL_LAST = VAL_LOC,
117 };
118
119 #define BIT(i)  (1U << (i))
120
121 #define MASK_1  BIT(1)
122 #define MASK_2  BIT(2)
123 #define MASK_3  BIT(3)
124 #define MASK_4  BIT(4)
125 #define MASK_5  BIT(5)
126 #define MASK_8  BIT(8)
127
128 #define MASK_1_2  MASK_1 | MASK_2       /* Revs 1 - 2 */
129 #define MASK_1_3  MASK_1_2 | MASK_3     /* Revs 1 - 3 */
130 #define MASK_2_3  MASK_2 | MASK_3       /* Revs 2 - 3 */
131 #define MASK_4_5  MASK_4 | MASK_5       /* Revs 4 - 5 */
132 #define MASK_1_5  MASK_1_3 | MASK_4_5   /* Revs 1 - 5 */
133 #define MASK_1_8  MASK_1_5 | MASK_8     /* Revs 1 - 5, 8 */
134
135 struct cmdline_vparm {
136         enum valuetype type;
137         int set;
138         int bits;
139         union {
140                 uint32_t value;
141                 uint8_t mac[6];
142                 char ccode[2];
143                 struct {
144                         uint16_t value;
145                         uint16_t offset;
146                 } raw;
147         } u;
148 };
149
150 struct cmdline_args {
151         const char *infile;
152         const char *outfile;
153         int verbose;
154         int force;
155         int bin_mode;
156
157 #define MAX_VPARM       512
158         struct cmdline_vparm vparm[MAX_VPARM];
159         int nr_vparm;
160 };
161
162 struct var_entry {
163         uint16_t rev_mask;
164         enum valuetype type;
165         uint16_t length;
166         uint16_t offset;
167         uint16_t mask;
168         uint16_t shift;
169         const char *desc;
170         const char *label;
171 };
172
173 extern struct cmdline_args cmdargs;
174
175 #endif /* SSB_SPROMTOOL_H_ */