tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms) { tpAniSirGlobal pMac = NULL; if(pHalHandle == NULL) return eSIR_FAILURE; /* * Make sure this adapter is not already opened. (Compare pAdapter pointer in already * allocated pMac structures.) * If it is opened just return pointer to previously allocated pMac pointer. * Or should this result in error? */ /* Allocate pMac */ pMac = vos_mem_malloc(sizeof(tAniSirGlobal)); if ( NULL == pMac ) return eSIR_FAILURE; /* Initialize the pMac structure */ vos_mem_set(pMac, sizeof(tAniSirGlobal), 0); /** Store the Driver type in pMac Global.*/ //pMac->gDriverType = pMacOpenParms->driverType; /* * Set various global fields of pMac here * (Could be platform dependant as some variables in pMac are platform * dependant) */ pMac->hHdd = hHdd; pMac->pAdapter = hHdd; //This line wil be removed *pHalHandle = (tHalHandle)pMac; { /* Call various PE (and other layer init here) */ if( eSIR_SUCCESS != logInit(pMac)) return eSIR_FAILURE; /* Call routine to initialize CFG data structures */ if( eSIR_SUCCESS != cfgInit(pMac) ) return eSIR_FAILURE; sysInitGlobals(pMac); } return peOpen(pMac, pMacOpenParms); }
tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms) { tpAniSirGlobal pMac = NULL; if(pHalHandle == NULL) return eSIR_FAILURE; pMac = vos_mem_malloc(sizeof(tAniSirGlobal)); if ( NULL == pMac ) return eSIR_FAILURE; vos_mem_set(pMac, sizeof(tAniSirGlobal), 0); pMac->hHdd = hHdd; pMac->pAdapter = hHdd; *pHalHandle = (tHalHandle)pMac; { if( eSIR_SUCCESS != logInit(pMac)) return eSIR_FAILURE; if( eSIR_SUCCESS != cfgInit(pMac) ) return eSIR_FAILURE; sysInitGlobals(pMac); } return peOpen(pMac, pMacOpenParms); }
tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms) { tpAniSirGlobal p_mac = NULL; tSirRetStatus status = eSIR_SUCCESS; uint8_t i =0; bool mem_alloc_failed = false; if(pHalHandle == NULL) return eSIR_FAILURE; /* * Make sure this adapter is not already opened. (Compare pAdapter pointer in already * allocated p_mac structures.) * If it is opened just return pointer to previously allocated p_mac pointer. * Or should this result in error? */ /* Allocate p_mac */ p_mac = vos_mem_malloc(sizeof(tAniSirGlobal)); if (NULL == p_mac) return eSIR_FAILURE; /* Initialize the p_mac structure */ vos_mem_set(p_mac, sizeof(tAniSirGlobal), 0); /* * Set various global fields of p_mac here * (Could be platform dependant as some variables in p_mac are platform * dependant) */ p_mac->hHdd = hHdd; *pHalHandle = (tHalHandle)p_mac; { /* Call various PE (and other layer init here) */ if (eSIR_SUCCESS != logInit(p_mac)) { vos_mem_free(p_mac); return eSIR_FAILURE; } /* Call routine to initialize CFG data structures */ if (eSIR_SUCCESS != cfgInit(p_mac)) { vos_mem_free(p_mac); return eSIR_FAILURE; } sysInitGlobals(p_mac); } /* Set the Powersave Offload Capability to TRUE irrespective of * INI param as it should be always enabled for qca-cld driver */ p_mac->psOffloadEnabled = TRUE; p_mac->scan.nextScanID = FIRST_SCAN_ID; /* FW: 0 to 2047 and Host: 2048 to 4095 */ p_mac->mgmtSeqNum = WLAN_HOST_SEQ_NUM_MIN-1; p_mac->first_scan_done = false; status = peOpen(p_mac, pMacOpenParms); if (eSIR_SUCCESS != status) { sysLog(p_mac, LOGE, FL("macOpen failure\n")); vos_mem_free(p_mac); return status; } for (i=0; i<MAX_DUMP_TABLE_ENTRY; i++) { p_mac->dumpTableEntry[i] = vos_mem_malloc(sizeof(tDumpModuleEntry)); if (NULL == p_mac->dumpTableEntry[i]) { mem_alloc_failed = eANI_BOOLEAN_TRUE; break; } else { vos_mem_set(p_mac->dumpTableEntry[i], sizeof(tSirMbMsg), 0); } } if (mem_alloc_failed) { while (i>0) { i--; vos_mem_free(p_mac->dumpTableEntry[i]); } peClose(p_mac); vos_mem_free(p_mac); return eSIR_FAILURE; } return status; }
tSirRetStatus macOpen(tHalHandle *pHalHandle, tHddHandle hHdd, tMacOpenParameters *pMacOpenParms) { tpAniSirGlobal pMac = NULL; if(pHalHandle == NULL) return eSIR_FAILURE; /* * Make sure this adapter is not already opened. (Compare pAdaptor pointer in already * allocated pMac structures.) * If it is opened just return pointer to previously allocated pMac pointer. * Or should this result in error? */ /* Allocate pMac */ if (palAllocateMemory(hHdd, ((void **)&pMac), sizeof(tAniSirGlobal)) != eHAL_STATUS_SUCCESS) return eSIR_FAILURE; /* Initialize the pMac structure */ palZeroMemory(hHdd, pMac, sizeof(tAniSirGlobal)); /** Store the Driver type in pMac Global.*/ //pMac->gDriverType = pMacOpenParms->driverType; #ifndef GEN6_ONWARDS #ifdef RTL8652 { //Leverage 8651c's on-chip data scratchpad memory to lock all HAL DxE data there extern void * rtlglue_alloc_data_scratchpad_memory(unsigned int size, char *); pMac->hal.pHalDxe = (tpAniHalDxe) rtlglue_alloc_data_scratchpad_memory(sizeof(tAniHalDxe), "halDxe"); } if(pMac->hal.pHalDxe){ ; }else #endif /* Allocate HalDxe */ if (palAllocateMemory(hHdd, ((void **)&pMac->hal.pHalDxe), sizeof(tAniHalDxe)) != eHAL_STATUS_SUCCESS){ palFreeMemory(hHdd, pMac); return eSIR_FAILURE; } /* Initialize the HalDxe structure */ palZeroMemory(hHdd, pMac->hal.pHalDxe, sizeof(tAniHalDxe)); #endif //GEN6_ONWARDS /* * Set various global fields of pMac here * (Could be platform dependant as some variables in pMac are platform * dependant) */ pMac->hHdd = hHdd; pMac->pAdapter = hHdd; //This line wil be removed *pHalHandle = (tHalHandle)pMac; { /* Call various PE (and other layer init here) */ if( eSIR_SUCCESS != logInit(pMac)) return eSIR_FAILURE; /* Call routine to initialize CFG data structures */ if( eSIR_SUCCESS != cfgInit(pMac) ) return eSIR_FAILURE; sysInitGlobals(pMac); #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC // This decides whether HW needs to translate the 802.3 frames // from the host OS to the 802.11 frames. When set HW does the // translation from 802.3 to 802.11 and vice versa if(pMacOpenParms->frameTransRequired) { pMac->hal.halMac.frameTransEnabled = 1; } else { pMac->hal.halMac.frameTransEnabled = 0; } #endif //Need to do it here in case halOpen fails later on. #if defined( VOSS_ENABLED ) tx_voss_wrapper_init(pMac, hHdd); #endif } #ifdef FEATURE_WLAN_NON_INTEGRATED_SOC if (eHAL_STATUS_SUCCESS != halOpen(pMac, pHalHandle, hHdd, pMacOpenParms)) return eSIR_FAILURE; #endif return peOpen(pMac, pMacOpenParms); }