TWD/FirmwareApi/public_descriptors.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * public_descriptors.h
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    11  *                                                                       
       
    12  * Redistribution and use in source and binary forms, with or without    
       
    13  * modification, are permitted provided that the following conditions    
       
    14  * are met:                                                              
       
    15  *                                                                       
       
    16  *  * Redistributions of source code must retain the above copyright     
       
    17  *    notice, this list of conditions and the following disclaimer.      
       
    18  *  * Redistributions in binary form must reproduce the above copyright  
       
    19  *    notice, this list of conditions and the following disclaimer in    
       
    20  *    the documentation and/or other materials provided with the         
       
    21  *    distribution.                                                      
       
    22  *  * Neither the name Texas Instruments nor the names of its            
       
    23  *    contributors may be used to endorse or promote products derived    
       
    24  *    from this software without specific prior written permission.      
       
    25  *                                                                       
       
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   
       
    27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     
       
    28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
       
    29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
       
    30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      
       
    32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
       
    33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
       
    34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   
       
    35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
       
    36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    37  */
       
    38 
       
    39 /**********************************************************************************************************************
       
    40 
       
    41   FILENAME:       public_descriptors.h
       
    42 
       
    43   DESCRIPTION:    Contains the host interface descriptor types in use.
       
    44 
       
    45 
       
    46 
       
    47 ***********************************************************************************************************************/
       
    48 #ifndef PUBLIC_DESCRIPTORS_H
       
    49 #define PUBLIC_DESCRIPTORS_H
       
    50 
       
    51 
       
    52 #include "public_types.h"
       
    53 
       
    54 
       
    55 
       
    56 /******************************************************************************
       
    57 
       
    58 		TX PATH
       
    59 	 
       
    60 ******************************************************************************/
       
    61 
       
    62 #define AID_BROADCAST 0x0       /* broadcast frames AID */
       
    63 #define AID_GLOBAL    0xFF      /* unassociated STAs AID */
       
    64 
       
    65 #define TRQ_DEPTH           16      /* depth of TX Result Queue */
       
    66 
       
    67 #define NUM_TX_DESCRIPTORS  32      /* Total number of Tx descriptors in the FW */
       
    68 
       
    69 /* TX attributes masks and offset used in the txAttr of TxIfDescriptor_t. */
       
    70 #define     TX_ATTR_SAVE_RETRIES          BIT_0
       
    71 #define     TX_ATTR_HEADER_PAD            BIT_1
       
    72 #define     TX_ATTR_SESSION_COUNTER       (BIT_2 | BIT_3 | BIT_4)
       
    73 #define     TX_ATTR_RATE_POLICY           (BIT_5 | BIT_6 | BIT_7 | BIT_8 | BIT_9)
       
    74 #define     TX_ATTR_LAST_WORD_PAD         (BIT_10 | BIT_11)
       
    75 #define     TX_ATTR_TX_CMPLT_REQ          BIT_12
       
    76 
       
    77 #define     TX_ATTR_OFST_SAVE_RETRIES     0
       
    78 #define     TX_ATTR_OFST_HEADER_PAD       1
       
    79 #define     TX_ATTR_OFST_SESSION_COUNTER  2
       
    80 #define     TX_ATTR_OFST_RATE_POLICY      5
       
    81 #define     TX_ATTR_OFST_LAST_WORD_PAD    10
       
    82 #define     TX_ATTR_OFST_TX_CMPLT_REQ     12
       
    83 
       
    84 /* The packet transmission result, written in the status field of TxResultDescriptor_t */
       
    85 typedef enum
       
    86 {
       
    87     TX_SUCCESS              = 0,     
       
    88 	TX_HW_ERROR             = 1,
       
    89 	TX_DISABLED             = 2,
       
    90 	TX_RETRY_EXCEEDED       = 3,
       
    91 	TX_TIMEOUT              = 4,
       
    92 	TX_KEY_NOT_FOUND        = 5,
       
    93 	TX_PEER_NOT_FOUND       = 6,
       
    94     TX_SESSION_MISMATCH     = 7 
       
    95 } TxDescStatus_enum;
       
    96 
       
    97 #ifdef HOST_COMPILE
       
    98 typedef uint8 TxDescStatus_e;
       
    99 #else
       
   100 typedef TxDescStatus_enum TxDescStatus_e;
       
   101 #endif
       
   102 
       
   103 /* The Tx Descriptor preceding each Tx packet copied to the FW (before the packet). */
       
   104 typedef struct TxIfDescriptor_t
       
   105 {
       
   106     uint16          length;		/* Length of packet in words, including descriptor+header+data */
       
   107     uint8           extraMemBlks; /* Number of extra memory blocks to allocate for this packet in addition 
       
   108                                        to the number of blocks derived from the packet length */
       
   109     uint8           totalMemBlks;   /* Total number of memory blocks allocated by the host for this packet. 
       
   110                                     Must be equal or greater than the actual blocks number allocated by HW!! */
       
   111     uint32          startTime;  /* Device time (in us) when the packet arrived to the driver */
       
   112     uint16          lifeTime;   /* Max delay in TUs until transmission. The last device time the 
       
   113                                       packet can be transmitted is: startTime+(1024*LifeTime) */ 
       
   114     uint16          txAttr;		/* Bitwise fields - see TX_ATTR... definitions above. */
       
   115     uint8           descID;		/* Packet identifier used also in the Tx-Result. */
       
   116     uint8           tid;		/* The packet TID value (as User-Priority) */
       
   117     uint8           aid;	    /* Identifier of the remote STA in IBSS, 1 in infra-BSS */
       
   118     uint8           reserved;       /* For HW use, set to 0 */
       
   119 
       
   120 } TxIfDescriptor_t;
       
   121 
       
   122 
       
   123 /* The Tx result retrieved from FW upon TX completion. */
       
   124 typedef struct TxResultDescriptor_t
       
   125 {
       
   126     uint8			descID;		 /* Packet Identifier - same value used in the Tx descriptor.*/
       
   127 	TxDescStatus_e	status;		 /* The status of the transmission, indicating success or one of several
       
   128 									 possible reasons for failure. Refer to TxDescStatus_enum above.*/
       
   129     uint16 			mediumUsage; /* Total air access duration including all retrys and overheads.*/
       
   130     uint32 			fwHandlingTime;	/* The time passed from host xfer to Tx-complete.*/
       
   131     uint32 			mediumDelay; /* Total media delay (from 1st EDCA AIFS counter until TX Complete). */
       
   132     uint8  			lsbSecuritySequenceNumber; /* LS-byte of last TKIP seq-num (saved per AC for recovery).*/
       
   133     uint8  			ackFailures; /* Retry count - number of transmissions without successful ACK.*/
       
   134     TxRateIndex_t	rate;		 /* The rate that succeeded getting ACK (Valid only if status=SUCCESS). */
       
   135     uint8  			spare;       /* for 4-byte alignment. */  
       
   136 } TxResultDescriptor_t;
       
   137 
       
   138 /* The Host-FW Tx-Result control counters */
       
   139 typedef struct
       
   140 {
       
   141 	uint32 TxResultFwCounter;	/* FW updates num of results written to results-queue since FW-init. */
       
   142     uint32 TxResultHostCounter;	/* Host updates num of results read from results-queue since FW-init. */
       
   143 } TxResultControl_t;
       
   144 
       
   145 /* The Host-FW Tx-Result Interface */
       
   146 typedef struct 
       
   147 {
       
   148 	TxResultControl_t TxResultControl;  		   /* See above. */
       
   149 	TxResultDescriptor_t TxResultQueue[TRQ_DEPTH];
       
   150 } TxResultInterface_t;
       
   151 
       
   152 
       
   153 /******************************************************************************
       
   154 
       
   155 		RX PATH
       
   156 
       
   157 ******************************************************************************/
       
   158 /* ------------------------------------- */
       
   159 /* flags field in the RxIfDescriptor_t   */
       
   160 /* ------------------------------------- */
       
   161 /*   Bit5-7: Encryption type:            */
       
   162 /*           0 - none                    */
       
   163 /*           1 - WEP                     */
       
   164 /*           2 - TKIP                    */
       
   165 /*           3 - AES                     */
       
   166 /*           4 - GEM                     */
       
   167 /*   Bit4: HT                            */
       
   168 /*   Bit3: Was part of A-MPDU            */
       
   169 /*   Bit2: STBC                          */
       
   170 /*   Bit0-1: Band the frame was received */
       
   171 /*           from (0=2.4, 1=4.9, 2=5.0)  */
       
   172 /* ------------------------------------- */
       
   173 #define    RX_DESC_BAND_MASK        0x03  /* Band is in Bits 0-1 */
       
   174 #define    RX_DESC_BAND_BG          0x00  
       
   175 #define    RX_DESC_BAND_J           0x01  
       
   176 #define    RX_DESC_BAND_A           0x02
       
   177 #define    RX_DESC_STBC             0x04
       
   178 #define    RX_DESC_A_MPDU           0x08
       
   179 #define    RX_DESC_HT               0x10
       
   180     #define    RX_DESC_ENCRYPT_MASK     0xE0  /* Encryption is in Bits 5-7 */
       
   181 #define    RX_DESC_ENCRYPT_WEP      0x20
       
   182 #define    RX_DESC_ENCRYPT_TKIP     0x40
       
   183 #define    RX_DESC_ENCRYPT_AES      0x60
       
   184     #define    RX_DESC_ENCRYPT_GEM      0x80
       
   185 
       
   186 
       
   187 /* ------------------------------------- */
       
   188 /* Status field in the RxIfDescriptor_t  */
       
   189 /* ------------------------------------- */
       
   190 /*   Bit3-7: reserved (0)                */
       
   191 /*   Bit0-2: 0 - Success,                */
       
   192 /*           1 - RX_DECRYPT_FAIL,        */
       
   193 /*           2 - RX_MIC_FAIL             */ 
       
   194 /* ------------------------------------- */
       
   195 #define    RX_DESC_STATUS_SUCCESS           0  
       
   196 #define    RX_DESC_STATUS_DECRYPT_FAIL      1  
       
   197 #define    RX_DESC_STATUS_MIC_FAIL          2
       
   198 #define    RX_DESC_STATUS_DRIVER_RX_Q_FAIL  3
       
   199 
       
   200 #define    RX_DESC_STATUS_MASK              7
       
   201 
       
   202 
       
   203 /**********************************************
       
   204     clasify tagging 
       
   205 ***********************************************/
       
   206 typedef enum
       
   207 {
       
   208     TAG_CLASS_UNKNOWN       = 0,
       
   209     TAG_CLASS_MANAGEMENT    = 1, /* other than Beacon or Probe Resp */
       
   210     TAG_CLASS_DATA          = 2,
       
   211     TAG_CLASS_QOS_DATA      = 3,
       
   212     TAG_CLASS_BCN_PRBRSP    = 4,
       
   213     TAG_CLASS_EAPOL         = 5, 
       
   214     TAG_CLASS_BA_EVENT      = 6,
       
   215     TAG_CLASS_AMSDU         = 7
       
   216 } PacketClassTag_enum;
       
   217 
       
   218 #ifdef HOST_COMPILE
       
   219 typedef uint8 PacketClassTag_e;
       
   220 #else
       
   221 typedef PacketClassTag_enum PacketClassTag_e;
       
   222 #endif
       
   223 
       
   224 typedef uint8 ProcessIDTag_e;
       
   225 
       
   226 /******************************************************************************
       
   227 
       
   228     RxIfDescriptor_t
       
   229 
       
   230     the structure of the Rx Descriptor recieved by HOST.
       
   231 
       
   232 ******************************************************************************/
       
   233 typedef struct
       
   234 {    
       
   235 	uint16              length;             /* Length of payload (including headers)*/
       
   236     
       
   237     uint8               status;             /* 0 = Success, 1 = RX Decrypt Fail, 2 = RX MIC Fail */
       
   238 
       
   239     uint8               flags;              /* See RX_DESC_xxx above */
       
   240 
       
   241     TxRateIndex_t       rate;               /* Recevied Rate:at ETxRateClassId format */
       
   242 
       
   243     uint8               channel;            /* The received channel*/
       
   244     
       
   245     int8                rx_level;           /* The computed RSSI value in db of current frame */  
       
   246     
       
   247     uint8               rx_snr;             /* The computed SNR value in db of current frame */
       
   248                                             
       
   249     uint32              timestamp;          /* Timestamp in microseconds,     */
       
   250 
       
   251     PacketClassTag_e    packet_class_tag;   /* Packet classification tagging info */
       
   252 
       
   253     ProcessIDTag_e      proccess_id_tag;    /* Driver defined ID */
       
   254 
       
   255     uint8               extraBytes;         /* Number of padding bytes added to actual packet length */
       
   256 
       
   257     uint8               reserved;
       
   258     
       
   259 } RxIfDescriptor_t;
       
   260 
       
   261 
       
   262 
       
   263 #endif /* PUBLIC_DESCRIPTORS_H*/
       
   264 
       
   265 
       
   266