~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/staging/ath6kl/include/common/htc.h

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#ifndef __HTC_H__
25
25
#define __HTC_H__
26
26
 
27
 
#ifndef ATH_TARGET
28
 
#include "athstartpack.h"
29
 
#endif
30
 
 
31
27
#define A_OFFSETOF(type,field) (unsigned long)(&(((type *)NULL)->field))
32
28
 
33
29
#define ASSEMBLE_UNALIGNED_UINT16(p,highbyte,lowbyte) \
34
 
        (((A_UINT16)(((A_UINT8 *)(p))[(highbyte)])) << 8 | (A_UINT16)(((A_UINT8 *)(p))[(lowbyte)]))
 
30
        (((u16)(((u8 *)(p))[(highbyte)])) << 8 | (u16)(((u8 *)(p))[(lowbyte)]))
35
31
        
36
32
/* alignment independent macros (little-endian) to fetch UINT16s or UINT8s from a 
37
33
 * structure using only the type and field name.
43
39
 
44
40
#define A_SET_UINT16_FIELD(p,type,field,value) \
45
41
{                                              \
46
 
    ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (A_UINT8)(value);        \
47
 
    ((A_UINT8 *)(p))[A_OFFSETOF(type,field) + 1] = (A_UINT8)((value) >> 8); \
 
42
    ((u8 *)(p))[A_OFFSETOF(type,field)] = (u8)(value);        \
 
43
    ((u8 *)(p))[A_OFFSETOF(type,field) + 1] = (u8)((value) >> 8); \
48
44
}
49
45
  
50
46
#define A_GET_UINT8_FIELD(p,type,field) \
51
 
            ((A_UINT8 *)(p))[A_OFFSETOF(type,field)]
 
47
            ((u8 *)(p))[A_OFFSETOF(type,field)]
52
48
            
53
49
#define A_SET_UINT8_FIELD(p,type,field,value) \
54
 
    ((A_UINT8 *)(p))[A_OFFSETOF(type,field)] = (value)
 
50
    ((u8 *)(p))[A_OFFSETOF(type,field)] = (value)
55
51
 
56
52
/****** DANGER DANGER ***************
57
53
 * 
66
62
 */
67
63
 
68
64
/* HTC frame header */
69
 
typedef PREPACK struct _HTC_FRAME_HDR{
 
65
PREPACK struct htc_frame_hdr {
70
66
        /* do not remove or re-arrange these fields, these are minimally required
71
67
         * to take advantage of 4-byte lookaheads in some hardware implementations */
72
 
    A_UINT8   EndpointID;
73
 
    A_UINT8   Flags;
74
 
    A_UINT16  PayloadLen;       /* length of data (including trailer) that follows the header */
 
68
    u8 EndpointID;
 
69
    u8 Flags;
 
70
    u16 PayloadLen;       /* length of data (including trailer) that follows the header */
75
71
    
76
72
    /***** end of 4-byte lookahead ****/
77
73
    
78
 
    A_UINT8   ControlBytes[2];
 
74
    u8 ControlBytes[2];
79
75
    
80
76
    /* message payload starts after the header */
81
77
    
82
 
} POSTPACK HTC_FRAME_HDR;
 
78
} POSTPACK;
83
79
 
84
80
/* frame header flags */
85
81
 
94
90
#define HTC_FLAGS_RECV_BUNDLE_CNT_MASK (0xF0)  /* bits 7..4  */
95
91
#define HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT 4
96
92
 
97
 
#define HTC_HDR_LENGTH  (sizeof(HTC_FRAME_HDR))
 
93
#define HTC_HDR_LENGTH  (sizeof(struct htc_frame_hdr))
98
94
#define HTC_MAX_TRAILER_LENGTH   255
99
 
#define HTC_MAX_PAYLOAD_LENGTH   (4096 - sizeof(HTC_FRAME_HDR))
 
95
#define HTC_MAX_PAYLOAD_LENGTH   (4096 - sizeof(struct htc_frame_hdr))
100
96
 
101
97
/* HTC control message IDs */
102
98
 
110
106
         
111
107
/* base message ID header */
112
108
typedef PREPACK struct {
113
 
    A_UINT16 MessageID;    
 
109
    u16 MessageID;
114
110
} POSTPACK HTC_UNKNOWN_MSG;
115
111
                                                     
116
112
/* HTC ready message
117
113
 * direction : target-to-host  */
118
114
typedef PREPACK struct {
119
 
    A_UINT16  MessageID;    /* ID */
120
 
    A_UINT16  CreditCount;  /* number of credits the target can offer */       
121
 
    A_UINT16  CreditSize;   /* size of each credit */
122
 
    A_UINT8   MaxEndpoints; /* maximum number of endpoints the target has resources for */
123
 
    A_UINT8   _Pad1;
 
115
    u16 MessageID;    /* ID */
 
116
    u16 CreditCount;  /* number of credits the target can offer */
 
117
    u16 CreditSize;   /* size of each credit */
 
118
    u8 MaxEndpoints; /* maximum number of endpoints the target has resources for */
 
119
    u8 _Pad1;
124
120
} POSTPACK HTC_READY_MSG;
125
121
 
126
122
    /* extended HTC ready message */
127
123
typedef PREPACK struct {
128
124
    HTC_READY_MSG   Version2_0_Info;   /* legacy version 2.0 information at the front... */
129
125
    /* extended information */
130
 
    A_UINT8         HTCVersion;
131
 
    A_UINT8         MaxMsgsPerHTCBundle;
 
126
    u8 HTCVersion;
 
127
    u8 MaxMsgsPerHTCBundle;
132
128
} POSTPACK HTC_READY_EX_MSG;
133
129
 
