Esempio n. 1
0
/** 
 * \fn     cmdHndlr_Init 
 * \brief  Init required handles and registries
 * 
 * Init required handles and module variables, create the commands-queue and 
 *     register as the context-engine client.
 * 
 * \note    
 * \param  pStadHandles  - The driver modules handles
 * \return void  
 * \sa     
 */ 
void cmdHndlr_Init (TStadHandlesList *pStadHandles)
{
    TCmdHndlrObj *pCmdHndlr = (TCmdHndlrObj *)(pStadHandles->hCmdHndlr);
    TI_UINT32     uNodeHeaderOffset;

    pCmdHndlr->hReport  = pStadHandles->hReport;
    pCmdHndlr->hContext = pStadHandles->hContext;

    cmdInterpret_Init (pCmdHndlr->hCmdInterpret, pStadHandles);

    /* The offset of the queue-node-header from the commands structure entry is needed by the queue */
    uNodeHeaderOffset = TI_FIELD_OFFSET(TConfigCommand, tQueNodeHdr); 

    /* Create and initialize the commands queue */
    pCmdHndlr->hCmdQueue = que_Create (pCmdHndlr->hOs, pCmdHndlr->hReport, COMMANDS_QUE_SIZE, uNodeHeaderOffset);

    /* Register to the context engine and get the client ID */
    pCmdHndlr->uContextId = context_RegisterClient (pCmdHndlr->hContext,
                                                    cmdHndlr_HandleCommands,
                                                    (TI_HANDLE)pCmdHndlr,
                                                    TI_FALSE,
                                                    "COMMAND",
                                                    sizeof("COMMAND"));

	if(pCmdHndlr->hReport != NULL)
	{
		os_setDebugOutputToLogger(TI_FALSE);
	}
}
Esempio n. 2
0
/**
 * \fn     tmr_Init
 * \brief  Init required handles
 *
 * Init required handles and module variables, create the init-queue and
 *     operational-queue, and register as the context-engine client.
 *
 * \note
 * \param  hTimerModule  - The queue object
 * \param  hOs       - Handle to Os Abstraction Layer
 * \param  hReport   - Handle to report module
 * \param  hContext  - Handle to context module
 * \return void
 * \sa
 */
void tmr_Init (TI_HANDLE hTimerModule, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext)
{
    TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
    TI_UINT32     uNodeHeaderOffset;

    pTimerModule->hOs           = hOs;
    pTimerModule->hReport       = hReport;
    pTimerModule->hContext      = hContext;

    pTimerModule->bOperState    = TI_FALSE;
    pTimerModule->uTimersCount  = 0;
    pTimerModule->uTwdInitCount = 0;

    /* The offset of the queue-node-header from timer structure entry is needed by the queue */
    uNodeHeaderOffset = TI_FIELD_OFFSET(TTimerInfo, tQueNodeHdr);

    /* Create and initialize the Init and Operational queues (for timers expiry events) */
    pTimerModule->hInitQueue = que_Create (pTimerModule->hOs,
                                           pTimerModule->hReport,
                                           EXPIRY_QUE_SIZE,
                                           uNodeHeaderOffset);
    pTimerModule->hOperQueue = que_Create (pTimerModule->hOs,
                                           pTimerModule->hReport,
                                           EXPIRY_QUE_SIZE,
                                           uNodeHeaderOffset);

    /* Register to the context engine and get the client ID */
    pTimerModule->uContextId = context_RegisterClient (pTimerModule->hContext,
                               tmr_HandleExpiry,
                               hTimerModule,
                               TI_TRUE,
                               "TIMER",
                               sizeof("TIMER"));
}
Esempio n. 3
0
/****************************************************************************
 *                      txResult_setHwInfo()
 ****************************************************************************
 * DESCRIPTION:  
 *      Called after the HW configuration upon init or recovery.
 *      Store the Tx-result table HW address.
 ****************************************************************************/
