1 /*
2 * Copyright (c) 2021-2022 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 "osal_mem.h"
10 #include "securec.h"
11 #include "wifi_inc.h"
12 #include "hdf_log.h"
13 #include "hdf_wlan_config.h"
14 #include "hdf_base.h"
15 #include "hdf_ibus_intf.h"
16
17 #define HDF_LOG_TAG HDF_WIFI_CORE
18
19 #ifdef __cplusplus
20 #if __cplusplus
21 extern "C" {
22 #endif
23 #endif
24
HdfWlanCreateBusManager(const struct HdfConfigWlanBus * busConfig)25 struct BusDev *HdfWlanCreateBusManager(const struct HdfConfigWlanBus *busConfig)
26 {
27 struct BusDev *bus = NULL;
28 if (busConfig == NULL) {
29 HDF_LOGE("%s: Input param is null", __func__);
30 return NULL;
31 }
32 if (busConfig->busType >= BUS_BUTT) {
33 HDF_LOGE("%s: Bus type %u not support!", __func__, busConfig->busType);
34 return NULL;
35 }
36
37 bus = (struct BusDev *)OsalMemCalloc(sizeof(struct BusDev));
38 if (bus == NULL) {
39 HDF_LOGE("%s: Failed to request memory", __func__);
40 return NULL;
41 }
42
43 if (HdfWlanBusAbsInit(bus, busConfig) != HDF_SUCCESS) {
44 HDF_LOGE("%s: HdfWlanBusAbsInit init failed", __func__);
45 OsalMemFree(bus);
46 return NULL;
47 }
48 HDF_LOGD("%s: HdfWlanCreateBusManager finished!", __func__);
49 return bus;
50 }
51
52 #ifdef __cplusplus
53 #if __cplusplus
54 }
55 #endif
56 #endif
57