spec.h 18 KB

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