void  txResult_setHwInfo(TI_HANDLE hTxResult, TDmaParams *pDmaParams)
{
    TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;

    pTxResult->uTxResultInfoAddr = (TI_UINT32)(pDmaParams->fwTxResultInterface);
	pTxResult->uTxResultHostCounterAddr = pTxResult->uTxResultInfoAddr + 
		TI_FIELD_OFFSET(TxResultControl_t, TxResultHostCounter);

    txResult_Restart (pTxResult);
} 
Esempio n. 4
0
TI_STATUS txnQ_Open (TI_HANDLE       hTxnQ, 
                     TI_UINT32       uFuncId, 
                     TI_UINT32       uNumPrios, 
                     TTxnQueueDoneCb fTxnQueueDoneCb,
                     TI_HANDLE       hCbHandle)
{
    TTxnQObj     *pTxnQ = (TTxnQObj*) hTxnQ;
    TI_UINT32     uNodeHeaderOffset;
    TI_UINT32     i;

    if (uFuncId >= MAX_FUNCTIONS  ||  uNumPrios > MAX_PRIORITY) 
    {
        TRACE2(pTxnQ->hReport, REPORT_SEVERITY_ERROR, ": Invalid Params!  uFuncId = %d, uNumPrios = %d\n", uFuncId, uNumPrios);
        return TI_NOK;
    }

    context_EnterCriticalSection (pTxnQ->hContext);

    /* Save functional driver info */
    pTxnQ->aFuncInfo[uFuncId].uNumPrios       = uNumPrios;
    pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb = fTxnQueueDoneCb;
    pTxnQ->aFuncInfo[uFuncId].hCbHandle       = hCbHandle;
    pTxnQ->aFuncInfo[uFuncId].eState          = FUNC_STATE_STOPPED;
    
    /* Create the functional driver's queues. */
    uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); 
    for (i = 0; i < uNumPrios; i++)
    {
        pTxnQ->aTxnQueues[uFuncId][i] = que_Create (pTxnQ->hOs, pTxnQ->hReport, TXN_QUE_SIZE, uNodeHeaderOffset);
        if (pTxnQ->aTxnQueues[uFuncId][i] == NULL)
        {
            TRACE0(pTxnQ->hReport, REPORT_SEVERITY_ERROR, ": Queues creation failed!\n");
            context_LeaveCriticalSection (pTxnQ->hContext);
            return TI_NOK;
        }
    }

    /* Update functions actual range (to optimize Txn selection loops - see txnQ_SelectTxn) */
    if (uFuncId < pTxnQ->uMinFuncId) 
    {
        pTxnQ->uMinFuncId = uFuncId;
    }
    if (uFuncId > pTxnQ->uMaxFuncId) 
    {
        pTxnQ->uMaxFuncId = uFuncId;
    }

    context_LeaveCriticalSection (pTxnQ->hContext);

    TRACE2(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, ": Function %d registered successfully, uNumPrios = %d\n", uFuncId, uNumPrios);

    return TI_OK;
}
/** 
 * \fn     txMgmtQ_Init
 * \brief  Configure module with default settings
*
 * Get other modules handles.
 * Init the Tx Mgmt queues.
 * Register as the context-engine client.
 * 
 * \note   
 * \param  pStadHandles  - The driver modules handles
 * \return void  
 * \sa     
 */ 
void txMgmtQ_Init (TStadHandlesList *pStadHandles)
{
    TTxMgmtQ  *pTxMgmtQ = (TTxMgmtQ *)(pStadHandles->hTxMgmtQ);
    TI_UINT32  uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode);
	int        uQueId;
	
    /* configure modules handles */
    pTxMgmtQ->hOs		= pStadHandles->hOs;
    pTxMgmtQ->hReport	= pStadHandles->hReport;
    pTxMgmtQ->hTxCtrl	= pStadHandles->hTxCtrl;
    pTxMgmtQ->hTxPort	= pStadHandles->hTxPort;
    pTxMgmtQ->hContext	= pStadHandles->hContext;
    pTxMgmtQ->hTWD	    = pStadHandles->hTWD;

	pTxMgmtQ->bMgmtPortEnable = TI_TRUE;	/* Port Default status is open (data-queues are disabled). */
	pTxMgmtQ->eSmState = SM_STATE_CLOSE; /* SM default state is CLOSE. */
	pTxMgmtQ->eTxConnState = TX_CONN_STATE_CLOSE;

    /* initialize tx Mgmt queues */
	for (uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++)
    {
        pTxMgmtQ->aQueues[uQueId] = que_Create (pTxMgmtQ->hOs, 
                                                pTxMgmtQ->hReport, 
                                                MGMT_QUEUES_DEPTH, 
                                                uNodeHeaderOffset);
		
		/* If any Queues' allocation failed, print error, free TxMgmtQueue module and exit */
		if (pTxMgmtQ->aQueues[uQueId] == NULL)
		{
            TRACE0(pTxMgmtQ->hReport, REPORT_SEVERITY_CONSOLE , "Failed to create queue\n");
			WLAN_OS_REPORT(("Failed to create queue\n"));
			os_memoryFree (pTxMgmtQ->hOs, pTxMgmtQ, sizeof(TTxMgmtQ));
			return;
		}

		pTxMgmtQ->aQueueBusy[uQueId]        = TI_FALSE;	/* aQueueBusy default is not busy. */
		pTxMgmtQ->aQueueEnabledBySM[uQueId] = TI_FALSE; /* Queue is disabled by the SM (state is CLOSE). */
    }

    /* Register to the context engine and get the client ID */
    pTxMgmtQ->uContextId = context_RegisterClient (pTxMgmtQ->hContext,
                                                   txMgmtQ_QueuesNotEmpty,
                                                   (TI_HANDLE)pTxMgmtQ,
                                                   TI_TRUE,
                                                   "TX_MGMT",
                                                   sizeof("TX_MGMT"));

