Initial import from the website's tarball, on the 18th of october 2004
[islsm.git] / p54u_protocol.h
blobfa83bc7a663b61215e6ced6197268ddfa26745c7
1 #ifndef _HAVE_PROTOCOL_H
2 #define _HAVE_PROTOCOL_H
4 /* GPL */
5 /* jbnote */
6 #define P54U_NR_CHANNELS 14
7 #define P54U_CHANNEL_DEFS 8
8 /* this seems to be present
9 in all kinds of frames
10 received on data and mgmt pipes */
12 struct p54u_rx {
13 u16 length;
14 u8 padding[14];
15 void* data;
16 /* this can be p54u_mgmt_tx2 */
17 } __attribute__((packed));
19 struct p54u_tx
21 u32 magic1;
22 /* until i sort out what this means... */
23 #define P54U_TX_MAGIC1_CHANNEL 0x00020200
24 #define P54U_TX_MAGIC1_FILTER 0x00020200
25 #define P54U_TX_MAGIC1_80211 0x0002076c
26 u16 length;
27 u8 padding[10];
28 void *data;
29 /* this can be p54u_mgmt_tx */
30 } __attribute__((packed));
33 /* outgoing mgmt readback frames */
35 /* len is the length of the _next_ (tx2) data sent */
36 struct p54u_mgmt_tx1 {
37 u32 magic1;
38 #define P54U_TX1_MAGIC_1 0x02066c
39 u16 len;
40 u16 magic2;
41 #define P54U_TX1_MAGIC_2 0x2
42 u32 padding1;
43 u32 padding2;
44 } __attribute__ ((packed));
46 /* len is the length of the frame, including the
47 sub_pos and sub_len fields below, which i believe
48 are part of the lower-level frame */
49 /* this comes as payload of p54u_tx or p54u_rx */
50 struct p54u_mgmt_tx2 {
51 u16 magic1;
52 #define P54U_TX2_MAGIC_1 0x8000
53 u16 len;
54 u32 magic2;
55 //#define P54U_TX2_MAGIC_2_EVEN 0x81306510
56 //#define P54U_TX2_MAGIC_2_ODD 0x812f1130
57 #define P54U_TX2_MAGIC_2_EVEN 0x81288290
58 #define P54U_TX2_MAGIC_2_ODD 0x81328030
60 u32 magic3;
61 #define P54U_TX2_MAGIC_3 0xc
62 u16 sub_pos;
63 u16 sub_len;
64 void* data;
65 } __attribute__ ((packed));
68 /* incoming mgmt readback frame */
69 struct p54u_freq_struct1
71 u16 freq; /* in MHz */
72 u8 data[6];
73 } __attribute__ ((packed));
75 struct p54u_freq_substruct1
77 u16 head;
78 u8 tail;
79 } __attribute__ ((packed));
81 struct p54u_freq_struct2
83 u16 freq;
84 struct p54u_freq_substruct1 data[P54U_CHANNEL_DEFS];
85 } __attribute__ ((packed));
87 struct p54u_freq_struct3
89 u16 freq;
90 u8 data[8];
91 } __attribute__ ((packed));
93 /* this is payload for p54u_mgmt_tx2 */
94 struct p54u_mgmt_rx_header
96 u32 magic1;
97 u16 padding;
98 u16 preamble_length; /* this is null for linksys devices, but is not null for SMC dongles, for instance */
99 void* data;
100 } __attribute__ ((packed));
102 struct p54u_mgmt_rx_frame
104 u8 unknown1[0x2c];
105 u8 mac_addr[6];
106 u8 unknown2[0x32];
107 struct p54u_freq_struct1 l1[P54U_NR_CHANNELS];
108 u8 unknown3[8];
109 struct p54u_freq_struct2 l2[P54U_NR_CHANNELS];
110 u8 unknown4[4];
111 struct p54u_freq_struct3 l3[P54U_NR_CHANNELS];
112 u8 unknown5[0x24];
113 u16 crc;
114 } __attribute__ ((packed));
118 * protocol definitions, data frames
121 /* this is payload of p54u_tx */
122 struct p54u_tx_control
124 u16 magic1;
125 /* response triggers a response on the management pipe */
126 #define P54U_TX_CONTROL_NORESPONSE 0x8001
127 #define P54U_TX_CONTROL_RESPONSE 0x8010
128 u16 length;
129 u32 magic2;
130 u32 magic3;
131 void *data;
132 } __attribute__ ((packed));
135 struct p54u_freq_substruct2
137 u16 head;
138 u8 subtails[4];
139 u8 tail;
140 u8 padding; /* zero */
141 } __attribute__ ((packed));
143 /* this comes as the payload of p54u_tx_control */
144 struct p54u_tx_control_channel
146 u32 magic1;
147 #define P54U_TX_CONTROL_CHANNEL_MAGIC1_SCAN 0x00780002
148 #define P54U_TX_CONTROL_CHANNEL_MAGIC1_DEFAULT 0x00280006
149 u8 padding1[20];
150 struct p54u_freq_struct3 freq; /* directly from l3 */
151 u16 unknown1; /* field unknown, the only one !*/
152 u8 l1data[4]; /* filled with values from l1 */
153 struct p54u_freq_substruct2 str[P54U_CHANNEL_DEFS]; /* filled with values from p54u_freq_struct1 from l2 */
154 u32 padding; /* filled with 0 in old firmware, nothing in new */
155 } __attribute__ ((packed));
157 #define FULL_TX_CONTROL_CHANNEL sizeof(struct p54u_tx) - sizeof(void*) + sizeof(struct p54u_tx_control) - sizeof(void*) + sizeof(struct p54u_tx_control_channel)
159 #define FULL_TX_CONTROL_FILTER 0x44
160 /* this also comes as the payload of p54u_tx_control */
161 struct p54u_tx_control_filter
163 u16 unknown1;
164 u8 destination[ETH_ALEN];
165 u8 source[ETH_ALEN];
166 /* I can see the breakup but can't tell what it means */
167 void *data;
168 } __attribute__ ((packed));
171 #endif /* _HAVE_PROTOCOL_H */