OLD | NEW |
(Empty) | |
| 1 //------------------------------------------------------------------------------ |
| 2 // <copyright file="epping_test.h" company="Atheros"> |
| 3 // Copyright (c) 2009 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 /* This file contains shared definitions for the host/target endpoint ping test
*/ |
| 21 |
| 22 #ifndef EPPING_TEST_H_ |
| 23 #define EPPING_TEST_H_ |
| 24 |
| 25 #ifndef ATH_TARGET |
| 26 #include "athstartpack.h" |
| 27 #endif |
| 28 |
| 29 #define A_OFFSETOF(type,field) (int)(&(((type *)NULL)->field)) |
| 30 |
| 31 #define EPPING_RSVD_FILL 0xCC |
| 32 |
| 33 #define HCI_RSVD_EXPECTED_PKT_TYPE_RECV_OFFSET 7 |
| 34 |
| 35 typedef PREPACK struct { |
| 36 A_UINT8 _HCIRsvd[8]; /* reserved for HCI packet header (GMBOX)
testing */ |
| 37 A_UINT8 StreamEcho_h; /* stream no. to echo this packet on (fil
led by host) */ |
| 38 A_UINT8 StreamEchoSent_t; /* stream no. packet was echoed to (fille
d by target) |
| 39 When echoed: StreamEchoSent_t == Strea
mEcho_h */ |
| 40 A_UINT8 StreamRecv_t; /* stream no. that target received this p
acket on (filled by target) */ |
| 41 A_UINT8 StreamNo_h; /* stream number to send on (filled by ho
st) */ |
| 42 A_UINT8 Magic_h[4]; /* magic number to filter for this packet
on the host*/ |
| 43 A_UINT8 _rsvd[6]; /* reserved fields that must be set to a
"reserved" value |
| 44 since this packet maps to a 14-byte et
hernet frame we want |
| 45 to make sure ethertype field is set to
something unknown */ |
| 46 |
| 47 A_UINT8 _pad[2]; /* padding for alignment */
|
| 48 A_UINT8 TimeStamp[8]; /* timestamp of packet (host or target) *
/ |
| 49 A_UINT32 HostContext_h; /* 4 byte host context, target echos this
back */ |
| 50 A_UINT32 SeqNo; /* sequence number (set by host or target
) */ |
| 51 A_UINT16 Cmd_h; /* ping command (filled by host) */ |
| 52 A_UINT16 CmdFlags_h; /* optional flags */ |
| 53 A_UINT8 CmdBuffer_h[8]; /* buffer for command (host -> target) */ |
| 54 A_UINT8 CmdBuffer_t[8]; /* buffer for command (target -> host) */
|
| 55 A_UINT16 DataLength; /* length of data */ |
| 56 A_UINT16 DataCRC; /* 16 bit CRC of data */ |
| 57 A_UINT16 HeaderCRC; /* header CRC (fields : StreamNo_h to end
, minus HeaderCRC) */ |
| 58 } POSTPACK EPPING_HEADER; |
| 59 |
| 60 #define EPPING_PING_MAGIC_0 0xAA |
| 61 #define EPPING_PING_MAGIC_1 0x55 |
| 62 #define EPPING_PING_MAGIC_2 0xCE |
| 63 #define EPPING_PING_MAGIC_3 0xEC |
| 64 |
| 65 |
| 66 |
| 67 #define IS_EPPING_PACKET(pPkt) (((pPkt)->Magic_h[0] == EPPING_PING_MAGIC_0) &&
\ |
| 68 ((pPkt)->Magic_h[1] == EPPING_PING_MAGIC_1) &&
\ |
| 69 ((pPkt)->Magic_h[2] == EPPING_PING_MAGIC_2) &&
\ |
| 70 ((pPkt)->Magic_h[3] == EPPING_PING_MAGIC_3)) |
| 71 |
| 72 #define SET_EPPING_PACKET_MAGIC(pPkt) { (pPkt)->Magic_h[0] = EPPING_PING_MAGIC_0
; \ |
| 73 (pPkt)->Magic_h[1] = EPPING_PING_MAGIC_1
; \ |
| 74 (pPkt)->Magic_h[2] = EPPING_PING_MAGIC_2
; \ |
| 75 (pPkt)->Magic_h[3] = EPPING_PING_MAGIC_3
;} |
| 76 |
| 77 #define CMD_FLAGS_DATA_CRC (1 << 0) /* DataCRC field is valid */ |
| 78 #define CMD_FLAGS_DELAY_ECHO (1 << 1) /* delay the echo of the packet
*/ |
| 79 #define CMD_FLAGS_NO_DROP (1 << 2) /* do not drop at HTC layer no m
atter what the stream is */ |
| 80 |
| 81 #define IS_EPING_PACKET_NO_DROP(pPkt) ((pPkt)->CmdFlags_h & CMD_FLAGS_NO_DROP) |
| 82 |
| 83 #define EPPING_CMD_ECHO_PACKET 1 /* echo packet test */ |
| 84 #define EPPING_CMD_RESET_RECV_CNT 2 /* reset recv count */ |
| 85 #define EPPING_CMD_CAPTURE_RECV_CNT 3 /* fetch recv count, 4-byte count re
turned in CmdBuffer_t */ |
| 86 #define EPPING_CMD_NO_ECHO 4 /* non-echo packet test (tx-only) */ |
| 87 #define EPPING_CMD_CONT_RX_START 5 /* continous RX packets, parameters
are in CmdBuffer_h */ |
| 88 #define EPPING_CMD_CONT_RX_STOP 6 /* stop continuous RX packet transmi
ssion */ |
| 89 |
| 90 /* test command parameters may be no more than 8 bytes */ |
| 91 typedef PREPACK struct { |
| 92 A_UINT16 BurstCnt; /* number of packets to burst together (for HTC 2.
1 testing) */ |
| 93 A_UINT16 PacketLength; /* length of packet to generate including header *
/ |
| 94 A_UINT16 Flags; /* flags */ |
| 95 |
| 96 #define EPPING_CONT_RX_DATA_CRC (1 << 0) /* Add CRC to all data */ |
| 97 #define EPPING_CONT_RX_RANDOM_DATA (1 << 1) /* randomize the data pattern */ |
| 98 #define EPPING_CONT_RX_RANDOM_LEN (1 << 2) /* randomize the packet lengths */
|
| 99 } POSTPACK EPPING_CONT_RX_PARAMS; |
| 100 |
| 101 #define EPPING_HDR_CRC_OFFSET A_OFFSETOF(EPPING_HEADER,StreamNo_h) |
| 102 #define EPPING_HDR_BYTES_CRC (sizeof(EPPING_HEADER) - EPPING_HDR_CRC_OFFSET
- (sizeof(A_UINT16))) |
| 103 |
| 104 #define HCI_TRANSPORT_STREAM_NUM 16 /* this number is higher than the define W
MM AC classes so we |
| 105 can use this to distinguish packets */ |
| 106 |
| 107 #ifndef ATH_TARGET |
| 108 #include "athendpack.h" |
| 109 #endif |
| 110 |
| 111 |
| 112 #endif /*EPPING_TEST_H_*/ |
OLD | NEW |