TRACE0(pTxMgmtQ->hReport, REPORT_SEVERITY_INIT, ".....Tx Mgmt Queue configured successfully\n");
}
Esempio n. 6
0
void txnQ_Init (TI_HANDLE hTxnQ, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext)
{
	TTxnQObj  *pTxnQ = (TTxnQObj*)hTxnQ;
	TI_UINT32  uNodeHeaderOffset;

	pTxnQ->hOs             = hOs;
	pTxnQ->hReport         = hReport;
	pTxnQ->hContext        = hContext;

	/* Create the TxnDone queue. */
	uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode);
	pTxnQ->hTxnDoneQueue = que_Create (pTxnQ->hOs, pTxnQ->hReport, TXN_DONE_QUE_SIZE, uNodeHeaderOffset);

	busDrv_Init (pTxnQ->hBusDrv, hReport);
}
Esempio n. 7
0
void txnQ_Init (TI_HANDLE hTxnQ, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext)
{
    TTxnQObj  *pTxnQ = (TTxnQObj*)hTxnQ;
    TI_UINT32  uNodeHeaderOffset;

    pTxnQ->hOs             = hOs;
    pTxnQ->hReport         = hReport;
    pTxnQ->hContext        = hContext;

    /* Create the TxnDone queue. */
    uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); 
    pTxnQ->hTxnDoneQueue = que_Create (pTxnQ->hOs, pTxnQ->hReport, TXN_DONE_QUE_SIZE, uNodeHeaderOffset);
    if (pTxnQ->hTxnDoneQueue == NULL)
    {
        TRACE0(pTxnQ->hReport, REPORT_SEVERITY_ERROR, ": TxnDone queue creation failed!\n");
    }

    busDrv_Init (pTxnQ->hBusDrv, hReport);
}
/**
 * \fn     txDataQ_Init
 * \brief  Save required modules handles
 *
 * Save other modules handles.
 *
 * \note
 * \param  pStadHandles  - The driver modules handles
 * \return void
 * \sa
 */
