htc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. /*
  2. * Copyright (c) 2012, 2014-2016, 2018 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. #ifndef __HTC_H__
  27. #define __HTC_H__
  28. #ifndef ATH_TARGET
  29. #include "athstartpack.h"
  30. #endif
  31. #ifdef ATHR_WIN_NWF
  32. #pragma warning( disable:4214 ) //bit field types other than int
  33. #endif
  34. #undef MS
  35. #define MS(_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)
  36. #undef SM
  37. #define SM(_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
  38. #undef WO
  39. #define WO(_f) ((_f##_OFFSET) >> 2)
  40. #undef GET_FIELD
  41. #define GET_FIELD(_addr, _f) MS(*((A_UINT32 *)(_addr) + WO(_f)), _f)
  42. #undef SET_FIELD
  43. #define SET_FIELD(_addr, _f, _val) \
  44. (*((A_UINT32 *)(_addr) + WO(_f)) = \
  45. (*((A_UINT32 *)(_addr) + WO(_f)) & ~_f##_MASK) | SM(_val, _f))
  46. #define HTC_GET_FIELD(_msg_buf, _msg_type, _f) \
  47. GET_FIELD(_msg_buf, _msg_type ## _ ## _f)
  48. #define HTC_SET_FIELD(_msg_buf, _msg_type, _f, _val) \
  49. SET_FIELD(_msg_buf, _msg_type ## _ ## _f, _val)
  50. #define HTC_WRITE32(_addr, _val) \
  51. (*(A_UINT32 *)(_addr) = (_val))
  52. #ifndef A_OFFSETOF
  53. #define A_OFFSETOF(type,field) (unsigned long)(&(((type *)NULL)->field))
  54. #endif
  55. #define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \
  56. (((A_UINT16)(((A_UINT8 *)(p))[(highbyte)])) << 8 | (A_UINT16)(((A_UINT8 *)(p))[(lowbyte)]))
  57. /****** DANGER DANGER ***************
  58. *
  59. * The frame header length and message formats defined herein were
  60. * selected to accommodate optimal alignment for target processing. This reduces code
  61. * size and improves performance.
  62. *
  63. * Any changes to the header length may alter the alignment and cause exceptions
  64. * on the target. When adding to the message structures insure that fields are
  65. * properly aligned.
  66. *
  67. */
  68. /* HTC frame header */
  69. typedef PREPACK struct _HTC_FRAME_HDR{
  70. /* do not remove or re-arrange these fields, these are minimally required
  71. * to take advantage of 4-byte lookaheads in some hardware implementations */
  72. A_UINT32 EndpointID : 8,
  73. Flags : 8,
  74. PayloadLen : 16; /* length of data (including trailer) that follows the header */
  75. /***** end of 4-byte lookahead ****/
  76. A_UINT32 ControlBytes0 : 8, /* used for CRC check if CRC_CHECK flag set */
  77. ControlBytes1 : 8, /* used for seq check if SEQ_CHECK flag set */
  78. reserved : 16; /* used by bundle processing in SDIO systems */
  79. /* message payload starts after the header */
  80. } POSTPACK HTC_FRAME_HDR;
  81. #define HTC_FRAME_HDR_ENDPOINTID_LSB 0
  82. #define HTC_FRAME_HDR_ENDPOINTID_MASK 0x000000ff
  83. #define HTC_FRAME_HDR_ENDPOINTID_OFFSET 0x00000000
  84. #define HTC_FRAME_HDR_FLAGS_LSB 8
  85. #define HTC_FRAME_HDR_FLAGS_MASK 0x0000ff00
  86. #define HTC_FRAME_HDR_FLAGS_OFFSET 0x00000000
  87. #define HTC_FRAME_HDR_PAYLOADLEN_LSB 16
  88. #define HTC_FRAME_HDR_PAYLOADLEN_MASK 0xffff0000
  89. #define HTC_FRAME_HDR_PAYLOADLEN_OFFSET 0x00000000
  90. #define HTC_FRAME_HDR_CONTROLBYTES0_LSB 0
  91. #define HTC_FRAME_HDR_CONTROLBYTES0_MASK 0x000000ff
  92. #define HTC_FRAME_HDR_CONTROLBYTES0_OFFSET 0x00000004
  93. #define HTC_FRAME_HDR_CONTROLBYTES1_LSB 8
  94. #define HTC_FRAME_HDR_CONTROLBYTES1_MASK 0x0000ff00
  95. #define HTC_FRAME_HDR_CONTROLBYTES1_OFFSET 0x00000004
  96. #define HTC_FRAME_HDR_RESERVED_LSB 16
  97. #define HTC_FRAME_HDR_RESERVED_MASK 0xffff0000
  98. #define HTC_FRAME_HDR_RESERVED_OFFSET 0x00000004
  99. /* frame header flags */
  100. /* send direction */
  101. #define HTC_FLAGS_NEED_CREDIT_UPDATE (1 << 0)
  102. #define HTC_FLAGS_SEND_BUNDLE (1 << 1) /* start or part of bundle */
  103. #define HTC_FLAGS_SEQ_CHECK (1 << 2) /* seq check on rx side */
  104. #define HTC_FLAGS_CRC_CHECK (1 << 3) /* CRC check on rx side */
  105. /* HTC_FLAGS_PADDING_CHECK
  106. * Set by the sender to inform the receiver that the HTC packet begins
  107. * with continuation (block) alignment padding from the prior HTC packet.
  108. */
  109. #define HTC_FLAGS_PADDING_CHECK (1 << 4)
  110. /* receive direction */
  111. #define HTC_FLAGS_RECV_1MORE_BLOCK (1 << 0) /* bit 0 bundle trailer present */
  112. #define HTC_FLAGS_RECV_TRAILER (1 << 1) /* bit 1 trailer data present */
  113. #define HTC_FLAGS_RECV_BUNDLE_CNT_MASK (0xFC) /* bits 7..2 */
  114. #define HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT 2
  115. /*
  116. * To be compatible with an older definition of a smaller (4-bit)
  117. * bundle count field, the bundle count is stored in a segmented
  118. * format - the 4 LSbs of the bundle count value are stored in bits 5:2
  119. * of the BUNDLE_CNT field, which is bits 7:4 of the HTC_FLAGS word;
  120. * the next 2 bits of the bundle count value are stored in bits 1:0 of
  121. * the BUNDLE_CNT field, which is bits 3:2 of the HTC_FLAGS word.
  122. */
  123. #define HTC_FLAGS_RECV_BUNDLE_CNT_SET(x) \
  124. ((((x) << 2) | ((x) >> 4)) << HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT)
  125. #define HTC_FLAGS_RECV_BUNDLE_CNT_GET(x) \
  126. ((((x) & HTC_FLAGS_RECV_BUNDLE_CNT_MASK) >> (HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT + 2)) | \
  127. ((((x) >> HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT) & 0x3) << 4))
  128. #define HTC_HDR_LENGTH (sizeof(HTC_FRAME_HDR))
  129. #define HTC_HDR_ALIGNMENT_PADDING \
  130. (((sizeof(HTC_FRAME_HDR) + 3) & (~0x3)) - sizeof(HTC_FRAME_HDR))
  131. #define HTC_MAX_TRAILER_LENGTH 255
  132. #define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(HTC_FRAME_HDR))
  133. /* HTC control message IDs */
  134. #define HTC_MSG_READY_ID 1
  135. #define HTC_MSG_CONNECT_SERVICE_ID 2
  136. #define HTC_MSG_CONNECT_SERVICE_RESPONSE_ID 3
  137. #define HTC_MSG_SETUP_COMPLETE_ID 4
  138. #define HTC_MSG_SETUP_COMPLETE_EX_ID 5
  139. #define HTC_MSG_SEND_SUSPEND_COMPLETE 6
  140. #define HTC_MSG_NACK_SUSPEND 7
  141. #define HTC_MSG_WAKEUP_FROM_SUSPEND_ID 8
  142. #define HTC_MAX_CONTROL_MESSAGE_LENGTH 256
  143. /* base message ID header */
  144. typedef PREPACK struct {
  145. A_UINT32 MessageID : 16,
  146. reserved : 16;
  147. } POSTPACK HTC_UNKNOWN_MSG;
  148. #define HTC_UNKNOWN_MSG_MESSAGEID_LSB 0
  149. #define HTC_UNKNOWN_MSG_MESSAGEID_MASK 0x0000ffff
  150. #define HTC_UNKNOWN_MSG_MESSAGEID_OFFSET 0x00000000
  151. /* HTC ready message
  152. * direction : target-to-host */
  153. typedef PREPACK struct {
  154. A_UINT32 MessageID : 16, /* ID */
  155. CreditCount: 16; /* number of credits the target can offer */
  156. A_UINT32 CreditSize : 16, /* size of each credit */
  157. MaxEndpoints : 8, /* maximum number of endpoints the target has resources for */
  158. _Pad1 : 8;
  159. } POSTPACK HTC_READY_MSG;
  160. #define HTC_READY_MSG_MESSAGEID_LSB 0
  161. #define HTC_READY_MSG_MESSAGEID_MASK 0x0000ffff
  162. #define HTC_READY_MSG_MESSAGEID_OFFSET 0x00000000
  163. #define HTC_READY_MSG_CREDITCOUNT_LSB 16
  164. #define HTC_READY_MSG_CREDITCOUNT_MASK 0xffff0000
  165. #define HTC_READY_MSG_CREDITCOUNT_OFFSET 0x00000000
  166. #define HTC_READY_MSG_CREDITSIZE_LSB 0
  167. #define HTC_READY_MSG_CREDITSIZE_MASK 0x0000ffff
  168. #define HTC_READY_MSG_CREDITSIZE_OFFSET 0x00000004
  169. #define HTC_READY_MSG_MAXENDPOINTS_LSB 16
  170. #define HTC_READY_MSG_MAXENDPOINTS_MASK 0x00ff0000
  171. #define HTC_READY_MSG_MAXENDPOINTS_OFFSET 0x00000004
  172. /* extended HTC ready message */
  173. typedef PREPACK struct {
  174. HTC_READY_MSG Version2_0_Info; /* legacy version 2.0 information at the front... */
  175. /* extended information */
  176. A_UINT32 HTCVersion : 8,
  177. MaxMsgsPerHTCBundle : 8, /* used in SDIO systems */
  178. AltDataCreditSize : 12, /* used in HL (SDIO/USB) systems */
  179. reserved : 4;
  180. } POSTPACK HTC_READY_EX_MSG;
  181. #define HTC_READY_EX_MSG_HTCVERSION_LSB 0
  182. #define HTC_READY_EX_MSG_HTCVERSION_MASK 0x000000ff
  183. #define HTC_READY_EX_MSG_HTCVERSION_OFFSET sizeof(HTC_READY_MSG)
  184. #define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE_LSB 8
  185. #define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE_MASK 0x0000ff00
  186. #define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE_OFFSET sizeof(HTC_READY_MSG)
  187. #define HTC_VERSION_2P0 0x00
  188. #define HTC_VERSION_2P1 0x01 /* HTC 2.1 */
  189. #define HTC_SERVICE_META_DATA_MAX_LENGTH 128
  190. /* connect service
  191. * direction : host-to-target */
  192. typedef PREPACK struct {
  193. A_UINT32 MessageID : 16,
  194. ServiceID : 16; /* service ID of the service to connect to */
  195. A_UINT32 ConnectionFlags : 16, /* connection flags */
  196. #define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribbling when
  197. the host needs credits */
  198. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK (0x3)
  199. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH 0x0
  200. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF 0x1
  201. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS 0x2
  202. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY 0x3
  203. /* disable credit flow control on a specific service */
  204. #define HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL (1 << 3)
  205. /* enable htc schedule on a specific service */
  206. #define HTC_CONNECT_FLAGS_ENABLE_HTC_SCHEDULE (1 << 4)
  207. ServiceMetaLength : 8, /* length of meta data that follows */
  208. LookAheadV2 : 1, /* 1 if host supports HTC_LOOKAHEAD_REPORT_V2 */
  209. _Pad1 : 7;
  210. /* service-specific meta data starts after the header */
  211. } POSTPACK HTC_CONNECT_SERVICE_MSG;
  212. #define HTC_CONNECT_SERVICE_MSG_MESSAGEID_LSB 0
  213. #define HTC_CONNECT_SERVICE_MSG_MESSAGEID_MASK 0x0000ffff
  214. #define HTC_CONNECT_SERVICE_MSG_MESSAGEID_OFFSET 0x00000000
  215. #define HTC_CONNECT_SERVICE_MSG_SERVICE_ID_LSB 16
  216. #define HTC_CONNECT_SERVICE_MSG_SERVICE_ID_MASK 0xffff0000
  217. #define HTC_CONNECT_SERVICE_MSG_SERVICE_ID_OFFSET 0x00000000
  218. #define HTC_CONNECT_SERVICE_MSG_CONNECTIONFLAGS_LSB 0
  219. #define HTC_CONNECT_SERVICE_MSG_CONNECTIONFLAGS_MASK 0x0000ffff
  220. #define HTC_CONNECT_SERVICE_MSG_CONNECTIONFLAGS_OFFSET 0x00000004
  221. #define HTC_CONNECT_SERVICE_MSG_SERVICEMETALENGTH_LSB 16
  222. #define HTC_CONNECT_SERVICE_MSG_SERVICEMETALENGTH_MASK 0x00ff0000
  223. #define HTC_CONNECT_SERVICE_MSG_SERVICEMETALENGTH_OFFSET 0x00000004
  224. #define HTC_SET_RECV_ALLOC_SHIFT 8
  225. #define HTC_SET_RECV_ALLOC_MASK 0xFF00
  226. #define HTC_CONNECT_FLAGS_SET_RECV_ALLOCATION(value) (((A_UINT8)value) << HTC_SET_RECV_ALLOC_SHIFT)
  227. #define HTC_CONNECT_FLAGS_GET_RECV_ALLOCATION(value) (A_UINT8)(((value) & HTC_SET_RECV_ALLOC_MASK) >> HTC_SET_RECV_ALLOC_SHIFT)
  228. /* connect response
  229. * direction : target-to-host */
  230. typedef PREPACK struct {
  231. A_UINT32 MessageID : 16,
  232. ServiceID : 16; /* service ID that the connection request was made */
  233. A_UINT32 Status : 8, /* service connection status */
  234. EndpointID : 8, /* assigned endpoint ID */
  235. MaxMsgSize : 16; /* maximum expected message size on this endpoint */
  236. A_UINT32 ServiceMetaLength : 8, /* length of meta data that follows */
  237. LookAheadV2 : 1,/* 1 if target supports HTC_LOOKAHEAD_REPORT_V2 */
  238. _Pad1 : 7,
  239. reserved : 16;
  240. /* service-specific meta data starts after the header */
  241. } POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG;
  242. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MESSAGEID_LSB 0
  243. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MESSAGEID_MASK 0x0000ffff
  244. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MESSAGEID_OFFSET 0x00000000
  245. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEID_LSB 16
  246. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEID_MASK 0xffff0000
  247. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEID_OFFSET 0x00000000
  248. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_STATUS_LSB 0
  249. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_STATUS_MASK 0x000000ff
  250. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_STATUS_OFFSET 0x00000004
  251. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_ENDPOINTID_LSB 8
  252. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_ENDPOINTID_MASK 0x0000ff00
  253. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_ENDPOINTID_OFFSET 0x00000004
  254. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MAXMSGSIZE_LSB 16
  255. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MAXMSGSIZE_MASK 0xffff0000
  256. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MAXMSGSIZE_OFFSET 0x00000004
  257. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEMETALENGTH_LSB 0
  258. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEMETALENGTH_MASK 0x000000ff
  259. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEMETALENGTH_OFFSET 0x00000008
  260. typedef PREPACK struct {
  261. A_UINT32 MessageID : 16,
  262. reserved : 16;
  263. /* currently, no other fields */
  264. } POSTPACK HTC_SETUP_COMPLETE_MSG;
  265. #define HTC_SETUP_COMPLETE_MSG_MESSAGEID_LSB 0
  266. #define HTC_SETUP_COMPLETE_MSG_MESSAGEID_MASK 0x0000ffff
  267. #define HTC_SETUP_COMPLETE_MSG_MESSAGEID_OFFSET 0x00000000
  268. /* extended setup completion message */
  269. typedef PREPACK struct {
  270. A_UINT32 MessageID : 16,
  271. reserved : 16;
  272. A_UINT32 SetupFlags : 32;
  273. A_UINT32 MaxMsgsPerBundledRecv : 8,
  274. Rsvd0 : 8,
  275. Rsvd1 : 8,
  276. Rsvd2 : 8;
  277. } POSTPACK HTC_SETUP_COMPLETE_EX_MSG;
  278. #define HTC_SETUP_COMPLETE_EX_MSG_MESSAGEID_LSB 0
  279. #define HTC_SETUP_COMPLETE_EX_MSG_MESSAGEID_MASK 0x0000ffff
  280. #define HTC_SETUP_COMPLETE_EX_MSG_MESSAGEID_OFFSET 0x00000000
  281. #define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS_LSB 0
  282. #define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS_MASK 0xffffffff
  283. #define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS_OFFSET 0x00000004
  284. #define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV_LSB 0
  285. #define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV_MASK 0x000000ff
  286. #define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV_OFFSET 0x00000008
  287. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD0_LSB 8
  288. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD0_MASK 0x0000ff00
  289. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD0_OFFSET 0x00000008
  290. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD1_LSB 16
  291. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD1_MASK 0x00ff0000
  292. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD1_OFFSET 0x00000008
  293. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD2_LSB 24
  294. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD2_MASK 0xff000000
  295. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD2_OFFSET 0x00000008
  296. #define HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV (1 << 0) /* enable recv bundling from target */
  297. #define HTC_SETUP_COMPLETE_FLAGS_DISABLE_TX_CREDIT_FLOW (1 << 1) /* disable credit based flow control,
  298. only supported on some interconnects */
  299. /* connect response status codes */
  300. #define HTC_SERVICE_SUCCESS 0 /* success */
  301. #define HTC_SERVICE_NOT_FOUND 1 /* service could not be found */
  302. #define HTC_SERVICE_FAILED 2 /* specific service failed the connect */
  303. #define HTC_SERVICE_NO_RESOURCES 3 /* no resources (i.e. no more endpoints) */
  304. #define HTC_SERVICE_NO_MORE_EP 4 /* specific service is not allowing any more
  305. endpoints */
  306. /* report record IDs */
  307. #define HTC_RECORD_NULL 0
  308. #define HTC_RECORD_CREDITS 1
  309. #define HTC_RECORD_LOOKAHEAD 2
  310. #define HTC_RECORD_LOOKAHEAD_BUNDLE 3
  311. typedef PREPACK struct {
  312. A_UINT32 RecordID : 8, /* Record ID */
  313. Length : 8, /* Length of record */
  314. reserved : 16;
  315. } POSTPACK HTC_RECORD_HDR;
  316. #define HTC_RECORD_HDR_RECORDID_LSB 0
  317. #define HTC_RECORD_HDR_RECORDID_MASK 0x000000ff
  318. #define HTC_RECORD_HDR_RECORDID_OFFSET 0x00000000
  319. #define HTC_RECORD_HDR_LENGTH_LSB 8
  320. #define HTC_RECORD_HDR_LENGTH_MASK 0x0000ff00
  321. #define HTC_RECORD_HDR_LENGTH_OFFSET 0x00000000
  322. typedef PREPACK struct {
  323. A_UINT32 EndpointID : 8, /* Endpoint that owns these credits */
  324. Credits : 8, /* credits to report since last report */
  325. reserved : 16;
  326. } POSTPACK HTC_CREDIT_REPORT;
  327. #define HTC_CREDIT_REPORT_ENDPOINTID_LSB 0
  328. #define HTC_CREDIT_REPORT_ENDPOINTID_MASK 0x000000ff
  329. #define HTC_CREDIT_REPORT_ENDPOINTID_OFFSET 0x00000000
  330. #define HTC_CREDIT_REPORT_CREDITS_LSB 8
  331. #define HTC_CREDIT_REPORT_CREDITS_MASK 0x0000ff00
  332. #define HTC_CREDIT_REPORT_CREDITS_OFFSET 0x00000000
  333. typedef PREPACK struct {
  334. A_UINT32 PreValid : 8, /* pre valid guard */
  335. reserved0 : 24;
  336. A_UINT32 LookAhead0 : 8, /* 4 byte lookahead */
  337. LookAhead1 : 8,
  338. LookAhead2 : 8,
  339. LookAhead3 : 8;
  340. A_UINT32 PostValid : 8, /* post valid guard */
  341. reserved1 : 24;
  342. /* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard bytes.
  343. * The PreValid bytes must equal the inverse of the PostValid byte */
  344. } POSTPACK HTC_LOOKAHEAD_REPORT;
  345. /*
  346. * If the host sets the HTC_CONNECT_SERVICE_MSG.LookAheadV2 flag and the
  347. * target sets the HTC_CONNECT_SERVICE_RESPONSE_MSG.LookAheadV2 flag,
  348. * HTC_LOOKAHEAD_REPORT_V2 is used; otherwise HTC_LOOKAHEAD_REPORT is used.
  349. */
  350. typedef PREPACK struct {
  351. A_UINT32 PreValid : 8, /* pre valid guard */
  352. reserved0 : 24;
  353. A_UINT32 LookAhead0 : 8, /* 8 byte lookahead */
  354. LookAhead1 : 8,
  355. LookAhead2 : 8,
  356. LookAhead3 : 8;
  357. A_UINT32 LookAhead4 : 8, /* 8 byte lookahead */
  358. LookAhead5 : 8,
  359. LookAhead6 : 8,
  360. LookAhead7 : 8;
  361. A_UINT32 PostValid : 8, /* post valid guard */
  362. reserved1 : 24;
  363. /* NOTE: the LookAhead array is guarded by PreValid and Post Valid
  364. * guard bytes.
  365. * The PreValid byte must equal the inverse of the PostValid byte.
  366. */
  367. } POSTPACK HTC_LOOKAHEAD_REPORT_V2;
  368. #define HTC_LOOKAHEAD_REPORT_PREVALID_LSB 0
  369. #define HTC_LOOKAHEAD_REPORT_PREVALID_MASK 0x000000ff
  370. #define HTC_LOOKAHEAD_REPORT_PREVALID_OFFSET 0x00000000
  371. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD0_LSB 0
  372. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD0_MASK 0x000000ff
  373. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD0_OFFSET 0x00000004
  374. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD1_LSB 8
  375. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD1_MASK 0x0000ff00
  376. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD1_OFFSET 0x00000004
  377. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD2_LSB 16
  378. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD2_MASK 0x00ff0000
  379. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD2_OFFSET 0x00000004
  380. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD3_LSB 24
  381. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD3_MASK 0xff000000
  382. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD3_OFFSET 0x00000004
  383. #define HTC_LOOKAHEAD_REPORT_POSTVALID_LSB 0
  384. #define HTC_LOOKAHEAD_REPORT_POSTVALID_MASK 0x000000ff
  385. #define HTC_LOOKAHEAD_REPORT_POSTVALID_OFFSET 0x00000008
  386. typedef PREPACK struct {
  387. A_UINT32 LookAhead0 : 8, /* 4 byte lookahead */
  388. LookAhead1 : 8,
  389. LookAhead2 : 8,
  390. LookAhead3 : 8;
  391. } POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT;
  392. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD0_LSB 0
  393. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD0_MASK 0x000000ff
  394. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD0_OFFSET 0x00000000
  395. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD1_LSB 8
  396. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD1_MASK 0x0000ff00
  397. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD1_OFFSET 0x00000000
  398. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD2_LSB 16
  399. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD2_MASK 0x00ff0000
  400. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD2_OFFSET 0x00000000
  401. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD3_LSB 24
  402. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD3_MASK 0xff000000
  403. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD3_OFFSET 0x00000000
  404. #ifndef ATH_TARGET
  405. #include "athendpack.h"
  406. #endif
  407. #endif /* __HTC_H__ */