Initial commit.
[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 Steet, 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 #define VERSION                 ssb_stringify(VERSION_)
30
31 #define SPROM_SIZE              128 /* bytes */
32
33 /* byte offsets */
34 #define SPROM_SUBP              (0x02 * 2)
35 #define SPROM_SUBV              (0x03 * 2)
36 #define SPROM_PPID              (0x04 * 2)
37 #define SPROM_BFLHI             (0x1C * 2)
38 #define SPROM_IL0MACADDR        (0x24 * 2)
39 #define SPROM_ET0MACADDR        (0x27 * 2)
40 #define SPROM_ET1MACADDR        (0x2a * 2)
41 #define SPROM_ETHPHY            (0x2d * 2)
42 #define SPROM_BOARDREV          (0x2e * 2)
43 #define SPROM_PA0B0             (0x2f * 2)
44 #define SPROM_PA0B1             (0x30 * 2)
45 #define SPROM_PA0B2             (0x31 * 2)
46 #define SPROM_WL0GPIO0          (0x32 * 2)
47 #define SPROM_WL0GPIO2          (0x33 * 2)
48 #define SPROM_MAXPWR            (0x34 * 2)
49 #define SPROM_PA1B0             (0x35 * 2)
50 #define SPROM_PA1B1             (0x36 * 2)
51 #define SPROM_PA1B2             (0x37 * 2)
52 #define SPROM_IDL_TSSI_TGT      (0x38 * 2)
53 #define SPROM_BOARDFLAGS        (0x39 * 2)
54 #define SPROM_ANTENNA_GAIN      (0x3a * 2)
55 #define SPROM_VERSION           (0x3f * 2)
56
57 enum valuetype {
58         VALUE_RAW,
59
60         VALUE_SUBP,
61  VALUE_FIRST = VALUE_SUBP,
62         VALUE_SUBV,
63         VALUE_PPID,
64         VALUE_BFLHI,
65         VALUE_BFL,
66         VALUE_BGMAC,
67         VALUE_ETMAC,
68         VALUE_AMAC,
69         VALUE_ET0PHY,
70         VALUE_ET1PHY,
71         VALUE_ET0MDC,
72         VALUE_ET1MDC,
73         VALUE_BREV,
74         VALUE_LOC,
75         VALUE_ANTA0,
76         VALUE_ANTA1,
77         VALUE_ANTBG0,
78         VALUE_ANTBG1,
79         VALUE_ANTGA,
80         VALUE_ANTGBG,
81         VALUE_PA0B0,
82         VALUE_PA0B1,
83         VALUE_PA0B2,
84         VALUE_PA1B0,
85         VALUE_PA1B1,
86         VALUE_PA1B2,
87         VALUE_WL0GPIO0,
88         VALUE_WL0GPIO1,
89         VALUE_WL0GPIO2,
90         VALUE_WL0GPIO3,
91         VALUE_MAXPA,
92         VALUE_MAXPBG,
93         VALUE_ITSSIA,
94         VALUE_ITSSIBG,
95         VALUE_SVER,
96  VALUE_LAST = VALUE_SVER,
97 };
98
99 struct cmdline_vparm {
100         enum valuetype type;
101         int set;
102         int bits;
103         union {
104                 uint16_t value;
105                 uint8_t mac[6];
106                 struct {
107                         uint8_t value;
108                         uint8_t offset;
109                 } raw;
110         } u;
111 };
112
113 struct cmdline_args {
114         const char *infile;
115         const char *outfile;
116         int verbose;
117         int force;
118         int bin_mode;
119
120 #define MAX_VPARM       512
121         struct cmdline_vparm vparm[MAX_VPARM];
122         int nr_vparm;
123 };
124 extern struct cmdline_args cmdargs;
125
126 #endif /* SSB_SPROMTOOL_H_ */