void txDataQ_Init (TStadHandlesList *pStadHandles)
{
	TTxDataQ  *pTxDataQ = (TTxDataQ *)(pStadHandles->hTxDataQ);
	TI_UINT32  uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode);
	TI_UINT8   uQueId;

	/* save modules handles */
	pTxDataQ->hContext	= pStadHandles->hContext;
	pTxDataQ->hTxCtrl	= pStadHandles->hTxCtrl;
	pTxDataQ->hOs		= pStadHandles->hOs;
	pTxDataQ->hReport	= pStadHandles->hReport;
	pTxDataQ->hTxMgmtQ	= pStadHandles->hTxMgmtQ;
	pTxDataQ->hTWD	    = pStadHandles->hTWD;

	/* Configures the Port Default status to Close */
	pTxDataQ->bDataPortEnable = TI_FALSE;

	/* Configures the LastQueId to zero => scheduler will strart from Queue 1*/
	pTxDataQ->uLastQueId = 0;

	/* init the number of the Data queue to be used */
	pTxDataQ->uNumQueues = MAX_NUM_OF_AC;

	/* init the max size of the Data queues */
	pTxDataQ->aQueueMaxSize[QOS_AC_BE] = DATA_QUEUE_DEPTH_BE;
	pTxDataQ->aQueueMaxSize[QOS_AC_BK] = DATA_QUEUE_DEPTH_BK;
	pTxDataQ->aQueueMaxSize[QOS_AC_VI] = DATA_QUEUE_DEPTH_VI;
	pTxDataQ->aQueueMaxSize[QOS_AC_VO] = DATA_QUEUE_DEPTH_VO;

	/* Create the tx data queues */
	for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) {
		pTxDataQ->aQueues[uQueId] = que_Create (pTxDataQ->hOs,
		                                        pTxDataQ->hReport,
		                                        pTxDataQ->aQueueMaxSize[uQueId],
		                                        uNodeHeaderOffset);

		/* If any Queues' allocation failed, print error, free TxDataQueue module and exit */
		if (pTxDataQ->aQueues[uQueId] == NULL) {
			TRACE0(pTxDataQ->hReport, REPORT_SEVERITY_CONSOLE , "Failed to create queue\n");
			WLAN_OS_REPORT(("Failed to create queue\n"));
			os_memoryFree (pTxDataQ->hOs, pTxDataQ, sizeof(TTxDataQ));
			return;
		}

		/* Configure the Queues default values */
		pTxDataQ->aQueueBusy[uQueId] = TI_FALSE;
		pTxDataQ->aNetStackQueueStopped[uQueId] = TI_FALSE;
		pTxDataQ->aTxSendPaceThresh[uQueId] = 1;
	}

	pTxDataQ->hTxSendPaceTimer = tmr_CreateTimer (pStadHandles->hTimer);
	if (pTxDataQ->hTxSendPaceTimer == NULL) {
		TRACE0(pTxDataQ->hReport, REPORT_SEVERITY_ERROR, "txDataQ_Init(): Failed to create hTxSendPaceTimer!\n");
		return;
	}

	/* Register to the context engine and get the client ID */
	pTxDataQ->uContextId = context_RegisterClient (pTxDataQ->hContext,
	                       txDataQ_RunScheduler,
	                       (TI_HANDLE)pTxDataQ,
	                       TI_TRUE,
	                       "TX_DATA",
	                       sizeof("TX_DATA"));

}
Esempio n. 9
0
/** 
 * \fn     twIf_Init 
 * \brief  Init module 
 * 
 * - Init required handles and module variables
 * - Create the TxnDone-queue
 * - Register to TxnQ
 * - Register to context module
 * 
 * \note    
 * \param  hTwIf       - The module's object
 * \param  hXxx        - Handles to other modules
 * \param  fRecoveryCb - Callback function for recovery completed after TxnDone
 * \param  hRecoveryCb - Handle for fRecoveryCb
 * \return void        
 * \sa     
 */
