TWD/TWDriver/TWDriverInternal.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * TWDriverInternal.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 /** \file TWDriverInternal.h
       
    42  *  \brief TWD Driver internal common internal declarations
       
    43  *
       
    44  *  \see TWDriver.h
       
    45  */
       
    46 
       
    47 
       
    48 #ifndef TWDRIVERINTERNAL_H
       
    49 #define TWDRIVERINTERNAL_H
       
    50 
       
    51 
       
    52 #include "TWDriver.h"
       
    53 #include "Device.h"
       
    54 
       
    55 
       
    56 /* Shift factor to conver between TU (1024 uSec) and uSec. */
       
    57 #define SHIFT_BETWEEN_TU_AND_USEC       10  
       
    58 
       
    59 /* keep-alive templates definitions */
       
    60 #define KLV_MAX_TMPL_NUM                4
       
    61 
       
    62 /* Definitions for Rx Filter MIB */
       
    63 
       
    64 /* Set A—Enable: Forward all frames to host driver */
       
    65 #define MIB_RX_FILTER_PROMISCOUS_SET    0x01       
       
    66 /* Cleared A— Disable: Do not orward all frames to the host driver */
       
    67 #define MIB_RX_FILTER_PROMISCOUS_CLEAR  0x00       
       
    68 /* Set A—filter enabled: receive only those frames that match the BSSID given in the Join command */
       
    69 #define MIB_RX_FILTER_BSSID_SET         0x02       
       
    70 /* Cleared A—filter disabled: ignore BSSID in receiving */
       
    71 #define MIB_RX_FILTER_BSSID_CLEAR       0x00       
       
    72 
       
    73 /* Asynchronous init mode callback function type */
       
    74 typedef void (*fnotify_t)(TI_HANDLE module, TI_STATUS status);
       
    75 
       
    76         /* Callback function definition for EndOfRecovery */
       
    77 typedef void (*TEndOfRecoveryCb) (TI_HANDLE handle);
       
    78 
       
    79 
       
    80 /* TWD Driver Structure */
       
    81 typedef struct
       
    82 {
       
    83     TI_HANDLE           hOs;
       
    84     TI_HANDLE           hUser;
       
    85     TI_HANDLE           hReport;
       
    86     TI_HANDLE           hTimer;
       
    87     TI_HANDLE           hContext;
       
    88     TI_HANDLE           hMacServices;
       
    89     TI_HANDLE           hTxCtrlBlk;
       
    90     TI_HANDLE           hTxHwQueue;
       
    91     TI_HANDLE           hHwIntr;
       
    92     TI_HANDLE           hHealthMonitor;
       
    93     TI_HANDLE           hTwIf;
       
    94     TI_HANDLE           hTxnQ;
       
    95     TI_HANDLE           hCmdQueue;
       
    96     TI_HANDLE           hCmdBld;
       
    97     TI_HANDLE           hTxXfer;
       
    98     TI_HANDLE           hTxResult;
       
    99     TI_HANDLE           hRxXfer;
       
   100     TI_HANDLE           hFwEvent;
       
   101     TI_HANDLE           hHwInit;
       
   102     TI_HANDLE           hCmdMbox;
       
   103     TI_HANDLE           hEventMbox;
       
   104     TI_HANDLE           hFwDbg;
       
   105     TI_HANDLE           hRxQueue;
       
   106     
       
   107     /* If true it means that we are in recovery process */  
       
   108     TI_BOOL             bRecoveryEnabled;
       
   109 
       
   110     /* Init success flag */
       
   111     TI_BOOL             bInitSuccess;
       
   112 
       
   113     ReadWriteCommand_t  tPrintRegsBuf;    
       
   114 
       
   115     /* Init/Recovery/Stop callbacks */
       
   116     TTwdCallback        fInitHwCb;
       
   117     TTwdCallback        fInitFwCb;
       
   118     TTwdCallback        fConfigFwCb;
       
   119     TTwdCallback        fStopCb;
       
   120     TTwdCallback        fInitFailCb;
       
   121 
       
   122     TFailureEventCb     fFailureEventCb;
       
   123     TI_HANDLE          	hFailureEventCb;
       
   124 
       
   125     TI_UINT32           uNumMboxFailures;
       
   126 
       
   127 #ifdef TI_DBG  /* Just for debug. */
       
   128     /* Packets sequence counter (common for all queues). */
       
   129     TI_UINT32           dbgPktSeqNum;                               
       
   130     /* Tx counters per queue:*/
       
   131     /* Count packets sent from upper driver. */
       
   132     TI_UINT32           dbgCountSentPackets[MAX_NUM_OF_AC];  
       
   133     /* Count packets sent and queue not busy. */
       
   134     TI_UINT32           dbgCountQueueAvailable[MAX_NUM_OF_AC];
       
   135     /* Count XferDone return values from Xfer. */
       
   136     TI_UINT32           dbgCountXferDone[MAX_NUM_OF_AC];     
       
   137     /* Count Success return values from Xfer. */
       
   138     TI_UINT32           dbgCountXferSuccess[MAX_NUM_OF_AC];  
       
   139     /* Count Pending return value from Xfer. */
       
   140     TI_UINT32           dbgCountXferPending[MAX_NUM_OF_AC];  
       
   141     /* Count Error return value from Xfer. */
       
   142     TI_UINT32           dbgCountXferError[MAX_NUM_OF_AC];    
       
   143     /* Count XferDone callback calls. */
       
   144     TI_UINT32           dbgCountXferDoneCB[MAX_NUM_OF_AC];   
       
   145     /* Count TxComplete callback calls. */
       
   146     TI_UINT32           dbgCountTxCompleteCB[MAX_NUM_OF_AC]; 
       
   147 
       
   148     MemoryMap_t         MemMap;
       
   149     ACXStatistics_t     acxStatistic;
       
   150 #endif
       
   151 
       
   152 	TTestCmdCB	fRadioCb;
       
   153 	void		*pRadioCb;
       
   154 	TI_HANDLE	hRadioCb;
       
   155 	TTestCmd 	testCmd; 
       
   156 
       
   157 } TTwd;
       
   158 
       
   159 
       
   160 /* External Functions Prototypes */
       
   161 
       
   162 void  SendPacketTransfer (TI_HANDLE         hUser,  
       
   163                           TI_UINT32         aPacketId);
       
   164 void  SendPacketComplete (TI_HANDLE         hUser, 
       
   165                           TI_STATUS         aStatus, 
       
   166                           TI_UINT32         aPacketId, 
       
   167                           TI_UINT32         aRate, 
       
   168                           TI_UINT8          aAckFailures, 
       
   169                           TI_UINT32         durationInAir, 
       
   170                           TI_UINT32         fwHandlingTime, 
       
   171                           TI_UINT32         mediumDelay);
       
   172 
       
   173 
       
   174 
       
   175 
       
   176 #endif /* TNETW_DRIVER_H */
       
   177