Home | History | Annotate | Download | only in Export_Inc
      1 /****************************************************************************
      2 **+-----------------------------------------------------------------------+**
      3 **|                                                                       |**
      4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
      5 **| All rights reserved.                                                  |**
      6 **|                                                                       |**
      7 **| Redistribution and use in source and binary forms, with or without    |**
      8 **| modification, are permitted provided that the following conditions    |**
      9 **| are met:                                                              |**
     10 **|                                                                       |**
     11 **|  * Redistributions of source code must retain the above copyright     |**
     12 **|    notice, this list of conditions and the following disclaimer.      |**
     13 **|  * Redistributions in binary form must reproduce the above copyright  |**
     14 **|    notice, this list of conditions and the following disclaimer in    |**
     15 **|    the documentation and/or other materials provided with the         |**
     16 **|    distribution.                                                      |**
     17 **|  * Neither the name Texas Instruments nor the names of its            |**
     18 **|    contributors may be used to endorse or promote products derived    |**
     19 **|    from this software without specific prior written permission.      |**
     20 **|                                                                       |**
     21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
     22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
     23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
     24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
     25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
     26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
     27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
     28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
     29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
     30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
     31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
     32 **|                                                                       |**
     33 **+-----------------------------------------------------------------------+**
     34 ****************************************************************************/
     35 
     36 
     37 /***************************************************************************/
     38 /*																			*/
     39 /*	  MODULE:	TNETW-Driver												*/
     40 /*																			*/
     41 /*    PURPOSE:	Driver constants and type definitions						*/
     42 /*																			*/
     43 /***************************************************************************/
     44 
     45 #ifndef TNETW_DRIVER_TYPES_H
     46 #define TNETW_DRIVER_TYPES_H
     47 
     48 
     49 #include "commonTypes.h"
     50 #include "whalCtrl_api.h"
     51 #include "public_descriptors.h"   /* The FW Tx-Descriptor and Tx-Result structures are used to ensure
     52 									   FW compatibility and to avoid conversions in the data path. */
     53 #if defined(HW_ACCESS_WSPI)
     54 /* Read data offset */
     55 #define TNETWIF_READ_OFFSET_BYTES  8
     56 
     57 /* Write data offset */
     58 #define TNETWIF_WRITE_OFFSET_BYTES 4
     59 #else
     60 #define TNETWIF_READ_OFFSET_BYTES  0
     61 #define TNETWIF_WRITE_OFFSET_BYTES 0
     62 #endif
     63 /* Tx packet offset before the actual data */
     64 #define TX_TOTAL_OFFSET_BEFORE_DATA (TNETWIF_WRITE_OFFSET_BYTES + sizeof(DbTescriptor))
     65 
     66 /* Tx packet Control-Block flags bit-mask. */
     67 #define TX_CTRL_BLK_FLAGS_XFER_DONE_ISSUED		0x0001	/* Xfer-Done already issued to upper driver. */
     68 #define TX_CTRL_BLK_FLAGS_TX_COMPLETE_ISSUED	0x0002	/* Tx-Complete already issued to upper driver. */
     69 
     70 
     71 /* TNETW Driver Callback Module owner */
     72 typedef enum
     73 {
     74     TNETW_DRIVER_TX_XFER_OWNER			= 0x0100,
     75 	TNETW_DRIVER_RX_XFER_OWNER			= 0x0200,
     76 	TNETW_DRIVER_HAL_CTRL_OWNER			= 0x0300,
     77 	TNETW_DRIVER_MAC_SERVICES_OWNER		= 0x0400,
     78     TNETW_DRIVER_TX_RESULT_OWNER		= 0x0500,
     79 	TNETW_DRIVER_TWD_OWNER				= 0x0600,
     80 
     81     TNETW_DRIVER_LAST_OWNER				= TNETW_DRIVER_TWD_OWNER
     82 
     83 }   TNETW_DRIVER_CB_ModuleOwner_e;
     84 
     85 
     86 /* TxXfer MODULE Callbacks */
     87 #define  TX_XFER_SEND_PKT_TRANSFER		0x01
     88 #define  TX_XFER_SEND_PKT_DEBUG         0x02
     89 
     90 /* TxResult MODULE Callbacks */
     91 #define  TX_RESULT_SEND_PKT_COMPLETE	0x01
     92 
     93 
     94 
     95 /* TNETW Driver Callback ID */
     96 typedef enum
     97 {
     98 	/* Internal Failure Event Callbacks */
     99 	TNETW_DRIVER_EVENT_FAILURE					=   HAL_INTERNAL_EVENT_FAILURE,
    100 
    101 	/* MAC Services Event Callbacks */
    102 	TNETW_DRIVER_EVENT_SCAN_COMPLETE			= TNETW_DRIVER_MAC_SERVICES_OWNER | HAL_EVENT_SCAN_CMPLT,	  /* WHAL HW EVENT MBOX */
    103 	TNETW_DRIVER_EVENT_PS_MODE_COMPLETE			= TNETW_DRIVER_MAC_SERVICES_OWNER | HAL_EVENT_PS_REPORT,	  /* WHAL HW EVENT MBOX */
    104 	TNETW_DRIVER_EVENT_MEASUREMENT_COMPLETE		= TNETW_DRIVER_MAC_SERVICES_OWNER | HAL_EVENT_MEASUREMENT_COMPLETE,	  /* WHAL HW EVENT MBOX */
    105 
    106 
    107 	/* Ctrl Event Callbacks */
    108 	TNETW_DRIVER_EVENT_MEASUREMENT_START		=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_MEASUREMENT_START,
    109 	TNETW_DRIVER_EVENT_CALIB_CMPLT				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_CALIB_CMPLT,
    110 	TNETW_DRIVER_EVENT_RSSI_LEVEL				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_RSSI_LEVEL,
    111 	TNETW_DRIVER_EVENT_PS_REPORT				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_PS_REPORT,
    112 	TNETW_DRIVER_EVENT_SYNCHRONIZATION_TIMEOUT	=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_SYNCHRONIZATION_TIMEOUT,
    113 	TNETW_DRIVER_EVENT_HEALTH_REPORT			=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_HEALTH_REPORT,
    114 	TNETW_DRIVER_EVENT_ACI						=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_ACI,
    115 	TNETW_DRIVER_EVENT_DEBUG_MESSAGE			=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_DEBUG_MESSAGE,
    116 	TNETW_DRIVER_EVENT_MAC_STATUS				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_MAC_STATUS,
    117 	TNETW_DRIVER_EVENT_DISCONNECT_COMPLETE		=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_DISCONNECT_COMPLETE,
    118 	TNETW_DRIVER_EVENT_JOIN_CMPLT				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_JOIN_CMPLT,
    119 	TNETW_DRIVER_EVENT_SWITCH_CHANNEL_CMPLT		=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_SWITCH_CHANNEL_CMPLT,
    120 	TNETW_DRIVER_EVENT_BSS_LOSE					=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_BSS_LOSE,
    121 	TNETW_DRIVER_EVENT_MAX_TX_RETRY				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_MAX_TX_RETRY,
    122 	TNETW_DRIVER_EVENT_AP_DISCOVERY_COMPLETE	=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_AP_DISCOVERY_COMPLETE,
    123 	TNETW_DRIVER_EVENT_SPS_SCAN_CMPLT			=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_SPS_SCAN_CMPLT,
    124 	TNETW_DRIVER_EVENT_BSS_REGAIN				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_BSS_REGAIN,
    125 	TNETW_DRIVER_EVENT_RSSI_LEVEL_REGAIN		=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_RSSI_LEVEL_REGAIN,
    126 	TNETW_DRIVER_EVENT_BT_COEX_SENSE			=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_SOFT_GEMINI_SENSE,
    127 	TNETW_DRIVER_EVENT_BT_COEX_PROTECTIVE_MODE	=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_SOFT_GEMINI_PREDICTION,
    128 	TNETW_DRIVER_EVENT_BT_COEX_AVALANCHE		=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_EVENT_SOFT_GEMINI_AVALANCHE,
    129 	TNETW_DRIVER_COMMAND_COMPLETE				=  TNETW_DRIVER_HAL_CTRL_OWNER | HAL_INT_COMMAND_COMPLETE,
    130 
    131 	/* Tx Data Path Callbacks */
    132     TNETW_DRIVER_TX_XFER_SEND_PKT_TRANSFER		=  TNETW_DRIVER_TX_XFER_OWNER	| TX_XFER_SEND_PKT_TRANSFER,   /* TxXfer MODULE */
    133     TNETW_DRIVER_TX_RESULT_SEND_PKT_COMPLETE	=  TNETW_DRIVER_TX_RESULT_OWNER | TX_RESULT_SEND_PKT_COMPLETE, /* TxResult MODULE */
    134     TNETW_DRIVER_TX_XFER_SEND_PKT_DEBUG         =  TNETW_DRIVER_TX_XFER_OWNER   | TX_XFER_SEND_PKT_DEBUG,      /* TxXfer MODULE */
    135 
    136 	/* Rx Data Path Callbacks */
    137     TNETW_DRIVER_RX_RECEIVE_PACKET				=  TNETW_DRIVER_RX_XFER_OWNER | HAL_INT_RECEIVE_PACKET,			/* WHAL RX MODULE */
    138     TNETW_DRIVER_RX_REQUEST_FOR_BUFFER			=  TNETW_DRIVER_RX_XFER_OWNER | HAL_INT_REQUEST_FOR_BUFFER,		/* WHAL RX MODULE */
    139 
    140 }TnetwDrv_CB_ID_e;
    141 
    142 
    143 
    144 /* TNETW Driver print functions codes. */
    145 typedef enum
    146 {
    147 	TNETW_DRV_PRINT_TX_CTRL_BLK_TBL,
    148 	TNETW_DRV_PRINT_TX_HW_QUEUE_INFO,
    149 	TNETW_DRV_PRINT_TX_XFER_INFO,
    150 	TNETW_DRV_PRINT_TX_RESULT_INFO,
    151 	TNETW_DRV_CLEAR_TX_RESULT_INFO
    152 }TnetwDrv_PrintInfoType_e;
    153 
    154 
    155 
    156 /* Tx Control-Block Packet parameters that are not included in the Tx-descriptor. */
    157 typedef struct
    158 {
    159 	const void *pFrame;		/* Points to the whole packet including Tx-Descriptor + MAC-Header + Data. */
    160 	UINT32 packetId;		/* The packet ID used by the upper driver to identify it when called back. */
    161 	UINT16 headerFrameCtrl; /* The Frame Control field from the MAC header. */
    162 	UINT16 flags;			/* See TX_CTRL_BLK_FLAGS_xxxx above. */
    163 
    164 #ifdef TI_DBG
    165 	UINT32 dbgPktSeqNum;	/* Packets sequence counter per queue. */
    166 #endif
    167 
    168 } TxPktParams_t;
    169 
    170 
    171 /*
    172  * txCtrlBlkEntry_t:
    173  * =================
    174  * Contains the Tx packet parameters required for the Tx process, including
    175  *   the Tx descriptor and the attributes required for HW-queue calculations.
    176  * Allocated for each packet sent from the upper driver and freed upon Tx-complete.
    177  * The entry index is the descriptor-ID written in the descriptor and copied back in
    178  *   the tx-complete results.
    179  */
    180 typedef struct _txCtrlBlkEntry_t
    181 {
    182 	struct _txCtrlBlkEntry_t * pNextFreeEntry;	/* Pointer to the next free entry. */
    183 
    184 	DbTescriptor  txDescriptor; /* The packet descriptor copied to the FW. */
    185 
    186 	TxPktParams_t	txPktParams;  /* Per packet parameters not included in the descriptor. */
    187 
    188 } txCtrlBlkEntry_t;
    189 
    190 
    191 typedef void (*TnetDrv_callback_t)(TI_HANDLE CB_Handle);
    192 
    193 /* Data path constant parametrs */
    194 #define  DP_RX_PACKET_RING_CHUNK_SIZE 1600
    195 #define  DP_TX_PACKET_RING_CHUNK_SIZE 1600
    196 #define  DP_RX_PACKET_RING_CHUNK_NUM 2
    197 #define  DP_TX_PACKET_RING_CHUNK_NUM 2
    198 #define  DP_TX_COMPLETE_TIME_OUT 20
    199 
    200 #endif  /* TNETW_DRIVER_TYPES_H */
    201 
    202