void twIf_Init(TI_HANDLE hTwIf,
	       TI_HANDLE hReport,
	       TI_HANDLE hContext,
	       TI_HANDLE hTimer,
	       TI_HANDLE hTxnQ, TRecoveryCb fRecoveryCb, TI_HANDLE hRecoveryCb)
{
	TTwIfObj *pTwIf = (TTwIfObj *) hTwIf;
	TI_UINT32 uNodeHeaderOffset;
	TTxnStruct *pTxnHdr;	/* The ELP transactions header (as used in the TxnQ API) */

	pTwIf->hReport = hReport;
	pTwIf->hContext = hContext;
	pTwIf->hTimer = hTimer;
	pTwIf->hTxnQ = hTxnQ;
	pTwIf->fRecoveryCb = fRecoveryCb;
	pTwIf->hRecoveryCb = hRecoveryCb;

	/* Prepare ELP sleep transaction */
	pTwIf->tElpTxnSleep.uElpData = ELP_CTRL_REG_SLEEP;
	pTxnHdr = &(pTwIf->tElpTxnSleep.tHdr);
	TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN,
		      TXN_DIRECTION_WRITE, TXN_INC_ADDR)
	    TXN_PARAM_SET_MORE(pTxnHdr, 0);	/* Sleep is the last transaction! */
	/* NOTE: Function id for single step will be replaced to 0 by the bus driver */
	TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 1);	/* ELP write is always single step (TxnQ is topped)! */
	BUILD_TTxnStruct(pTxnHdr, ELP_CTRL_REG_ADDR,
			 &(pTwIf->tElpTxnSleep.uElpData), sizeof(TI_UINT8),
			 NULL, NULL)

	    /* Prepare ELP awake transaction */
	    pTwIf->tElpTxnAwake.uElpData = ELP_CTRL_REG_AWAKE;
	pTxnHdr = &(pTwIf->tElpTxnAwake.tHdr);
	TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN,
		      TXN_DIRECTION_WRITE, TXN_INC_ADDR)
	    TXN_PARAM_SET_MORE(pTxnHdr, 1);
	/* NOTE: Function id for single step will be replaced to 0 by the bus driver */
	TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 1);	/* ELP write is always single step (TxnQ is topped)! */
	BUILD_TTxnStruct(pTxnHdr, ELP_CTRL_REG_ADDR,
			 &(pTwIf->tElpTxnAwake.uElpData), sizeof(TI_UINT8),
			 NULL, NULL)

	    /* Create the TxnDone queue. */
	    uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode);
	pTwIf->hTxnDoneQueue =
	    que_Create(pTwIf->hOs, pTwIf->hReport, TXN_DONE_QUE_SIZE,
		       uNodeHeaderOffset);
	if (pTwIf->hTxnDoneQueue == NULL) {
		TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR,
		       "twIf_Init: TxnDone queue creation failed!\n");
	}

	/* Register to the context engine and get the client ID */
	pTwIf->uContextId = context_RegisterClient(pTwIf->hContext,
						   twIf_HandleTxnDone,
						   hTwIf,
						   TI_TRUE,
						   "TWIF", sizeof("TWIF"));

	/* Allocate timer */
	pTwIf->hPendRestartTimer = tmr_CreateTimer(hTimer);
	if (pTwIf->hPendRestartTimer == NULL) {
		TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR,
		       "twIf_Init: Failed to create PendRestartTimer!\n");
		return;
	}
	pTwIf->bPendRestartTimerRunning = TI_FALSE;

	/* Register to TxnQ */
	txnQ_Open(pTwIf->hTxnQ, TXN_FUNC_ID_WLAN, TXN_NUM_PRIORITYS,
		  (TTxnQueueDoneCb) twIf_TxnDoneCb, hTwIf);

	/* Restart TwIf and TxnQ modules */
	twIf_Restart(hTwIf);
}
Esempio n. 10
0
/** 
 * \fn     txMgmtQ_Init
 * \brief  Configure module with default settings
*
 * Get other modules handles.
 * Init the Tx Mgmt queues.
 * Register as the context-engine client.
 * 
 * \note   
 * \param  pStadHandles  - The driver modules handles
 * \return void  
 * \sa     
 */ 
void txMgmtQ_Init (TStadHandlesList *pStadHandles)
{
    TTxMgmtQ  *pTxMgmtQ = (TTxMgmtQ *)(pStadHandles->hTxMgmtQ);
    TI_UINT32  uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode);
    int        uQueId;
    TMgmtLinkQ *pLinkQ;
    TI_UINT32  uHlid;
    
    /* configure modules handles */
    pTxMgmtQ->hOs		= pStadHandles->hOs;
    pTxMgmtQ->hReport	= pStadHandles->hReport;
    pTxMgmtQ->hTxCtrl	= pStadHandles->hTxCtrl;
    pTxMgmtQ->hTxDataQ	= pStadHandles->hTxDataQ;
    pTxMgmtQ->hTxPort	= pStadHandles->hTxPort;
    pTxMgmtQ->hContext	= pStadHandles->hContext;
    pTxMgmtQ->hTWD	    = pStadHandles->hTWD;

    pTxMgmtQ->bMgmtPortEnable = TI_TRUE;	/* Port Default status is open (data-queues are disabled). */
    pTxMgmtQ->aMgmtAcBusy = TI_FALSE;       /* Init busy flag per for Mgmt ccess category (same for MGMT and EAPOL)  */
    
    /* 
     * init all queues in all links 
     */
    for (uHlid = 0; uHlid < WLANLINKS_MAX_LINKS; uHlid++)
    {       
        pLinkQ = &pTxMgmtQ->aMgmtLinkQ[uHlid]; /* Link queues */
        pLinkQ->eTxConnState = TX_CONN_STATE_CLOSE;
        pLinkQ->eState = SM_STATE_CLOSE; /* SM default state is CLOSE. */
        pLinkQ->bSendEvent_NotEmpty = TI_FALSE;
        pLinkQ->bBusy = TI_FALSE; /* default is not busy */
        pLinkQ->bEnabled = TI_FALSE; /* default is not enabled */
    
        for (uQueId = 0; uQueId < NUM_OF_MGMT_QUEUES; uQueId++)
        {
            pLinkQ->aQueues[uQueId] = que_Create (pTxMgmtQ->hOs, 
                                                pTxMgmtQ->hReport, 
                                                    LINK_MGMT_QUEUES_DEPTH, 
                                                uNodeHeaderOffset);
        
            /* If any Queues' allocation failed, print error, free TxMgmtQueue module and exit */
            if (pLinkQ->aQueues[uQueId] == NULL)
            {
                TRACE1(pTxMgmtQ->hReport, REPORT_SEVERITY_CONSOLE , "Failed to create queue for link %d\n", uHlid);
                WLAN_OS_REPORT(("Failed to create queue for link %d\n", uHlid));
                os_memoryFree (pTxMgmtQ->hOs, pTxMgmtQ, sizeof(TTxMgmtQ));
                return;
            }
    
            pLinkQ->aQenabled[uQueId] = TI_FALSE; /* Queue is disabled */
        }
    }
    pTxMgmtQ->uLastHlid = 0; /* scheduler starts from first link */
    
    /* Register to the context engine and get the client ID */
    pTxMgmtQ->uContextId = context_RegisterClient (pTxMgmtQ->hContext,
                                                   txMgmtQ_QueuesNotEmpty,
                                                   (TI_HANDLE)pTxMgmtQ,
                                                   TI_TRUE,
                                                   "TX_MGMT",
                                                   sizeof("TX_MGMT"));
    
    TRACE0(pTxMgmtQ->hReport, REPORT_SEVERITY_INIT, ".....Tx Mgmt Queue configured successfully\n");
}
Esempio n. 11
0
/**
 * \fn     txDataQ_Init
 * \brief  Save required modules handles
 *
 * Save other modules handles.
 *
 * \note
 * \param  pStadHandles  - The driver modules handles
 * \return void
 * \sa
 */
