コード例 #1
0
/*                      TnetwDrv_Create()
 ****************************************************************************
 * DESCRIPTION: Create the Module
 *
 * INPUTS:  Handle to the OS
 *
 * OUTPUT:  
 *
 * RETURNS: Handle to the module on success or NULL on failure 
 ****************************************************************************/
TI_HANDLE TnetwDrv_Create (TI_HANDLE hOs)
{
    TnetwDrv_t *pTnetwDrv;

    /* Allocate the TNETW_Driver module */
    pTnetwDrv = (TnetwDrv_t *)os_memoryAlloc (hOs, sizeof(TnetwDrv_t));
    if (pTnetwDrv == NULL)
        return NULL;

    os_memoryZero (hOs, pTnetwDrv, sizeof(TnetwDrv_t));

    pTnetwDrv->hOs = hOs;

    /* Create the HAL Ctrl module */
    pTnetwDrv->hHalCtrl = whalCtrl_Create(hOs);
    if (pTnetwDrv->hHalCtrl == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv whalCtrl_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    pTnetwDrv->hTNETWIF = whalCtrl_GetTnetwifHandle (pTnetwDrv->hHalCtrl);

    /* Create the MAC Services module */
    pTnetwDrv->hMacServices = MacServices_create(hOs);
    if (pTnetwDrv->hMacServices == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv MacServices_create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    /* Create the Ctrl module */
    pTnetwDrv->hCmdQueue = CmdQueue_Create(hOs);
    if (pTnetwDrv->hCmdQueue == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv CmdQueue_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    /* 
     * Create the FW-Transfer modules:
     */

    pTnetwDrv->hTxXfer = txXfer_Create(hOs);
    if (pTnetwDrv->hTxXfer == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv txXfer_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    pTnetwDrv->hTxResult = txResult_Create(hOs);
    if (pTnetwDrv->hTxResult == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv txResult_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    pTnetwDrv->hRxXfer = rxXfer_Create(hOs);
    if (pTnetwDrv->hRxXfer == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv rxXfer_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    pTnetwDrv->hFwEvent = FwEvent_Create(hOs);
    if (pTnetwDrv->hFwEvent == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv FwEvent_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    pTnetwDrv->hEventMbox = eventMbox_Create(hOs);
    if (pTnetwDrv->hEventMbox == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv eventMbox_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

#ifdef TI_DBG
    pTnetwDrv->hDebugTrace = debugTrace_Create(hOs);
    if (pTnetwDrv->hDebugTrace == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv debugTrace_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }
#endif /* TI_DBG */

    pTnetwDrv->hCmdMBox = CmdMBox_Create(hOs);
    if (pTnetwDrv->hCmdMBox == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv CmdMBox_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    /* 
     * Create the Data-Services modules:
     */

    pTnetwDrv->hTxCtrlBlk = txCtrlBlk_Create(hOs);
    if (pTnetwDrv->hTxCtrlBlk == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv txCtrlBlk_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

    pTnetwDrv->hTxHwQueue = txHwQueue_Create(hOs);
    if (pTnetwDrv->hTxHwQueue == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv txHwQueue_Create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }

#if !defined(GWSI_DRIVER) && !defined(GWSI_LIB)
    pTnetwDrv->hRecoveryCtrl = recoveryCtrl_create(hOs);
#ifdef USE_RECOVERY
    if (pTnetwDrv->hRecoveryCtrl == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv recoveryCtrl_create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }
#endif /* USE_RECOVERY */
    pTnetwDrv->hHwInit = hwInit_create(hOs);
#ifdef USE_RECOVERY
    if (pTnetwDrv->hHwInit == NULL)
    {
        WLAN_OS_REPORT(("TnetwDrv hwInit_create failed!!!\n"));
        TnetwDrv_Destroy((TI_HANDLE)pTnetwDrv);
        return NULL;
    }
#endif /* USE_RECOVERY */
    pTnetwDrv->bRecoveryFlag = FALSE; /* init value is not Recovery */
#endif
    WLAN_INIT_REPORT (("TnetwDrv_Create: CREATED !!!\n"));

    return (TI_HANDLE)pTnetwDrv;
}
コード例 #2
0
ファイル: TWDriver.c プロジェクト: bluewater-cn/ti_wilink
TI_HANDLE TWD_Create (TI_HANDLE hOs)
{
    TTwd *pTWD;

    /* Allocate the TNETW_Driver module */
    pTWD = (TTwd *)os_memoryAlloc (hOs, sizeof(TTwd));
    if (pTWD == NULL)
    {
        return NULL;
    }

    os_memoryZero (hOs, pTWD, sizeof(TTwd));

    pTWD->hOs = hOs;

    /* Create TwIf module */
    pTWD->hTwIf = twIf_Create (hOs);
    if (pTWD->hTwIf == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    /* Create command builder module */
    pTWD->hCmdBld = cmdBld_Create (hOs);
    if (pTWD->hCmdBld == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    /* Create the MAC Services module */
    pTWD->hMacServices = MacServices_create (hOs);
    if (pTWD->hMacServices == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    /* Create the Ctrl module */
    pTWD->hCmdQueue = cmdQueue_Create (hOs);
    if (pTWD->hCmdQueue == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    /*
     * Create the FW-Transfer modules:
     */

    pTWD->hTxXfer = txXfer_Create (hOs);
    if (pTWD->hTxXfer == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hTxResult = txResult_Create (hOs);
    if (pTWD->hTxResult == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hRxXfer = rxXfer_Create (hOs);
    if (pTWD->hRxXfer == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hFwEvent = fwEvent_Create (hOs);
    if (pTWD->hFwEvent == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hEventMbox = eventMbox_Create (hOs);
    if (pTWD->hEventMbox == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

#ifdef TI_DBG
    pTWD->hFwDbg = fwDbg_Create (hOs);
    if (pTWD->hFwDbg == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }
#endif /* TI_DBG */

    pTWD->hCmdMbox = cmdMbox_Create (hOs);
    if (pTWD->hCmdMbox == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hRxQueue = RxQueue_Create (hOs);
    if (pTWD->hRxQueue == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }


    /*
     * Create the Data-Services modules:
     */

    pTWD->hTxCtrlBlk = txCtrlBlk_Create (hOs);
    if (pTWD->hTxCtrlBlk == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hTxHwQueue = txHwQueue_Create (hOs);
    if (pTWD->hTxHwQueue == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    pTWD->hHwInit = hwInit_Create (hOs);
    if (pTWD->hHwInit == NULL)
    {
        TWD_Destroy ((TI_HANDLE)pTWD);
        return NULL;
    }

    return (TI_HANDLE)pTWD;
}