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