void txDataQ_Init (TStadHandlesList *pStadHandles)
{
	TTxDataQ  *pTxDataQ = (TTxDataQ *)(pStadHandles->hTxDataQ);
	TI_UINT32  uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode);
	TI_UINT8   uQueId;
	TDataLinkQ *pLinkQ;
	TI_UINT32  uHlid;

	/* save modules handles */
	pTxDataQ->hContext	= pStadHandles->hContext;
	pTxDataQ->hTxCtrl	= pStadHandles->hTxCtrl;
	pTxDataQ->hOs		= pStadHandles->hOs;
	pTxDataQ->hReport	= pStadHandles->hReport;
	pTxDataQ->hTxMgmtQ	= pStadHandles->hTxMgmtQ;
	pTxDataQ->hTWD	    = pStadHandles->hTWD;

	/* Configures the Port Default status to Close */
	pTxDataQ->bDataPortEnable = TI_FALSE;

	/* Configures the NextQueId to zero => scheduler will strart from Queue 1*/
	pTxDataQ->uNextQueId = 0;
	pTxDataQ->uNextHlid = 0;

	/* init the number of the Data queue to be used */
	pTxDataQ->uNumQueues = MAX_NUM_OF_AC;

	/* init the max size of the Data queues */
	pTxDataQ->aQueueMaxSize[QOS_AC_BE] = DATA_QUEUE_DEPTH_BE;
	pTxDataQ->aQueueMaxSize[QOS_AC_BK] = DATA_QUEUE_DEPTH_BK;
	pTxDataQ->aQueueMaxSize[QOS_AC_VI] = DATA_QUEUE_DEPTH_VI;
	pTxDataQ->aQueueMaxSize[QOS_AC_VO] = DATA_QUEUE_DEPTH_VO;

	for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) {
		pTxDataQ->aTxSendPaceThresh[uQueId] = 1;
	}

	/*
	 * init all queues in all links
	 */
	for (uHlid = 0; uHlid < WLANLINKS_MAX_LINKS; uHlid++) {
		pLinkQ = &pTxDataQ->aDataLinkQ[uHlid]; /* Link queues */
		pLinkQ->bBusy = TI_FALSE; /* default is not busy */
		pLinkQ->bEnabled = TI_FALSE; /* default is not enabled */

		/* Create the tx data queues */
		for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) {
			pLinkQ->aQueues[uQueId] = que_Create (pTxDataQ->hOs,
			                                      pTxDataQ->hReport,
			                                      pTxDataQ->aQueueMaxSize[uQueId],
			                                      uNodeHeaderOffset);

			/* If any Queues' allocation failed, print error, free TxDataQueue module and exit */
			if (pLinkQ->aQueues[uQueId] == NULL) {
				WLAN_OS_REPORT(("Failed to create queue\n"));
				os_memoryFree (pTxDataQ->hOs, pTxDataQ, sizeof(TTxDataQ));
				return;
			}

			/* Configure the Queues default values */
			pLinkQ->aNetStackQueueStopped[uQueId] = TI_FALSE;
		}
	}
	/* Init busy flag per AC (not also per link) */
	for (uQueId = 0; uQueId < pTxDataQ->uNumQueues; uQueId++) {
		pTxDataQ->aQueueBusy[uQueId] = TI_FALSE;
	}
	pTxDataQ->hTxSendPaceTimer = tmr_CreateTimer (pStadHandles->hTimer);
	if (pTxDataQ->hTxSendPaceTimer == NULL) {
		return;
	}

	/* Register to the context engine and get the client ID */
	pTxDataQ->uContextId = context_RegisterClient (pTxDataQ->hContext,
	                       txDataQ_RunScheduler,
	                       (TI_HANDLE)pTxDataQ,
	                       TI_TRUE,
	                       "TX_DATA",
	                       sizeof("TX_DATA"));

}
/*
 * \brief	Initialization of callback table
 *
 * \param  hEventMbox  - Handle to EventMbox
 * \return none
 *
 * \par Description
 * This function is called to configure the CB table initialize the
 * CB functions and handle and set the Data offset.
 *
 * \sa
 */
