diff --git a/amlogic/build/BUILD.gn b/amlogic/build/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..096bca8cc7ec293f1469c7af3e29f3957f02195b --- /dev/null +++ b/amlogic/build/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +device_type = "vim3l" +group("products_group") { + if (device_type == "vim3l") { + deps = [ + "//device/amlogic/vim3l:vim3l_group", + ] + } +} diff --git a/amlogic/build/ohos.build b/amlogic/build/ohos.build new file mode 100755 index 0000000000000000000000000000000000000000..5cca377fe17e6d53396bc669b507d4d2d696fc29 --- /dev/null +++ b/amlogic/build/ohos.build @@ -0,0 +1,10 @@ +{ + "subsystem": "amlogic_products", + "parts": { + "amlogic_products": { + "module_list": [ + "//device/amlogic/build:products_group" + ] + } + } +} \ No newline at end of file diff --git a/amlogic/drivers/ethernet/adapter/Kconfig b/amlogic/drivers/ethernet/adapter/Kconfig new file mode 100755 index 0000000000000000000000000000000000000000..d35246aaa87255a378d3c6b3b9abbf060cb3ca74 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/Kconfig @@ -0,0 +1,6 @@ +config DRIVERS_HDF_VIM3L_ETHERNET + bool "Enable HDF vim3l ethernet driver" + default n + depends on DRIVERS_HDF_PLATFORM + help + Answer Y to enable HDF vim3l ethernet driver. diff --git a/amlogic/drivers/ethernet/adapter/Makefile b/amlogic/drivers/ethernet/adapter/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..0cf8c0967627c27c37790fbf61ab2e5e4d76bbbc --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# +# This software is licensed under the terms of the GNU General Public +# License version 2, as published by the Free Software Foundation, and +# may be copied, distributed, and modified under those terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# + +MODULE_NAME := hdf_ethernet_model + +ETHERNET_PATH := $(shell pwd) +$(warning ETHERNET_PATH=$(ETHERNET_PATH)) + +include $(ETHERNET_PATH)/../../../../../device/amlogic/drivers/ethernet/adapter/ethernet_config.mk + +ETHERNET_FW_PATH := ../../../../../out/KERNEL_OBJ/kernel/src_tmp/linux-4.19/drivers/hdf/framework/model/network/ethernet/src + +obj-y += $(ETHERNET_FW_PATH)/eth_chip_driver.o \ + $(ETHERNET_FW_PATH)/eth_device.o \ + $(ETHERNET_FW_PATH)/hdf_eth_core.o + +obj-y += $(MODULE_NAME).o +$(MODULE_NAME)-objs := hdf_driver_register.o \ + net_adapter.o \ + amlogiceth_mac.o \ + amlogiceth_phy.o +ccflags-y += \ + $(HDF_FRAMEWORKS_INC) \ + $(HDF_ETHERNET_FRAMEWORKS_INC) \ + $(SECURE_LIB_INC) \ + $(HDF_ETHERNET_ADAPTER_INC) \ + $(HDF_ETHERNET_FLAGS) + +ccflags-$(CONFIG_DRIVERS_HDF_VIM3L_ETHERNET) += -Idrivers/net/ethernet/stmicro/stmmac/ + diff --git a/amlogic/drivers/ethernet/adapter/amlogiceth_mac.c b/amlogic/drivers/ethernet/adapter/amlogiceth_mac.c new file mode 100755 index 0000000000000000000000000000000000000000..000691c9a29662749f0138e9fde42f25690c6db6 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/amlogiceth_mac.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "amlogiceth_mac.h" +#include "osal_mem.h" + +extern void amlogic_get_mac(unsigned char * mac_address); +void AmlogicethMacCoreInit(void) +{ + return; +} + +int32_t AmlogicethPortReset(struct EthDevice *ethDevice) +{ + return HDF_SUCCESS; +} + +int32_t AmlogicethPortInit(struct EthDevice *ethDevice) +{ + return HDF_SUCCESS; +} + +static struct EthMacOps g_macOps = { + .MacInit = AmlogicethMacCoreInit, + .PortReset = AmlogicethPortReset, + .PortInit = AmlogicethPortInit, +}; + +struct HdfEthMacChipDriver *BuildAmlogicMacDriver(void) +{ + HDF_LOGE("BuildAmlogicMacDriver start !!!!!!!!!!!!\n"); + struct HdfEthMacChipDriver *macChipDriver = (struct HdfEthMacChipDriver *)OsalMemCalloc( + sizeof(struct HdfEthMacChipDriver)); + + if (macChipDriver == NULL) { + HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__); + return NULL; + } + macChipDriver->ethMacOps = &g_macOps; + return macChipDriver; +} + +void ReleaseAmlogicMacDriver(struct HdfEthMacChipDriver *chipDriver) +{ + if (chipDriver == NULL) { + HDF_LOGE("%s fail: chipDriver == NULL!", __func__); + return; + } + OsalMemFree(chipDriver); +} + +struct HdfEthMacChipDriver *GetAmlogicEthMacChipDriver(const struct NetDevice *netDev) +{ + struct HdfEthNetDeviceData *data = GetEthNetDeviceData(netDev); + if (data != NULL) { + return data->macChipDriver; + } + return NULL; +} + +void EthAmlogicRandomAddr(uint8_t *addr, int32_t len) +{ + amlogic_get_mac(addr); + + return; +} + diff --git a/amlogic/drivers/ethernet/adapter/amlogiceth_mac.h b/amlogic/drivers/ethernet/adapter/amlogiceth_mac.h new file mode 100755 index 0000000000000000000000000000000000000000..ca7afe4740192c5752ccf17f75e4005df5d65f61 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/amlogiceth_mac.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AMLOGICETH_MAC_H +#define AMLOGICETH_MAC_H + +#include "eth_chip_driver.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +struct HdfEthMacChipDriver *BuildAmlogicMacDriver(void); +void ReleaseAmlogicMacDriver(struct HdfEthMacChipDriver *chipDriver); +struct HdfEthMacChipDriver *GetAmlogicEthMacChipDriver(const struct NetDevice *netDev); +void EthAmlogicRandomAddr(uint8_t *addr, int32_t len); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* AMLOGICETH_MAC_H */ diff --git a/amlogic/drivers/ethernet/adapter/amlogiceth_phy.c b/amlogic/drivers/ethernet/adapter/amlogiceth_phy.c new file mode 100755 index 0000000000000000000000000000000000000000..5ade53fbe6f2b67e9b710d8368a2949e6883e79d --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/amlogiceth_phy.c @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "amlogiceth_phy.h" +#include +#include "net_adapter.h" +#include "eth_chip_driver.h" +#include "net_device.h" +#include "net_device_adapter.h" +#include +#include +#include +#include "osal_mem.h" + +struct NetDevice *g_hdf_netdev; +extern int meson6_dwmac_driver_init(void); +extern int32_t GetSizeOfPrivData(void); +int32_t InitAmlogicethDriver(struct EthDevice *ethDevice) +{ + int32_t ret; + int32_t size = GetSizeOfPrivData(); + + if (ethDevice == NULL) { + HDF_LOGE("%s input is NULL!", __func__); + return HDF_FAILURE; + } + + g_hdf_netdev = ethDevice->netdev; + g_hdf_netdev->mlPriv = (struct stmmac_priv *)OsalMemCalloc(size); + if (NULL == g_hdf_netdev->mlPriv) { + HDF_LOGE("%s kzalloc mlPriv failed!", __func__); + return HDF_FAILURE; + } else { + HDF_LOGE("%s kzalloc mlPriv ok!", __func__); + } + + meson6_dwmac_driver_init(); + ret = EthernetInitNetdev(ethDevice->netdev); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s failed to init ethernet netDev", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +int32_t DeinitAmlogicethDriver(struct EthDevice *ethDevice) +{ + return HDF_SUCCESS; +} + +int32_t GetSizeOfPrivData(void) +{ + return sizeof(struct stmmac_priv); +} + +struct stmmac_priv * +stmmac_get_priv_data(struct net_device *ndev) +{ + (void)ndev; + return (struct stmmac_priv *)g_hdf_netdev->mlPriv; +} + +EXPORT_SYMBOL(GetSizeOfPrivData); +EXPORT_SYMBOL(stmmac_get_priv_data); diff --git a/amlogic/drivers/ethernet/adapter/amlogiceth_phy.h b/amlogic/drivers/ethernet/adapter/amlogiceth_phy.h new file mode 100755 index 0000000000000000000000000000000000000000..b9bfed4a0bb7fba5015e1da7f6388cca91757329 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/amlogiceth_phy.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AMLOGICETH_PHY_H +#define AMLOGICETH_PHY_H + +#include "eth_chip_driver.h" +#include "net_device_impl.h" +#include "stmmac.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +int32_t InitAmlogicethDriver(struct EthDevice *ethDevice); +int32_t DeinitAmlogicethDriver(struct EthDevice *ethDevice); +bool AmlogicethHwInit(struct EthDevice *ethDevice); +int32_t AmlogicethInit(struct EthDevice *ethDevice); + +struct FullNetDeviceVim3lEthPriv { + struct net_device *dev; + struct NetDeviceImpl *impl; + struct stmmac_priv *lstmmacp; +}; + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* AMLOGICETH_PHY_H */ diff --git a/amlogic/drivers/ethernet/adapter/ethernet_config.mk b/amlogic/drivers/ethernet/adapter/ethernet_config.mk new file mode 100644 index 0000000000000000000000000000000000000000..20615ff2ae0cf9cbda6dc72ca6f4d670dc3a19e3 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/ethernet_config.mk @@ -0,0 +1,55 @@ +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# +# This software is licensed under the terms of the GNU General Public +# License version 2, as published by the Free Software Foundation, and +# may be copied, distributed, and modified under those terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +ETHERNET_CONFIG_PATH := $(shell pwd) +$(warning ETHERNET_CONFIG_PATH=$(ETHERNET_CONFIG_PATH)) + +HDF_FRAMEWORKS_INC := \ + -I./ \ + -Idrivers/hdf/framework/ability/sbuf/include \ + -Idrivers/hdf/framework/core/common/include/host \ + -Idrivers/hdf/framework/core/host/include \ + -Idrivers/hdf/framework/core/manager/include \ + -Idrivers/hdf/framework/core/shared/include \ + -Idrivers/hdf/framework/include \ + -Idrivers/hdf/framework/include/config \ + -Idrivers/hdf/framework/include/core \ + -Idrivers/hdf/framework/include/platform \ + -Idrivers/hdf/framework/include/utils \ + -Idrivers/hdf/framework/support/platform/include \ + -Idrivers/hdf/framework/support/platform/include/platform \ + -Idrivers/hdf/framework/utils/include \ + -Idrivers/hdf/khdf/osal/include \ + -Idrivers/hdf/khdf/config/include \ + -Iinclude/hdf \ + -Iinclude/hdf/osal \ + -Iinclude/hdf/utils \ + -Idrivers/hdf/framework/include/ethernet\ + -Idrivers/hdf/framework/include/net\ + -Idrivers/hdf/framework/model/network/common/netdevice\ + +HDF_ETHERNET_FRAMEWORKS_INC := \ + -Idrivers/hdf/framework/model/network/ethernet/include + +SECURE_LIB_INC := \ + -I./../../../../../third_party/bounds_checking_function/include + +HDF_ETHERNET_ADAPTER_INC := \ + -I./../../../../../device/amlogic/drivers/ethernet/adapter \ + -Idrivers/hdf/khdf/network/include \ + -Idrivers/net/ethernet/stmicro/stmmac + + +HDF_ETHERNET_FLAGS +=-D_PRE_OS_VERSION_LINUX=1 +HDF_ETHERNET_FLAGS +=-D_PRE_OS_VERSION_LITEOS=2 +HDF_ETHERNET_FLAGS +=-D_PRE_OS_VERSION=_PRE_OS_VERSION_LINUX diff --git a/amlogic/drivers/ethernet/adapter/hdf_driver_register.c b/amlogic/drivers/ethernet/adapter/hdf_driver_register.c new file mode 100755 index 0000000000000000000000000000000000000000..d10cbf53cb2121a6ef84e5e34b7416c3dba81847 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/hdf_driver_register.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "devsvc_manager_clnt.h" +#include "eth_chip_driver.h" +#include "hdf_device_desc.h" +#include "hdf_log.h" +#include "amlogiceth_mac.h" +#include "amlogiceth_phy.h" +#include "osal_mem.h" + +static const char* const AMLOGIC_ETHERNET_DRIVER_NAME = "amlogiceth-meson6"; + +static int32_t HdfEthRegAmlogicDriverFactory(void) +{ + static struct HdfEthChipDriverFactory tmpFactory = { 0 }; + struct HdfEthChipDriverManager *driverMgr = HdfEthGetChipDriverMgr(); + + if (driverMgr == NULL && driverMgr->RegChipDriver == NULL) { + HDF_LOGE("%s fail: driverMgr is NULL", __func__); + return HDF_FAILURE; + } + tmpFactory.driverName = AMLOGIC_ETHERNET_DRIVER_NAME; + tmpFactory.InitEthDriver = InitAmlogicethDriver; + tmpFactory.GetMacAddr = EthAmlogicRandomAddr; + tmpFactory.DeinitEthDriver = DeinitAmlogicethDriver; + tmpFactory.BuildMacDriver = BuildAmlogicMacDriver; + tmpFactory.ReleaseMacDriver = ReleaseAmlogicMacDriver; + if (driverMgr->RegChipDriver(&tmpFactory) != HDF_SUCCESS) { + HDF_LOGE("%s fail: driverMgr is NULL", __func__); + return HDF_FAILURE; + } + HDF_LOGI("amlogic eth driver register success"); + return HDF_SUCCESS; +} + +static int32_t HdfEthAmlogicChipDriverInit(struct HdfDeviceObject *device) +{ + (void)device; + return HdfEthRegAmlogicDriverFactory(); +} + +static int32_t HdfEthAmlogicDriverBind(struct HdfDeviceObject *dev) +{ + (void)dev; + return HDF_SUCCESS; +} + +static void HdfEthAmlogicChipRelease(struct HdfDeviceObject *object) +{ + (void)object; +} + +struct HdfDriverEntry g_hdfamlogicethchipentry = { + .moduleVersion = 1, + .Bind = HdfEthAmlogicDriverBind, + .Init = HdfEthAmlogicChipDriverInit, + .Release = HdfEthAmlogicChipRelease, + .moduleName = "HDF_ETHERNET_CHIPS" +}; + +HDF_INIT(g_hdfamlogicethchipentry); diff --git a/amlogic/drivers/ethernet/adapter/modules.builtin b/amlogic/drivers/ethernet/adapter/modules.builtin new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/amlogic/drivers/ethernet/adapter/modules.order b/amlogic/drivers/ethernet/adapter/modules.order new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/amlogic/drivers/ethernet/adapter/net_adapter.c b/amlogic/drivers/ethernet/adapter/net_adapter.c new file mode 100755 index 0000000000000000000000000000000000000000..d5a82c403b914c9ba06ec4c407f9d38e939ac063 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/net_adapter.c @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "net_adapter.h" +#include "eth_chip_driver.h" +#include "net_device.h" +#include "netbuf_adapter.h" +#include "net_device_adapter.h" +#include +#include +#include +#include "amlogiceth_phy.h" + +struct net_device *g_save_eth_net = NULL; +extern const struct net_device_ops stmmac_netdev_ops; +extern struct net_device *get_eth_netdev(void); +extern int amlogic_set_mac(unsigned char * mac_address, struct net_device *ndev); +static int32_t EthSetMacAddr(struct NetDevice *netDev, void *addr) +{ + struct net_device *dev = NULL; + + dev = get_eth_netdev(); + + if (NULL == dev || NULL == addr) { + HDF_LOGE("%s dev is null || addr is null!", __func__); + } + + amlogic_set_mac((unsigned char *)addr, dev); + HDF_LOGE("%s SetMac successful !", __func__); + return HDF_SUCCESS; +} + +static int32_t EthXmit(struct NetDevice *netDev, NetBuf *netbuf) +{ + int32_t ret = 0; + struct net_device *dev = NULL; + + dev = get_eth_netdev(); + + stmmac_netdev_ops.ndo_start_xmit(netbuf, dev); + + return ret; +} + +static int32_t EthOpen(struct NetDevice *netDev) +{ + int32_t ret = 0; + struct net_device *dev = NULL; + + dev = get_eth_netdev(); + if (NULL == dev) { + HDF_LOGE("%s dev is null !", __func__); + } + + stmmac_netdev_ops.ndo_open(dev); + HDF_LOGE("%s open successful !", __func__); + return ret; +} + +static int32_t EthStop(struct NetDevice *netDev) +{ + int32_t ret = 0; + struct net_device *dev = NULL; + + dev = get_eth_netdev(); + if (NULL == dev) { + HDF_LOGE("%s dev is null !", __func__); + } + + stmmac_netdev_ops.ndo_stop(dev); + HDF_LOGE("%s stop successful !", __func__); + + return ret; +} + +struct NetDeviceInterFace g_ethnetdevops = { + .xmit = EthXmit, + .setMacAddr = EthSetMacAddr, + .open = EthOpen, + .stop = EthStop, +}; + +int32_t EthernetInitNetdev(NetDevice *netdev) +{ + int32_t ret = HDF_FAILURE; + + if (netdev == NULL) { + HDF_LOGE("%s netdev is null!", __func__); + return HDF_ERR_INVALID_PARAM; + } + netdev->netDeviceIf = &g_ethnetdevops; + + ret = NetDeviceAdd(netdev); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s NetDeviceAdd return error code %d!", __func__, ret); + return ret; + } + + // open netdevice + HDF_LOGE("%s netdev->netDeviceIf->open!", __func__); + netdev->netDeviceIf->open(netdev); + + return ret; +} + +void set_eth_netdev(struct net_device *dev) { + g_save_eth_net = dev; +} + +struct net_device *get_eth_netdev(void) { + return g_save_eth_net; +} + +EXPORT_SYMBOL(set_eth_netdev); +EXPORT_SYMBOL(get_eth_netdev); diff --git a/amlogic/drivers/ethernet/adapter/net_adapter.h b/amlogic/drivers/ethernet/adapter/net_adapter.h new file mode 100755 index 0000000000000000000000000000000000000000..7dc4013d0a417cec1e5653c4ff440fdfb8c00c25 --- /dev/null +++ b/amlogic/drivers/ethernet/adapter/net_adapter.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef NET_ADAPTER_H +#define NET_ADAPTER_H + +#include "eth_chip_driver.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +int32_t EthernetInitNetdev(NetDevice *netdev); +struct NetDeviceInterFace *EthGetNetdevOps(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* NET_ADAPTER_H */ diff --git a/amlogic/drivers/wifi/ap6212/Makefile b/amlogic/drivers/wifi/ap6212/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..cd804b1c6abe86d8a4c91a18f9cb338aa680a271 --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/Makefile @@ -0,0 +1,39 @@ +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# +# This software is licensed under the terms of the GNU General Public +# License version 2, as published by the Free Software Foundation, and +# may be copied, distributed, and modified under those terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +#5 + +MODULE_NAME := ap6212 + +VENDOR_WIFI_ROOT = . + +WIFI_PATH := $(shell pwd) +$(warning WIFI_PATH=$(WIFI_PATH)) + +include $(WIFI_PATH)/../../../../../device/amlogic/drivers/wifi/ap6212/wifi_config.mk + +$(warning HDF_FRAMEWORKS_INC=$(HDF_FRAMEWORKS_INC)) +$(warning HDF_WIFI_FRAMEWORKS_INC=$(HDF_WIFI_FRAMEWORKS_INC)) +$(warning SECURE_LIB_INC=$(SECURE_LIB_INC)) +$(warning HDF_WIFI_ADAPTER_INC=$(HDF_WIFI_ADAPTER_INC)) + +obj-y += $(MODULE_NAME).o +$(MODULE_NAME)-objs := $(VENDOR_WIFI_ROOT)/hdfadapter/hdf_driver_register.o \ + $(VENDOR_WIFI_ROOT)/hdfadapter/hdfinit_ap6212.o \ + $(VENDOR_WIFI_ROOT)/hdfadapter/net_adpater.o \ + $(VENDOR_WIFI_ROOT)/hdfadapter/hdf_mac80211.o + +ccflags-y += \ + $(HDF_FRAMEWORKS_INC) \ + $(HDF_WIFI_FRAMEWORKS_INC) \ + $(SECURE_LIB_INC) \ + $(HDF_WIFI_ADAPTER_INC) diff --git a/amlogic/drivers/wifi/ap6212/hdfadapter/hdf_driver_register.c b/amlogic/drivers/wifi/ap6212/hdfadapter/hdf_driver_register.c new file mode 100644 index 0000000000000000000000000000000000000000..9a0dfbffd9da6cc309f8336d8f1d1488e47fbfa7 --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/hdfadapter/hdf_driver_register.c @@ -0,0 +1,132 @@ +#include "hdf_device_desc.h" +#include "hdf_wifi_product.h" +#include "hdf_log.h" +#include "osal_mem.h" +#include "hdf_wlan_chipdriver_manager.h" +#include "securec.h" +#include "wifi_module.h" + +#define HDF_LOG_TAG Ap6212Driver +static const char * const AP6212_DRIVER_NAME = "ap6212"; + +int32_t InitAp6212Chip(struct HdfWlanDevice *device); +int32_t DeinitAp6212Chip(struct HdfWlanDevice *device); +int32_t Ap6212Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice); +int32_t Ap6212Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice); +void ApMac80211Init(struct HdfChipDriver *chipDriver); + +static struct HdfChipDriver *BuildAp6212Driver(struct HdfWlanDevice *device, uint8_t ifIndex) +{ + struct HdfChipDriver *specificDriver = NULL; + + HDF_LOGE("%s: Enter ", __func__); + + if (device == NULL) { + HDF_LOGE("%s fail : channel is NULL", __func__); + return NULL; + } + (void)device; + (void)ifIndex; + specificDriver = (struct HdfChipDriver *)OsalMemCalloc(sizeof(struct HdfChipDriver)); + if (specificDriver == NULL) { + HDF_LOGE("%s fail: OsalMemCalloc fail!", __func__); + return NULL; + } + if (memset_s(specificDriver, sizeof(struct HdfChipDriver), 0, sizeof(struct HdfChipDriver)) != EOK) { + HDF_LOGE("%s fail: memset_s fail!", __func__); + OsalMemFree(specificDriver); + return NULL; + } + + if (strcpy_s(specificDriver->name, MAX_WIFI_COMPONENT_NAME_LEN, AP6212_DRIVER_NAME) != EOK) { + HDF_LOGE("%s fail : strcpy_s fail", __func__); + OsalMemFree(specificDriver); + return NULL; + } + specificDriver->init = Ap6212Init; + specificDriver->deinit = Ap6212Deinit; + + ApMac80211Init(specificDriver); + + return specificDriver; +} + +static void ReleaseAp6212Driver(struct HdfChipDriver *chipDriver) +{ + HDF_LOGE("%s: Enter ", __func__); + return; + + if (chipDriver == NULL) { + return; + } + if (strcmp(chipDriver->name, AP6212_DRIVER_NAME) != 0) { + HDF_LOGE("%s:Not my driver!", __func__); + return; + } + OsalMemFree(chipDriver); +} + +static uint8_t GetAp6212GetMaxIFCount(struct HdfChipDriverFactory *factory) +{ + (void)factory; + HDF_LOGE("%s: Enter ", __func__); + + return 1; +} + +/* ap6212's register */ +static int32_t HDFWlanRegApDriverFactory(void) +{ + static struct HdfChipDriverFactory tmpFactory = { 0 }; + struct HdfChipDriverManager *driverMgr = NULL; + + HDF_LOGE("%s: Enter ", __func__); + driverMgr = HdfWlanGetChipDriverMgr(); + if (driverMgr == NULL) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + tmpFactory.driverName = AP6212_DRIVER_NAME; + tmpFactory.GetMaxIFCount = GetAp6212GetMaxIFCount; + tmpFactory.InitChip = InitAp6212Chip; + tmpFactory.DeinitChip = DeinitAp6212Chip; + tmpFactory.Build = BuildAp6212Driver; + tmpFactory.Release = ReleaseAp6212Driver; + tmpFactory.ReleaseFactory = NULL; + if (driverMgr->RegChipDriver(&tmpFactory) != HDF_SUCCESS) { + HDF_LOGE("%s fail: driverMgr is NULL!", __func__); + return HDF_FAILURE; + } + + return HDF_SUCCESS; +} + +static int32_t HdfWlanApChipDriverInit(struct HdfDeviceObject *device) +{ + (void)device; + HDF_LOGE("%s: Enter ", __func__); + return HDFWlanRegApDriverFactory(); +} + +static int HdfWlanApDriverBind(struct HdfDeviceObject *dev) +{ + (void)dev; + HDF_LOGE("%s: Enter ", __func__); + return HDF_SUCCESS; +} + +static void HdfWlanApChipRelease(struct HdfDeviceObject *object) +{ + (void)object; + HDF_LOGE("%s: Enter ", __func__); +} + +struct HdfDriverEntry g_hdfapchipentry = { + .moduleVersion = 1, + .Bind = HdfWlanApDriverBind, + .Init = HdfWlanApChipDriverInit, + .Release = HdfWlanApChipRelease, + .moduleName = "HDF_WLAN_CHIPS" +}; + +HDF_INIT(g_hdfapchipentry); diff --git a/amlogic/drivers/wifi/ap6212/hdfadapter/hdf_mac80211.c b/amlogic/drivers/wifi/ap6212/hdfadapter/hdf_mac80211.c new file mode 100644 index 0000000000000000000000000000000000000000..381fdd1b555ad001b9e003573ed53a3f035ec680 --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/hdfadapter/hdf_mac80211.c @@ -0,0 +1,1158 @@ +/* + * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "wifi_mac80211_ops.h" +#include "net_adpater.h" +#include "hdf_wlan_utils.h" +#include "wifi_module.h" +#include +#include +#include "osal_mem.h" +#include "hdf_wifi_event.h" + +#define HDF_LOG_TAG Ap6212Driver +#ifndef errno_t +typedef int errno_t; +#endif + +extern struct net_device_ops dhd_ops_pri; +extern struct cfg80211_ops wl_cfg80211_ops; + +extern NetDevice *get_netDev(void); +extern struct wiphy* wrap_get_wiphy(void); +extern struct net_device *get_krn_netdev(void); +extern struct wireless_dev* wrap_get_widev(void); +extern const struct ieee80211_regdomain * wrp_get_regdomain(void); +extern int32_t wl_get_all_sta(struct net_device *ndev, uint32_t *num); +extern void dhd_get_mac_address(struct net_device *dev, void **addr); +extern s32 wl_get_all_sta_info(struct net_device *ndev, char* mac, uint32_t num); +extern int32_t wal_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy, struct net_device *netDev); +extern int32_t wl_cfg80211_set_wps_p2p_ie_wrp(struct net_device *ndev, char *buf, int len, int8_t type); +extern int32_t wal_cfg80211_remain_on_channel(struct wiphy *wiphy, struct net_device *netDev, + int32_t freq, unsigned int duration); +extern void wl_cfg80211_add_virtual_iface_wrap(struct wiphy *wiphy, char *name, + enum nl80211_iftype type, + struct vif_params *params); +extern int32_t wl_cfg80211_set_country_code(struct net_device *net, char *country_code, + bool notify, bool user_enforced, int revinfo); +extern int32_t HdfWifiEventInformBssFrame(const struct NetDevice *netDev, + const struct WlanChannel *channel, + const struct ScannedBssInfo *bssInfo); +extern int32_t wl_cfg80211_change_beacon_wrap(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_beacon_data *info, + int interval, int dtimPeriod, bool hidden_ssid); + +extern errno_t memcpy_s(void *dest, size_t dest_max, const void *src, size_t count); +extern int snprintf_s(char *dest, size_t dest_max, size_t count, const char *format, ...); + +typedef enum { + WLAN_BAND_2G, + WLAN_BAND_BUTT +} wlan_channel_band_enum; + +#define WIFI_24G_CHANNEL_NUMS (14) +#define WAL_MIN_CHANNEL_2G (1) +#define WAL_MAX_CHANNEL_2G (14) +#define WAL_MIN_FREQ_2G (2412 + 5*(WAL_MIN_CHANNEL_2G - 1)) +#define WAL_MAX_FREQ_2G (2484) +#define WAL_FREQ_2G_INTERVAL (5) +#define WLAN_WPS_IE_MAX_SIZE (352) // (WLAN_MEM_EVENT_SIZE2 - 32) /* 32表示事件自身占用的空间 */ +/* Driver supports AP mode */ +#define HISI_DRIVER_FLAGS_AP 0x00000040 +/* Driver supports concurrent P2P operations */ +#define HISI_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200 + +#define HISI_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400 +/* P2P capable (P2P GO or P2P Client) */ +#define HISI_DRIVER_FLAGS_P2P_CAPABLE 0x00000800 +/* Driver supports a dedicated interface for P2P Device */ +#define HISI_DRIVER_FLAGS_DEDICATED_P2P_DEVICE 0x20000000 + +/*--------------------------------------------------------------------------------------------------*/ +/* public */ +/*--------------------------------------------------------------------------------------------------*/ +static int32_t GetIfName(enum nl80211_iftype type, char *ifName, uint32_t len) +{ + if (ifName == NULL || len == 0) { + HDF_LOGE("%s:para is null!", __func__); + return HDF_FAILURE; + } + switch (type) { + case NL80211_IFTYPE_P2P_DEVICE: + if (snprintf_s(ifName, len, len -1, "p2p%d", 0) < 0) { + HDF_LOGE("%s:format ifName failed!", __func__); + return HDF_FAILURE; + } + break; + case NL80211_IFTYPE_P2P_CLIENT: + /* fall-through */ + case NL80211_IFTYPE_P2P_GO: + if (snprintf_s(ifName, len, len -1, "p2p-p2p0-%d", 0) < 0) { + HDF_LOGE("%s:format ifName failed!", __func__); + return HDF_FAILURE; + } + break; + default: + HDF_LOGE("%s:GetIfName::not supported dev type!", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +void WalReleaseHwCapability(struct WlanHwCapability *self) +{ + uint8_t i; + if (self == NULL) { + return; + } + for (i = 0; i < IEEE80211_NUM_BANDS; i++) { + if (self->bands[i] != NULL) { + OsalMemFree(self->bands[i]); + self->bands[i] = NULL; + } + } + if (self->supportedRates != NULL) { + OsalMemFree(self->supportedRates); + self->supportedRates = NULL; + } + OsalMemFree(self); +} + +static struct ieee80211_channel *GetChannelByFreq(struct wiphy* wiphy, uint16_t center_freq) +{ + enum Ieee80211Band band; + struct ieee80211_supported_band *currentBand = NULL; + int32_t loop; + for (band = (enum Ieee80211Band)0; band < IEEE80211_NUM_BANDS; band++) { + currentBand = wiphy->bands[band]; + if (currentBand == NULL) { + continue; + } + for (loop = 0; loop < currentBand->n_channels; loop++) { + if (currentBand->channels[loop].center_freq == center_freq) { + return ¤tBand->channels[loop]; + } + } + } + return NULL; +} + +static struct ieee80211_channel *WalGetChannel(struct wiphy *wiphy, int32_t freq) +{ + int32_t loop = 0; + enum Ieee80211Band band = IEEE80211_BAND_2GHZ; + struct ieee80211_supported_band *currentBand = NULL; + + if (wiphy == NULL) { + HDF_LOGE("%s: capality is NULL!", __func__); + return NULL; + } + + for (band = (enum Ieee80211Band)0; band < IEEE80211_NUM_BANDS; band++) { + currentBand = wiphy->bands[band]; + if (currentBand == NULL) { + continue; + } + + for (loop = 0; loop < currentBand->n_channels; loop++) { + if (currentBand->channels[loop].center_freq == freq) { + return ¤tBand->channels[loop]; + } + } + } + + return NULL; +} + +void inform_bss_frame(struct ieee80211_channel *channel, int32_t signal, + int16_t freq, struct ieee80211_mgmt *mgmt, + uint32_t mgmtLen) +{ + int32_t retVal = 0; + NetDevice *netDev = get_netDev(); + struct ScannedBssInfo bssInfo; + struct WlanChannel hdfchannel; + + if (channel == NULL || netDev == NULL || mgmt == NULL) { + HDF_LOGE("%s: inform_bss_frame channel = null or netDev = null!", __func__); + return; + } + + bssInfo.signal = signal; + bssInfo.freq = freq; + bssInfo.mgmtLen = mgmtLen; + bssInfo.mgmt = (struct Ieee80211Mgmt *)mgmt; + + hdfchannel.flags = channel->flags; + hdfchannel.channelId = channel->hw_value; + hdfchannel.centerFreq = channel->center_freq; + + HDF_LOGE("%s: hdfchannel flags:%d--channelId:%d--centerFreq:%d--dstMac:%02x:%02x:%02x:%02x:%02x:%02x!", + __func__, hdfchannel.flags, hdfchannel.channelId, hdfchannel.centerFreq, + bssInfo.mgmt->bssid[0], bssInfo.mgmt->bssid[1], bssInfo.mgmt->bssid[2], + bssInfo.mgmt->bssid[3], bssInfo.mgmt->bssid[4], bssInfo.mgmt->bssid[5]); + + retVal = HdfWifiEventInformBssFrame(netDev, &hdfchannel, &bssInfo); + if (retVal < 0) { + HDF_LOGE("%s: hdf wifi event inform bss frame failed!", __func__); + } +} + +#define HDF_ETHER_ADDR_LEN (6) +void inform_connect_result(uint8_t *bssid, uint8_t *rspIe, uint8_t *reqIe, + uint32_t reqIeLen, uint32_t rspIeLen, + uint16_t connectStatus) +{ + int32_t retVal = 0; + NetDevice *netDev = get_netDev(); + struct ConnetResult connResult; + + if (netDev == NULL || bssid == NULL || rspIe == NULL || reqIe == NULL) { + HDF_LOGE("%s: netDev / bssid / rspIe / reqIe null!", __func__); + return; + } + + memcpy(&connResult.bssid[0], bssid, HDF_ETHER_ADDR_LEN); + HDF_LOGE("%s: connResult:%02x:%02x:%02x:%02x:%02x:%02x\n", __func__, + connResult.bssid[0], connResult.bssid[1], connResult.bssid[2], + connResult.bssid[3], connResult.bssid[4], connResult.bssid[5]); + + connResult.rspIe = rspIe; + connResult.rspIeLen = rspIeLen; + + connResult.reqIe = reqIe; + connResult.reqIeLen = reqIeLen; + + connResult.connectStatus = connectStatus; + + // TODO: modify freq & statusCode + connResult.freq = 0; + connResult.statusCode = connectStatus; + + retVal = HdfWifiEventConnectResult(netDev, &connResult); + if (retVal < 0) { + HDF_LOGE("%s: hdf wifi event inform connect result failed!", __func__); + } +} + +struct wireless_dev g_ap_wireless_dev; +struct ieee80211_channel g_ap_ieee80211_channel; +#define GET_DEV_CFG80211_WIRELESS(dev) ((struct wireless_dev*)((dev)->ieee80211_ptr)) +static int32_t SetupWireLessDev(struct net_device *netDev, struct WlanAPConf *apSettings) +{ + + if (netDev->ieee80211_ptr == NULL) { + netDev->ieee80211_ptr = &g_ap_wireless_dev; + } + + if (GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.chan == NULL) { + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.chan = &g_ap_ieee80211_channel; + } + GET_DEV_CFG80211_WIRELESS(netDev)->iftype = NL80211_IFTYPE_AP; + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.width = (enum nl80211_channel_type)apSettings->width; + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.center_freq1 = apSettings->centerFreq1; + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.center_freq2 = apSettings->centerFreq2; + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.chan->hw_value = apSettings->channel; + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.chan->band = IEEE80211_BAND_2GHZ; + GET_DEV_CFG80211_WIRELESS(netDev)->preset_chandef.chan->center_freq = apSettings->centerFreq1; + + return HDF_SUCCESS; +} + +/*--------------------------------------------------------------------------------------------------*/ +/* HdfMac80211BaseOps */ +/*--------------------------------------------------------------------------------------------------*/ +// OK +int32_t WalSetMode(NetDevice *netDev, enum WlanWorkMode iftype) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + HDF_LOGE("%s: start... iftype=%d ", __func__, iftype); + + retVal = (int32_t)wl_cfg80211_ops.change_virtual_intf(wiphy, + netdev, + (enum nl80211_iftype)iftype, NULL, NULL); + if (retVal < 0) { + HDF_LOGE("%s: set mode failed!", __func__); + } + + return retVal; +} + +int32_t WalAddKey(struct NetDevice *netDev, uint8_t keyIndex, bool pairwise, const uint8_t *macAddr, + struct KeyParams *params) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + HDF_LOGE("%s: start...", __func__); + + (void)netDev; + retVal = (int32_t)wl_cfg80211_ops.add_key(wiphy, netdev, keyIndex, pairwise, macAddr, (struct key_params *)params); + if (retVal < 0) { + HDF_LOGE("%s: add key failed!", __func__); + } + + return retVal; +} + +int32_t WalDelKey(struct NetDevice *netDev, uint8_t keyIndex, bool pairwise, const uint8_t *macAddr) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + HDF_LOGE("%s: start...", __func__); + + (void)netDev; + retVal = (int32_t)wl_cfg80211_ops.del_key(wiphy, netdev, keyIndex, pairwise, macAddr); + if (retVal < 0) { + HDF_LOGE("%s: delete key failed!", __func__); + } + + return retVal; +} + +int32_t WalSetDefaultKey(struct NetDevice *netDev, uint8_t keyIndex, bool unicast, bool multicas) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_cfg80211_ops.set_default_key(wiphy, netdev, keyIndex, unicast, multicas); + if (retVal < 0) { + HDF_LOGE("%s: set default key failed!", __func__); + } + + return retVal; +} + +int32_t WalGetDeviceMacAddr(NetDevice *netDev, int32_t type, uint8_t *mac, uint8_t len) +{ + struct net_device *netdev = get_krn_netdev(); + + (void)len; + (void)type; + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + dhd_get_mac_address(netdev, (void**)&mac); + + return HDF_SUCCESS; +} + +int32_t WalSetMacAddr(NetDevice *netDev, uint8_t *mac, uint8_t len) +{ + int32_t retVal = 0; + struct net_device *netdev = get_krn_netdev(); + + (void)len; + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)dhd_ops_pri.ndo_set_mac_address(netdev, mac); + if (retVal < 0) { + HDF_LOGE("%s: set mac address failed!", __func__); + } + + return retVal; +} + +int32_t WalSetTxPower(NetDevice *netDev, int32_t power) +{ + int retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct wireless_dev *wdev = GET_NET_DEV_CFG80211_WIRELESS(netDev); + + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_cfg80211_ops.set_tx_power(wiphy, wdev, NL80211_TX_POWER_FIXED ,power); + + if (retVal < 0) { + HDF_LOGE("%s: set_tx_power failed!", __func__); + } + + return HDF_SUCCESS; +} + +int32_t WalGetValidFreqsWithBand(NetDevice *netDev, int32_t band, int32_t *freqs, uint32_t *num) +{ + uint32_t freqIndex = 0; + uint32_t channelNumber; + uint32_t freqTmp; + uint32_t minFreq; + uint32_t maxFreq; + const struct ieee80211_regdomain *regdom = wrp_get_regdomain(); + if (regdom == NULL) { + HDF_LOGE("%s: wal_get_cfg_regdb failed!", __func__); + return HDF_FAILURE; + } + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + minFreq = regdom->reg_rules[0].freq_range.start_freq_khz / MHZ_TO_KHZ(1); + maxFreq = regdom->reg_rules[0].freq_range.end_freq_khz / MHZ_TO_KHZ(1); + switch (band) { + case WLAN_BAND_2G: + for (channelNumber = 1; channelNumber <= WIFI_24G_CHANNEL_NUMS; channelNumber++) { + if (channelNumber < WAL_MAX_CHANNEL_2G) { + freqTmp = WAL_MIN_FREQ_2G + (channelNumber - 1) * WAL_FREQ_2G_INTERVAL; + } else if (channelNumber == WAL_MAX_CHANNEL_2G) { + freqTmp = WAL_MAX_FREQ_2G; + } + if (freqTmp < minFreq || freqTmp > maxFreq) { + continue; + } + freqs[freqIndex] = freqTmp; + freqIndex++; + } + *num = freqIndex; + break; + default: + HDF_LOGE("%s: no support band!", __func__); + return HDF_ERR_NOT_SUPPORT; + } + return HDF_SUCCESS; +} + +int32_t WalGetHwCapability(struct NetDevice *netDev, struct WlanHwCapability **capability) +{ + uint8_t loop = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_2GHZ]; + struct WlanHwCapability *hwCapability = (struct WlanHwCapability *)OsalMemCalloc(sizeof(struct WlanHwCapability)); + + (void)netDev; + if (hwCapability == NULL) { + HDF_LOGE("%s: oom!\n", __func__); + return HDF_FAILURE; + } + hwCapability->Release = WalReleaseHwCapability; + if (hwCapability->bands[IEEE80211_BAND_2GHZ] == NULL) { + hwCapability->bands[IEEE80211_BAND_2GHZ] = + OsalMemCalloc(sizeof(struct WlanBand) + (sizeof(struct WlanChannel) * band->n_channels)); + if (hwCapability->bands[IEEE80211_BAND_2GHZ] == NULL) { + HDF_LOGE("%s: oom!\n", __func__); + WalReleaseHwCapability(hwCapability); + return HDF_FAILURE; + } + } + hwCapability->htCapability = band->ht_cap.cap; + hwCapability->bands[IEEE80211_BAND_2GHZ]->channelCount = band->n_channels; + for (loop = 0; loop < band->n_channels; loop++) { + hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].centerFreq = band->channels[loop].center_freq; + hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].flags = band->channels[loop].flags; + hwCapability->bands[IEEE80211_BAND_2GHZ]->channels[loop].channelId = band->channels[loop].hw_value; + } + hwCapability->supportedRateCount = band->n_bitrates; + hwCapability->supportedRates = OsalMemCalloc(sizeof(uint16_t) * band->n_bitrates); + if (hwCapability->supportedRates == NULL) { + HDF_LOGE("%s: oom!\n", __func__); + WalReleaseHwCapability(hwCapability); + return HDF_FAILURE; + } + for (loop = 0; loop < band->n_bitrates; loop++) { + hwCapability->supportedRates[loop] = band->bitrates[loop].bitrate; + } + *capability = hwCapability; + return HDF_SUCCESS; +} + +int32_t WalRemainOnChannel(struct NetDevice *netDev, WifiOnChannel *onChannel) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + if (netdev == NULL || onChannel == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + + retVal = (int32_t)wal_cfg80211_remain_on_channel(wiphy, netdev, onChannel->freq, onChannel->duration); + if (retVal < 0) { + HDF_LOGE("%s: remain on channel failed!", __func__); + } + + return retVal; +} + +int32_t WalCancelRemainOnChannel(struct NetDevice *netDev) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + if (netdev == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + + retVal = (int32_t)wal_cfg80211_cancel_remain_on_channel(wiphy, netdev); + if (retVal < 0) { + HDF_LOGE("%s: cancel remain on channel failed!", __func__); + } + + return retVal; +} + +int32_t WalProbeReqReport(struct NetDevice *netDev, int32_t report) +{ + // NO SUPPORT + (void)report; + HDF_LOGE("%s: start...", __func__); + if (netDev == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + return HDF_SUCCESS; +} + +int32_t WalAddIf(struct NetDevice *netDev, WifiIfAdd *ifAdd) +{ + char ifName[16] = {0}; + struct wiphy* wiphy = wrap_get_wiphy(); + + HDF_LOGE("%s: start...", __func__); + + GetIfName(ifAdd->type, ifName, 16); + wl_cfg80211_ops.add_virtual_intf(wiphy, ifName, 0, ifAdd->type, NULL, NULL); + + return HDF_SUCCESS; +} + +int32_t WalRemoveIf(struct NetDevice *netDev, WifiIfRemove *ifRemove) +{ + struct NetDevice *removeNetdev = NULL; + struct wireless_dev *wdev = NULL; + struct wiphy* wiphy = wrap_get_wiphy(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + if (ifRemove == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + + removeNetdev = NetDeviceGetInstByName((const char*)(ifRemove->ifname)); + if (removeNetdev == NULL) { + return HDF_FAILURE; + } + + wdev = GET_NET_DEV_CFG80211_WIRELESS(removeNetdev); + wl_cfg80211_ops.del_virtual_intf(wiphy, wdev); + + return HDF_SUCCESS; +} + +int32_t WalSetApWpsP2pIe(struct NetDevice *netDev, WifiAppIe *appIe) +{ + int32_t retVal = 0; + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + if (netdev == NULL || appIe == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + + if (appIe->ieLen > WLAN_WPS_IE_MAX_SIZE) { + HDF_LOGE("%s:app ie length is too large!", __func__); + return HDF_FAILURE; + } + + retVal = (int32_t)wl_cfg80211_set_wps_p2p_ie_wrp(netdev, appIe->ie, appIe->ieLen, (int8_t)appIe->appIeType); + if (retVal < 0) { + HDF_LOGE("%s: set_wps_p2p_ie failed!", __func__); + } + + return retVal; +} + +// ?? +int32_t WalGetDriverFlag(struct NetDevice *netDev, WifiGetDrvFlags **params) +{ + struct wireless_dev *wdev = GET_NET_DEV_CFG80211_WIRELESS(netDev); + WifiGetDrvFlags *getDrvFlag = (WifiGetDrvFlags *)OsalMemCalloc(sizeof(WifiGetDrvFlags)); + + if (netDev == NULL || params == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + + HDF_LOGE("%s: start...", __func__); + + if (NULL == wdev) { + HDF_LOGE("%s: wdev NULL", __func__); + return HDF_FAILURE; + } else { + HDF_LOGE("%s: p_wdev:%p", __func__, wdev); + } + + if (NULL == getDrvFlag) { + HDF_LOGE("%s: getDrvFlag NULL", __func__); + } + switch (wdev->iftype) { + case NL80211_IFTYPE_P2P_CLIENT: + /* fall-through */ + case NL80211_IFTYPE_P2P_GO: + HDF_LOGE("%s: NL80211_IFTYPE_P2P_GO case!", __func__); + getDrvFlag->drvFlags = HISI_DRIVER_FLAGS_AP; + break; + case NL80211_IFTYPE_P2P_DEVICE: + HDF_LOGE("%s: NL80211_IFTYPE_P2P_DEVICE case!", __func__); + getDrvFlag->drvFlags = (HISI_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE | + HISI_DRIVER_FLAGS_P2P_CONCURRENT | + HISI_DRIVER_FLAGS_P2P_CAPABLE); + break; + default: + HDF_LOGE("%s: getDrvFlag->drvFlags default to 0 case!", __func__); + getDrvFlag->drvFlags = 0; + } + *params = getDrvFlag; + return HDF_SUCCESS; +} + +// ?? +int32_t WalSendAction(struct NetDevice *netDev, WifiActionData *actionData) +{ + (void)netDev; + (void)actionData; + HDF_LOGE("%s: start...", __func__); + return HDF_ERR_NOT_SUPPORT; +} + +int32_t WalGetIftype(struct NetDevice *netDev, uint8_t *iftype) +{ + iftype = (uint8_t *)(&(GET_NET_DEV_CFG80211_WIRELESS(netDev)->iftype)); + HDF_LOGE("%s: start...", __func__); + return HDF_SUCCESS; +} + + +/*--------------------------------------------------------------------------------------------------*/ +/* HdfMac80211STAOps */ +/*--------------------------------------------------------------------------------------------------*/ +static int32_t WalConnect(NetDevice *netDev, WlanConnectParams *param) +{ + int ret = 0; + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + struct cfg80211_connect_params cfg80211_params = { 0 }; + + HDF_LOGE("%s: start ...!", __func__); + + (void)netDev; + if (netdev == NULL || param == NULL) { + HDF_LOGE("%s:NULL ptr!", __func__); + return HDF_FAILURE; + } + + if (param->centerFreq != WLAN_FREQ_NOT_SPECFIED) { + cfg80211_params.channel = WalGetChannel(wiphy, param->centerFreq); + if ((cfg80211_params.channel == NULL) || (cfg80211_params.channel->flags & WIFI_CHAN_DISABLED)) { + HDF_LOGE("%s:illegal channel.flags=%u", __func__, + (cfg80211_params.channel == NULL) ? 0 : cfg80211_params.channel->flags); + return HDF_FAILURE; + } + } + cfg80211_params.bssid = param->bssid; + cfg80211_params.ssid = param->ssid; + cfg80211_params.ie = param->ie; + cfg80211_params.ssid_len = param->ssidLen; + cfg80211_params.ie_len = param->ieLen; + ret = memcpy_s(&cfg80211_params.crypto, sizeof(cfg80211_params.crypto), ¶m->crypto, sizeof(param->crypto)); + if (ret != 0) { + HDF_LOGE("%s:Copy crypto info failed!ret=%d", __func__, ret); + return HDF_FAILURE; + } + cfg80211_params.key = param->key; + cfg80211_params.auth_type = (u_int8_t)param->authType; + cfg80211_params.privacy = param->privacy; + cfg80211_params.key_len = param->keyLen; + cfg80211_params.key_idx = param->keyIdx; + cfg80211_params.mfp = (u_int8_t)param->mfp; + + retVal = wl_cfg80211_ops.connect(wiphy, netdev, &cfg80211_params); + if (retVal < 0) { + HDF_LOGE("%s: connect failed!\n", __func__); + } + + return retVal; +} + +int32_t WalDisconnect(NetDevice *netDev, uint16_t reasonCode) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...reasonCode:%d", __func__, reasonCode); + + retVal = (int32_t)wl_cfg80211_ops.disconnect(wiphy, netdev, reasonCode); + if (retVal < 0) { + HDF_LOGE("%s: sta disconnect failed!", __func__); + } + + return retVal; +} + +struct cfg80211_scan_request g_s_request; +struct cfg80211_ssid g_s_cfg80211_ssid[20]; +uint8_t g_s_extraIE[4096]; + +int32_t WalStartScan(NetDevice *netDev, struct WlanScanRequest *scanParam) +{ + + int32_t loop; + int32_t count = 0; + int32_t retVal = 0; + enum Ieee80211Band band = IEEE80211_BAND_2GHZ; + struct ieee80211_channel *chan = NULL; + struct wiphy* wiphy = wrap_get_wiphy(); + +#if 1 + struct cfg80211_scan_request *request = (struct cfg80211_scan_request *)&g_s_request; +#else + struct cfg80211_scan_request *request = + (struct cfg80211_scan_request *)OsalMemCalloc(sizeof(struct cfg80211_scan_request)); +#endif + + if (request == NULL) { + HDF_LOGE("%s: calloc request null!\n", __func__); + return HDF_FAILURE; + } + + // basic info + request->wiphy = wiphy; + // request->dev = netdev; // for sched scan + request->wdev = GET_NET_DEV_CFG80211_WIRELESS(netDev); + request->n_ssids = scanParam->ssidCount; + // request->prefix_ssid_scan_flag = 0; // for sched scan + + // channel info + if ((scanParam->freqs == NULL) || (scanParam->freqsCount == 0)) { + if (wiphy->bands[band] == NULL) { + HDF_LOGE("%s: wiphy->bands[band] = NULL!\n", __func__); + return HDF_FAILURE; + } + + for (loop = 0; loop < (int32_t)wiphy->bands[band]->n_channels; loop++) { + chan = &wiphy->bands[band]->channels[loop]; + if ((chan->flags & WIFI_CHAN_DISABLED) != 0) { + continue; + } + request->channels[count++] = chan; + } + } else { + for (loop = 0; loop < scanParam->freqsCount; loop++) { + chan = GetChannelByFreq(wiphy, (uint16_t)(scanParam->freqs[loop])); + if (chan == NULL) { + HDF_LOGE("%s: freq not found!freq=%d!\n", __func__, scanParam->freqs[loop]); + continue; + } + + request->channels[count++] = chan; + } + } + + if (count == 0) { + HDF_LOGE("%s: invalid freq info!\n", __func__); + return HDF_FAILURE; + } + request->n_channels = count; + + // ssid info + count = 0; + loop = 0; + if (scanParam->ssidCount > WPAS_MAX_SCAN_SSIDS) { + HDF_LOGE("%s:unexpected numSsids!numSsids=%u", __func__, scanParam->ssidCount); + return HDF_FAILURE; + } + + if (scanParam->ssidCount == 0) { + HDF_LOGE("%s:ssid number is 0!", __func__); + } + + request->ssids = (struct cfg80211_ssid *)g_s_cfg80211_ssid; + //request->ssids = (struct cfg80211_ssid *)OsalMemCalloc(scanParam->ssidCount * sizeof(struct cfg80211_ssid)); + if (request->ssids == NULL) { + HDF_LOGE("%s: calloc request->ssids null", __func__); + return HDF_FAILURE; + } + + for (loop = 0; loop < scanParam->ssidCount; loop++) { + if (count >= DRIVER_MAX_SCAN_SSIDS) { + break; + } + + if (scanParam->ssids[loop].ssidLen > IEEE80211_MAX_SSID_LEN) { + continue; + } + + request->ssids[count].ssid_len = scanParam->ssids[loop].ssidLen; + HDF_LOGE("ZXC============scanParam->ssids[loop].ssid:%s\n", scanParam->ssids[loop].ssid); + if (memcpy_s(request->ssids[count].ssid, OAL_IEEE80211_MAX_SSID_LEN, scanParam->ssids[loop].ssid, + scanParam->ssids[loop].ssidLen) != 0) { + continue; + } + count++; + } + request->n_ssids = count; + + // User Ie Info + if (scanParam->extraIEsLen > 512) { + HDF_LOGE("%s:unexpected extra len!extraIesLen=%d", __func__, scanParam->extraIEsLen); + return HDF_FAILURE; + } + + if ((scanParam->extraIEs != NULL) && (scanParam->extraIEsLen != 0)) { + request->ie = (uint8_t *)g_s_extraIE; + //request->ie = (uint8_t *)OsalMemCalloc(scanParam->extraIEsLen); + if (request->ie == NULL) { + HDF_LOGE("%s: calloc request->ie null", __func__); + if (request->ie != NULL) { + //OsalMemFree((void*)request->ie); + request->ie = NULL; + } + + return HDF_FAILURE; + } + (void)memcpy_s((void*)request->ie, scanParam->extraIEsLen, scanParam->extraIEs, scanParam->extraIEsLen); + request->ie_len = scanParam->extraIEsLen; + } + + retVal = (int32_t)wl_cfg80211_ops.scan(wiphy, request); + if (retVal < 0) { + HDF_LOGE("%s: scan Failed!", __func__); + if (request != NULL) { + if ((request)->ie != NULL) { + //OsalMemFree((void*)(request->ie)); + request->ie = NULL; + } + if ((request)->ssids != NULL) { + //OsalMemFree(request->ssids); + (request)->ssids = NULL; + } + //OsalMemFree(request); + request = NULL; + } + } else { + HDF_LOGE("%s: scan OK!", __func__); + } + + return retVal; +} + +int32_t WalAbortScan(NetDevice *netDev) +{ + struct wiphy* wiphy = wrap_get_wiphy(); + struct wireless_dev* wdev = wrap_get_widev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + wl_cfg80211_ops.abort_scan(wiphy, wdev); + + return HDF_SUCCESS; +} + +int32_t WalSetScanningMacAddress(NetDevice *netDev, unsigned char *mac, uint32_t len) +{ + (void)netDev; + (void)mac; + (void)len; + return HDF_ERR_NOT_SUPPORT; +} + +/*--------------------------------------------------------------------------------------------------*/ +/* HdfMac80211APOps */ +/*--------------------------------------------------------------------------------------------------*/ +struct cfg80211_ap_settings g_ap_setting_info; +u8 g_ap_ssid[IEEE80211_MAX_SSID_LEN]; +struct ieee80211_channel g_ap_chan; +int32_t WalConfigAp(NetDevice *netDev, struct WlanAPConf *apConf) +{ + int32_t ret = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + ret = SetupWireLessDev(netdev, apConf); + if (0 != ret) { + HDF_LOGE("%s: set up wireless device failed!", __func__); + return HDF_FAILURE; + } + + HDF_LOGE("%s: before iftype = %d!", __func__, netdev->ieee80211_ptr->iftype); + netdev->ieee80211_ptr->iftype = NL80211_IFTYPE_AP; + HDF_LOGE("%s: after iftype = %d!", __func__, netdev->ieee80211_ptr->iftype); + + g_ap_setting_info.ssid_len = apConf->ssidConf.ssidLen; + memcpy(&g_ap_ssid[0], &apConf->ssidConf.ssid[0], apConf->ssidConf.ssidLen); + + g_ap_setting_info.ssid = &g_ap_ssid[0]; + g_ap_setting_info.chandef.center_freq1 = apConf->centerFreq1; + g_ap_setting_info.chandef.center_freq2 = apConf->centerFreq2; + g_ap_setting_info.chandef.width = apConf->width; + + g_ap_chan.center_freq = apConf->centerFreq1; + g_ap_chan.hw_value = apConf->channel; + g_ap_chan.band = apConf->band; + g_ap_chan.band = IEEE80211_BAND_2GHZ; + g_ap_setting_info.chandef.chan = &g_ap_chan; + + ret = (int32_t)wl_cfg80211_ops.change_virtual_intf(wiphy, + netdev, + (enum nl80211_iftype)netdev->ieee80211_ptr->iftype, NULL, NULL); + if (ret < 0) { + HDF_LOGE("%s: set mode failed!", __func__); + } + + return HDF_SUCCESS; +} + +int32_t WalStartAp(NetDevice *netDev) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + GET_DEV_CFG80211_WIRELESS(netdev)->preset_chandef.chan->center_freq = \ + netdev->ieee80211_ptr->preset_chandef.center_freq1; + retVal = (int32_t)wl_cfg80211_ops.start_ap(wiphy, netdev, &g_ap_setting_info); + if (retVal < 0) { + HDF_LOGE("%s: start_ap failed!", __func__); + } + + return retVal; +} + +int32_t WalStopAp(NetDevice *netDev) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_cfg80211_ops.stop_ap(wiphy, netdev); + if (retVal < 0) { + HDF_LOGE("%s: stop_ap failed!", __func__); + } + + return retVal; +} + +int32_t WalChangeBeacon(NetDevice *netDev, struct WlanBeaconConf *param) +{ + int32_t retVal = 0; + struct cfg80211_beacon_data info; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + memset(&info, 0x00, sizeof(info)); + info.head = param->headIEs; + info.head_len = (size_t)param->headIEsLength; + info.tail = param->tailIEs; + info.tail_len = (size_t)param->tailIEsLength; + + info.beacon_ies = NULL; + info.proberesp_ies = NULL; + info.assocresp_ies = NULL; + info.probe_resp = NULL; + info.beacon_ies_len = 0X00; + info.proberesp_ies_len = 0X00; + info.assocresp_ies_len = 0X00; + info.probe_resp_len = 0X00; + + // add beacon data for start ap + g_ap_setting_info.dtim_period = param->DTIMPeriod; + g_ap_setting_info.hidden_ssid = param->hiddenSSID; + g_ap_setting_info.beacon_interval = param->interval; + HDF_LOGE("%s: dtim_period:%d---hidden_ssid:%d---beacon_interval:%d!", + __func__, g_ap_setting_info.dtim_period, g_ap_setting_info.hidden_ssid, g_ap_setting_info.beacon_interval); + + g_ap_setting_info.beacon.head = param->headIEs; + g_ap_setting_info.beacon.head_len = param->headIEsLength; + g_ap_setting_info.beacon.tail = param->tailIEs; + g_ap_setting_info.beacon.tail_len = param->tailIEsLength; + + g_ap_setting_info.beacon.beacon_ies = NULL; + g_ap_setting_info.beacon.proberesp_ies = NULL; + g_ap_setting_info.beacon.assocresp_ies = NULL; + g_ap_setting_info.beacon.probe_resp = NULL; + g_ap_setting_info.beacon.beacon_ies_len = 0X00; + g_ap_setting_info.beacon.proberesp_ies_len = 0X00; + g_ap_setting_info.beacon.assocresp_ies_len = 0X00; + g_ap_setting_info.beacon.probe_resp_len = 0X00; + + HDF_LOGE("%s: headIEsLen:%d---tailIEsLen:%d!", __func__, param->headIEsLength, param->tailIEsLength); + + retVal = (int32_t)wl_cfg80211_ops.change_beacon(wiphy, netdev, &info); + if (retVal < 0) { + HDF_LOGE("%s: change_beacon failed!", __func__); + } + + return HDF_SUCCESS; +} + +int32_t WalDelStation(NetDevice *netDev, const uint8_t *macAddr) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device *netdev = get_krn_netdev(); + struct station_del_parameters del_param = {macAddr, 10, 0}; + + (void)netDev; + (void)macAddr; + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_cfg80211_ops.del_station(wiphy, netdev, &del_param); + if (retVal < 0) { + HDF_LOGE("%s: del_station failed!", __func__); + } + + return retVal; +} + +int32_t WalSetCountryCode(NetDevice *netDev, const char *code, uint32_t len) +{ + int32_t retVal = 0; + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_cfg80211_set_country_code(netdev, (char*)code, false, true, len); + if (retVal < 0) { + HDF_LOGE("%s: set_country_code failed!", __func__); + } + + return retVal; +} + +int32_t WalGetAssociatedStasCount(NetDevice *netDev, uint32_t *num) +{ + int32_t retVal = 0; + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_get_all_sta(netdev, num); + if (retVal < 0) { + HDF_LOGE("%s: wl_get_all_sta failed!", __func__); + } + return retVal; +} + +int32_t WalGetAssociatedStasInfo(NetDevice *netDev, WifiStaInfo *staInfo, uint32_t num) +{ + int32_t retVal = 0; + struct net_device *netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + retVal = (int32_t)wl_get_all_sta_info(netdev, staInfo->mac, num); + if (retVal < 0) { + HDF_LOGE("%s: wl_get_all_sta_info failed!", __func__); + } + + return retVal; +} +/*--------------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------------------------------*/ +static struct HdfMac80211BaseOps g_baseOps = +{ + .SetMode = WalSetMode, + .AddKey = WalAddKey, + .DelKey = WalDelKey, + .SetDefaultKey = WalSetDefaultKey, + .GetDeviceMacAddr = WalGetDeviceMacAddr, + .SetMacAddr = WalSetMacAddr, + .SetTxPower = WalSetTxPower, + .GetValidFreqsWithBand = WalGetValidFreqsWithBand, + .GetHwCapability = WalGetHwCapability, + .RemainOnChannel = WalRemainOnChannel, + .CancelRemainOnChannel = WalCancelRemainOnChannel, + .ProbeReqReport = WalProbeReqReport, + .AddIf = WalAddIf, + .RemoveIf = WalRemoveIf, + .SetApWpsP2pIe = WalSetApWpsP2pIe, + .GetDriverFlag = WalGetDriverFlag, + .SendAction = WalSendAction, + .GetIftype = WalGetIftype, +}; + +static struct HdfMac80211STAOps g_staOps = +{ + .Connect = WalConnect, + .Disconnect = WalDisconnect, + .StartScan = WalStartScan, + .AbortScan = WalAbortScan, + .SetScanningMacAddress = WalSetScanningMacAddress, +}; + +static struct HdfMac80211APOps g_apOps = +{ + .ConfigAp = WalConfigAp, + .StartAp = WalStartAp, + .StopAp = WalStopAp, + .ConfigBeacon = WalChangeBeacon, + .DelStation = WalDelStation, + .SetCountryCode = WalSetCountryCode, + .GetAssociatedStasCount = WalGetAssociatedStasCount, + .GetAssociatedStasInfo = WalGetAssociatedStasInfo +}; + +void ApMac80211Init(struct HdfChipDriver *chipDriver) +{ + HDF_LOGE("%s: start...", __func__); + + if (chipDriver == NULL) { + HDF_LOGE("%s: input is NULL", __func__); + return; + } + chipDriver->ops = &g_baseOps; + chipDriver->staOps = &g_staOps; + chipDriver->apOps = &g_apOps; +} + +EXPORT_SYMBOL(inform_bss_frame); +EXPORT_SYMBOL(inform_connect_result); \ No newline at end of file diff --git a/amlogic/drivers/wifi/ap6212/hdfadapter/hdfinit_ap6212.c b/amlogic/drivers/wifi/ap6212/hdfadapter/hdfinit_ap6212.c new file mode 100644 index 0000000000000000000000000000000000000000..90bff04a6a9658f87d0fc2666872764fa89804fa --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/hdfadapter/hdfinit_ap6212.c @@ -0,0 +1,117 @@ +#include "hdf_wifi_product.h" +#include "wifi_mac80211_ops.h" +#include "hdf_wlan_utils.h" + +/***********************************************************/ +/* marco declare */ +/***********************************************************/ +#define AP_SUCCESS (0) +#define HDF_LOG_TAG Ap6212Driver + +/***********************************************************/ +/* variable and function declare */ +/***********************************************************/ +struct NetDevice *g_hdf_netdevice; +struct net_device *g_save_kernel_net = NULL; + +/***********************************************************/ +/* variable and function declare */ +/***********************************************************/ +extern struct net_device_ops dhd_ops_pri; +// extern struct net_device *g_save_kernel_net; +extern int get_dhd_priv_data_size(void); +extern int32_t hdf_netdev_init(struct NetDevice *netDev); +extern int32_t hdf_netdev_open(struct NetDevice *netDev); +extern int32_t hdf_netdev_stop(struct NetDevice *netDev); + +/***********************************************************/ +/* Function declare */ +/***********************************************************/ +int32_t InitAp6212Chip(struct HdfWlanDevice *device) +{ + HDF_LOGE("%s: start...", __func__); + return HDF_SUCCESS; +} + +int32_t DeinitAp6212Chip(struct HdfWlanDevice *device) +{ + int32_t ret = 0; + + (void)device; + HDF_LOGE("%s: start...", __func__); + if (ret != 0) + { + HDF_LOGE("%s:Deinit failed!ret=%d", __func__, ret); + } + return ret; +} + +int32_t Ap6212Init(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) +{ + int32_t ret = 0; + int private_data_size = 0; + struct HdfWifiNetDeviceData *data = NULL; + + (void)chipDriver; + HDF_LOGE("%s: start...", __func__); + + if (netDevice == NULL) + { + HDF_LOGE("%s:para is null!", __func__); + return HDF_FAILURE; + } + + data = GetPlatformData(netDevice); + if (data == NULL) + { + HDF_LOGE("%s:netdevice data null!", __func__); + return HDF_FAILURE; + } + + /* set netdevice ops to netDevice */ + hdf_netdev_init(netDevice); + netDevice->classDriverName = netDevice->classDriverName; + netDevice->classDriverPriv = data; + g_hdf_netdevice = netDevice; + + private_data_size = get_dhd_priv_data_size(); + g_hdf_netdevice->mlPriv = kzalloc(private_data_size, GFP_KERNEL); + if (NULL == g_hdf_netdevice->mlPriv) + { + printk("%s:kzalloc mlPriv failed\n", __func__); + return HDF_FAILURE; + } + dhd_module_init(g_save_kernel_net); + NetDeviceAdd(netDevice); + + HDF_LOGE("%s:NetDeviceAdd success", __func__); + + ret = hdf_netdev_open(netDevice); + return HDF_SUCCESS; +} + +int32_t Ap6212Deinit(struct HdfChipDriver *chipDriver, struct NetDevice *netDevice) +{ + HDF_LOGE("%s: start...", __func__); + (void)netDevice; + (void)chipDriver; + hdf_netdev_stop(netDevice); + return HDF_SUCCESS; +} + +void set_krn_netdev(struct net_device *dev) { + g_save_kernel_net = dev; +} + +struct net_device *get_krn_netdev(void) { + return g_save_kernel_net; +} + +void* getDevicePrivateData(void) +{ + return g_hdf_netdevice->mlPriv; +} + +EXPORT_SYMBOL(set_krn_netdev); +EXPORT_SYMBOL(get_krn_netdev); +EXPORT_SYMBOL(getDevicePrivateData); diff --git a/amlogic/drivers/wifi/ap6212/hdfadapter/net_adpater.c b/amlogic/drivers/wifi/ap6212/hdfadapter/net_adpater.c new file mode 100644 index 0000000000000000000000000000000000000000..7dd2a2fe6dc1237e4d826daf83f85c3227c96289 --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/hdfadapter/net_adpater.c @@ -0,0 +1,378 @@ +/* + * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* **************************************************************************** + 1 头文件包含 +**************************************************************************** */ +#include "net_adpater.h" +#include "hdf_base.h" +#include "net_device.h" +#include +#include +#include "eapol.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* **************************************************************************** + 2 全局变量声明 +**************************************************************************** */ +NetDevice *gp_hdf_netdev; +extern struct net_device_ops dhd_ops_pri; +extern struct wiphy* wrap_get_wiphy(void); +extern struct net_device *get_krn_netdev(void); +extern struct NetDeviceInterFace *wal_get_net_dev_ops(void); +extern int dhd_netdev_changemtu_wrapper(struct net_device *netdev, int mtu); +extern struct wireless_dev *wl_cfg80211_add_monitor_if_wrap(struct net_device * netdev, + struct wiphy *wiphy, + const char *name); +/* **************************************************************************** + 2 全局变量定义 +**************************************************************************** */ + +/* **************************************************************************** + 3 函数实现 +**************************************************************************** */ +int32_t hdf_netdev_init(struct NetDevice *netDev) +{ + HDF_LOGE("%s: start...", __func__); + if (NULL == netDev) { + HDF_LOGE("%s: netDev null!", __func__); + return HDF_FAILURE; + } + + HDF_LOGE("%s: netDev->name:%s\n", __func__, netDev->name); + netDev->netDeviceIf = wal_get_net_dev_ops(); + CreateEapolData(netDev); + + return HDF_SUCCESS; +} + +void hdf_netdev_deinit(struct NetDevice *netDev) +{ + HDF_LOGE("%s: start...", __func__); + (void)netDev; +} + +int32_t hdf_netdev_open(struct NetDevice *netDev) +{ + int32_t retVal = 0; + struct wiphy* wiphy = wrap_get_wiphy(); + struct net_device * netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + if (NULL == netdev) { + HDF_LOGE("%s: netDev null!", __func__); + return HDF_FAILURE; + } + + HDF_LOGE("%s: ndo_stop...", __func__); + retVal = (int32_t)dhd_ops_pri.ndo_stop(netdev); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device stop failed! ret = %d", __func__, retVal); + } + + retVal = (int32_t)dhd_ops_pri.ndo_open(netdev); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device open failed! ret = %d", __func__, retVal); + } + + netDev->ieee80211Ptr = netdev->ieee80211_ptr; + if (NULL == netDev->ieee80211Ptr) { + HDF_LOGE("%s: NULL == netDev->ieee80211Ptr", __func__); + } + + dhd_get_mac_address(netdev, netDev->macAddr); + HDF_LOGE("%s: %02x:%02x:%02x:%02x:%02x:%02x", __func__, + netDev->macAddr[0], + netDev->macAddr[1], + netDev->macAddr[2], + netDev->macAddr[3], + netDev->macAddr[4], + netDev->macAddr[5] + ); + + struct wireless_dev *wdev = GET_NET_DEV_CFG80211_WIRELESS(netDev); + gp_hdf_netdev = netDev; + + return retVal; +} + +int32_t hdf_netdev_stop(struct NetDevice *netDev) +{ + int32_t retVal = 0; + struct net_device * netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + if (NULL == netdev) { + HDF_LOGE("%s: netDev null!", __func__); + return HDF_FAILURE; + } + + retVal = (int32_t)dhd_ops_pri.ndo_stop(netdev); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device stop failed! ret = %d", __func__, retVal); + } + + return retVal; +} + +int32_t hdf_netdev_xmit(struct NetDevice *netDev, NetBuf *netBuff) +{ + int32_t retVal = 0; + struct net_device * netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGI("%s: start...", __func__); + + if (NULL == netdev || NULL == netBuff) { + HDF_LOGE("%s: netdev or netBuff null!", __func__); + return HDF_FAILURE; + } + + retVal = (int32_t)dhd_ops_pri.ndo_start_xmit((struct sk_buff *)netBuff, netdev); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device xmit failed! ret = %d", __func__, retVal); + } + + return retVal; +} + +int32_t hdf_netdev_ioctl(struct NetDevice *netDev, IfReq *req, int32_t cmd) +{ + int32_t retVal = 0; + struct ifreq *dhd_req = NULL; + struct net_device * netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + if (NULL == netdev || NULL == req) { + HDF_LOGE("%s: netdev or req null!", __func__); + return HDF_FAILURE; + } + + dhd_req->ifr_ifru.ifru_data = req->ifrData; + + retVal = (int32_t)dhd_ops_pri.ndo_do_ioctl(netdev, dhd_req, cmd); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device ioctl failed! ret = %d", __func__, retVal); + } + + return retVal; +} + +int32_t hdf_netdev_setmacaddr(struct NetDevice *netDev, void *addr) +{ + int32_t retVal = 0; + struct net_device * netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + if (NULL == netdev || NULL == addr) { + HDF_LOGE("%s: netDev or addr null!", __func__); + return HDF_FAILURE; + } + + retVal = (int32_t)dhd_ops_pri.ndo_set_mac_address(netdev, addr); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device setmacaddr failed! ret = %d", __func__, retVal); + } + + return retVal; +} + +struct NetDevStats *hdf_netdev_getstats(struct NetDevice *netDev) +{ + static struct NetDevStats devStat = {0}; + struct net_device_stats * kdevStat = NULL; + struct net_device * netdev = get_krn_netdev(); + + (void)netDev; + HDF_LOGE("%s: start...", __func__); + + if (NULL == netdev) { + HDF_LOGE("%s: netDev null!", __func__); + return NULL; + } + + kdevStat = dhd_ops_pri.ndo_get_stats(netdev); + if (NULL == kdevStat) { + HDF_LOGE("%s: ndo_get_stats return null!", __func__); + return NULL; + } + + devStat.rxPackets = kdevStat->rx_packets; + devStat.txPackets = kdevStat->tx_packets; + devStat.rxBytes = kdevStat->rx_bytes; + devStat.txBytes = kdevStat->tx_bytes; + devStat.rxErrors = kdevStat->rx_errors; + devStat.txErrors = kdevStat->tx_errors; + devStat.rxDropped = kdevStat->rx_dropped; + devStat.txDropped = kdevStat->tx_dropped; + + return &devStat; +} + +void hdf_netdev_setnetifstats(struct NetDevice *netDev, NetIfStatus status) +{ + HDF_LOGE("%s: start...", __func__); + (void)netDev; + (void)status; +} + +uint16_t hdf_netdev_selectqueue(struct NetDevice *netDev, NetBuf *netBuff) +{ + HDF_LOGE("%s: start...", __func__); + (void)netDev; + (void)netBuff; + return HDF_SUCCESS; +} + +uint32_t hdf_netdev_netifnotify(struct NetDevice *netDev, NetDevNotify *notify) +{ + HDF_LOGE("%s: start...", __func__); + (void)netDev; + (void)notify; + return HDF_SUCCESS; +} + +int32_t hdf_netdev_changemtu(struct NetDevice *netDev, int32_t mtu) +{ + int32_t retVal = 0; + struct net_device * netdev = get_krn_netdev(); + HDF_LOGE("%s: start...", __func__); + + (void)netDev; + if (NULL == netdev) { + HDF_LOGE("%s: netdev null!", __func__); + return HDF_FAILURE; + } + HDF_LOGE("%s: change mtu to %d\n", __FUNCTION__, mtu); + + retVal = (int32_t)dhd_netdev_changemtu_wrapper(netdev, mtu); + if (retVal < 0) { + HDF_LOGE("%s: hdf net device chg mtu failed! ret = %d", __func__, retVal); + } + + return retVal; +} + +void hdf_netdev_linkstatuschanged(struct NetDevice *netDev) +{ + HDF_LOGE("%s: start...", __func__); + (void)netDev; +} + +ProcessingResult hdf_netdev_specialethertypeprocess(const struct NetDevice *netDev, NetBuf *buff) +{ + struct EtherHeader *header = NULL; + uint16_t etherType; + const struct Eapol *eapolInstance = NULL; + int ret = HDF_SUCCESS; + uint16_t protocol; + + HDF_LOGE("%s: start...", __func__); + + if (netDev == NULL || buff == NULL) { + return PROCESSING_ERROR; + } + + header = (struct EtherHeader *)NetBufGetAddress(buff, E_DATA_BUF); + + protocol = (buff->data[12] << 8) | buff->data[13]; + if (protocol != ETHER_TYPE_PAE) { + HDF_LOGE("%s: return PROCESSING_CONTINUE", __func__); + return PROCESSING_CONTINUE; + } + if (netDev->specialProcPriv == NULL) { + HDF_LOGE("%s: return PROCESSING_ERROR", __func__); + return PROCESSING_ERROR; + } + + eapolInstance = EapolGetInstance(); + ret = eapolInstance->eapolOp->writeEapolToQueue(netDev, buff); + if (ret != HDF_SUCCESS) { + HDF_LOGE("%s: writeEapolToQueue failed", __func__); + NetBufFree(buff); + } + return PROCESSING_COMPLETE; +} + +/***************************************************************************** + net_device上挂接的net_device_ops函数 +**************************************************************************** */ +struct NetDeviceInterFace g_wal_net_dev_ops = +{ + .init = hdf_netdev_init, + .deInit = hdf_netdev_deinit, + .open = hdf_netdev_open, + .stop = hdf_netdev_stop, + .xmit = hdf_netdev_xmit, + .ioctl = hdf_netdev_ioctl, + .setMacAddr = hdf_netdev_setmacaddr, + .getStats = hdf_netdev_getstats, + .setNetIfStatus = hdf_netdev_setnetifstats, + .selectQueue = hdf_netdev_selectqueue, + .netifNotify = hdf_netdev_netifnotify, + .changeMtu = hdf_netdev_changemtu, + .linkStatusChanged = hdf_netdev_linkstatuschanged, + .specialEtherTypeProcess = hdf_netdev_specialethertypeprocess, +}; + +struct NetDeviceInterFace *wal_get_net_dev_ops(void) +{ + return &g_wal_net_dev_ops; +} + +void wal_netif_rx_ni(struct sk_buff *skb) +{ + NetIfRxNi(gp_hdf_netdev, skb); +} + +void wal_netif_rx(struct sk_buff *skb) +{ + NetIfRx(gp_hdf_netdev, skb); +} + +NetDevice *get_netDev(void) +{ + return gp_hdf_netdev; +} + +EXPORT_SYMBOL(get_netDev); +EXPORT_SYMBOL(wal_netif_rx); +EXPORT_SYMBOL(wal_netif_rx_ni); + +// #ifdef CHG_FOR_HDF +EXPORT_SYMBOL(hdf_netdev_open); +EXPORT_SYMBOL(hdf_netdev_stop); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif diff --git a/amlogic/drivers/wifi/ap6212/hdfadapter/net_adpater.h b/amlogic/drivers/wifi/ap6212/hdfadapter/net_adpater.h new file mode 100644 index 0000000000000000000000000000000000000000..2b732fdded5f0a85a075595073dc2dad058218d1 --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/hdfadapter/net_adpater.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef NET_ADAPTER_H +#define NET_ADAPTER_H + +/* **************************************************************************** + 1 其他头文件包含 +**************************************************************************** */ + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/* **************************************************************************** + 2 宏定义 +**************************************************************************** */ + +/* **************************************************************************** + 3 枚举定义 +**************************************************************************** */ + +/* **************************************************************************** + 7 STRUCT定义 +**************************************************************************** */ + +/* **************************************************************************** + 10 函数声明 +**************************************************************************** */ +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif + +#endif diff --git a/amlogic/drivers/wifi/ap6212/modules.builtin b/amlogic/drivers/wifi/ap6212/modules.builtin new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/amlogic/drivers/wifi/ap6212/modules.order b/amlogic/drivers/wifi/ap6212/modules.order new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/amlogic/drivers/wifi/ap6212/wifi_config.mk b/amlogic/drivers/wifi/ap6212/wifi_config.mk new file mode 100644 index 0000000000000000000000000000000000000000..932be5cf0373c39e1ab7a66150213ad78f1eed27 --- /dev/null +++ b/amlogic/drivers/wifi/ap6212/wifi_config.mk @@ -0,0 +1,55 @@ +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# +# This software is licensed under the terms of the GNU General Public +# License version 2, as published by the Free Software Foundation, and +# may be copied, distributed, and modified under those terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# +WIFI_CONFIG_PATH := $(shell pwd) +$(warning WIFI_CONFIG_PATH=$(WIFI_CONFIG_PATH)) + +HDF_FRAMEWORKS_INC := \ + -I./ \ + -Idrivers/hdf/framework/ability/sbuf/include \ + -Idrivers/hdf/framework/core/common/include/host \ + -Idrivers/hdf/framework/core/host/include \ + -Idrivers/hdf/framework/core/manager/include \ + -Idrivers/hdf/framework/core/shared/include \ + -Idrivers/hdf/framework/include \ + -Idrivers/hdf/framework/include/config \ + -Idrivers/hdf/framework/include/core \ + -Idrivers/hdf/framework/include/platform \ + -Idrivers/hdf/framework/include/utils \ + -Idrivers/hdf/framework/support/platform/include \ + -Idrivers/hdf/framework/support/platform/include/platform \ + -Idrivers/hdf/framework/utils/include \ + -Idrivers/hdf/khdf/osal/include \ + -Idrivers/hdf/khdf/config/include \ + -Iinclude/hdf \ + -Iinclude/hdf/osal \ + -Iinclude/hdf/utils \ + -Idrivers/hdf/framework/include/ethernet\ + -Idrivers/hdf/framework/include/net\ + -Idrivers/hdf/framework/model/network/common/netdevice\ + -Idrivers/hdf/framework/include/wifi\ + -Idrivers/hdf/framework/model/network/wifi/platform/include \ + -Idrivers/hdf/framework/model/network/wifi/core/components/eapol + + + +HDF_WIFI_FRAMEWORKS_INC := \ + -Idrivers/hdf/framework/model/network/ethernet/include \ + -Idrivers/hdf/framework/model/network/wifi/include + +SECURE_LIB_INC := \ + -I./../../../../../third_party/bounds_checking_function/include + +HDF_WIFI_ADAPTER_INC := \ + -I./../../../../../device/amlogic/drivers/wifi/adapter \ + -Idrivers/hdf/khdf/network/include \ No newline at end of file diff --git a/amlogic/vim3l/BUILD.gn b/amlogic/vim3l/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..458341c4bfe62d045f0b93632970350a64fb4bae --- /dev/null +++ b/amlogic/vim3l/BUILD.gn @@ -0,0 +1,12 @@ +# Copyright (C) 2021 Hisilicon (Shanghai) Technologies Co., Ltd. All rights reserved. + +import("//build/ohos.gni") + +print("vim3l_group in") +group("vim3l_group") { + deps = [ + "build:rc_files", + "build/rootfs:init_configs", + "//kernel/linux/build:linux_kernel", + ] +} diff --git a/amlogic/vim3l/bootloader/u-boot.bin b/amlogic/vim3l/bootloader/u-boot.bin new file mode 100644 index 0000000000000000000000000000000000000000..f131dfd1147d0baecc768bf1664ea05f02e29ca4 --- /dev/null +++ b/amlogic/vim3l/bootloader/u-boot.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:813fa3d641cb81736316a6e2934943b0a8e3678d4252b4b10af660c52d607c29 +size 802816 diff --git a/amlogic/vim3l/bootloader/u-boot.deb b/amlogic/vim3l/bootloader/u-boot.deb new file mode 100644 index 0000000000000000000000000000000000000000..07ef49b4d218c38529f2329c6f8218774b982f3c Binary files /dev/null and b/amlogic/vim3l/bootloader/u-boot.deb differ diff --git a/amlogic/vim3l/build/BUILD.gn b/amlogic/vim3l/build/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8bce9fdd25e5cf4c65211f9595d06c9495231793 --- /dev/null +++ b/amlogic/vim3l/build/BUILD.gn @@ -0,0 +1,106 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +ohos_prebuilt_etc("init.vim3l.rc") { + source = "rootfs/init.vim3l.rc" + module_install_dir = "etc/init" + install_images = [ "vendor" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("init.vim3l.usb.rc") { + source = "rootfs/init.vim3l.usb.rc" + module_install_dir = "etc/init" + install_images = [ "vendor" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("ueventd.rc") { + source = "rootfs/ueventd.rc" + install_images = [ "vendor" ] + module_install_dir = "./" + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("fstab.vim3l") { + source = "vendor/etc/fstab.vim3l" + module_install_dir = "etc" + install_images = [ "vendor" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("vb_config_user.ini") { + source = "vendor/etc/vb_config_user.ini" + module_install_dir = "./" + install_images = [ "vendor" ] + part_name = "amlogic_products" +} + +ohos_copy("u-boot.deb") { + sources = [ "//device/amlogic/vim3l/bootloader/u-boot.deb" ] + outputs = + [ "$root_build_dir/packages/phone/images/u-boot.deb" ] +} + +ohos_prebuilt_etc("firmware_apsta_bin") { + source = "//device/amlogic/vim3l/firmware/fw_bcm4359c0_ag_apsta.bin" + module_install_dir = "./etc/wifi" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("firmware_p2p_bin") { + source = "//device/amlogic/vim3l/firmware/fw_bcm4359c0_ag_p2p.bin" + module_install_dir = "./etc/wifi" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("firmware_bin") { + source = "//device/amlogic/vim3l/firmware/fw_bcm4359c0_ag.bin" + module_install_dir = "./etc/wifi" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("firmware_s_nvram") { + source = "//device/amlogic/vim3l/firmware/nvram_ap6398s.txt" + module_install_dir = "./etc/wifi" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("firmware_sa_nvram") { + source = "//device/amlogic/vim3l/firmware/nvram_ap6398sa.txt" + module_install_dir = "./etc/wifi" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +group("rc_files") { + deps = [ + ":u-boot.deb", + ":firmware_apsta_bin", + ":firmware_p2p_bin", + ":firmware_bin", + ":firmware_s_nvram", + ":firmware_sa_nvram", + ":fstab.vim3l", + ":init.vim3l.rc", + ":init.vim3l.usb.rc", + ":ueventd.rc", + ":vb_config_user.ini", + ] +} diff --git a/amlogic/vim3l/build/LICENSE b/amlogic/vim3l/build/LICENSE new file mode 100755 index 0000000000000000000000000000000000000000..4947287f7b5ccb5d1e8b7b2d3aa5d89f322c160d --- /dev/null +++ b/amlogic/vim3l/build/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/amlogic/vim3l/build/rootfs/BUILD.gn b/amlogic/vim3l/build/rootfs/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..93950dbcb7075002ae611e061ae797a71adb2a80 --- /dev/null +++ b/amlogic/vim3l/build/rootfs/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/ohos.gni") + +ohos_prebuilt_etc("init.vim3l.cfg") { + source = "init.vim3l.cfg" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("init.vim3l.usb.cfg") { + source = "init.vim3l.usb.cfg" + install_images = [ "system" ] + part_name = "amlogic_products" +} + +ohos_prebuilt_etc("init.vim3l.updater.cfg") { + source = "init.vim3l.updater.cfg" + install_images = [ "updater" ] + part_name = "amlogic_products" +} + +group("init_configs") { + deps = [ + ":init.vim3l.cfg", + ":init.vim3l.updater.cfg", + ":init.vim3l.usb.cfg", + ] +} diff --git a/amlogic/vim3l/build/rootfs/init.vim3l.cfg b/amlogic/vim3l/build/rootfs/init.vim3l.cfg new file mode 100755 index 0000000000000000000000000000000000000000..e28c3e33edde81ae292403970f98b431516e9398 --- /dev/null +++ b/amlogic/vim3l/build/rootfs/init.vim3l.cfg @@ -0,0 +1,51 @@ +{ + "import" : [ + "init.${ro.hardware}.usb.cfg" + ], + "jobs" : [{ + "name" : "pre-init", + "cmds" : [ + "write /proc/sys/vm/min_free_kbytes 10240" + ] + }, { + "name" : "init", + "cmds" : [ + "mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755", + "write /sys/kernel/debug/hisi_inno_phy/role peripheral" + ] + }, { + "name" : "fs", + "cmds" : [ + "insmod /vendor/modules/hi_securec.ko", + "insmod /vendor/modules/hi_osal.ko anony=1 mmz_allocator=hisi mmz=anonymous,0,0xA8000000,384M || report_error", + "insmod /vendor/modules/hi_irq.ko", + "insmod /vendor/modules/hi_proc.ko", + "insmod /vendor/modules/sys_config.ko chip=hi3516dv300 sensors=sns0=imx335,sns1=NULL,g_cmos_yuv_flag=0", + "insmod /vendor/modules/hi3516cv500_base.ko", + "insmod /vendor/modules/hi3516cv500_sys.ko", + "insmod /vendor/modules/hi3516cv500_tde.ko", + "insmod /vendor/modules/hi3516cv500_vo_dev.ko", + "insmod /vendor/modules/hifb.ko video=\"hifb:vram0_size:16200\"", + "insmod /vendor/modules/hi3516cv500_hdmi.ko", + "insmod /vendor/modules/hi_mipi_rx.ko" + ] + }, { + "name" : "boot", + "cmds" : [ + "chmod 777 /dev/ttyAMA2", + "chmod 775 /sys/class/rfkill/rfkill0/state", + "chmod 777 /dev/rtkbt_dev", + "chmod 0440 /proc/interrupts", + "chmod 0440 /proc/stat", + "chmod 0640 /dev/xt_qtaguid", + "chmod 0660 /proc/net/xt_qtaguid/ctrl", + "chmod 0440 /proc/net/xt_qtaguid/stats", + "chmod 666 /dev/mali0", + "chown system graphics /dev/mali0", + "chown system graphics /dev/graphics/fb0", + "chmod 666 /dev/ion", + "chown system system /dev/ion" + ] + } + ] +} diff --git a/amlogic/vim3l/build/rootfs/init.vim3l.rc b/amlogic/vim3l/build/rootfs/init.vim3l.rc new file mode 100755 index 0000000000000000000000000000000000000000..6833220354ba9f9a80ad582e7cbdca06daf22e68 --- /dev/null +++ b/amlogic/vim3l/build/rootfs/init.vim3l.rc @@ -0,0 +1,80 @@ +import init.${ro.hardware}.usb.rc + +on early-init +# copy from goldfish + write /proc/sys/vm/min_free_kbytes 10240 + +on init + # mount debugfs + mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755 + + # switch USB to peripheral + write /sys/kernel/debug/hisi_inno_phy/role "peripheral" + +on fs + #mount_all /vendor/etc/fstab.Hi3559A + mount_all /vendor/etc/fstab.Hi3516DV300 + swapon_all /vendor/etc/fstab.Hi3516DV300 + + # hos partition + #chown root root /hos + #chmod 777 /hos + #restorecon_recursive /hos + + # insmod hisi ko + insmod /vendor/modules/hi_securec.ko + insmod /vendor/modules/hi_osal.ko anony=1 mmz_allocator=hisi mmz=anonymous,0,0xA8000000,384M || report_error + insmod /vendor/modules/hi_irq.ko + insmod /vendor/modules/hi_proc.ko + + insmod /vendor/modules/sys_config.ko chip=hi3516dv300 sensors=sns0=imx335,sns1=NULL,g_cmos_yuv_flag=0 + insmod /vendor/modules/hi3516cv500_base.ko + insmod /vendor/modules/hi3516cv500_sys.ko + insmod /vendor/modules/hi3516cv500_tde.ko + insmod /vendor/modules/hi3516cv500_vo_dev.ko + insmod /vendor/modules/hifb.ko video="hifb:vram0_size:16200" + + insmod /vendor/modules/hi3516cv500_hdmi.ko + insmod /vendor/modules/hi_mipi_rx.ko + insmod /vendor/modules/hi3516cv500_drm.ko + +on boot + chmod 777 /dev/ttyAMA2 + chmod 775 /sys/class/rfkill/rfkill0/state + chmod 777 /dev/rtkbt_dev + + chmod 0440 /proc/interrupts + chmod 0440 /proc/stat + + chmod 0640 /dev/xt_qtaguid + chmod 0660 /proc/net/xt_qtaguid/ctrl + chmod 0440 /proc/net/xt_qtaguid/stats + chmod 666 /dev/mali0 + chown system graphics /dev/mali0 + chown system graphics /dev/graphics/fb0 + chmod 666 /dev/ion + chown system system /dev/ion + # FIXME temp modify for nonencrypted + class_start main + class_start late_start + + +# zygote need to be started after otapreopt which will be done on post-fs-data +on zygote-start + # zygote is started in common init.rc + # and now we can continue initialize /data/ + + # Create the directories used by the Wireless subsystem + mkdir /data/vendor/wifi 0771 wifi wifi + mkdir /data/vendor/wifi/wpa 0770 wifi wifi + mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi + +#on property:sys.boot_completed=1 && property:sys.logbootcomplete=1 +# chmod 0666 /dev/hal_ion_vb_server + + +#service hi_server_msghdr /vendor/bin/server_msghdr +# class main +# user root +# group root system audio graphics +# oneshot diff --git a/amlogic/vim3l/build/rootfs/init.vim3l.updater.cfg b/amlogic/vim3l/build/rootfs/init.vim3l.updater.cfg new file mode 100755 index 0000000000000000000000000000000000000000..8145a6a8f6dc4c97f52d9cc99e2b515cf5ccd18b --- /dev/null +++ b/amlogic/vim3l/build/rootfs/init.vim3l.updater.cfg @@ -0,0 +1,16 @@ +{ + "jobs" : [ + { + "name" : "init", + "cmds" : [ + "insmod /modules/hi_osal.ko anony=1 mmz_allocator=hisi mmz=anonymous,0,0xA8000000,384M", + "insmod /modules/sys_config.ko chip=hi3516dv300 sensors=sns0=imx335,sns1=NULL,g_cmos_yuv_flag=0", + "insmod /modules/hi3516cv500_base.ko", + "insmod /modules/hi3516cv500_sys.ko", + "insmod /modules/hi3516cv500_vo_dev.ko", + "insmod /modules/hifb.ko video=\"hifb:vram0_size:16200\"", + "insmod /modules/hi3516cv500_hdmi.ko" + ] + } + ] +} diff --git a/amlogic/vim3l/build/rootfs/init.vim3l.usb.cfg b/amlogic/vim3l/build/rootfs/init.vim3l.usb.cfg new file mode 100755 index 0000000000000000000000000000000000000000..a6df3255922ab5f311ccb1ea1b861fdfe82e596d --- /dev/null +++ b/amlogic/vim3l/build/rootfs/init.vim3l.usb.cfg @@ -0,0 +1,51 @@ +{ + "jobs" : [{ + "name" : "boot", + "cmds" : [ + "mkdir /dev/usb-ffs 0770 shell shell", + "mkdir /dev/usb-ffs/hdc 0770 shell shell", + "mount configfs none /config", + "mkdir /config/usb_gadget/g1 0770 shell shell", + "write /config/usb_gadget/g1/idVendor 0x12D1", + "write /config/usb_gadget/g1/idProduct 0x5000", + "write /config/usb_gadget/g1/os_desc/use 1", + "write /config/usb_gadget/g1/bcdDevice 0x0223", + "write /config/usb_gadget/g1/bcdUSB 0x0200", + "mkdir /config/usb_gadget/g1/strings/0x409 0770", + "copy /sys/block/mmcblk0/device/cid /config/usb_gadget/g1/strings/0x409/serialnumber", + "write /config/usb_gadget/g1/strings/0x409/manufacturer HISILICON", + "write /config/usb_gadget/g1/strings/0x409/product \"HDC Device\"", + "mkdir /config/usb_gadget/g1/functions/ffs.hdc", + "mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell", + "mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell", + "write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1", + "write /config/usb_gadget/g1/os_desc/qw_sign MSFT100", + "write /config/usb_gadget/g1/configs/b.1/MaxPower 500", + "symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1", + "mount functionfs hdc /dev/usb-ffs/hdc uid=2000,gid=2000", + "setparam sys.usb.configfs 1", + "setparam sys.usb.controller 100e0000.hidwc3_0" + ] + }, { + "name" : "param:sys.usb.config=none && param:sys.usb.configfs=1", + "condition" : "sys.usb.config=none && sys.usb.configfs=1", + "cmds" : [ + "write /config/usb_gadget/g1/os_desc/use 0", + "setparam sys.usb.ffs.ready 0" + ] + }, { + "name" : "param:init.svc.hdcd=stopped", + "condition" : "init.svc.hdcd=stopped", + "cmds" : [ + "setparam sys.usb.ffs.ready 0" + ] + }, { + "name" : "param:sys.usb.config=hdc && param:sys.usb.configfs=1", + "condition" : "sys.usb.config=hdc && sys.usb.configfs=1", + "cmds" : [ + "write /config/usb_gadget/g1/idProduct 0x5000", + "write /config/usb_gadget/g1/os_desc/use 1" + ] + } + ] +} diff --git a/amlogic/vim3l/build/rootfs/init.vim3l.usb.rc b/amlogic/vim3l/build/rootfs/init.vim3l.usb.rc new file mode 100644 index 0000000000000000000000000000000000000000..cf0868bda5b210240da6388f28bef351d186ebe9 --- /dev/null +++ b/amlogic/vim3l/build/rootfs/init.vim3l.usb.rc @@ -0,0 +1,35 @@ +on boot + mkdir /dev/usb-ffs 0770 shell shell + mkdir /dev/usb-ffs/hdc 0770 shell shell + mount configfs none /config + mkdir /config/usb_gadget/g1 0770 shell shell + write /config/usb_gadget/g1/idVendor 0x12D1 + write /config/usb_gadget/g1/idProduct 0x5000 + write /config/usb_gadget/g1/os_desc/use 1 + write /config/usb_gadget/g1/bcdDevice 0x0223 + write /config/usb_gadget/g1/bcdUSB 0x0200 + mkdir /config/usb_gadget/g1/strings/0x409 0770 + copy /sys/block/mmcblk0/device/cid /config/usb_gadget/g1/strings/0x409/serialnumber + write /config/usb_gadget/g1/strings/0x409/manufacturer "HISILICON" + write /config/usb_gadget/g1/strings/0x409/product "HDC Device" + mkdir /config/usb_gadget/g1/functions/ffs.hdc + mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell + mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell + write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1 + write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100" + write /config/usb_gadget/g1/configs/b.1/MaxPower 500 + symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1 + mount functionfs hdc /dev/usb-ffs/hdc uid=2000,gid=2000 + setprop sys.usb.configfs 1 + setprop sys.usb.controller "100e0000.hidwc3_0" + +on property:sys.usb.config=none && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/os_desc/use 0 + setprop sys.usb.ffs.ready 0 + +on property:init.svc.hdcd=stopped + setprop sys.usb.ffs.ready 0 + +on property:sys.usb.config=hdc,adb && property:sys.usb.configfs=1 + write /config/usb_gadget/g1/idProduct 0x5000 + write /config/usb_gadget/g1/os_desc/use 1 diff --git a/amlogic/vim3l/build/rootfs/ueventd.rc b/amlogic/vim3l/build/rootfs/ueventd.rc new file mode 100755 index 0000000000000000000000000000000000000000..127d7a70af2097ed5ed2d5fb8b801f098d81fbff --- /dev/null +++ b/amlogic/vim3l/build/rootfs/ueventd.rc @@ -0,0 +1,49 @@ +subsystem functionfs + devname uevent_devpath + dirname /dev/functionfs + +/dev/jpeg 0666 system graphics +/dev/vinput 0660 system input +/dev/mmz_userdev 0644 system audio +/dev/graphics/fb* 0660 system graphics +/dev/functionfs/f_g* 0660 system functionfs +/dev/mem 0660 system audio +/dev/video* 0660 system camera +/dev/ion 0666 system system +/dev/mali* 0666 system graphics +#for Bluetooth USB driver +/dev/btusb0 0660 bluetooth bluetooth +/dev/uhid 0660 bluetooth bluetooth +/dev/bt_usb* 0660 bluetooth bluetooth +/dev/tc_ns_client 0660 system audio +/dev/rtk_btusb 0660 bluetooth net_bt_stack +/dev/sil9293 0660 system audio +/dev/stpbt 0660 bluetooth radio +#for hisilicon dev +/dev/avs 0660 system audio +/dev/gdc 0660 system audio +/dev/hdmi 0660 system audio +/dev/hi_mipi 0660 system audio +/dev/hi_mipi_tx 0660 system audio +/dev/hi_tde 0644 system graphics +/dev/isp_dev 0660 system camera +/dev/match 0660 system audio +/dev/photo 0660 system audio +/dev/rect 0660 system audio +/dev/rgn 0660 system audio +/dev/sys 0660 system audio +/dev/vb 0666 system audio +/dev/vdec 0666 system audio +/dev/venc 0666 system audio +/dev/vi 0660 system audio +/dev/vo 0660 system audio +/dev/vpss 0660 system audio +/dev/i2c-0 0660 system camera +/dev/i2c-1 0660 system camera +/dev/i2c-2 0660 system camera +/dev/i2c-3 0660 system camera +/dev/i2c-4 0660 system camera +/dev/i2c-5 0660 system camera +/dev/i2c-6 0660 system camera +/dev/i2c-7 0660 system camera +/dev/vgs 0666 system audio diff --git a/amlogic/vim3l/build/rootfs/ueventd.vim3l.rc b/amlogic/vim3l/build/rootfs/ueventd.vim3l.rc new file mode 100755 index 0000000000000000000000000000000000000000..acf35f1403ac0c1cc66e308ffbcfb6bcdc943fcc --- /dev/null +++ b/amlogic/vim3l/build/rootfs/ueventd.vim3l.rc @@ -0,0 +1,44 @@ +/dev/jpeg 0666 system graphics +/dev/vinput 0660 system input +/dev/mmz_userdev 0644 system audio +/dev/graphics/fb* 0660 system graphics +/dev/mem 0660 system audio +/dev/video* 0660 system camera +/dev/ion 0666 system system +/dev/mali* 0666 system graphics +#for Bluetooth USB driver +/dev/btusb0 0660 bluetooth bluetooth +/dev/uhid 0660 bluetooth bluetooth +/dev/bt_usb* 0660 bluetooth bluetooth +/dev/tc_ns_client 0660 system audio +/dev/rtk_btusb 0660 bluetooth net_bt_stack +/dev/sil9293 0660 system audio +/dev/stpbt 0660 bluetooth radio +#for hisilicon dev +/dev/avs 0660 system audio +/dev/gdc 0660 system audio +/dev/hdmi 0660 system audio +/dev/hi_mipi 0660 system audio +/dev/hi_mipi_tx 0660 system audio +/dev/hi_tde 0644 system graphics +/dev/isp_dev 0660 system camera +/dev/match 0660 system audio +/dev/photo 0660 system audio +/dev/rect 0660 system audio +/dev/rgn 0660 system audio +/dev/sys 0660 system audio +/dev/vb 0666 system audio +/dev/vdec 0666 system audio +/dev/venc 0666 system audio +/dev/vi 0660 system audio +/dev/vo 0660 system audio +/dev/vpss 0660 system audio +/dev/i2c-0 0660 system camera +/dev/i2c-1 0660 system camera +/dev/i2c-2 0660 system camera +/dev/i2c-3 0660 system camera +/dev/i2c-4 0660 system camera +/dev/i2c-5 0660 system camera +/dev/i2c-6 0660 system camera +/dev/i2c-7 0660 system camera +/dev/vgs 0666 system audio diff --git a/amlogic/vim3l/build/sepolicy/file.te b/amlogic/vim3l/build/sepolicy/file.te new file mode 100755 index 0000000000000000000000000000000000000000..35f787db46306812b83a3fe924097f5727642723 --- /dev/null +++ b/amlogic/vim3l/build/sepolicy/file.te @@ -0,0 +1 @@ +type hos_file, file_type; diff --git a/amlogic/vim3l/build/sepolicy/file_contexts b/amlogic/vim3l/build/sepolicy/file_contexts new file mode 100755 index 0000000000000000000000000000000000000000..64ba5e18d3f1edce39139d545f7bb6d8eceb4e94 --- /dev/null +++ b/amlogic/vim3l/build/sepolicy/file_contexts @@ -0,0 +1,2 @@ + +/hos(/.*)? u:object_r:hos_file:s0 diff --git a/amlogic/vim3l/build/sepolicy/hos.te b/amlogic/vim3l/build/sepolicy/hos.te new file mode 100755 index 0000000000000000000000000000000000000000..f6eb0bcc0801bde6e4090caac21799a6879b2f79 --- /dev/null +++ b/amlogic/vim3l/build/sepolicy/hos.te @@ -0,0 +1 @@ +allow rootfs labeledfs:filesystem { associate }; diff --git a/amlogic/vim3l/build/updater_config/BOARD.list b/amlogic/vim3l/build/updater_config/BOARD.list new file mode 100755 index 0000000000000000000000000000000000000000..7d680abc7158072d8fcbd9a25390d6c1691f8539 --- /dev/null +++ b/amlogic/vim3l/build/updater_config/BOARD.list @@ -0,0 +1,3 @@ +HI3516 +HI3518 +HI3559 \ No newline at end of file diff --git a/amlogic/vim3l/build/updater_config/VERSION.mbn b/amlogic/vim3l/build/updater_config/VERSION.mbn new file mode 100755 index 0000000000000000000000000000000000000000..edb5612cd718e14fb8ca09a0e2c5b79b1f35a05b --- /dev/null +++ b/amlogic/vim3l/build/updater_config/VERSION.mbn @@ -0,0 +1 @@ +Hi3516DV300-eng 10 QP1A.190711.020 diff --git a/amlogic/vim3l/build/updater_config/rsa_private_key2048.pem b/amlogic/vim3l/build/updater_config/rsa_private_key2048.pem new file mode 100755 index 0000000000000000000000000000000000000000..b44ddc3754ce095dc508675d91b65d5d08d47b28 --- /dev/null +++ b/amlogic/vim3l/build/updater_config/rsa_private_key2048.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEA49SUn9WClk/whGbVLVc8ol4FiSt/jw5EZ8T9PVFiYirAf4Cm +R0/bBZhlGiHtfFSOeHwednGhdbDVPb9dZl/a9SwhuCPhhQVICne8RvqzgJFsgpO5 +CBxW1xspM/HDuz9c5gOLnu1+df3EASsv56xh6hH1LOe5QkGEA5QPZ9WoRlOJaP5T +ndZ+BEih4IPgQswRlCRFpx/Idiv8gi4bg9ZxmJ8CVMusSPHGm64dvlkn+LSZ9KMh +vhWFSZAFtcHK9hz55wQwMrhN+LCjVZA+MPUvaU1L+cT0ZDh+qxH0MQuL1wbgkd1b +HfYCUu+8D2q0PLfk4d6ncZRvjiChalX5g2mVLQIDAQABAoIBACIhhKp1N/0AuM19 +Ak6qlQDWCQpFo/RwdLr+/dkjyhNeyDvRsBda1Tr/W5YQox1PJZDTN1UTLNcOyMNZ +WcqubYTxOZP2fCCLbAF1cpVHlYCbSKA/NScL586N2RxZCbORiH9E5LPIbHuMqsJq +D+ErJ/gC/LHffRd57ScEFVK+5VizfrCddBsPbbF2aCoQZyiDX4DBIQ+kMUgNChN7 +I7J5yA8DrTjzEATArOlnKUvnlVx/jKT3ncCYQujxwQlzJWDbaSgon5ZhjBazSUiC +eHPbE+bCvcD90pWddUByeS885eMDIOhErJFS+lYYdI+bT3T5rILzK8wR2CupMhkX +a9RYuZkCgYEA9lGoxWyWIFK3ymeT6DOhqK6Cr7MJiYgAvgk+fA3dDVsGuEM6Xy/O +wwt915cZvKzcb018AmeSVwYvy7l3EuYDKXP/YzntV7OLuH9Fu3zuoZ4U3VOHtKLD +VOHeWO/dg/BB96mP2xxltwv64ZT3gPf9MIpDmgVnL4QREUG4K6T/XEsCgYEA7Mjl +8AK/Hu9cIPAwB0NNCU3ptnlznu42c+lj1SHfCtYV9me14nVEIynevyniZ3y8jMi6 +5Ozo/Rt26W+WuxZj6vPH2FBtB3kMgxDPDGunphl6wKJ+3RqvBrErAu9AW6e/H5NP +gxU8V8PVO+Qo3CwIhjnjkobi7nBXe6gU1iqkeWcCgYAubqJD5P4/xZgDvZayFNmK +dKsJ99P6avrI1/FBbVOYKuqPXYzpWJe/SLFGLKObX3KGQLL5uRBq+y2TV7jMhTNf +YxBnYgoNmDjkZIl+mERbjvMb7Z0NPglYPOOvHDhDoMyupPYLNcUuxkFauLwXQagm +uEmaBR64ZErbV+ohwA6rFQKBgQC9P6RnvAo9E1ozCUWZyHSd5yPQsCl08TecVQFx +q2y1IH7VPfblVIxs/l4Fs9g8ljms3BJkPeXJxlW4JXP3e+HIO6eSgFVkD5+scZbK +epC39M1jgXycA2O4mYmjAs4Rc3USK471Wdes3dxjzevKbXcysLnutthRcoC5WJGu +ys5CKQKBgQDpYc/LxUR4K5k55kQyPofkyIlVK/De3VwsD7eCeRDb1jfcF52Xuuxg +Pm6RlIvVRy7RsrG7kKqWCiVAFauQQswW6DDBbjmrFd6CrruEAqwwgbCHZjE5Dy+0 +ZKsKfkm/bymEiq7ATwzvWfuU3T3R0O9+S1RbTNYo+D3N2soTfPnXyw== +-----END RSA PRIVATE KEY----- diff --git a/amlogic/vim3l/build/updater_config/signing_cert.crt b/amlogic/vim3l/build/updater_config/signing_cert.crt new file mode 100755 index 0000000000000000000000000000000000000000..eca5d72cea8e87bc4b41f4e85570e32fbc23f69e --- /dev/null +++ b/amlogic/vim3l/build/updater_config/signing_cert.crt @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDazCCAlOgAwIBAgIUDbbfN0ry6xlKrFyylM9asKzjANYwDQYJKoZIhvcNAQEL +BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMTAyMjUxMjA2MTNaFw0yMjAy +MjUxMjA2MTNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw +HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDj1JSf1YKWT/CEZtUtVzyiXgWJK3+PDkRnxP09UWJi +KsB/gKZHT9sFmGUaIe18VI54fB52caF1sNU9v11mX9r1LCG4I+GFBUgKd7xG+rOA +kWyCk7kIHFbXGykz8cO7P1zmA4ue7X51/cQBKy/nrGHqEfUs57lCQYQDlA9n1ahG +U4lo/lOd1n4ESKHgg+BCzBGUJEWnH8h2K/yCLhuD1nGYnwJUy6xI8cabrh2+WSf4 +tJn0oyG+FYVJkAW1wcr2HPnnBDAyuE34sKNVkD4w9S9pTUv5xPRkOH6rEfQxC4vX +BuCR3Vsd9gJS77wParQ8t+Th3qdxlG+OIKFqVfmDaZUtAgMBAAGjUzBRMB0GA1Ud +DgQWBBQR55YSUMEzkyqHQKGQ51bBcqbvazAfBgNVHSMEGDAWgBQR55YSUMEzkyqH +QKGQ51bBcqbvazAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBy +30XquNfGVCOlXBaJJ/gyl5TP0nFZ9iQ9P0Tk6Ya6tN+Nh4lqA4uG1rUqPrQCd0+N +DUnJlwdto8E2fznfJQ0ojkQdlPv3zkqW25QSYTb9wegQ6CnWq2ANnvoXPcSebHXE +yXcEXybgaWkBg3h8VHcwVns5psXSDsprisFGyETBwMIqM15Z81bEpejKz2viW5ow ++c3ToGs8VhymfG3Pbls3nFeFYSD/A4sOOzM+O/ioG4YI6cGfSBztrAShtdvadHL6 +Cbp6X36ZSveGOkfS/Yrq4z/yE2V0kCJXBMo+9SrhxUrwACjMDIdE5YLlw9qpkLQV +t5MJhDWJe6tCRSBSmoA4 +-----END CERTIFICATE----- diff --git a/amlogic/vim3l/build/vendor/etc/fstab.updater b/amlogic/vim3l/build/vendor/etc/fstab.updater new file mode 100755 index 0000000000000000000000000000000000000000..24386a19fb2953b3c27c2077d5dcee7c49f92374 --- /dev/null +++ b/amlogic/vim3l/build/vendor/etc/fstab.updater @@ -0,0 +1,6 @@ +# +/dev/block/platform/soc/10100000.himci.eMMC/by-name/system /system ext4 ro,barrier=1 wait +/dev/block/platform/soc/10100000.himci.eMMC/by-name/vendor /vendor ext4 ro,barrier=1 wait +/dev/block/platform/soc/10100000.himci.eMMC/by-name/userdata /data ext4 nosuid,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc wait,reservedsize=104857600 +/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc /misc none none wait +/dev/block/platform/soc/100f0000.himci.SD/mmcblk1p1 /sdcard ext4 rw wait diff --git a/amlogic/vim3l/build/vendor/etc/fstab.vim3l b/amlogic/vim3l/build/vendor/etc/fstab.vim3l new file mode 100755 index 0000000000000000000000000000000000000000..e3bcf06b6815be80fab3a4ccb6d71f568529e76b --- /dev/null +++ b/amlogic/vim3l/build/vendor/etc/fstab.vim3l @@ -0,0 +1,3 @@ +# fstab file. +# +/dev/block/platform/soc/10100000.himci.eMMC/by-name/userdata /data ext4 nosuid,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc wait,reservedsize=104857600 diff --git a/amlogic/vim3l/build/vendor/etc/vb_config_user.ini b/amlogic/vim3l/build/vendor/etc/vb_config_user.ini new file mode 100755 index 0000000000000000000000000000000000000000..0d3fce92bbcfdf52aac912ff7f2ab54ce0800978 --- /dev/null +++ b/amlogic/vim3l/build/vendor/etc/vb_config_user.ini @@ -0,0 +1,24 @@ +<-Creator/HeapName : String Name, max length 64 chars + +<-PixelWidth/PixelHigh/BlockNum : DEC numbers chars,BlockNum >= 1, Pixelformate : 90P~2160P,width:high=16:9 + +<-PixelFormate : [YVU_SEMIPLANAR_420] [YVU_SEMIPLANAR_422] [RGB_BAYER_16BPP] + +<-BitWidth : [DATA_BITWIDTH_8] [DATA_BITWIDTH_10] + +<-CompressMode : [COMPRESS_MODE_NONE] [COMPRESS_MODE_SEG] + +<-MapType : [NONE] [NOCACHE] [CACHE] + +<-!!!Note : This config file max file size < 10K bytes, Line < 256 bytes word < 64 bytes + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +Creator PixelWidth PixelHigh PixelFormate BitWidth CompressMode MapType BlockNum HeapName +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +Public 3840 2160 YVU_SEMIPLANAR_420 DATA_BITWIDTH_10 COMPRESS_MODE_SEG NONE 10 HeapVI +Public 3840 2160 RGB_BAYER_16BPP DATA_BITWIDTH_8 COMPRESS_MODE_NONE NONE 4 HeapCamera +OMX_VCODEC 320 180 YVU_SEMIPLANAR_420 DATA_BITWIDTH_8 COMPRESS_MODE_NONE NONE 190 omx +OMX_VCODEC 640 360 YVU_SEMIPLANAR_420 DATA_BITWIDTH_8 COMPRESS_MODE_NONE NONE 110 omx +OMX_VCODEC 1280 720 YVU_SEMIPLANAR_420 DATA_BITWIDTH_8 COMPRESS_MODE_NONE NONE 16 omx +OMX_VCODEC 1920 1080 YVU_SEMIPLANAR_420 DATA_BITWIDTH_8 COMPRESS_MODE_NONE NONE 14 omx +OMX_VCODEC 4096 2304 YVU_SEMIPLANAR_420 DATA_BITWIDTH_8 COMPRESS_MODE_NONE NONE 19 omx \ No newline at end of file diff --git a/amlogic/vim3l/firmware/fw_bcm4359c0_ag.bin b/amlogic/vim3l/firmware/fw_bcm4359c0_ag.bin new file mode 100644 index 0000000000000000000000000000000000000000..192a44fb7435ad6c891c1ea1bea7d8f9b0eba12b --- /dev/null +++ b/amlogic/vim3l/firmware/fw_bcm4359c0_ag.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4fea16916528ac0337e969a73267f1bf49c13d35d4d3cf5b038065a19c6d186 +size 637347 diff --git a/amlogic/vim3l/firmware/fw_bcm4359c0_ag_apsta.bin b/amlogic/vim3l/firmware/fw_bcm4359c0_ag_apsta.bin new file mode 100644 index 0000000000000000000000000000000000000000..192a44fb7435ad6c891c1ea1bea7d8f9b0eba12b --- /dev/null +++ b/amlogic/vim3l/firmware/fw_bcm4359c0_ag_apsta.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4fea16916528ac0337e969a73267f1bf49c13d35d4d3cf5b038065a19c6d186 +size 637347 diff --git a/amlogic/vim3l/firmware/fw_bcm4359c0_ag_p2p.bin b/amlogic/vim3l/firmware/fw_bcm4359c0_ag_p2p.bin new file mode 100644 index 0000000000000000000000000000000000000000..192a44fb7435ad6c891c1ea1bea7d8f9b0eba12b --- /dev/null +++ b/amlogic/vim3l/firmware/fw_bcm4359c0_ag_p2p.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b4fea16916528ac0337e969a73267f1bf49c13d35d4d3cf5b038065a19c6d186 +size 637347 diff --git a/amlogic/vim3l/firmware/nvram_ap6398s.txt b/amlogic/vim3l/firmware/nvram_ap6398s.txt new file mode 100644 index 0000000000000000000000000000000000000000..b69fe56db7d7b559c7e2c794ae08f623ec4e123a --- /dev/null +++ b/amlogic/vim3l/firmware/nvram_ap6398s.txt @@ -0,0 +1,222 @@ +#AP6398S_NVRAM_V1.1_20170926 +# BCM4359 WLBGA iPA, iLNA board for bringup -AP6359SA_V1.0NVRAM +NVRAMRev=$Rev: 528206 $ +cckdigfilttype=5 +#cckdigfilttype=4 (default) +#valid ofdm filter types are 0 and 1 +ofdmfilttype_2gbe=127 +ofdmfilttype_5gbe=127 +sromrev=11 +boardrev=0x1301 +boardtype=0x0812 +# JIRA:SW4349-945 MANDATORY! Update makefile in case you touch bfl +#boardflags=0x10081201 +boardflags=0x00480201 +boardflags2=0x40801000 +boardflags3=0x48700106 +#boardnum=57410 +macaddr=00:90:4c:27:80:01 +ccode=0 +regrev=0 +antswitch=0 +pdgain5g=0 +pdgain2g=0 +lowpowerrange2g=0 +lowpowerrange5g=0 +tworangetssi2g=0 +tworangetssi5g=0 +# Low Power Range start value: 0dBm +olpc_thresh2g=0 +olpc_thresh5g=0 +AvVmid_c0=2,130,2,130,2,130,2,130,2,130 +AvVmid_c1=2,130,2,130,2,130,2,130,2,130 +# JIRA:SW4349-945 MANDATORY! Update makefile in case you touch femctl +femctrl=14 +vendid=0x14e4 +devid=0x43ef +manfid=0x2d0 +#prodid=0x052e +nocrc=1 +btc_mode=1 +#btc_params82=0x1a0 +otpimagesize=502 +xtalfreq=37400 +rxgains2gelnagaina0=3 +rxgains2gtrisoa0=7 +rxgains2gtrelnabypa0=1 +rxgains5gelnagaina0=3 +rxgains5gtrisoa0=6 +rxgains5gtrelnabypa0=1 +rxgains5gmelnagaina0=3 +rxgains5gmtrisoa0=6 +rxgains5gmtrelnabypa0=1 +rxgains5ghelnagaina0=3 +rxgains5ghtrisoa0=6 +rxgains5ghtrelnabypa0=1 +rxgains2gelnagaina1=3 +rxgains2gtrisoa1=7 +rxgains2gtrelnabypa1=1 +rxgains5gelnagaina1=3 +rxgains5gtrisoa1=6 +rxgains5gtrelnabypa1=1 +rxgains5gmelnagaina1=3 +rxgains5gmtrisoa1=6 +rxgains5gmtrelnabypa1=1 +rxgains5ghelnagaina1=3 +rxgains5ghtrisoa1=6 +rxgains5ghtrelnabypa1=1 +rxchain=3 +txchain=3 +aa2g=3 +aa5g=3 +agbg0=2 +agbg1=2 +aga0=2 +aga1=2 +tssipos2g=1 +extpagain2g=2 +tssipos5g=1 +extpagain5g=2 +tempthresh=255 +tempoffset=255 +rawtempsense=0x1ff +fdss_interp_en=1 +#fdss_level_2g=3,3 +fdss_level_5g=4,4 +#pa2gccka0=-186,8076,-976 +#pa2gccka1=-217,7061,-881 +#pa2gccka2=-67,9864,-1253 +#pa2gccka3=-115,9164,-1225 +#pa2ga0=-196,6950,-832 +#pa2ga1=-204,6710,-809 +#pa2ga2=-220,4557,-593 +#pa2ga3=-218,4596,-601 +pa2ga0=-193,7335,-862 +pa2ga1=-202,6968,-828 +pa2ga2=-220,4685,-607 +pa2ga3=-218,4724,-615 +#pa5ga0=-191,6865,-844,-169,7525,-907,-168,7768,-938,-192,7073,-871 +#pa5ga1=-182,7580,-919,-188,7614,-931,-219,6536,-818,-202,7220,-895 +#pa5ga2=-220,4437,-628,-183,5005,-678,-229,4048,-551,-223,4448,-611 +#pa5ga3=-263,3914,-566,-224,4649,-640,-230,4385,-596,-154,6488,-866 +pa5ga0=-205,6664,-820,-201,6801,-835,-199,6767,-831,-178,7266,-873 +pa5ga1=-200,7025,-858,-193,7170,-871,-186,7290,-879,-187,7227,-873 +pa5ga2=-220,4616,-647,-183,5184,-694,-229,4227,-571,-223,4627,-631 +pa5ga3=-263,4170,-599,-224,4905,-668,-230,4641,-625,-154,6744,-885 +#pa5gbw4080a0=-201,6883,-859,-198,7088,-881,-202,6968,-870,-210,6522,-820 +#pa5gbw4080a1=-217,6626,-832,-201,7517,-932,-201,7251,-896,-184,7500,-917 +#pa5gbw4080a2=-272,3585,-525,-193,5404,-740,-229,4201,-572,-230,4036,-550 +#pa5gbw4080a3=-278,3361,-486,-230,4794,-662,-268,3605,-508,-276,3337,-478 +maxp2ga0=74 +maxp2ga1=74 +maxp5ga0=70,70,70,70 +maxp5ga1=70,70,71,70 +subband5gver=0x4 +paparambwver=3 +pdoffset2g40mvalid=0 +cckpwroffset0=0x3 +cckpwroffset1=0x3 +pdoffset2g40ma0=0x2 +pdoffset2g40ma1=0x3 +pdoffset40ma0=0x0022 +pdoffset80ma0=0xceff +pdoffset40ma1=0x0123 +pdoffset80ma1=0xdfff +cckbw202gpo=0 +cckbw20ul2gpo=0 +mcsbw202gpo=0x44444444 +mcsbw402gpo=0x44444444 +dot11agofdmhrbw202gpo=0x2222 +ofdmlrbw202gpo=0x0000 +mcsbw205glpo=0x44444444 +mcsbw405glpo=0x44444444 +mcsbw805glpo=0xCCCCCCCC +mcsbw1605glpo=0 +mcsbw205gmpo=0x44444444 +mcsbw405gmpo=0x44444444 +mcsbw805gmpo=0xCCCCCCCC +mcsbw1605gmpo=0 +mcsbw205ghpo=0x44444444 +mcsbw405ghpo=0x44444444 +mcsbw805ghpo=0xCCCCCCCC +mcsbw1605ghpo=0 +mcslr5glpo=0x0000 +mcslr5gmpo=0x0000 +mcslr5ghpo=0x0000 +sb20in40hrpo=0x0 +sb20in80and160hr5glpo=0x0 +sb40and80hr5glpo=0x0 +sb20in80and160hr5gmpo=0x0 +sb40and80hr5gmpo=0x0 +sb20in80and160hr5ghpo=0x0 +sb40and80hr5ghpo=0x0 +sb20in40lrpo=0x0 +sb20in80and160lr5glpo=0x0 +sb40and80lr5glpo=0x0 +sb20in80and160lr5gmpo=0x0 +sb40and80lr5gmpo=0x0 +sb20in80and160lr5ghpo=0x0 +sb40and80lr5ghpo=0x0 +dot11agduphrpo=0x0 +dot11agduplrpo=0x0 +phycal_tempdelta=255 +temps_period=15 +temps_hysteresis=15 +ltecxmux=0 +ltecxpadnum=0x0504 +ltecxfnsel=0x44 +ltecxgcigpio=0x04 +#OOB params +#device_wake_opt=1 +#host_wake_opt=0 +swctrlmap_2g=0x00000808,0x00001010,0x00001010,0x021010,0x3ff +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x003 +swctrlmap_5g=0x00004040,0x00000000,0x00000000,0x000000,0x3e5 +swctrlmapext_5g=0x00000000,0x00000101,0x00000101,0x000000,0x003 +fem_table_init_val=0x00001010,0x00000000 +rssi_delta_5gl_c0=3,3,2,2,5,5 +rssi_delta_5gml_c0=0,2,0,2,3,5 +rssi_delta_5gmu_c0=0,2,0,2,3,5 +rssi_delta_5gh_c0=2,5,2,5,5,8 +rssi_delta_5gl_c1=1,1,2,2,3,3 +rssi_delta_5gml_c1=-1,1,0,2,1,3 +rssi_delta_5gmu_c1=-1,1,0,2,1,3 +rssi_delta_5gh_c1=0,3,2,5,3,6 +rssi_delta_2g_c0=4,5,4,5 +rssi_delta_2g_c1=2,3,2,3 +#muxenab=1 +#avs_enab=1 + +# ########### BTC Dynctl profile params ############ +# flags:bit0 - dynctl enabled, bit1 dynamic desense, bit2 dynamic mode +btcdyn_flags=0x0 +#btcdyn_dflt_dsns_level=0 +#btcdyn_low_dsns_level=0 +#btcdyn_mid_dsns_level=7 +#btcdyn_high_dsns_level=2 +#btcdyn_default_btc_mode=5 +#btcdyn_btrssi_hyster=2 +# --- number of rows in the array vars below --- +#btcdyn_msw_rows=3 +#btcdyn_dsns_rows=2 +# --- mode switch data rows (max is 4) --- +#btcdyn_msw_row0=1,8,0,-50,-100 +#btcdyn_msw_row1=1,4,0,-55,-100 +#btcdyn_msw_row2=1,0,0,-70,-100 +#btcdyn_msw_row3=1,-4,0,-70,-100 +# --- desense switching data rows (max is 4) --- +#btcdyn_dsns_row0=5,8,0,-40,-40 +#btcdyn_dsns_row0=5,4,0,-60,-60 +#btcdyn_dsns_row1=5,0,0,0,-75 +powoffs2gtna0=1,3,3,1,0,0,1,2,2,2,1,1,0,0 +powoffs2gtna1=-1,1,1,1,0,0,1,2,3,2,2,0,0,0 +#new Jan 4th +#eps_shift0=-1,-6,-1,-5 +#eps_shift1=-4,-6,-1,-2 +#eps_shift2=-1,9,-2,-6 +muxenab=0x10 + +#bandedge +fdss_level_2g=4,4 +fdss_level_5g=5,5 +fdss_interp_en=1 diff --git a/amlogic/vim3l/firmware/nvram_ap6398sa.txt b/amlogic/vim3l/firmware/nvram_ap6398sa.txt new file mode 100644 index 0000000000000000000000000000000000000000..97713c2b94798d3f7edbb4612b3f8fef37586b31 --- /dev/null +++ b/amlogic/vim3l/firmware/nvram_ap6398sa.txt @@ -0,0 +1,232 @@ +#AP6398S_NVRAM_V3.0_20200312A +#@SA +# BCM4359 WLBGA iPA, iLNA board for bringup -AP6359SA_V1.1NVRAM +NVRAMRev=$Rev: 528206 $ +cckdigfilttype=5 +#cckdigfilttype=4 (default) +#valid ofdm filter types are 0 and 1 +ofdmfilttype_2gbe=127 +ofdmfilttype_5gbe=127 +sromrev=11 +boardrev=0x1301 +boardtype=0x0812 +# JIRA:SW4349-945 MANDATORY! Update makefile in case you touch bfl +#boardflags=0x10081201 +boardflags=0x00480201 +boardflags2=0x40801000 +boardflags3=0x48700106 +#boardnum=57410 +macaddr=00:90:4c:27:80:01 +ccode=0 +regrev=0 +antswitch=0 +pdgain5g=0 +pdgain2g=0 +lowpowerrange2g=0 +lowpowerrange5g=0 +tworangetssi2g=0 +tworangetssi5g=0 +# Low Power Range start value: 0dBm +olpc_thresh2g=0 +olpc_thresh5g=0 +AvVmid_c0=2,130,2,130,2,130,2,130,2,130 +AvVmid_c1=2,130,2,130,2,130,2,130,2,130 +# JIRA:SW4349-945 MANDATORY! Update makefile in case you touch femctl +femctrl=14 +vendid=0x14e4 +devid=0x43ef +manfid=0x2d0 +#prodid=0x052e +nocrc=1 +btc_mode=1 +#btc_params82=0x1a0 +otpimagesize=502 +xtalfreq=37400 +rxgains2gelnagaina0=3 +rxgains2gtrisoa0=7 +rxgains2gtrelnabypa0=1 +rxgains5gelnagaina0=3 +rxgains5gtrisoa0=6 +rxgains5gtrelnabypa0=1 +rxgains5gmelnagaina0=3 +rxgains5gmtrisoa0=6 +rxgains5gmtrelnabypa0=1 +rxgains5ghelnagaina0=3 +rxgains5ghtrisoa0=6 +rxgains5ghtrelnabypa0=1 +rxgains2gelnagaina1=3 +rxgains2gtrisoa1=7 +rxgains2gtrelnabypa1=1 +rxgains5gelnagaina1=3 +rxgains5gtrisoa1=6 +rxgains5gtrelnabypa1=1 +rxgains5gmelnagaina1=3 +rxgains5gmtrisoa1=6 +rxgains5gmtrelnabypa1=1 +rxgains5ghelnagaina1=3 +rxgains5ghtrisoa1=6 +rxgains5ghtrelnabypa1=1 +rxchain=3 +txchain=3 +aa2g=3 +aa5g=3 +agbg0=2 +agbg1=2 +aga0=2 +aga1=2 +tssipos2g=1 +extpagain2g=2 +tssipos5g=1 +extpagain5g=2 +tempthresh=255 +tempoffset=255 +rawtempsense=0x1ff +#fdss_interp_en=1 +#fdss_level_2g=3,3 +#fdss_level_5g=4,4 +#pa2gccka0=-186,8076,-976 +#pa2gccka1=-217,7061,-881 +#pa2gccka2=-67,9864,-1253 +#pa2gccka3=-115,9164,-1225 +#pa2ga0=-196,6950,-832 +#pa2ga1=-204,6710,-809 +#pa2ga2=-220,4557,-593 +#pa2ga3=-218,4596,-601 +pa2ga0=-202,7359,-892 +pa2ga1=-208,7383,-894 +pa2ga2=-220,4685,-607 +pa2ga3=-218,4724,-615 +#pa5ga0=-191,6865,-844,-169,7525,-907,-168,7768,-938,-192,7073,-871 +#pa5ga1=-182,7580,-919,-188,7614,-931,-219,6536,-818,-202,7220,-895 +#pa5ga2=-220,4437,-628,-183,5005,-678,-229,4048,-551,-223,4448,-611 +#pa5ga3=-263,3914,-566,-224,4649,-640,-230,4385,-596,-154,6488,-866 +pa5ga0=-205,6664,-820,-201,6801,-835,-199,6767,-831,-178,7266,-873 +pa5ga1=-202,6871,-849,-197,7009,-863,-193,6855,-840,-200,6643,-821 +pa5ga2=-220,4616,-647,-183,5184,-694,-229,4227,-571,-223,4627,-631 +pa5ga3=-263,4170,-599,-224,4905,-668,-230,4641,-625,-154,6744,-885 +#pa5gbw4080a0=-201,6883,-859,-198,7088,-881,-202,6968,-870,-210,6522,-820 +#pa5gbw4080a1=-217,6626,-832,-201,7517,-932,-201,7251,-896,-184,7500,-917 +#pa5gbw4080a2=-272,3585,-525,-193,5404,-740,-229,4201,-572,-230,4036,-550 +#pa5gbw4080a3=-278,3361,-486,-230,4794,-662,-268,3605,-508,-276,3337,-478 +maxp2ga0=82 +maxp2ga1=78 +maxp5ga0=70,70,70,70 +maxp5ga1=70,70,71,70 +subband5gver=0x4 +paparambwver=3 +pdoffset2g40mvalid=0 +cckpwroffset0=0x3 +cckpwroffset1=0x3 +pdoffset2g40ma0=0x2 +pdoffset2g40ma1=0x3 +pdoffset40ma0=0x0022 +pdoffset80ma0=0xceff +pdoffset40ma1=0x0123 +pdoffset80ma1=0xdfff +cckbw202gpo=0x0000 +cckbw20ul2gpo=0x0000 +mcsbw202gpo=0x44444444 +mcsbw402gpo=0x44444444 +dot11agofdmhrbw202gpo=0x2222 +ofdmlrbw202gpo=0x0422 +mcsbw205glpo=0xA6200000 +mcsbw405glpo=0xA6222222 +mcsbw805glpo=0xA6444444 +mcsbw1605glpo=0 +mcsbw205gmpo=0xA6200000 +mcsbw405gmpo=0xA6222222 +mcsbw805gmpo=0xA6444444 +mcsbw1605gmpo=0 +mcsbw205ghpo=0xA6200000 +mcsbw405ghpo=0xA6222222 +mcsbw805ghpo=0xA6444444 +mcsbw1605ghpo=0 +mcslr5glpo=0x0000 +mcslr5gmpo=0x0000 +mcslr5ghpo=0x0000 +sb20in40hrpo=0x0 +sb20in80and160hr5glpo=0x0 +sb40and80hr5glpo=0x0 +sb20in80and160hr5gmpo=0x0 +sb40and80hr5gmpo=0x0 +sb20in80and160hr5ghpo=0x0 +sb40and80hr5ghpo=0x0 +sb20in40lrpo=0x0 +sb20in80and160lr5glpo=0x0 +sb40and80lr5glpo=0x0 +sb20in80and160lr5gmpo=0x0 +sb40and80lr5gmpo=0x0 +sb20in80and160lr5ghpo=0x0 +sb40and80lr5ghpo=0x0 +dot11agduphrpo=0x0 +dot11agduplrpo=0x0 +phycal_tempdelta=255 +temps_period=15 +temps_hysteresis=15 +ltecxmux=0 +ltecxpadnum=0x0504 +ltecxfnsel=0x44 +ltecxgcigpio=0x04 +#OOB params +#device_wake_opt=1 +#host_wake_opt=0 +swctrlmap_2g=0x00000808,0x00001010,0x00001010,0x021010,0x3ff +swctrlmapext_2g=0x00000000,0x00000000,0x00000000,0x000000,0x003 +swctrlmap_5g=0x00004040,0x00000000,0x00000000,0x000000,0x3e5 +swctrlmapext_5g=0x00000000,0x00000101,0x00000101,0x000000,0x003 +fem_table_init_val=0x00001010,0x00000000 +rssi_delta_5gl_c0=3,3,2,2,5,5 +rssi_delta_5gml_c0=0,2,0,2,3,5 +rssi_delta_5gmu_c0=0,2,0,2,3,5 +rssi_delta_5gh_c0=2,5,2,5,5,8 +rssi_delta_5gl_c1=1,1,2,2,3,3 +rssi_delta_5gml_c1=-1,1,0,2,1,3 +rssi_delta_5gmu_c1=-1,1,0,2,1,3 +rssi_delta_5gh_c1=0,3,2,5,3,6 +rssi_delta_2g_c0=4,5,4,5 +rssi_delta_2g_c1=2,3,2,3 +#muxenab=1 +#avs_enab=1 + +# ########### BTC Dynctl profile params ############ +# flags:bit0 - dynctl enabled, bit1 dynamic desense, bit2 dynamic mode +btcdyn_flags=0x0 +#btcdyn_dflt_dsns_level=0 +#btcdyn_low_dsns_level=0 +#btcdyn_mid_dsns_level=7 +#btcdyn_high_dsns_level=2 +#btcdyn_default_btc_mode=5 +#btcdyn_btrssi_hyster=2 +# --- number of rows in the array vars below --- +#btcdyn_msw_rows=3 +#btcdyn_dsns_rows=2 +# --- mode switch data rows (max is 4) --- +#btcdyn_msw_row0=1,8,0,-50,-100 +#btcdyn_msw_row1=1,4,0,-55,-100 +#btcdyn_msw_row2=1,0,0,-70,-100 +#btcdyn_msw_row3=1,-4,0,-70,-100 +# --- desense switching data rows (max is 4) --- +#btcdyn_dsns_row0=5,8,0,-40,-40 +#btcdyn_dsns_row0=5,4,0,-60,-60 +#btcdyn_dsns_row1=5,0,0,0,-75 +powoffs2gtna0=1,3,3,1,0,0,1,2,2,2,1,1,0,0 +powoffs2gtna1=-1,1,1,1,0,0,1,2,3,2,2,0,0,0 + +#band-edge channel power offsets +powoffs5g20mtna0=0,0,0,0,0,0,0 +powoffs5g20mtna1=-0,0,0,0,0,0,0 +powoffs5g40mtna0=0,0,0,0,0 +powoffs5g40mtna1=0,0,0,0,0 +powoffs5g80mtna0=-0,0,0,0,0 +powoffs5g80mtna1=0,0,0,0,0 + +#new Jan 4th +#eps_shift0=-1,-6,-1,-5 +#eps_shift1=-4,-6,-1,-2 +#eps_shift2=-1,9,-2,-6 +muxenab=0x10 + +#bandedge +fdss_level_2g=4,4 +fdss_level_5g=5,5 +fdss_interp_en=1 diff --git a/model/audio/Makefile b/model/audio/Makefile index d66037684d804b206980fcc6a8a2ba235f8be742..0901c7145ffe86624f1caea8f84ebf0c63f44102 100755 --- a/model/audio/Makefile +++ b/model/audio/Makefile @@ -25,43 +25,31 @@ obj-$(CONFIG_DRIVERS_HDF_AUDIO) += \ $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_parse.o \ $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_accessory_base.o \ $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_codec_base.o \ + $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_dsp_base.o \ $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_dai_base.o \ + + +obj-$(CONFIG_ARCH_HI3516DV300) += \ + $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_core.o \ + $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_host.o \ + $(KHDF_AUDIO_ROOT_DIR)/core/src/audio_parse.o \ + $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_accessory_base.o \ + $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_codec_base.o \ $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_platform_base.o \ - $(KHDF_AUDIO_ROOT_DIR)/common/src/audio_dma_base.o \ $(KHDF_AUDIO_ROOT_DIR)/sapm/src/audio_sapm.o \ $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_stream_dispatch.o \ - $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o - -obj-$(CONFIG_DRIVERS_HDF_AUDIO_HI3516CODEC) += \ - $(KHDF_AUDIO_HI3516DV300_DIR)/../tfa9879/accessory/src/tfa9879_accessory_adapter.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/../tfa9879/accessory/src/tfa9879_accessory_impl.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/codec/src/hi3516_codec_adapter.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/codec/src/hi3516_codec_impl.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/codec/src/hi3516_codec_ops.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/dsp/src/dsp_adapter.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/dsp/src/dsp_ops.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/soc/src/hi3516_dai_adapter.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/soc/src/hi3516_dai_ops.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/soc/src/hi3516_aiao_impl.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/soc/src/hi3516_dma_ops.o \ - $(KHDF_AUDIO_HI3516DV300_DIR)/soc/src/hi3516_dma_adapter.o - -ccflags-$(CONFIG_DRIVERS_HDF_AUDIO) += -lm -lc -lgcc -std=gnu99 -Werror \ - -I$(srctree)/$(KHDF_AUDIO_KHDF_ROOT_DIR)/osal/include \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/core \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/utils \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/osal \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/platform \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/config \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/include/audio \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/ability/sbuf/include \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/core/common/include/host \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/core/include \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/sapm/include \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/dispatch/include \ - -I$(srctree)/$(KHDF_FRAMEWORK_ROOT_DIR)/model/audio/common/include \ - -I$(srctree)/bounds_checking_function/include + $(KHDF_AUDIO_ROOT_DIR)/dispatch/src/audio_control_dispatch.o \ + $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/tfa9879/accessory/src/tfa9879_accessory_impl.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_impl.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/codec/src/hi3516_codec_ops.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/dsp/src/dsp_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_dai_adapter.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_aiao_impl.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_ops.o \ + $(KHDF_AUDIO_CODEC_DIR)/hi3516dv300/soc/src/hi3516_platform_adapter.o ccflags-$(CONFIG_DRIVERS_HDF_AUDIO_HI3516CODEC) += \ -I$(srctree)/$(KHDF_AUDIO_HI3516DV300_INC_DIR)/codec/include \ diff --git a/platform/pwm/pwm_hi35xx.h b/platform/pwm/pwm_hi35xx.h index c5c3f27de6971a90bfb2187d7d5f533019882657..20c14d303cead473da3c8bd069b83ae7c3ee55ab 100644 --- a/platform/pwm/pwm_hi35xx.h +++ b/platform/pwm/pwm_hi35xx.h @@ -36,9 +36,10 @@ #define PWM_INV_OFFSET 1 #define PWM_KEEP_OFFSET 2 -#define PWM_DEFAULT_PERIOD 0x3E7 // 999 +#define PWM_DEFAULT_PERIOD 0x3E7 #define PWM_DEFAULT_POLARITY 0 -#define PWM_DEFAULT_DUTY_CYCLE 0x14D // 333 +#define PWM_DEFAULT_DUTY_CYCLE 0x14D + struct HiPwmRegs { volatile uint32_t cfg0;