134
130
#define HTC_VERSION_2P0  0x00  
139
135
/* connect service
140
136
 * direction : host-to-target */
141
137
typedef PREPACK struct {
142
 
    A_UINT16  MessageID;
143
 
    A_UINT16  ServiceID;           /* service ID of the service to connect to */       
144
 
    A_UINT16  ConnectionFlags;     /* connection flags */
 
138
    u16 MessageID;
 
139
    u16 ServiceID;           /* service ID of the service to connect to */
 
140
    u16 ConnectionFlags;     /* connection flags */
145
141
 
146
142
#define HTC_CONNECT_FLAGS_REDUCE_CREDIT_DRIBBLE (1 << 2)  /* reduce credit dribbling when 
147
143
                                                             the host needs credits */  
151
147
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_THREE_FOURTHS     0x2
152
148
#define HTC_CONNECT_FLAGS_THRESHOLD_LEVEL_UNITY             0x3
153
149
                                                             
154
 
    A_UINT8   ServiceMetaLength;   /* length of meta data that follows */
155
 
    A_UINT8   _Pad1;
 
150
    u8 ServiceMetaLength;   /* length of meta data that follows */
 
151
    u8 _Pad1;
156
152
    
157
153
    /* service-specific meta data starts after the header */
158
154
    
161
157
/* connect response
162
158
 * direction : target-to-host */
163
159
typedef PREPACK struct {
164
 
    A_UINT16  MessageID;
165
 
    A_UINT16  ServiceID;            /* service ID that the connection request was made */
166
 
    A_UINT8   Status;               /* service connection status */ 
167
 
    A_UINT8   EndpointID;           /* assigned endpoint ID */
168
 
    A_UINT16  MaxMsgSize;           /* maximum expected message size on this endpoint */
169
 
    A_UINT8   ServiceMetaLength;    /* length of meta data that follows */
170
 
    A_UINT8   _Pad1;               
 
160
    u16 MessageID;
 
161
    u16 ServiceID;            /* service ID that the connection request was made */
 
162
    u8 Status;               /* service connection status */
 
163
    u8 EndpointID;           /* assigned endpoint ID */
 
164
    u16 MaxMsgSize;           /* maximum expected message size on this endpoint */
 
165
    u8 ServiceMetaLength;    /* length of meta data that follows */
 
166
    u8 _Pad1;
171
167
    
172
168
    /* service-specific meta data starts after the header */
173
169
    
174
170
} POSTPACK HTC_CONNECT_SERVICE_RESPONSE_MSG;
175
171
 
176
172
typedef PREPACK struct {
177
 
    A_UINT16  MessageID;
 
173
    u16 MessageID;
178
174
    /* currently, no other fields */
179
175
} POSTPACK HTC_SETUP_COMPLETE_MSG;
180
176
 
181
177
    /* extended setup completion message */
182
178
typedef PREPACK struct {
183
 
    A_UINT16  MessageID;
184
 
    A_UINT32  SetupFlags;
185
 
    A_UINT8   MaxMsgsPerBundledRecv;
186
 
    A_UINT8   Rsvd[3];
 
179
    u16 MessageID;
 
180
    u32 SetupFlags;
 
181
    u8 MaxMsgsPerBundledRecv;
 
182
    u8 Rsvd[3];
187
183
} POSTPACK HTC_SETUP_COMPLETE_EX_MSG;
188
184
 
189
185
#define HTC_SETUP_COMPLETE_FLAGS_ENABLE_BUNDLE_RECV     (1 << 0)
204
200
#define HTC_RECORD_LOOKAHEAD_BUNDLE 3
205
201
 
206
202
typedef PREPACK struct {
207
 
    A_UINT8 RecordID;     /* Record ID */
208
 
    A_UINT8 Length;       /* Length of record */
 
203
    u8 RecordID;     /* Record ID */
 
204
    u8 Length;       /* Length of record */
209
205
} POSTPACK HTC_RECORD_HDR;
210
206
 
211
207
typedef PREPACK struct {
212
 
    A_UINT8 EndpointID;     /* Endpoint that owns these credits */
213
 
    A_UINT8 Credits;        /* credits to report since last report */
 
208
    u8 EndpointID;     /* Endpoint that owns these credits */
 
209
    u8 Credits;        /* credits to report since last report */
214
210
} POSTPACK HTC_CREDIT_REPORT;
215
211
 
216
212
typedef PREPACK struct {    
217
 
    A_UINT8 PreValid;         /* pre valid guard */
218
 
    A_UINT8 LookAhead[4];     /* 4 byte lookahead */
219
 
    A_UINT8 PostValid;        /* post valid guard */
 
213
    u8 PreValid;         /* pre valid guard */
 
214
    u8 LookAhead[4];     /* 4 byte lookahead */
 
215
    u8 PostValid;        /* post valid guard */
220
216
    
221
217
   /* NOTE: the LookAhead array is guarded by a PreValid and Post Valid guard bytes.
222
218
    * The PreValid bytes must equal the inverse of the PostValid byte */
224
220
} POSTPACK HTC_LOOKAHEAD_REPORT;
225
221
 
226
222
typedef PREPACK struct {    
227
 
    A_UINT8 LookAhead[4];     /* 4 byte lookahead */    
 
223
    u8 LookAhead[4];     /* 4 byte lookahead */
228
224
} POSTPACK HTC_BUNDLED_LOOKAHEAD_REPORT;
229
225
 
230
 
#ifndef ATH_TARGET
231
 
#include "athendpack.h"
232
 
#endif
233
 
 
234
 
 
235
226
#endif /* __HTC_H__ */
236
227