static void eventMbox_ConfigCbTable(TI_HANDLE hEventMbox)
{
	TEventMbox* pEventMbox;
	TI_UINT8	EvID;

	pEventMbox = (TEventMbox*)hEventMbox;

	/* for all events set a dummy func and data offset */
	for (EvID = 0; EvID < TWD_OWN_EVENT_MAX; EvID++) {
		pEventMbox->CbTable[EvID].pDataOffset = (TI_UINT8*)&pEventMbox->iTxnEventMbox.iEventMboxBuf;
		pEventMbox->CbTable[EvID].fCb		  = (void*)eventMbox_DummyCb;
		pEventMbox->CbTable[EvID].hCb		  = pEventMbox;
	}
	/* set the data offset for Events with data only */
	for (EvID = 0; EvID < NUM_OF_RSSI_SNR_TRIGGERS; EvID++) {
		pEventMbox->CbTable[EvID].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, RSSISNRTriggerMetric[EvID]);
	}
	pEventMbox->CbTable[TWD_DBG_EVENT                       ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, dbgEventRep);
	pEventMbox->CbTable[TWD_OWN_EVENT_SCAN_CMPLT            ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,scanCompleteResults);
	pEventMbox->CbTable[TWD_OWN_EVENT_SPS_SCAN_CMPLT        ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,scheduledScanAttendedChannels);
	pEventMbox->CbTable[TWD_OWN_EVENT_PERIODIC_SCAN_COMPLETE].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, scanCompleteResults);
	pEventMbox->CbTable[TWD_OWN_EVENT_PERIODIC_SCAN_REPORT  ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, scanCompleteResults);
	pEventMbox->CbTable[TWD_OWN_EVENT_SOFT_GEMINI_SENSE     ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,softGeminiSenseInfo);

	pEventMbox->CbTable[TWD_OWN_EVENT_SWITCH_CHANNEL_CMPLT  ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,channelSwitchStatus);
	pEventMbox->CbTable[TWD_OWN_EVENT_PS_REPORT             ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,psStatus);
	pEventMbox->CbTable[TWD_OWN_EVENT_STA_REMOVE_COMPLETE   ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,hlidRemoved);
#ifdef AP_MODE_ENABLED
	pEventMbox->CbTable[TWD_OWN_INACTIVE_STA_EVENT_ID   	].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,stationsAgingStatus);
	pEventMbox->CbTable[TWD_OWN_EVENT_MAX_TX_RETRY   	].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,stationTxRetryExceeded);
#else
	pEventMbox->CbTable[TWD_OWN_EVENT_SOFT_GEMINI_PREDIC    ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,softGeminiProtectiveInfo);
#endif
}
static  int tb_control_size(void)
{
	return TI_FIELD_OFFSET(tb_control_t, entry) + sizeof(tb_entry_t)*TB_NUM_ENTRIES;
}