Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: chromeos/drivers/ath6kl/include/htc.h

Issue 646055: Atheros AR600x driver + build glue (Closed)
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 //------------------------------------------------------------------------------
2 // <copyright file="htc.h" company="Atheros">
3 // Copyright (c) 2004-2007 Atheros Corporation. All rights reserved.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // Software distributed under the License is distributed on an "AS
10 // IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11 // implied. See the License for the specific language governing
12 // rights and limitations under the License.
13 //
14 //
15 //------------------------------------------------------------------------------
16 //==============================================================================
17 // Author(s): ="Atheros"
18 //==============================================================================
19
20 #ifndef __HTC_H__
21 #define __HTC_H__
22
23 #ifndef ATH_TARGET
24 #include "athstartpack.h"
25 #endif
26
27 #define A_OFFSETOF(type,field) (int)(&(((type *)NULL)->field))
28
29 #define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \
30 (((A_UINT16)(((A_UINT8 *)(p))[(highbyte)])) << 8 | (A_UINT16)(((A_UINT8 *)(p))[(lowbyte)]))
31
32 /* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a
33 * structure using only the type and field name.
34 * Use these macros if there is the potential for unaligned buffer accesses. */
35 #define A_GET_UINT16_FIELD(p,type,field) \
36 ASSEMBLE_UNALIGNED_UINT16(p,\
37 A_OFFSETOF(type,field) + 1, \
38 A_OFFSETOF(type,field))
39
40 #define A_SET_UINT16_FIELD(p,type,field,value) \
41 { \
42 ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (A_UINT8)(value); \
43 ((A_UINT8 *)(p))[A_OFFSETOF(type,field) + 1] = (A_UINT8)((value) >> 8); \
44 }
45
46 #define A_GET_UINT8_FIELD(p,type,field) \
47 ((A_UINT8 *)(p))[A_OFFSETOF(type,field)]
48
49 #define A_SET_UINT8_FIELD(p,type,field,value) \
50 ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (value)
51
52 /****** DANGER DANGER ***************
53 *
54 * The frame header length and message formats defined herein were
55 * selected to accommodate optimal alignment for target processing. This redu ces code
56 * size and improves performance.
57 *
58 * Any changes to the header length may alter the alignment and cause exceptio ns
59 * on the target. When adding to the message structures insure that fields are
60 * properly aligned.
61 *
62 */
63
64 /* HTC frame header */
65 typedef PREPACK struct _HTC_FRAME_HDR{
66 /* do not remove or re-arrange these fields, these are minimally require d
67 * to take advantage of 4-byte lookaheads in some hardware implementatio ns */
68 A_UINT8 EndpointID;
69 A_UINT8 Flags;
70 A_UINT16 PayloadLen; /* length of data (including trailer) that follo ws the header */
71
72 /***** end of 4-byte lookahead ****/
73
74 A_UINT8 ControlBytes[2];
75
76 /* message payload starts after the header */
77
78 } POSTPACK HTC_FRAME_HDR;
79
80 /* frame header flags */
81
82 /* send direction */
83 #define HTC_FLAGS_NEED_CREDIT_UPDATE (1 << 0)
84 #define HTC_FLAGS_SEND_BUNDLE (1 << 1) /* start or part of bundle */
85 /* receive direction */
86 #define HTC_FLAGS_RECV_UNUSED_0 (1 << 0) /* bit 0 unused */
87 #define HTC_FLAGS_RECV_TRAILER (1 << 1) /* bit 1 trailer data present */
88 #define HTC_FLAGS_RECV_UNUSED_2 (1 << 0) /* bit 2 unused */
89 #define HTC_FLAGS_RECV_UNUSED_3 (1 << 0) /* bit 3 unused */
90 #define HTC_FLAGS_RECV_BUNDLE_CNT_MASK (0xF0) /* bits 7..4 */
91 #define HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT 4
92
93 #define HTC_HDR_LENGTH (sizeof(HTC_FRAME_HDR))
94 #define HTC_MAX_TRAILER_LENGTH 255
95 #define HTC_MAX_PAYLOAD_LENGTH (4096 - sizeof(HTC_FRAME_HDR))
96
97 /* HTC control message IDs */
98
99 #define HTC_MSG_READY_ID 1
100 #define HTC_MSG_CONNECT_SERVICE_ID 2
101 #define HTC_MSG_CONNECT_SERVICE_RESPONSE_ID 3
102 #define HTC_MSG_SETUP_COMPLETE_ID 4
103 #define HTC_MSG_SETUP_COMPLETE_EX_ID 5
104
105 #define HTC_MAX_CONTROL_MESSAGE_LENGTH 256
106
107 /* base message ID header */
108 typedef PREPACK struct {
109 A_UINT16 MessageID;
110 } POSTPACK HTC_UNKNOWN_MSG;
111
112 /* HTC ready message
113 * direction : target-to-host */
114 typedef PREPACK struct {
115 A_UINT16 MessageID; /* ID */
116 A_UINT16 CreditCount; /* number of credits the target can offer */
117 A_UINT16 CreditSize; /* size of each credit */
118 A_UINT8 MaxEndpoints; /* maximum number of endpoints the target has resour ces for */
119 A_UINT8 _Pad1;
120 } POSTPACK HTC_READY_MSG;
121
122 /* extended HTC ready message */
123 typedef PREPACK struct {
124 HTC_READY_MSG Version2_0_Info; /* legacy version 2.0 information at the front... */
125 /* extended information */
126 A_UINT8 HTCVersion;
127 A_UINT8 MaxMsgsPerHTCBundle;
128 } POSTPACK HTC_READY_EX_MSG;
129
130 #define HTC_VERSION_2P0 0x00
131 #define HTC_VERSION_2P1 0x01 /* HTC 2.1 */
132
133 #define HTC_SERVICE_META_DATA_MAX_LENGTH 128
134
135 /* connect service
136 * direction : host-to-target */
137 typedef PREPACK struct {
138 A_UINT16 MessageID;
139 A_UINT16 ServiceID; /* service ID of the service to connect to */
140 A_UINT16 ConnectionFlags; /* connection flags */
141
142 #define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2) /* reduce credit dribb ling when
143 the host needs cred its */
144 #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_MASK (0x3)
145 #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_FOURTH 0x0
146 #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_ONE_HALF 0x1
147 #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS 0x2
148 #define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY 0x3
149
150 A_UINT8 ServiceMetaLength; /* length of meta data that follows */
151 A_UINT8 _Pad1;
152
153 /* service-specific meta data starts after the header */
154
155 } POSTPACK HTC_CONNECT_SERVICE_MSG;
156
157 /* connect response
158 * direction : target-to-host */
159 typedef PREPACK struct {
160 A_UINT16 MessageID;
161 A_UINT16 ServiceID; /* service ID that the connection request wa s made */
162 A_UINT8 Status; /* service connection status */
163 A_UINT8 EndpointID; /* assigned endpoint ID */
164 A_UINT16 MaxMsgSize; /* maximum expected message size on this end point */
165 A_UINT8 ServiceMetaLength; /* length of meta data that follows */
166 A_UINT8 _Pad1;
167
168 /* service-specific meta data starts after the header */
169
170 } POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG;
171
172 typedef PREPACK struct {
173 A_UINT16 MessageID;
174 /* currently, no other fields */
175 } POSTPACK HTC_SETUP_COMPLETE_MSG;
176
177 /* extended setup completion message */
178 typedef PREPACK struct {
179 A_UINT16 MessageID;
180 A_UINT32 SetupFlags;
181 A_UINT8 MaxMsgsPerBundledRecv;
182 A_UINT8 Rsvd[3];
183 } POSTPACK HTC_SETUP_COMPLETE_EX_MSG;
184
185 #define HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV (1 << 0)
186
187 /* connect response status codes */
188 #define HTC_SERVICE_SUCCESS 0 /* success */
189 #define HTC_SERVICE_NOT_FOUND 1 /* service could not be found */
190 #define HTC_SERVICE_FAILED 2 /* specific service failed the connect */
191 #define HTC_SERVICE_NO_RESOURCES 3 /* no resources (i.e. no more endpoints) */
192 #define HTC_SERVICE_NO_MORE_EP 4 /* specific service is not allowing any more
193 endpoints */
194
195 /* report record IDs */
196
197 #define HTC_RECORD_NULL 0
198 #define HTC_RECORD_CREDITS 1
199 #define HTC_RECORD_LOOKAHEAD 2
200 #define HTC_RECORD_LOOKAHEAD_BUNDLE 3
201
202 typedef PREPACK struct {
203 A_UINT8 RecordID; /* Record ID */
204 A_UINT8 Length; /* Length of record */
205 } POSTPACK HTC_RECORD_HDR;
206
207 typedef PREPACK struct {
208 A_UINT8 EndpointID; /* Endpoint that owns these credits */
209 A_UINT8 Credits; /* credits to report since last report */
210 } POSTPACK HTC_CREDIT_REPORT;
211
212 typedef PREPACK struct {
213 A_UINT8 PreValid; /* pre valid guard */
214 A_UINT8 LookAhead[4]; /* 4 byte lookahead */
215 A_UINT8 PostValid; /* post valid guard */
216
217 /* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard by tes.
218 * The PreValid bytes must equal the inverse of the PostValid byte */
219
220 } POSTPACK HTC_LOOKAHEAD_REPORT;
221
222 typedef PREPACK struct {
223 A_UINT8 LookAhead[4]; /* 4 byte lookahead */
224 } POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT;
225
226 #ifndef ATH_TARGET
227 #include "athendpack.h"
228 #endif
229
230
231 #endif /* __HTC_H__ */
232
OLDNEW
« no previous file with comments | « chromeos/drivers/ath6kl/include/host_version.h ('k') | chromeos/drivers/ath6kl/include/htc_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698