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