htc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  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. MetaData: 8,
  147. reserved: 8;
  148. } POSTPACK HTC_UNKNOWN_MSG;
  149. #define HTC_UNKNOWN_MSG_MESSAGEID_LSB 0
  150. #define HTC_UNKNOWN_MSG_MESSAGEID_MASK 0x0000ffff
  151. #define HTC_UNKNOWN_MSG_MESSAGEID_OFFSET 0x00000000
  152. #define HTC_UNKNOWN_MSG_METADATA_LSB 16
  153. #define HTC_UNKNOWN_MSG_METADATA_MASK 0X00ff0000
  154. #define HTC_UNKNOWN_MSG_METADATA_OFFSET 0x00000000
  155. /* HTC ready message
  156. * direction : target-to-host */
  157. typedef PREPACK struct {
  158. A_UINT32 MessageID : 16, /* ID */
  159. CreditCount: 16; /* number of credits the target can offer */
  160. A_UINT32 CreditSize : 16, /* size of each credit */
  161. MaxEndpoints : 8, /* maximum number of endpoints the target has resources for */
  162. _Pad1 : 8;
  163. } POSTPACK HTC_READY_MSG;
  164. #define HTC_READY_MSG_MESSAGEID_LSB 0
  165. #define HTC_READY_MSG_MESSAGEID_MASK 0x0000ffff
  166. #define HTC_READY_MSG_MESSAGEID_OFFSET 0x00000000
  167. #define HTC_READY_MSG_CREDITCOUNT_LSB 16
  168. #define HTC_READY_MSG_CREDITCOUNT_MASK 0xffff0000
  169. #define HTC_READY_MSG_CREDITCOUNT_OFFSET 0x00000000
  170. #define HTC_READY_MSG_CREDITSIZE_LSB 0
  171. #define HTC_READY_MSG_CREDITSIZE_MASK 0x0000ffff
  172. #define HTC_READY_MSG_CREDITSIZE_OFFSET 0x00000004
  173. #define HTC_READY_MSG_MAXENDPOINTS_LSB 16
  174. #define HTC_READY_MSG_MAXENDPOINTS_MASK 0x00ff0000
  175. #define HTC_READY_MSG_MAXENDPOINTS_OFFSET 0x00000004
  176. /* extended HTC ready message */
  177. typedef PREPACK struct {
  178. HTC_READY_MSG Version2_0_Info; /* legacy version 2.0 information at the front... */
  179. /* extended information */
  180. A_UINT32 HTCVersion : 8,
  181. MaxMsgsPerHTCBundle : 8, /* used in SDIO systems */
  182. AltDataCreditSize : 12, /* used in HL (SDIO/USB) systems */
  183. reserved : 4;
  184. } POSTPACK HTC_READY_EX_MSG;
  185. #define HTC_READY_EX_MSG_HTCVERSION_LSB 0
  186. #define HTC_READY_EX_MSG_HTCVERSION_MASK 0x000000ff
  187. #define HTC_READY_EX_MSG_HTCVERSION_OFFSET sizeof(HTC_READY_MSG)
  188. #define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE_LSB 8
  189. #define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE_MASK 0x0000ff00
  190. #define HTC_READY_EX_MSG_MAXMSGSPERHTCBUNDLE_OFFSET sizeof(HTC_READY_MSG)
  191. #define HTC_VERSION_2P0 0x00
  192. #define HTC_VERSION_2P1 0x01 /* HTC 2.1 */
  193. #define HTC_SERVICE_META_DATA_MAX_LENGTH 128
  194. /* connect service
  195. * direction : host-to-target */
  196. typedef PREPACK struct {
  197. A_UINT32 MessageID : 16,
  198. ServiceID : 16; /* service ID of the service to connect to */
  199. A_UINT32 ConnectionFlags : 16, /* connection flags */
  200. #define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribbling when
  201. the host needs credits */
  202. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK (0x3)
  203. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH 0x0
  204. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF 0x1
  205. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS 0x2
  206. #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY 0x3
  207. /* disable credit flow control on a specific service */
  208. #define HTC_CONNECT_FLAGS_DISABLE_CREDIT_FLOW_CTRL (1 << 3)
  209. /* enable htc schedule on a specific service */
  210. #define HTC_CONNECT_FLAGS_ENABLE_HTC_SCHEDULE (1 << 4)
  211. ServiceMetaLength : 8, /* length of meta data that follows */
  212. LookAheadV2 : 1, /* 1 if host supports HTC_LOOKAHEAD_REPORT_V2 */
  213. _Pad1 : 7;
  214. /* service-specific meta data starts after the header */
  215. } POSTPACK HTC_CONNECT_SERVICE_MSG;
  216. #define HTC_CONNECT_SERVICE_MSG_MESSAGEID_LSB 0
  217. #define HTC_CONNECT_SERVICE_MSG_MESSAGEID_MASK 0x0000ffff
  218. #define HTC_CONNECT_SERVICE_MSG_MESSAGEID_OFFSET 0x00000000
  219. #define HTC_CONNECT_SERVICE_MSG_SERVICE_ID_LSB 16
  220. #define HTC_CONNECT_SERVICE_MSG_SERVICE_ID_MASK 0xffff0000
  221. #define HTC_CONNECT_SERVICE_MSG_SERVICE_ID_OFFSET 0x00000000
  222. #define HTC_CONNECT_SERVICE_MSG_CONNECTIONFLAGS_LSB 0
  223. #define HTC_CONNECT_SERVICE_MSG_CONNECTIONFLAGS_MASK 0x0000ffff
  224. #define HTC_CONNECT_SERVICE_MSG_CONNECTIONFLAGS_OFFSET 0x00000004
  225. #define HTC_CONNECT_SERVICE_MSG_SERVICEMETALENGTH_LSB 16
  226. #define HTC_CONNECT_SERVICE_MSG_SERVICEMETALENGTH_MASK 0x00ff0000
  227. #define HTC_CONNECT_SERVICE_MSG_SERVICEMETALENGTH_OFFSET 0x00000004
  228. #define HTC_SET_RECV_ALLOC_SHIFT 8
  229. #define HTC_SET_RECV_ALLOC_MASK 0xFF00
  230. #define HTC_CONNECT_FLAGS_SET_RECV_ALLOCATION(value) (((A_UINT8)value) << HTC_SET_RECV_ALLOC_SHIFT)
  231. #define HTC_CONNECT_FLAGS_GET_RECV_ALLOCATION(value) (A_UINT8)(((value) & HTC_SET_RECV_ALLOC_MASK) >> HTC_SET_RECV_ALLOC_SHIFT)
  232. /* connect response
  233. * direction : target-to-host */
  234. typedef PREPACK struct {
  235. A_UINT32 MessageID : 16,
  236. ServiceID : 16; /* service ID that the connection request was made */
  237. A_UINT32 Status : 8, /* service connection status */
  238. EndpointID : 8, /* assigned endpoint ID */
  239. MaxMsgSize : 16; /* maximum expected message size on this endpoint */
  240. A_UINT32 ServiceMetaLength : 8, /* length of meta data that follows */
  241. LookAheadV2 : 1,/* 1 if target supports HTC_LOOKAHEAD_REPORT_V2 */
  242. _Pad1 : 7,
  243. reserved : 16;
  244. /* service-specific meta data starts after the header */
  245. } POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG;
  246. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MESSAGEID_LSB 0
  247. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MESSAGEID_MASK 0x0000ffff
  248. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MESSAGEID_OFFSET 0x00000000
  249. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEID_LSB 16
  250. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEID_MASK 0xffff0000
  251. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEID_OFFSET 0x00000000
  252. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_STATUS_LSB 0
  253. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_STATUS_MASK 0x000000ff
  254. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_STATUS_OFFSET 0x00000004
  255. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_ENDPOINTID_LSB 8
  256. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_ENDPOINTID_MASK 0x0000ff00
  257. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_ENDPOINTID_OFFSET 0x00000004
  258. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MAXMSGSIZE_LSB 16
  259. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MAXMSGSIZE_MASK 0xffff0000
  260. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_MAXMSGSIZE_OFFSET 0x00000004
  261. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEMETALENGTH_LSB 0
  262. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEMETALENGTH_MASK 0x000000ff
  263. #define HTC_CONNECT_SERVICE_RESPONSE_MSG_SERVICEMETALENGTH_OFFSET 0x00000008
  264. typedef PREPACK struct {
  265. A_UINT32 MessageID : 16,
  266. reserved : 16;
  267. /* currently, no other fields */
  268. } POSTPACK HTC_SETUP_COMPLETE_MSG;
  269. #define HTC_SETUP_COMPLETE_MSG_MESSAGEID_LSB 0
  270. #define HTC_SETUP_COMPLETE_MSG_MESSAGEID_MASK 0x0000ffff
  271. #define HTC_SETUP_COMPLETE_MSG_MESSAGEID_OFFSET 0x00000000
  272. /* extended setup completion message */
  273. typedef PREPACK struct {
  274. A_UINT32 MessageID : 16,
  275. reserved : 16;
  276. A_UINT32 SetupFlags : 32;
  277. A_UINT32 MaxMsgsPerBundledRecv : 8,
  278. Rsvd0 : 8,
  279. Rsvd1 : 8,
  280. Rsvd2 : 8;
  281. } POSTPACK HTC_SETUP_COMPLETE_EX_MSG;
  282. #define HTC_SETUP_COMPLETE_EX_MSG_MESSAGEID_LSB 0
  283. #define HTC_SETUP_COMPLETE_EX_MSG_MESSAGEID_MASK 0x0000ffff
  284. #define HTC_SETUP_COMPLETE_EX_MSG_MESSAGEID_OFFSET 0x00000000
  285. #define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS_LSB 0
  286. #define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS_MASK 0xffffffff
  287. #define HTC_SETUP_COMPLETE_EX_MSG_SETUPFLAGS_OFFSET 0x00000004
  288. #define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV_LSB 0
  289. #define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV_MASK 0x000000ff
  290. #define HTC_SETUP_COMPLETE_EX_MSG_MAXMSGSPERBUNDLEDRECV_OFFSET 0x00000008
  291. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD0_LSB 8
  292. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD0_MASK 0x0000ff00
  293. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD0_OFFSET 0x00000008
  294. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD1_LSB 16
  295. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD1_MASK 0x00ff0000
  296. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD1_OFFSET 0x00000008
  297. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD2_LSB 24
  298. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD2_MASK 0xff000000
  299. #define HTC_SETUP_COMPLETE_EX_MSG_RSVD2_OFFSET 0x00000008
  300. #define HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV (1 << 0) /* enable recv bundling from target */
  301. #define HTC_SETUP_COMPLETE_FLAGS_DISABLE_TX_CREDIT_FLOW (1 << 1) /* disable credit based flow control,
  302. only supported on some interconnects */
  303. /* connect response status codes */
  304. #define HTC_SERVICE_SUCCESS 0 /* success */
  305. #define HTC_SERVICE_NOT_FOUND 1 /* service could not be found */
  306. #define HTC_SERVICE_FAILED 2 /* specific service failed the connect */
  307. #define HTC_SERVICE_NO_RESOURCES 3 /* no resources (i.e. no more endpoints) */
  308. #define HTC_SERVICE_NO_MORE_EP 4 /* specific service is not allowing any more
  309. endpoints */
  310. /* report record IDs */
  311. #define HTC_RECORD_NULL 0
  312. #define HTC_RECORD_CREDITS 1
  313. #define HTC_RECORD_LOOKAHEAD 2
  314. #define HTC_RECORD_LOOKAHEAD_BUNDLE 3
  315. typedef PREPACK struct {
  316. A_UINT32 RecordID : 8, /* Record ID */
  317. Length : 8, /* Length of record */
  318. reserved : 16;
  319. } POSTPACK HTC_RECORD_HDR;
  320. #define HTC_RECORD_HDR_RECORDID_LSB 0
  321. #define HTC_RECORD_HDR_RECORDID_MASK 0x000000ff
  322. #define HTC_RECORD_HDR_RECORDID_OFFSET 0x00000000
  323. #define HTC_RECORD_HDR_LENGTH_LSB 8
  324. #define HTC_RECORD_HDR_LENGTH_MASK 0x0000ff00
  325. #define HTC_RECORD_HDR_LENGTH_OFFSET 0x00000000
  326. typedef PREPACK struct {
  327. A_UINT32 EndpointID : 8, /* Endpoint that owns these credits */
  328. Credits : 8, /* credits to report since last report */
  329. reserved : 16;
  330. } POSTPACK HTC_CREDIT_REPORT;
  331. #define HTC_CREDIT_REPORT_ENDPOINTID_LSB 0
  332. #define HTC_CREDIT_REPORT_ENDPOINTID_MASK 0x000000ff
  333. #define HTC_CREDIT_REPORT_ENDPOINTID_OFFSET 0x00000000
  334. #define HTC_CREDIT_REPORT_CREDITS_LSB 8
  335. #define HTC_CREDIT_REPORT_CREDITS_MASK 0x0000ff00
  336. #define HTC_CREDIT_REPORT_CREDITS_OFFSET 0x00000000
  337. typedef PREPACK struct {
  338. A_UINT32 PreValid : 8, /* pre valid guard */
  339. reserved0 : 24;
  340. A_UINT32 LookAhead0 : 8, /* 4 byte lookahead */
  341. LookAhead1 : 8,
  342. LookAhead2 : 8,
  343. LookAhead3 : 8;
  344. A_UINT32 PostValid : 8, /* post valid guard */
  345. reserved1 : 24;
  346. /* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard bytes.
  347. * The PreValid bytes must equal the inverse of the PostValid byte */
  348. } POSTPACK HTC_LOOKAHEAD_REPORT;
  349. /*
  350. * If the host sets the HTC_CONNECT_SERVICE_MSG.LookAheadV2 flag and the
  351. * target sets the HTC_CONNECT_SERVICE_RESPONSE_MSG.LookAheadV2 flag,
  352. * HTC_LOOKAHEAD_REPORT_V2 is used; otherwise HTC_LOOKAHEAD_REPORT is used.
  353. */
  354. typedef PREPACK struct {
  355. A_UINT32 PreValid : 8, /* pre valid guard */
  356. reserved0 : 24;
  357. A_UINT32 LookAhead0 : 8, /* 8 byte lookahead */
  358. LookAhead1 : 8,
  359. LookAhead2 : 8,
  360. LookAhead3 : 8;
  361. A_UINT32 LookAhead4 : 8, /* 8 byte lookahead */
  362. LookAhead5 : 8,
  363. LookAhead6 : 8,
  364. LookAhead7 : 8;
  365. A_UINT32 PostValid : 8, /* post valid guard */
  366. reserved1 : 24;
  367. /* NOTE: the LookAhead array is guarded by PreValid and Post Valid
  368. * guard bytes.
  369. * The PreValid byte must equal the inverse of the PostValid byte.
  370. */
  371. } POSTPACK HTC_LOOKAHEAD_REPORT_V2;
  372. #define HTC_LOOKAHEAD_REPORT_PREVALID_LSB 0
  373. #define HTC_LOOKAHEAD_REPORT_PREVALID_MASK 0x000000ff
  374. #define HTC_LOOKAHEAD_REPORT_PREVALID_OFFSET 0x00000000
  375. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD0_LSB 0
  376. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD0_MASK 0x000000ff
  377. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD0_OFFSET 0x00000004
  378. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD1_LSB 8
  379. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD1_MASK 0x0000ff00
  380. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD1_OFFSET 0x00000004
  381. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD2_LSB 16
  382. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD2_MASK 0x00ff0000
  383. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD2_OFFSET 0x00000004
  384. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD3_LSB 24
  385. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD3_MASK 0xff000000
  386. #define HTC_LOOKAHEAD_REPORT_LOOKAHEAD3_OFFSET 0x00000004
  387. #define HTC_LOOKAHEAD_REPORT_POSTVALID_LSB 0
  388. #define HTC_LOOKAHEAD_REPORT_POSTVALID_MASK 0x000000ff
  389. #define HTC_LOOKAHEAD_REPORT_POSTVALID_OFFSET 0x00000008
  390. typedef PREPACK struct {
  391. A_UINT32 LookAhead0 : 8, /* 4 byte lookahead */
  392. LookAhead1 : 8,
  393. LookAhead2 : 8,
  394. LookAhead3 : 8;
  395. } POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT;
  396. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD0_LSB 0
  397. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD0_MASK 0x000000ff
  398. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD0_OFFSET 0x00000000
  399. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD1_LSB 8
  400. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD1_MASK 0x0000ff00
  401. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD1_OFFSET 0x00000000
  402. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD2_LSB 16
  403. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD2_MASK 0x00ff0000
  404. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD2_OFFSET 0x00000000
  405. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD3_LSB 24
  406. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD3_MASK 0xff000000
  407. #define HTC_BUNDLED_LOOKAHEAD_REPORT_LOOKAHEAD3_OFFSET 0x00000000
  408. #ifndef ATH_TARGET
  409. #include "athendpack.h"
  410. #endif
  411. #endif /* __HTC_H__ */