Fix common misspellings
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / ath6kl / include / common / epping_test.h
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2009-2010 Atheros Corporation. All rights reserved.
3 //
4 //
5 // Permission to use, copy, modify, and/or distribute this software for any
6 // purpose with or without fee is hereby granted, provided that the above
7 // copyright notice and this permission notice appear in all copies.
8 //
9 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 //
17 //
18 //------------------------------------------------------------------------------
19 //==============================================================================
20 // Author(s): ="Atheros"
21 //
22
23 /* This file contains shared definitions for the host/target endpoint ping test */
24
25 #ifndef EPPING_TEST_H_
26 #define EPPING_TEST_H_
27
28 #ifndef ATH_TARGET
29 #include "athstartpack.h"
30 #endif
31
32 /* alignment to 4-bytes */
33 #define EPPING_ALIGNMENT_PAD (((sizeof(struct htc_frame_hdr) + 3) & (~0x3)) - sizeof(struct htc_frame_hdr))
34
35 #ifndef A_OFFSETOF
36 #define A_OFFSETOF(type,field) (int)(&(((type *)NULL)->field))
37 #endif
38
39 #define EPPING_RSVD_FILL 0xCC
40
41 #define HCI_RSVD_EXPECTED_PKT_TYPE_RECV_OFFSET 7
42
43 typedef PREPACK struct {
44 u8 _HCIRsvd[8]; /* reserved for HCI packet header (GMBOX) testing */
45 u8 StreamEcho_h; /* stream no. to echo this packet on (filled by host) */
46 u8 StreamEchoSent_t; /* stream no. packet was echoed to (filled by target)
47 When echoed: StreamEchoSent_t == StreamEcho_h */
48 u8 StreamRecv_t; /* stream no. that target received this packet on (filled by target) */
49 u8 StreamNo_h; /* stream number to send on (filled by host) */
50 u8 Magic_h[4]; /* magic number to filter for this packet on the host*/
51 u8 _rsvd[6]; /* reserved fields that must be set to a "reserved" value
52 since this packet maps to a 14-byte ethernet frame we want
53 to make sure ethertype field is set to something unknown */
54
55 u8 _pad[2]; /* padding for alignment */
56 u8 TimeStamp[8]; /* timestamp of packet (host or target) */
57 u32 HostContext_h; /* 4 byte host context, target echos this back */
58 u32 SeqNo; /* sequence number (set by host or target) */
59 u16 Cmd_h; /* ping command (filled by host) */
60 u16 CmdFlags_h; /* optional flags */
61 u8 CmdBuffer_h[8]; /* buffer for command (host -> target) */
62 u8 CmdBuffer_t[8]; /* buffer for command (target -> host) */
63 u16 DataLength; /* length of data */
64 u16 DataCRC; /* 16 bit CRC of data */
65 u16 HeaderCRC; /* header CRC (fields : StreamNo_h to end, minus HeaderCRC) */
66 } POSTPACK EPPING_HEADER;
67
68 #define EPPING_PING_MAGIC_0 0xAA
69 #define EPPING_PING_MAGIC_1 0x55
70 #define EPPING_PING_MAGIC_2 0xCE
71 #define EPPING_PING_MAGIC_3 0xEC
72
73
74
75 #define IS_EPPING_PACKET(pPkt) (((pPkt)->Magic_h[0] == EPPING_PING_MAGIC_0) && \
76 ((pPkt)->Magic_h[1] == EPPING_PING_MAGIC_1) && \
77 ((pPkt)->Magic_h[2] == EPPING_PING_MAGIC_2) && \
78 ((pPkt)->Magic_h[3] == EPPING_PING_MAGIC_3))
79
80 #define SET_EPPING_PACKET_MAGIC(pPkt) { (pPkt)->Magic_h[0] = EPPING_PING_MAGIC_0; \
81 (pPkt)->Magic_h[1] = EPPING_PING_MAGIC_1; \
82 (pPkt)->Magic_h[2] = EPPING_PING_MAGIC_2; \
83 (pPkt)->Magic_h[3] = EPPING_PING_MAGIC_3;}
84
85 #define CMD_FLAGS_DATA_CRC (1 << 0) /* DataCRC field is valid */
86 #define CMD_FLAGS_DELAY_ECHO (1 << 1) /* delay the echo of the packet */
87 #define CMD_FLAGS_NO_DROP (1 << 2) /* do not drop at HTC layer no matter what the stream is */
88
89 #define IS_EPING_PACKET_NO_DROP(pPkt) ((pPkt)->CmdFlags_h & CMD_FLAGS_NO_DROP)
90
91 #define EPPING_CMD_ECHO_PACKET 1 /* echo packet test */
92 #define EPPING_CMD_RESET_RECV_CNT 2 /* reset recv count */
93 #define EPPING_CMD_CAPTURE_RECV_CNT 3 /* fetch recv count, 4-byte count returned in CmdBuffer_t */
94 #define EPPING_CMD_NO_ECHO 4 /* non-echo packet test (tx-only) */
95 #define EPPING_CMD_CONT_RX_START 5 /* continuous RX packets, parameters are in CmdBuffer_h */
96 #define EPPING_CMD_CONT_RX_STOP 6 /* stop continuous RX packet transmission */
97
98 /* test command parameters may be no more than 8 bytes */
99 typedef PREPACK struct {
100 u16 BurstCnt; /* number of packets to burst together (for HTC 2.1 testing) */
101 u16 PacketLength; /* length of packet to generate including header */
102 u16 Flags; /* flags */
103
104 #define EPPING_CONT_RX_DATA_CRC (1 << 0) /* Add CRC to all data */
105 #define EPPING_CONT_RX_RANDOM_DATA (1 << 1) /* randomize the data pattern */
106 #define EPPING_CONT_RX_RANDOM_LEN (1 << 2) /* randomize the packet lengths */
107 } POSTPACK EPPING_CONT_RX_PARAMS;
108
109 #define EPPING_HDR_CRC_OFFSET A_OFFSETOF(EPPING_HEADER,StreamNo_h)
110 #define EPPING_HDR_BYTES_CRC (sizeof(EPPING_HEADER) - EPPING_HDR_CRC_OFFSET - (sizeof(u16)))
111
112 #define HCI_TRANSPORT_STREAM_NUM 16 /* this number is higher than the define WMM AC classes so we
113 can use this to distinguish packets */
114
115 #ifndef ATH_TARGET
116 #include "athendpack.h"
117 #endif
118
119
120 #endif /*EPPING_TEST_H_*/