Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux...
[pandora-kernel.git] / include / linux / uwb / spec.h
1 /*
2  * Ultra Wide Band
3  * UWB Standard definitions
4  *
5  * Copyright (C) 2005-2006 Intel Corporation
6  * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License version
10  * 2 as published by the Free Software Foundation.
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; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  * 02110-1301, USA.
21  *
22  *
23  * All these definitions are based on the ECMA-368 standard.
24  *
25  * Note all definitions are Little Endian in the wire, and we will
26  * convert them to host order before operating on the bitfields (that
27  * yes, we use extensively).
28  */
29
30 #ifndef __LINUX__UWB_SPEC_H__
31 #define __LINUX__UWB_SPEC_H__
32
33 #include <linux/types.h>
34 #include <linux/bitmap.h>
35
36 #define i1480_FW 0x00000303
37 /* #define i1480_FW 0x00000302 */
38
39 /**
40  * Number of Medium Access Slots in a superframe.
41  *
42  * UWB divides time in SuperFrames, each one divided in 256 pieces, or
43  * Medium Access Slots. See MBOA MAC[5.4.5] for details. The MAS is the
44  * basic bandwidth allocation unit in UWB.
45  */
46 enum { UWB_NUM_MAS = 256 };
47
48 /**
49  * Number of Zones in superframe.
50  *
51  * UWB divides the superframe into zones with numbering starting from BPST.
52  * See MBOA MAC[16.8.6]
53  */
54 enum { UWB_NUM_ZONES = 16 };
55
56 /*
57  * Number of MAS in a zone.
58  */
59 #define UWB_MAS_PER_ZONE (UWB_NUM_MAS / UWB_NUM_ZONES)
60
61 /*
62  * Number of streams per DRP reservation between a pair of devices.
63  *
64  * [ECMA-368] section 16.8.6.
65  */
66 enum { UWB_NUM_STREAMS = 8 };
67
68 /*
69  * mMasLength
70  *
71  * The length of a MAS in microseconds.
72  *
73  * [ECMA-368] section 17.16.
74  */
75 enum { UWB_MAS_LENGTH_US = 256 };
76
77 /*
78  * mBeaconSlotLength
79  *
80  * The length of the beacon slot in microseconds.
81  *
82  * [ECMA-368] section 17.16
83  */
84 enum { UWB_BEACON_SLOT_LENGTH_US = 85 };
85
86 /*
87  * mMaxLostBeacons
88  *
89  * The number beacons missing in consecutive superframes before a
90  * device can be considered as unreachable.
91  *
92  * [ECMA-368] section 17.16
93  */
94 enum { UWB_MAX_LOST_BEACONS = 3 };
95
96 /*
97  * Length of a superframe in microseconds.
98  */
99 #define UWB_SUPERFRAME_LENGTH_US (UWB_MAS_LENGTH_US * UWB_NUM_MAS)
100
101 /**
102  * UWB MAC address
103  *
104  * It is *imperative* that this struct is exactly 6 packed bytes (as
105  * it is also used to define headers sent down and up the wire/radio).
106  */
107 struct uwb_mac_addr {
108         u8 data[6];
109 } __attribute__((packed));
110
111
112 /**
113  * UWB device address
114  *
115  * It is *imperative* that this struct is exactly 6 packed bytes (as
116  * it is also used to define headers sent down and up the wire/radio).
117  */
118 struct uwb_dev_addr {
119         u8 data[2];
120 } __attribute__((packed));
121
122
123 /**
124  * Types of UWB addresses
125  *
126  * Order matters (by size).
127  */
128 enum uwb_addr_type {
129         UWB_ADDR_DEV = 0,
130         UWB_ADDR_MAC = 1,
131 };
132
133
134 /** Size of a char buffer for printing a MAC/device address */
135 enum { UWB_ADDR_STRSIZE = 32 };
136
137
138 /** UWB WiMedia protocol IDs. */
139 enum uwb_prid {
140         UWB_PRID_WLP_RESERVED   = 0x0000,
141         UWB_PRID_WLP            = 0x0001,
142         UWB_PRID_WUSB_BOT       = 0x0010,
143         UWB_PRID_WUSB           = 0x0010,
144         UWB_PRID_WUSB_TOP       = 0x001F,
145 };
146
147
148 /** PHY Rate (MBOA MAC[7.8.12, Table 61]) */
149 enum uwb_phy_rate {
150         UWB_PHY_RATE_53 = 0,
151         UWB_PHY_RATE_80,
152         UWB_PHY_RATE_106,
153         UWB_PHY_RATE_160,
154         UWB_PHY_RATE_200,
155         UWB_PHY_RATE_320,
156         UWB_PHY_RATE_400,
157         UWB_PHY_RATE_480,
158         UWB_PHY_RATE_INVALID
159 };
160
161
162 /**
163  * Different ways to scan (MBOA MAC[6.2.2, Table 8], WUSB[Table 8-78])
164  */
165 enum uwb_scan_type {
166         UWB_SCAN_ONLY = 0,
167         UWB_SCAN_OUTSIDE_BP,
168         UWB_SCAN_WHILE_INACTIVE,
169         UWB_SCAN_DISABLED,
170         UWB_SCAN_ONLY_STARTTIME,
171         UWB_SCAN_TOP
172 };
173
174
175 /** ACK Policy types (MBOA MAC[7.2.1.3]) */
176 enum uwb_ack_pol {
177         UWB_ACK_NO = 0,
178         UWB_ACK_INM = 1,
179         UWB_ACK_B = 2,
180         UWB_ACK_B_REQ = 3,
181 };
182
183
184 /** DRP reservation types ([ECMA-368 table 106) */
185 enum uwb_drp_type {
186         UWB_DRP_TYPE_ALIEN_BP = 0,
187         UWB_DRP_TYPE_HARD,
188         UWB_DRP_TYPE_SOFT,
189         UWB_DRP_TYPE_PRIVATE,
190         UWB_DRP_TYPE_PCA,
191 };
192
193
194 /** DRP Reason Codes ([ECMA-368] table 107) */
195 enum uwb_drp_reason {
196         UWB_DRP_REASON_ACCEPTED = 0,
197         UWB_DRP_REASON_CONFLICT,
198         UWB_DRP_REASON_PENDING,
199         UWB_DRP_REASON_DENIED,
200         UWB_DRP_REASON_MODIFIED,
201 };
202
203 /** Relinquish Request Reason Codes ([ECMA-368] table 113) */
204 enum uwb_relinquish_req_reason {
205         UWB_RELINQUISH_REQ_REASON_NON_SPECIFIC = 0,
206         UWB_RELINQUISH_REQ_REASON_OVER_ALLOCATION,
207 };
208
209 /**
210  *  DRP Notification Reason Codes (WHCI 0.95 [3.1.4.9])
211  */
212 enum uwb_drp_notif_reason {
213         UWB_DRP_NOTIF_DRP_IE_RCVD = 0,
214         UWB_DRP_NOTIF_CONFLICT,
215         UWB_DRP_NOTIF_TERMINATE,
216 };
217
218
219 /** Allocation of MAS slots in a DRP request MBOA MAC[7.8.7] */
220 struct uwb_drp_alloc {
221         __le16 zone_bm;
222         __le16 mas_bm;
223 } __attribute__((packed));
224
225
226 /** General MAC Header format (ECMA-368[16.2]) */
227 struct uwb_mac_frame_hdr {
228         __le16 Frame_Control;
229         struct uwb_dev_addr DestAddr;
230         struct uwb_dev_addr SrcAddr;
231         __le16 Sequence_Control;
232         __le16 Access_Information;
233 } __attribute__((packed));
234
235
236 /**
237  * uwb_beacon_frame - a beacon frame including MAC headers
238  *
239  * [ECMA] section 16.3.
240  */
241 struct uwb_beacon_frame {
242         struct uwb_mac_frame_hdr hdr;
243         struct uwb_mac_addr Device_Identifier;  /* may be a NULL EUI-48 */
244         u8 Beacon_Slot_Number;
245         u8 Device_Control;
246         u8 IEData[];
247 } __attribute__((packed));
248
249
250 /** Information Element codes (MBOA MAC[T54]) */
251 enum uwb_ie {
252         UWB_PCA_AVAILABILITY = 2,
253         UWB_IE_DRP_AVAILABILITY = 8,
254         UWB_IE_DRP = 9,
255         UWB_BP_SWITCH_IE = 11,
256         UWB_MAC_CAPABILITIES_IE = 12,
257         UWB_PHY_CAPABILITIES_IE = 13,
258         UWB_APP_SPEC_PROBE_IE = 15,
259         UWB_IDENTIFICATION_IE = 19,
260         UWB_MASTER_KEY_ID_IE = 20,
261         UWB_RELINQUISH_REQUEST_IE = 21,
262         UWB_IE_WLP = 250, /* WiMedia Logical Link Control Protocol WLP 0.99 */
263         UWB_APP_SPEC_IE = 255,
264 };
265
266
267 /**
268  * Header common to all Information Elements (IEs)
269  */
270 struct uwb_ie_hdr {
271         u8 element_id;  /* enum uwb_ie */
272         u8 length;
273 } __attribute__((packed));
274
275
276 /** Dynamic Reservation Protocol IE (MBOA MAC[7.8.6]) */
277 struct uwb_ie_drp {
278         struct uwb_ie_hdr       hdr;
279         __le16                  drp_control;
280         struct uwb_dev_addr     dev_addr;
281         struct uwb_drp_alloc    allocs[];
282 } __attribute__((packed));
283
284 static inline int uwb_ie_drp_type(struct uwb_ie_drp *ie)
285 {
286         return (le16_to_cpu(ie->drp_control) >> 0) & 0x7;
287 }
288
289 static inline int uwb_ie_drp_stream_index(struct uwb_ie_drp *ie)
290 {
291         return (le16_to_cpu(ie->drp_control) >> 3) & 0x7;
292 }
293
294 static inline int uwb_ie_drp_reason_code(struct uwb_ie_drp *ie)
295 {
296         return (le16_to_cpu(ie->drp_control) >> 6) & 0x7;
297 }
298
299 static inline int uwb_ie_drp_status(struct uwb_ie_drp *ie)
300 {
301         return (le16_to_cpu(ie->drp_control) >> 9) & 0x1;
302 }
303
304 static inline int uwb_ie_drp_owner(struct uwb_ie_drp *ie)
305 {
306         return (le16_to_cpu(ie->drp_control) >> 10) & 0x1;
307 }
308
309 static inline int uwb_ie_drp_tiebreaker(struct uwb_ie_drp *ie)
310 {
311         return (le16_to_cpu(ie->drp_control) >> 11) & 0x1;
312 }
313
314 static inline int uwb_ie_drp_unsafe(struct uwb_ie_drp *ie)
315 {
316         return (le16_to_cpu(ie->drp_control) >> 12) & 0x1;
317 }
318
319 static inline void uwb_ie_drp_set_type(struct uwb_ie_drp *ie, enum uwb_drp_type type)
320 {
321         u16 drp_control = le16_to_cpu(ie->drp_control);
322         drp_control = (drp_control & ~(0x7 << 0)) | (type << 0);
323         ie->drp_control = cpu_to_le16(drp_control);
324 }
325
326 static inline void uwb_ie_drp_set_stream_index(struct uwb_ie_drp *ie, int stream_index)
327 {
328         u16 drp_control = le16_to_cpu(ie->drp_control);
329         drp_control = (drp_control & ~(0x7 << 3)) | (stream_index << 3);
330         ie->drp_control = cpu_to_le16(drp_control);
331 }
332
333 static inline void uwb_ie_drp_set_reason_code(struct uwb_ie_drp *ie,
334                                        enum uwb_drp_reason reason_code)
335 {
336         u16 drp_control = le16_to_cpu(ie->drp_control);
337         drp_control = (ie->drp_control & ~(0x7 << 6)) | (reason_code << 6);
338         ie->drp_control = cpu_to_le16(drp_control);
339 }
340
341 static inline void uwb_ie_drp_set_status(struct uwb_ie_drp *ie, int status)
342 {
343         u16 drp_control = le16_to_cpu(ie->drp_control);
344         drp_control = (drp_control & ~(0x1 << 9)) | (status << 9);
345         ie->drp_control = cpu_to_le16(drp_control);
346 }
347
348 static inline void uwb_ie_drp_set_owner(struct uwb_ie_drp *ie, int owner)
349 {
350         u16 drp_control = le16_to_cpu(ie->drp_control);
351         drp_control = (drp_control & ~(0x1 << 10)) | (owner << 10);
352         ie->drp_control = cpu_to_le16(drp_control);
353 }
354
355 static inline void uwb_ie_drp_set_tiebreaker(struct uwb_ie_drp *ie, int tiebreaker)
356 {
357         u16 drp_control = le16_to_cpu(ie->drp_control);
358         drp_control = (drp_control & ~(0x1 << 11)) | (tiebreaker << 11);
359         ie->drp_control = cpu_to_le16(drp_control);
360 }
361
362 static inline void uwb_ie_drp_set_unsafe(struct uwb_ie_drp *ie, int unsafe)
363 {
364         u16 drp_control = le16_to_cpu(ie->drp_control);
365         drp_control = (drp_control & ~(0x1 << 12)) | (unsafe << 12);
366         ie->drp_control = cpu_to_le16(drp_control);
367 }
368
369 /** Dynamic Reservation Protocol IE (MBOA MAC[7.8.7]) */
370 struct uwb_ie_drp_avail {
371         struct uwb_ie_hdr       hdr;
372         DECLARE_BITMAP(bmp, UWB_NUM_MAS);
373 } __attribute__((packed));
374
375 /* Relinqish Request IE ([ECMA-368] section 16.8.19). */
376 struct uwb_relinquish_request_ie {
377         struct uwb_ie_hdr       hdr;
378         __le16                  relinquish_req_control;
379         struct uwb_dev_addr     dev_addr;
380         struct uwb_drp_alloc    allocs[];
381 } __attribute__((packed));
382
383 static inline int uwb_ie_relinquish_req_reason_code(struct uwb_relinquish_request_ie *ie)
384 {
385         return (le16_to_cpu(ie->relinquish_req_control) >> 0) & 0xf;
386 }
387
388 static inline void uwb_ie_relinquish_req_set_reason_code(struct uwb_relinquish_request_ie *ie,
389                                                          int reason_code)
390 {
391         u16 ctrl = le16_to_cpu(ie->relinquish_req_control);
392         ctrl = (ctrl & ~(0xf << 0)) | (reason_code << 0);
393         ie->relinquish_req_control = cpu_to_le16(ctrl);
394 }
395
396 /**
397  * The Vendor ID is set to an OUI that indicates the vendor of the device.
398  * ECMA-368 [16.8.10]
399  */
400 struct uwb_vendor_id {
401         u8 data[3];
402 } __attribute__((packed));
403
404 /**
405  * The device type ID
406  * FIXME: clarify what this means
407  * ECMA-368 [16.8.10]
408  */
409 struct uwb_device_type_id {
410         u8 data[3];
411 } __attribute__((packed));
412
413
414 /**
415  * UWB device information types
416  * ECMA-368 [16.8.10]
417  */
418 enum uwb_dev_info_type {
419         UWB_DEV_INFO_VENDOR_ID = 0,
420         UWB_DEV_INFO_VENDOR_TYPE,
421         UWB_DEV_INFO_NAME,
422 };
423
424 /**
425  * UWB device information found in Identification IE
426  * ECMA-368 [16.8.10]
427  */
428 struct uwb_dev_info {
429         u8 type;        /* enum uwb_dev_info_type */
430         u8 length;
431         u8 data[];
432 } __attribute__((packed));
433
434 /**
435  * UWB Identification IE
436  * ECMA-368 [16.8.10]
437  */
438 struct uwb_identification_ie {
439         struct uwb_ie_hdr hdr;
440         struct uwb_dev_info info[];
441 } __attribute__((packed));
442
443 /*
444  * UWB Radio Controller
445  *
446  * These definitions are common to the Radio Control layers as
447  * exported by the WUSB1.0 HWA and WHCI interfaces.
448  */
449
450 /** Radio Control Command Block (WUSB1.0[Table 8-65] and WHCI 0.95) */
451 struct uwb_rccb {
452         u8 bCommandType;                /* enum hwa_cet */
453         __le16 wCommand;                /* Command code */
454         u8 bCommandContext;             /* Context ID */
455 } __attribute__((packed));
456
457
458 /** Radio Control Event Block (WUSB[table 8-66], WHCI 0.95) */
459 struct uwb_rceb {
460         u8 bEventType;                  /* enum hwa_cet */
461         __le16 wEvent;                  /* Event code */
462         u8 bEventContext;               /* Context ID */
463 } __attribute__((packed));
464
465
466 enum {
467         UWB_RC_CET_GENERAL = 0,         /* General Command/Event type */
468         UWB_RC_CET_EX_TYPE_1 = 1,       /* Extended Type 1 Command/Event type */
469 };
470
471 /* Commands to the radio controller */
472 enum uwb_rc_cmd {
473         UWB_RC_CMD_CHANNEL_CHANGE = 16,
474         UWB_RC_CMD_DEV_ADDR_MGMT = 17,  /* Device Address Management */
475         UWB_RC_CMD_GET_IE = 18,         /* GET Information Elements */
476         UWB_RC_CMD_RESET = 19,
477         UWB_RC_CMD_SCAN = 20,           /* Scan management  */
478         UWB_RC_CMD_SET_BEACON_FILTER = 21,
479         UWB_RC_CMD_SET_DRP_IE = 22,     /* Dynamic Reservation Protocol IEs */
480         UWB_RC_CMD_SET_IE = 23,         /* Information Element management */
481         UWB_RC_CMD_SET_NOTIFICATION_FILTER = 24,
482         UWB_RC_CMD_SET_TX_POWER = 25,
483         UWB_RC_CMD_SLEEP = 26,
484         UWB_RC_CMD_START_BEACON = 27,
485         UWB_RC_CMD_STOP_BEACON = 28,
486         UWB_RC_CMD_BP_MERGE = 29,
487         UWB_RC_CMD_SEND_COMMAND_FRAME = 30,
488         UWB_RC_CMD_SET_ASIE_NOTIF = 31,
489 };
490
491 /* Notifications from the radio controller */
492 enum uwb_rc_evt {
493         UWB_RC_EVT_IE_RCV = 0,
494         UWB_RC_EVT_BEACON = 1,
495         UWB_RC_EVT_BEACON_SIZE = 2,
496         UWB_RC_EVT_BPOIE_CHANGE = 3,
497         UWB_RC_EVT_BP_SLOT_CHANGE = 4,
498         UWB_RC_EVT_BP_SWITCH_IE_RCV = 5,
499         UWB_RC_EVT_DEV_ADDR_CONFLICT = 6,
500         UWB_RC_EVT_DRP_AVAIL = 7,
501         UWB_RC_EVT_DRP = 8,
502         UWB_RC_EVT_BP_SWITCH_STATUS = 9,
503         UWB_RC_EVT_CMD_FRAME_RCV = 10,
504         UWB_RC_EVT_CHANNEL_CHANGE_IE_RCV = 11,
505         /* Events (command responses) use the same code as the command */
506         UWB_RC_EVT_UNKNOWN_CMD_RCV = 65535,
507 };
508
509 enum uwb_rc_extended_type_1_cmd {
510         UWB_RC_SET_DAA_ENERGY_MASK = 32,
511         UWB_RC_SET_NOTIFICATION_FILTER_EX = 33,
512 };
513
514 enum uwb_rc_extended_type_1_evt {
515         UWB_RC_DAA_ENERGY_DETECTED = 0,
516 };
517
518 /* Radio Control Result Code. [WHCI] table 3-3. */
519 enum {
520         UWB_RC_RES_SUCCESS = 0,
521         UWB_RC_RES_FAIL,
522         UWB_RC_RES_FAIL_HARDWARE,
523         UWB_RC_RES_FAIL_NO_SLOTS,
524         UWB_RC_RES_FAIL_BEACON_TOO_LARGE,
525         UWB_RC_RES_FAIL_INVALID_PARAMETER,
526         UWB_RC_RES_FAIL_UNSUPPORTED_PWR_LEVEL,
527         UWB_RC_RES_FAIL_INVALID_IE_DATA,
528         UWB_RC_RES_FAIL_BEACON_SIZE_EXCEEDED,
529         UWB_RC_RES_FAIL_CANCELLED,
530         UWB_RC_RES_FAIL_INVALID_STATE,
531         UWB_RC_RES_FAIL_INVALID_SIZE,
532         UWB_RC_RES_FAIL_ACK_NOT_RECEIVED,
533         UWB_RC_RES_FAIL_NO_MORE_ASIE_NOTIF,
534         UWB_RC_RES_FAIL_TIME_OUT = 255,
535 };
536
537 /* Confirm event. [WHCI] section 3.1.3.1 etc. */
538 struct uwb_rc_evt_confirm {
539         struct uwb_rceb rceb;
540         u8 bResultCode;
541 } __attribute__((packed));
542
543 /* Device Address Management event. [WHCI] section 3.1.3.2. */
544 struct uwb_rc_evt_dev_addr_mgmt {
545         struct uwb_rceb rceb;
546         u8 baAddr[6];
547         u8 bResultCode;
548 } __attribute__((packed));
549
550
551 /* Get IE Event. [WHCI] section 3.1.3.3. */
552 struct uwb_rc_evt_get_ie {
553         struct uwb_rceb rceb;
554         __le16 wIELength;
555         u8 IEData[];
556 } __attribute__((packed));
557
558 /* Set DRP IE Event. [WHCI] section 3.1.3.7. */
559 struct uwb_rc_evt_set_drp_ie {
560         struct uwb_rceb rceb;
561         __le16 wRemainingSpace;
562         u8 bResultCode;
563 } __attribute__((packed));
564
565 /* Set IE Event. [WHCI] section 3.1.3.8. */
566 struct uwb_rc_evt_set_ie {
567         struct uwb_rceb rceb;
568         __le16 RemainingSpace;
569         u8 bResultCode;
570 } __attribute__((packed));
571
572 /* Scan command. [WHCI] 3.1.3.5. */
573 struct uwb_rc_cmd_scan {
574         struct uwb_rccb rccb;
575         u8 bChannelNumber;
576         u8 bScanState;
577         __le16 wStartTime;
578 } __attribute__((packed));
579
580 /* Set DRP IE command. [WHCI] section 3.1.3.7. */
581 struct uwb_rc_cmd_set_drp_ie {
582         struct uwb_rccb rccb;
583         __le16 wIELength;
584         struct uwb_ie_drp IEData[];
585 } __attribute__((packed));
586
587 /* Set IE command. [WHCI] section 3.1.3.8. */
588 struct uwb_rc_cmd_set_ie {
589         struct uwb_rccb rccb;
590         __le16 wIELength;
591         u8 IEData[];
592 } __attribute__((packed));
593
594 /* Set DAA Energy Mask event. [WHCI 0.96] section 3.1.3.17. */
595 struct uwb_rc_evt_set_daa_energy_mask {
596         struct uwb_rceb rceb;
597         __le16 wLength;
598         u8 result;
599 } __attribute__((packed));
600
601 /* Set Notification Filter Extended event. [WHCI 0.96] section 3.1.3.18. */
602 struct uwb_rc_evt_set_notification_filter_ex {
603         struct uwb_rceb rceb;
604         __le16 wLength;
605         u8 result;
606 } __attribute__((packed));
607
608 /* IE Received notification. [WHCI] section 3.1.4.1. */
609 struct uwb_rc_evt_ie_rcv {
610         struct uwb_rceb rceb;
611         struct uwb_dev_addr SrcAddr;
612         __le16 wIELength;
613         u8 IEData[];
614 } __attribute__((packed));
615
616 /* Type of the received beacon. [WHCI] section 3.1.4.2. */
617 enum uwb_rc_beacon_type {
618         UWB_RC_BEACON_TYPE_SCAN = 0,
619         UWB_RC_BEACON_TYPE_NEIGHBOR,
620         UWB_RC_BEACON_TYPE_OL_ALIEN,
621         UWB_RC_BEACON_TYPE_NOL_ALIEN,
622 };
623
624 /* Beacon received notification. [WHCI] 3.1.4.2. */
625 struct uwb_rc_evt_beacon {
626         struct uwb_rceb rceb;
627         u8      bChannelNumber;
628         u8      bBeaconType;
629         __le16  wBPSTOffset;
630         u8      bLQI;
631         u8      bRSSI;
632         __le16  wBeaconInfoLength;
633         u8      BeaconInfo[];
634 } __attribute__((packed));
635
636
637 /* Beacon Size Change notification. [WHCI] section 3.1.4.3 */
638 struct uwb_rc_evt_beacon_size {
639         struct uwb_rceb rceb;
640         __le16 wNewBeaconSize;
641 } __attribute__((packed));
642
643
644 /* BPOIE Change notification. [WHCI] section 3.1.4.4. */
645 struct uwb_rc_evt_bpoie_change {
646         struct uwb_rceb rceb;
647         __le16 wBPOIELength;
648         u8 BPOIE[];
649 } __attribute__((packed));
650
651
652 /* Beacon Slot Change notification. [WHCI] section 3.1.4.5. */
653 struct uwb_rc_evt_bp_slot_change {
654         struct uwb_rceb rceb;
655         u8 slot_info;
656 } __attribute__((packed));
657
658 static inline int uwb_rc_evt_bp_slot_change_slot_num(
659         const struct uwb_rc_evt_bp_slot_change *evt)
660 {
661         return evt->slot_info & 0x7f;
662 }
663
664 static inline int uwb_rc_evt_bp_slot_change_no_slot(
665         const struct uwb_rc_evt_bp_slot_change *evt)
666 {
667         return (evt->slot_info & 0x80) >> 7;
668 }
669
670 /* BP Switch IE Received notification. [WHCI] section 3.1.4.6. */
671 struct uwb_rc_evt_bp_switch_ie_rcv {
672         struct uwb_rceb rceb;
673         struct uwb_dev_addr wSrcAddr;
674         __le16 wIELength;
675         u8 IEData[];
676 } __attribute__((packed));
677
678 /* DevAddr Conflict notification. [WHCI] section 3.1.4.7. */
679 struct uwb_rc_evt_dev_addr_conflict {
680         struct uwb_rceb rceb;
681 } __attribute__((packed));
682
683 /* DRP notification. [WHCI] section 3.1.4.9. */
684 struct uwb_rc_evt_drp {
685         struct uwb_rceb           rceb;
686         struct uwb_dev_addr       src_addr;
687         u8                        reason;
688         u8                        beacon_slot_number;
689         __le16                    ie_length;
690         u8                        ie_data[];
691 } __attribute__((packed));
692
693 static inline enum uwb_drp_notif_reason uwb_rc_evt_drp_reason(struct uwb_rc_evt_drp *evt)
694 {
695         return evt->reason & 0x0f;
696 }
697
698
699 /* DRP Availability Change notification. [WHCI] section 3.1.4.8. */
700 struct uwb_rc_evt_drp_avail {
701         struct uwb_rceb rceb;
702         DECLARE_BITMAP(bmp, UWB_NUM_MAS);
703 } __attribute__((packed));
704
705 /* BP switch status notification. [WHCI] section 3.1.4.10. */
706 struct uwb_rc_evt_bp_switch_status {
707         struct uwb_rceb rceb;
708         u8 status;
709         u8 slot_offset;
710         __le16 bpst_offset;
711         u8 move_countdown;
712 } __attribute__((packed));
713
714 /* Command Frame Received notification. [WHCI] section 3.1.4.11. */
715 struct uwb_rc_evt_cmd_frame_rcv {
716         struct uwb_rceb rceb;
717         __le16 receive_time;
718         struct uwb_dev_addr wSrcAddr;
719         struct uwb_dev_addr wDstAddr;
720         __le16 control;
721         __le16 reserved;
722         __le16 dataLength;
723         u8 data[];
724 } __attribute__((packed));
725
726 /* Channel Change IE Received notification. [WHCI] section 3.1.4.12. */
727 struct uwb_rc_evt_channel_change_ie_rcv {
728         struct uwb_rceb rceb;
729         struct uwb_dev_addr wSrcAddr;
730         __le16 wIELength;
731         u8 IEData[];
732 } __attribute__((packed));
733
734 /* DAA Energy Detected notification. [WHCI 0.96] section 3.1.4.14. */
735 struct uwb_rc_evt_daa_energy_detected {
736         struct uwb_rceb rceb;
737         __le16 wLength;
738         u8 bandID;
739         u8 reserved;
740         u8 toneBmp[16];
741 } __attribute__((packed));
742
743
744 /**
745  * Radio Control Interface Class Descriptor
746  *
747  *  WUSB 1.0 [8.6.1.2]
748  */
749 struct uwb_rc_control_intf_class_desc {
750         u8 bLength;
751         u8 bDescriptorType;
752         __le16 bcdRCIVersion;
753 } __attribute__((packed));
754
755 #endif /* #ifndef __LINUX__UWB_SPEC_H__ */