1 /* 2 * Copyright (c) 2021-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #include "hdf_sdio_intf.h" 10 #include "osal_mem.h" 11 #include "securec.h" 12 #include "wifi_inc.h" 13 14 #ifdef __cplusplus 15 #if __cplusplus 16 extern "C" { 17 #endif 18 #endif 19 HdfWlanCreateBusManager(const struct HdfConfigWlanBus * busConfig)20struct BusDev *HdfWlanCreateBusManager(const struct HdfConfigWlanBus *busConfig) 21 { 22 if (busConfig == NULL) { 23 return NULL; 24 } 25 struct BusDev *bus = (struct BusDev *)OsalMemCalloc(sizeof(struct BusDev)); 26 if (bus == NULL) { 27 return NULL; 28 } 29 30 switch (busConfig->busType) { 31 case BUS_SDIO: 32 if (HdfSdioBusInit(bus, busConfig) != HDF_SUCCESS) { 33 OsalMemFree(bus); 34 return NULL; 35 } 36 break; 37 default: 38 HDF_LOGE("%s:bus type not support!", __func__); 39 OsalMemFree(bus); 40 return NULL; 41 } 42 return bus; 43 } 44 45 #ifdef __cplusplus 46 #if __cplusplus 47 } 48 #endif 49 #endif 50