1/*
2 * txCtrl_Api.h
3 *
4 * Copyright(c) 1998 - 2009 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/*    MODULE:   txCtrl_Api.h                                               */
38/*    PURPOSE:  TxCtrl module API Header file                              */
39/*                                                                         */
40/***************************************************************************/
41#ifndef _TX_CTRL_API_H_
42#define _TX_CTRL_API_H_
43
44#include "GeneralUtilApi.h"
45#include "DrvMainModules.h"
46
47/* TxCtrl Xmit results */
48typedef enum
49{
50    STATUS_XMIT_SUCCESS,
51    STATUS_XMIT_BUSY,
52    STATUS_XMIT_ERROR
53} EStatusXmit;
54
55
56typedef struct
57{
58	TI_BOOL    bHtEnable;	                        /* current flag of HT Capabilities enabled */
59    TI_UINT32  uTxCtrlHtControl;        	        /* The HT Control Field for futur use. for now empty and the FW set it */
60} TtxCtrlHtControl;
61
62
63/* Build the buffers descriptor of a typical two buffers (header & data) Tx packet */
64#define BUILD_TX_TWO_BUF_PKT_BDL(pPktCtrlBlk, pHdrBuf, uHdrLen, pDataBuf, uDataLen)  \
65    pPktCtrlBlk->tTxnStruct.aBuf[0]   = (TI_UINT8 *) (pHdrBuf);    \
66    pPktCtrlBlk->tTxnStruct.aLen[0]   = (TI_UINT16 ) (uHdrLen);    \
67    pPktCtrlBlk->tTxnStruct.aBuf[1]   = (TI_UINT8 *) (pDataBuf);   \
68    pPktCtrlBlk->tTxnStruct.aLen[1]   = (TI_UINT16 ) (uDataLen);   \
69    pPktCtrlBlk->tTxnStruct.aLen[2]   = 0;                         \
70    pPktCtrlBlk->tTxDescriptor.length = (TI_UINT16)((uHdrLen) + (uDataLen));
71
72
73/****************************************************************/
74/*                  MODULE  PUBLIC  FUNCTIONS                   */
75/****************************************************************/
76
77/*
78 *  The TxCtrl MAIN public functions (in txCtrl.c):
79 */
80TI_HANDLE txCtrl_Create (TI_HANDLE hOs);
81void      txCtrl_Init (TStadHandlesList *pStadHandles);
82TI_STATUS txCtrl_SetDefaults (TI_HANDLE hTxCtrl, txDataInitParams_t *txDataInitParams);
83TI_STATUS txCtrl_Unload (TI_HANDLE hTxCtrl);
84TI_STATUS txCtrl_XmitData (TI_HANDLE hTxCtrl, TTxCtrlBlk *pPktCtrlBlk);
85TI_STATUS txCtrl_XmitMgmt (TI_HANDLE hTxCtrl, TTxCtrlBlk *pPktCtrlBlk);
86void      txCtrl_UpdateQueuesMapping (TI_HANDLE hTxCtrl);
87void *    txCtrl_AllocPacketBuffer (TI_HANDLE hTxCtrl, TTxCtrlBlk *pPktCtrlBlk, TI_UINT32 uPacketLen);
88void      txCtrl_FreePacket (TI_HANDLE hTxCtrl, TTxCtrlBlk *pPktCtrlBlk, TI_STATUS eStatus);
89TI_STATUS txCtrl_NotifyFwReset(TI_HANDLE hTxCtrl);
90TI_STATUS txCtrl_CheckForTxStuck(TI_HANDLE hTxCtrl);
91TI_UINT32 txCtrl_BuildDataPktHdr (TI_HANDLE hTxCtrl, TTxCtrlBlk *pPktCtrlBlk, AckPolicy_e ackPolicy);
92
93
94/*
95 *  The txCtrlParams.c sub-module public functions:
96 */
97void      txCtrlParams_resetCounters(TI_HANDLE hTxCtrl);
98TI_HANDLE txCtrlParams_RegNotif(TI_HANDLE hTxCtrl,
99                                TI_UINT16 EventMask,
100                                GeneralEventCall_t CallBack,
101                                TI_HANDLE context,
102                                TI_UINT32 Cookie);
103TI_STATUS txCtrlParams_AddToNotifMask(TI_HANDLE hTxCtrl, TI_HANDLE Notifh, TI_UINT16 EventMask);
104TI_STATUS txCtrlParams_UnRegNotif(TI_HANDLE hTxCtrl, TI_HANDLE RegEventHandle);
105TI_STATUS txCtrlParams_setAdmissionCtrlParams(TI_HANDLE hTxCtrl,
106                                              TI_UINT8 acId,
107                                              TI_UINT16 mediumTime,
108                                              TI_UINT32 minimumPHYRate,
109                                              TI_BOOL admFlag);
110TI_STATUS txCtrlParams_getParam(TI_HANDLE hTxCtrl, paramInfo_t *pParamInfo);
111TI_STATUS txCtrlParams_setParam(TI_HANDLE hTxCtrl, paramInfo_t *pParamInfo);
112TI_STATUS txCtrlParams_SetHtControl (TI_HANDLE hTxCtrl, TtxCtrlHtControl *pHtControl);
113void txCtrlParams_setBssId (TI_HANDLE hTxCtrl, TMacAddr *pCurrBssId);
114void txCtrlParams_setBssType (TI_HANDLE hTxCtrl, ScanBssType_e currBssType);
115void txCtrlParams_setQosHeaderConverMode (TI_HANDLE hTxCtrl, EHeaderConvertMode  headerConverMode);
116void txCtrlParams_setCurrentPrivacyInvokedMode (TI_HANDLE hTxCtrl, TI_BOOL currentPrivacyInvokedMode);
117void txCtrlParams_setEapolEncryptionStatus (TI_HANDLE hTxCtrl, TI_BOOL eapolEncryptionStatus);
118void txCtrlParams_setEncryptionFieldSizes (TI_HANDLE hTxCtrl, TI_UINT8 encryptionFieldSize);
119void txCtrlParams_getCurrentEncryptionInfo (TI_HANDLE hTxCtrl,
120                                            TI_BOOL    *pCurrentPrivacyInvokedMode,
121                                            TI_UINT8   *pEncryptionFieldSize);
122ERate txCtrlParams_GetTxRate (TI_HANDLE hTxCtrl);
123void txCtrlParams_setAcAdmissionStatus (TI_HANDLE hTxCtrl,
124                                        TI_UINT8 ac,
125                                        EAdmissionState admissionRequired,
126                                        ETrafficAdmState admissionState);
127void txCtrlParams_setAcMsduLifeTime (TI_HANDLE hTxCtrl, TI_UINT8 ac, TI_UINT32 msduLifeTime);
128void txCtrlParams_setAcAckPolicy (TI_HANDLE hTxCtrl, TI_UINT8 ac, AckPolicy_e ackPolicy);
129void txCtrlParams_updateMgmtRateAttributes(TI_HANDLE hTxCtrl, TI_UINT8 ratePolicyId, TI_UINT8 ac);
130void txCtrlParams_updateDataRateAttributes(TI_HANDLE hTxCtrl, TI_UINT8 ratePolicyId, TI_UINT8 ac);
131void txCtrlParams_updateTxSessionCount(TI_HANDLE hTxCtrl, TI_UINT16 txSessionCount);
132#ifdef TI_DBG
133void txCtrlParams_printInfo(TI_HANDLE hTxCtrl);
134void txCtrlParams_printDebugCounters(TI_HANDLE hTxCtrl);
135void txCtrlParams_resetDbgCounters(TI_HANDLE hTxCtrl);
136#endif /* TI_DBG */
137
138
139/*
140 *  The txCtrlServ.c sub-module public functions:
141 */
142TI_STATUS txCtrlServ_buildNullFrame(TI_HANDLE hTxCtrl, TI_UINT8* pFrame, TI_UINT32* pLength);
143TI_STATUS txCtrlServ_buildWlanHeader(TI_HANDLE hTxCtrl, TI_UINT8* pFrame, TI_UINT32* pLength);
144
145#endif /* _TX_CTRL_API_H_ */
146