spec.h 19 KB

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