spec.h 17 KB

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