update openharmony 1.0.1

This commit is contained in:
mamingshuai
2021-03-11 18:46:24 +08:00
parent cddb01a857
commit 6900b13c1c
980 changed files with 4973 additions and 816 deletions
-5
View File
@@ -1,5 +0,0 @@
hi3861/tools/nvtool/out_nv_bin/sta/nv/Hi3861_wifiiot_app/mss_nvi_db.xml
hi3861/tools/nvtool/out_nv_bin/sta/nv/Hi3861_wifiiot_app/outside_demo/mss_nvi_db_sta.xml
hi3861/tools/nvtool/out_nv_bin/sta/nv/Hi3861_wifiiot_app/outside_demo/nv.xml
hi3861/tools/nvtool/out_nv_bin/sta/nv/Hi3861_wifiiot_app/outside_demo/nv/*
hi3861/tools/nvtool/out_nv_bin/sta/nv/hnv/*
Executable
+4
View File
@@ -0,0 +1,4 @@
# Copyright (C) 2020 Hisilicon (Shanghai) Technologies Co., Ltd. All rights reserved.
group("hispark_pegasus") {
}
View File
Executable
+112
View File
@@ -0,0 +1,112 @@
# HiSpark\_pegasus<a name="ZH-CN_TOPIC_0000001130176841"></a>
- [简介](#section11660541593)
- [特点](#section12212842173518)
- [目录](#section1464106163817)
- [许可协议](#section1478215290)
- [相关仓](#section1371113476307)
## 简介<a name="section11660541593"></a>
HiSpark\_pegasusHi3861V100)是一款高度集成的2.4GHz WiFi SoC芯片,集成IEEE 802.11b/g/n基带和RF电路,RF电路包括功率放大器PA、低 噪声放大器LNA、RF balun、天线开关以及电源管理等模块;支持20MHz标准带宽和5MHz/10MHz窄带宽,提供最大72.2Mbit/s 物理层速率。 Hi3861V100 WiFi基带支持正交频分复用(OFDM)技术,并向下兼容直接序列扩频(DSSS)和补码键控(CCK)技术,支 持IEEE 802.11 b/g/n协议的各种数据速率。 Hi3861V100芯片集成高性能32bit微处理器、硬件安全引擎以及丰富的外设接口,外设接口包括SPI、UART、I2C、PWM、 GPIO和多路ADC,同时支持高速SDIO2.0 Device接口,最高时钟可达50MHz;芯片内置SRAM和Flash,可独立运行,并支持 在Flash上运行程序。 Hi3861V100芯片适应于智能家电等物联网智能终端领域。
上海海思Hi3861系列的平台软件对应用层实现了底层屏蔽,并对应用软件直接提供API\(Application Programming Interface\)接口完成相应功能。典型的系统应用架构如下:
**图 1** 系统架构图<a name="fig4460722185514"></a>
![](figures/zh-cn_image_0000001084042234.png)
该框架可以分为以下几个层次:
- APP层:即应用层。SDK提供的代码示例在SDK的代码目录:app\\demo\\src。
- API层:提供基于SDK开发的通用接口。
- Platform平台层:提供SOC系统板级支持包,包括如下功能:
- 芯片和外围器件驱动
- 操作系统
- 系统管理
- Service服务层:提供包含WiFi等应用协议栈。用于上层应用软件进行数据收发等操作。
- 第三方:提供给Service服务层或提供给应用层使用的第三方软件库。
## 特点<a name="section12212842173518"></a>
**稳定、可靠的通信能力**
- 支持复杂环境下 TPC、自动速率、弱干扰免疫等可靠性通信算法
**灵活的组网能力**
- 支持 256 节点 Mesh 组网
- 支持标准 20M 带宽组网和 5M/10M 窄带组网
**完善的网络支持**
- 支持 IPv4/IPv6 网络功能
- 支持 DHCPv4/DHCPv6 Client/Server
- 支持 DNS Client 功能
- 支持 mDNS 功能
- 支持 CoAP/MQTT/HTTP/JSON 基础组件
**强大的安全引擎**
- 硬件实现 AES128/256 加解密算法
- 硬件实现 HASH-SHA256、HMAC\_SHA256 算法
- 硬件实现 RSA、ECC 签名校验算法
- 硬件实现真随机数生成,满足 FIPS140-2 随机测试标准
- 硬件支持 TLS/DTLS 加速
- 内部集成 EFUSE,支持安全存储、安全启动、安全升级
- 内部集成 MPU 特性,支持内存隔离特性
**开放的操作系统**
- 丰富的低功耗、小内存、高稳定性、高实时性机制
- 灵活的协议支撑和扩展能力
- 二次开发接口
- 多层级开发接口:操作系统适配接口和系统诊断接口、 链路层接口、网络层接口
## 目录<a name="section1464106163817"></a>
Hi3861的SDK软件包根目录结构所在位置device\\hisilicon\\hispark\_pegasus\\sdk\_liteos,如下图所示:
```
device/hisilicon/hispark_pegasus/sdk_liteos
├── app # 应用层代码(其中包含demo程序为参考示例)。
├── boot # Flash bootloader代码。
├── build # SDK构建所需的库文件、链接文件、配置文件。
├── BUILD.gn # GN构建脚本
├── build_patch.sh # 用于解压uboot开源源码包和打patch。
├── build.sh # 启动编译脚本,同时支持“sh build.sh menuconfig”进行客制化配置。
├── components # SDK平台相关的组件
├── config # SDK系统配置文件。
├── config.gni # 支持HarmonyOS配置文件。
├── factory.mk # 厂测版本编译脚本。
├── hm_build.sh # 适配HarmonyOS构建脚本。
├── include # API头文件存放目录。
├── license # SDK开源license声明
├── Makefile # 支持make编译,使用“make”或“make all”启动编译。
├── non_factory.mk # 非厂测版本编译脚本。
├── platform # SDK平台相关的文件(包括:内核镜像、驱动模块等)
├── SConstruct # SCons编译脚本。
├── third_party # 开源第三方软件目录。
└── tools # SDK提供的Linux系统和Windows系统上使用的工具(包括:NV制作工具、签名工具、Menuconfig等)。
```
## 许可协议<a name="section1478215290"></a>
- Hi3861V100自研代码使用基于Apache License Version 2.0许可的hisi版权声明。许可信息和版权信息通常可以在代码开头看到:
```
/ *Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.Licensed under the Apache License,* ... * /
```
- Hi3861V100使用的第三方代码遵循软件版本自带的开源许可声明。
- 将生成的库文件统一存放于根目录下的build/libs下。
- Hi3861V100可能会使用一些开源软件组件。如果这些开源软件组件所适用的许可与本协议内容冲突,则以该开源软件组件的许可为准。
## 相关仓<a name="section1371113476307"></a>
**hmf/device/hisilicon/hispark\_pegasus**
hmf/vendor/hisilicon
-27
View File
@@ -1,27 +0,0 @@
# Copyright (c) 2020 Huawei Device Co., Ltd. All rights reserved.
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/config/subsystem/lite_subsystem.gni")
lite_subsystem("wifiiot_sdk") {
subsystem_components = [ ":sdk" ]
}
build_ext_component("run_wifiiot_scons") {
exec_path = rebase_path(".", root_build_dir)
command = "sh hm_build.sh"
deps = [
":sdk",
"//base/security/frameworks/hichainsdk_lite:hichainsdk",
"//build/lite:ohos",
]
}
lite_component("sdk") {
features = []
deps = [
"//third_party/cJSON:cjson_static",
"//vendor/hisi/hi3861/hi3861_adapter/kal",
]
}
@@ -0,0 +1,23 @@
# 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/lite/config/component/lite_component.gni")
static_library("hal_wifiaware") {
sources = [ "source/hal_wifiaware.c" ]
include_dirs = [
"//device/hisilicon/hispark_pegasus/sdk_liteos/include",
"//device/hisilicon/hispark_pegasus/sdk_liteos/third_party/mbedtls-2.16.2/include",
"//foundation/communication/wifi_aware/interfaces/kits",
]
}
@@ -0,0 +1,105 @@
/*
* 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.
*/
#include "hi_cipher.h"
#include "hi_wifi_api.h"
#include "hi_wifi_sdp_api.h"
#include "wifiaware.h"
int HalWifiSdpInit(const char* ifname)
{
if (hi_wifi_sdp_init(ifname) != HISI_OK) {
return -1;
}
return 0;
}
unsigned int HalCipherHashSha256(const char* input, unsigned int inputLen, unsigned char* hash, unsigned hashLen)
{
if (hi_cipher_hash_sha256((uintptr_t)input, inputLen, hash, hashLen) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpStartService(const char* svcName, unsigned char localHandle, RecvCallback recvCB, unsigned char role)
{
if (hi_wifi_sdp_start_service(svcName, localHandle, (hi_wifi_sdp_recv_cb)recvCB, role) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpSend(unsigned char* macAddr, unsigned char peerHandle, unsigned char localHandle,
unsigned char* msg, int len)
{
if (hi_wifi_sdp_send(macAddr, peerHandle, localHandle, msg, len) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpStopService(unsigned char localHandle, unsigned char role)
{
if (hi_wifi_sdp_stop_service(localHandle, role) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpDeinit(void)
{
if (hi_wifi_sdp_deinit() != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpAdjustTxPower(const char *ifname, signed char power)
{
if (hi_wifi_sdp_adjust_tx_power(ifname, power) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpRestoreTxPower(const char *ifname)
{
if (hi_wifi_sdp_restore_tx_power(ifname) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpBeaconSwitch(const char *ifname, unsigned char enable)
{
if (hi_wifi_sdp_beacon_switch(ifname, enable) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpSetRetryTimes(unsigned int retries)
{
if (hi_wifi_sdp_set_retry_times(retries) != HISI_OK) {
return -1;
}
return 0;
}
int HalWifiSdpGetSyncMode(void)
{
return hi_wifi_sdp_get_sync_mode();
}
@@ -18,10 +18,10 @@ static_library("wifiservice") {
"source/wifi_hotspot.c",
]
include_dirs = [
"//vendor/hisi/hi3861/hi3861/include",
"//foundation/communication/interfaces/kits/wifi_lite/wifiservice",
"//device/hisilicon/hispark_pegasus/sdk_liteos/include",
"//foundation/communication/wifi_lite/interfaces/wifiservice",
"//kernel/liteos_m/kal",
"//foundation/distributedschedule/interfaces/kits/samgr_lite/samgr",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
]
}
if (ohos_kernel_type == "liteos_m") {
@@ -29,6 +29,6 @@ if (ohos_kernel_type == "liteos_m") {
deps = [ ":wifiservice" ]
head_files =
[ "//foundation/communication/interfaces/kits/wifi_lite/wifiservice" ]
[ "//foundation/communication/wifi_lite/interfaces/wifiservice" ]
}
}
@@ -19,7 +19,7 @@
#include "cmsis_os.h"
#include "common.h"
#include "hos_init.h"
#include "ohos_init.h"
#include "wifi_hotspot_config.h"
@@ -42,7 +42,7 @@ WifiSecurityType HiSecToHoSec(hi_wifi_auth_mode mode)
return WIFI_SEC_TYPE_WEP;
case HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX:
return WIFI_SEC_TYPE_PSK;
case HI_WIFI_SECURITY_SAE:
case HI_WIFI_SECURITY_WPA3_WPA2_PSK_MIX:
return WIFI_SEC_TYPE_SAE;
default:
return WIFI_SEC_TYPE_INVALID;
@@ -59,7 +59,7 @@ hi_wifi_auth_mode HoSecToHiSec(WifiSecurityType type)
case WIFI_SEC_TYPE_PSK:
return HI_WIFI_SECURITY_WPAPSK_WPA2PSK_MIX;
case WIFI_SEC_TYPE_SAE:
return HI_WIFI_SECURITY_SAE;
return HI_WIFI_SECURITY_WPA3_WPA2_PSK_MIX;
default:
return HI_WIFI_SECURITY_UNKNOWN;
}
@@ -1,39 +1,32 @@
# 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
# 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.
static_library("hal_iothardware") {
if (board_name == "hi3861v100") {
sources = [
"hal_wifiiot_watchdog.c",
"hal_wifiiot_at.c",
"hal_wifiiot_partition.c",
"hal_wifiiot_uart.c",
"hal_wifiiot_spi.c",
"hal_wifiiot_sdio.c",
"hal_wifiiot_pwm.c",
"hal_wifiiot_kal.c",
"hal_wifiiot_i2s.c",
"hal_wifiiot_i2c.c",
"hal_wifiiot_adc.c",
"hal_wifiiot_gpio.c",
"hal_wifiiot_flash.c",
"hal_lowpower.c",
"hal_reset.c"
]
include_dirs = [
"//utils/native/lite/include",
"//base/iot_hardware/hals/wifiiot_lite",
"//vendor/hisi/hi3861/hi3861/include"
]
}
}
static_library("hal_iothardware") {
if (board_name == "hispark_pegasus") {
sources = [
"hal_iot_flash.c",
"hal_iot_gpio.c",
"hal_iot_i2c.c",
"hal_iot_pwm.c",
"hal_iot_uart.c",
"hal_iot_watchdog.c",
"hal_lowpower.c",
"hal_reset.c",
]
include_dirs = [
"//utils/native/lite/include",
"//base/iot_hardware/peripheral/interfaces/kits",
"//device/hisilicon/hispark_pegasus/sdk_liteos/include",
]
}
}
@@ -13,38 +13,32 @@
* limitations under the License.
*/
#include <stdio.h>
#include "hal_wifiiot_flash.h"
#include "iot_errno.h"
#include "iot_flash.h"
#include "hi_flash.h"
unsigned int HalFlashRead(const unsigned int flashOffset, const unsigned int size, unsigned char *ramData)
unsigned int IoTFlashRead(unsigned int flashOffset, unsigned int size, unsigned char *ramData)
{
return hi_flash_read(flashOffset, size, ramData);
}
unsigned int HalFlashWrite(const unsigned int flashOffset, unsigned int size,
unsigned int IoTFlashWrite(unsigned int flashOffset, unsigned int size,
const unsigned char *ramData, unsigned char doErase)
{
return hi_flash_write(flashOffset, size, ramData, doErase);
}
unsigned int HalFlashErase(const unsigned int flashOffset, const unsigned int size)
unsigned int IoTFlashErase(unsigned int flashOffset, unsigned int size)
{
return hi_flash_erase(flashOffset, size);
}
unsigned int HalFlashInit(void)
unsigned int IoTFlashInit(void)
{
return hi_flash_init();
}
unsigned int HalFlashDeinit(void)
unsigned int IoTFlashDeinit(void)
{
return hi_flash_deinit();
}
unsigned int HalFlashIoctl(unsigned short cmd, char *data)
{
return hi_flash_ioctl(cmd, data);
}
@@ -0,0 +1,113 @@
/*
* 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.
*/
#include "iot_errno.h"
#include "iot_gpio.h"
#include "hi_gpio.h"
#define GPIO_PIN_INIT 1
#define GPIO_PIN_UNINIT 0
static unsigned char g_gpioMap[HI_GPIO_IDX_MAX] = {0};
static unsigned char g_gpioInitNum = 0;
unsigned int IoTGpioInit(unsigned int id)
{
if (id >= HI_GPIO_IDX_MAX) {
return IOT_FAILURE;
}
if (g_gpioInitNum == 0) {
(void)hi_gpio_init();
}
if (g_gpioMap[id] == GPIO_PIN_INIT) {
return IOT_FAILURE;
} else {
g_gpioMap[id] = GPIO_PIN_INIT;
g_gpioInitNum++;
}
return IOT_SUCCESS;
}
unsigned int IoTGpioSetDir(unsigned int id, IotGpioDir dir)
{
return hi_gpio_set_dir((hi_gpio_idx)id, (hi_gpio_dir)dir);
}
unsigned int IoTGpioGetDir(unsigned int id, IotGpioDir *dir)
{
return hi_gpio_get_dir((hi_gpio_idx)id, (hi_gpio_dir *)dir);
}
unsigned int IoTGpioSetOutputVal(unsigned int id, IotGpioValue val)
{
return hi_gpio_set_ouput_val((hi_gpio_idx)id, (hi_gpio_value)val);
}
unsigned int IoTGpioGetOutputVal(unsigned int id, IotGpioValue *val)
{
return hi_gpio_get_output_val((hi_gpio_idx)id, (hi_gpio_value *)val);
}
unsigned int IoTGpioGetInputVal(unsigned int id, IotGpioValue *val)
{
return hi_gpio_get_input_val((hi_gpio_idx)id, (hi_gpio_value *)val);
}
unsigned int IoTGpioRegisterIsrFunc(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity,
GpioIsrCallbackFunc func, char *arg)
{
return hi_gpio_register_isr_function((hi_gpio_idx)id, (hi_gpio_int_type)intType,
(hi_gpio_int_polarity)intPolarity, (gpio_isr_callback)func, arg);
}
unsigned int IoTGpioUnregisterIsrFunc(unsigned int id)
{
return hi_gpio_unregister_isr_function((hi_gpio_idx)id);
}
unsigned int IoTGpioSetIsrMask(unsigned int id, unsigned char mask)
{
return hi_gpio_set_isr_mask((hi_gpio_idx)id, (hi_bool)mask);
}
unsigned int IoTGpioSetIsrMode(unsigned int id, IotGpioIntType intType, IotGpioIntPolarity intPolarity)
{
return hi_gpio_set_isr_mode((hi_gpio_idx)id, (hi_gpio_int_type)intType, (hi_gpio_int_polarity)intPolarity);
}
unsigned int IoTGpioDeinit(unsigned int id)
{
if (id >= HI_GPIO_IDX_MAX) {
return IOT_FAILURE;
}
if (g_gpioMap[id] == GPIO_PIN_INIT) {
g_gpioInitNum--;
g_gpioMap[id] = GPIO_PIN_UNINIT;
} else {
return IOT_FAILURE;
}
if (g_gpioInitNum == 0) {
return hi_gpio_deinit();
} else {
return IOT_SUCCESS;
}
}
@@ -0,0 +1,55 @@
/*
* 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.
*/
#include "iot_errno.h"
#include "iot_i2c.h"
#include "hi_i2c.h"
unsigned int IoTI2cWrite(unsigned int id, unsigned short deviceAddr, const unsigned char *data, unsigned int dataLen)
{
hi_i2c_data i2cData;
i2cData.receive_buf = NULL;
i2cData.receive_len = 0;
i2cData.send_buf = data;
i2cData.send_len = dataLen;
return hi_i2c_write((hi_i2c_idx)id, deviceAddr, &i2cData);
}
unsigned int IoTI2cRead(unsigned int id, unsigned short deviceAddr, unsigned char *data, unsigned int dataLen)
{
hi_i2c_data i2cData;
i2cData.receive_buf = data;
i2cData.receive_len = dataLen;
i2cData.send_buf = NULL;
i2cData.send_len = 0;
return hi_i2c_read((hi_i2c_idx)id, deviceAddr, &i2cData);
}
unsigned int IoTI2cInit(unsigned int id, unsigned int baudrate)
{
return hi_i2c_init((hi_i2c_idx)id, baudrate);
}
unsigned int IoTI2cDeinit(unsigned int id)
{
return hi_i2c_deinit((hi_i2c_idx)id);
}
unsigned int IoTI2cSetBaudrate(unsigned int id, unsigned int baudrate)
{
return hi_i2c_set_baudrate((hi_i2c_idx)id, baudrate);
}
@@ -13,35 +13,50 @@
* limitations under the License.
*/
#include "iot_errno.h"
#include "iot_pwm.h"
#include "hi_pwm.h"
#include "hi_errno.h"
#include "hal_wifiiot_errno.h"
#include "hal_wifiiot_pwm.h"
unsigned int HalPwmInit(HalWifiIotPwmPort port)
#define CLK_160M 160000000
#define DUTY_MIN 0
#define DUTY_MAX 100
#define SHORT_MAX 0xFFFF
unsigned int IoTPwmInit(unsigned int port)
{
if (hi_pwm_set_clock(PWM_CLK_160M) != HI_ERR_SUCCESS) {
return (unsigned int)HAL_WIFI_IOT_FAILURE;
return IOT_FAILURE;
}
return hi_pwm_init((hi_pwm_port)port);
}
unsigned int HalPwmDeinit(HalWifiIotPwmPort port)
unsigned int IoTPwmDeinit(unsigned int port)
{
return hi_pwm_deinit((hi_pwm_port)port);
}
unsigned int HalPwmSetClock(HalWifiIotPwmClkSource clkSource)
unsigned int IoTPwmStart(unsigned int port, unsigned short duty, unsigned int freq)
{
return hi_pwm_set_clock((hi_pwm_clk_source)clkSource);
unsigned short hiDuty;
unsigned short hiFreq;
if ((freq == 0) || (duty >= DUTY_MAX) || (duty == DUTY_MIN)) {
return IOT_FAILURE;
}
if ((CLK_160M / freq) > SHORT_MAX) {
return IOT_FAILURE;
}
hiFreq = (unsigned short)(CLK_160M / freq);
hiDuty = (duty * hiFreq) / DUTY_MAX;
return hi_pwm_start((hi_pwm_port)port, hiDuty, hiFreq);
}
unsigned int HalPwmStart(HalWifiIotPwmPort port, unsigned short duty, unsigned short freq)
{
return hi_pwm_start((hi_pwm_port)port, duty, freq);
}
unsigned int HalPwmStop(HalWifiIotPwmPort port)
unsigned int IoTPwmStop(unsigned int port)
{
return hi_pwm_stop((hi_pwm_port)port);
}
@@ -0,0 +1,68 @@
/*
* 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.
*/
#include "iot_errno.h"
#include "iot_uart.h"
#include "hi_uart.h"
unsigned int IoTUartInit(unsigned int id, const IotUartAttribute *param)
{
hi_uart_attribute attr = {0};
hi_uart_extra_attr extraAttr = {0};
if (NULL == param) {
return IOT_FAILURE;
}
attr.baud_rate = param->baudRate;
attr.data_bits = param->dataBits;
attr.pad = param->pad;
attr.parity = param->parity;
attr.stop_bits = param->stopBits;
if (IOT_UART_BLOCK_STATE_NONE_BLOCK == param->rxBlock) {
extraAttr.rx_block = HI_UART_BLOCK_STATE_NONE_BLOCK;
} else {
extraAttr.rx_block = HI_UART_BLOCK_STATE_BLOCK;
}
if (IOT_UART_BLOCK_STATE_NONE_BLOCK == param->txBlock) {
extraAttr.tx_block = HI_UART_BLOCK_STATE_NONE_BLOCK;
} else {
extraAttr.tx_block = HI_UART_BLOCK_STATE_BLOCK;
}
return hi_uart_init((hi_uart_idx)id, &attr, &extraAttr);
}
int IoTUartRead(unsigned int id, unsigned char *data, unsigned int dataLen)
{
return hi_uart_read((hi_uart_idx)id, data, dataLen);
}
int IoTUartWrite(unsigned int id, const unsigned char *data, unsigned int dataLen)
{
return hi_uart_write((hi_uart_idx)id, data, dataLen);
}
unsigned int IoTUartDeinit(unsigned int id)
{
return hi_uart_deinit((hi_uart_idx)id);
}
unsigned int IoTUartSetFlowCtrl(unsigned int id, IotFlowCtrl flowCtrl)
{
return hi_uart_set_flow_ctrl((hi_uart_idx)id, (hi_flow_ctrl)flowCtrl);
}
@@ -13,20 +13,21 @@
* limitations under the License.
*/
#include "iot_errno.h"
#include "iot_watchdog.h"
#include "hi_watchdog.h"
#include "hal_wifiiot_watchdog.h"
void HalWatchDogEnable(void)
void IoTWatchDogEnable(void)
{
return hi_watchdog_enable();
}
void HalWatchDogKick(void)
void IoTWatchDogKick(void)
{
return hi_watchdog_feed();
}
void HalWatchDogDisable(void)
void IoTWatchDogDisable(void)
{
return hi_watchdog_disable();
}
@@ -13,15 +13,15 @@
* limitations under the License.
*/
#include "hal_lowpower.h"
#include "lowpower.h"
#include "hi_lowpower.h"
unsigned int HalLpcInit(void)
unsigned int LpcInit(void)
{
return hi_lpc_init();
}
unsigned int HalLpcSetType(HalLpcType type)
unsigned int LpcSetType(LpcType type)
{
return hi_lpc_set_type(type);
}
@@ -13,10 +13,10 @@
* limitations under the License.
*/
#include "hal_reset.h"
#include "reset.h"
#include "hi_reset.h"
void HalRebootDevice(HalRebootCause cause)
void RebootDevice(unsigned int cause)
{
hi_hard_reboot(cause);
}
@@ -1,9 +0,0 @@
#include "hi_adc.h"
#include "hal_wifiiot_adc.h"
unsigned int HalAdcRead(HalWifiIotAdcChannelIndex channel, unsigned short *data, HalWifiIotAdcEquModelSel equModel,
HalWifiIotAdcCurBais curBais, unsigned short rstCnt)
{
return hi_adc_read((hi_adc_channel_index)channel, (hi_u16*)data, (hi_adc_equ_model_sel)equModel,
(hi_adc_cur_bais)curBais, (hi_u16)rstCnt);
}
@@ -1,48 +0,0 @@
/*
* 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.
*/
#include "hal_wifiiot_at.h"
#include <stdio.h>
#include "hi_at.h"
#include "hal_wifiiot_errno.h"
unsigned int HalAtRegisterCmd(const HalAtCmdTbl *cmdTbl, unsigned short cmdNum)
{
return hi_at_register_cmd((at_cmd_func *)cmdTbl, cmdNum);
}
void HalAtSysCmdRegister(void)
{
hi_at_sys_cmd_register();
}
int HalAtPrintf(const char *buf, int len)
{
(void)len;
return hi_at_printf("%s", buf);
}
unsigned int HalAtInit(void)
{
return hi_at_init();
}
void HalAtCheckUartBusy(unsigned char enable)
{
hi_at_set_check_uart_busy(enable);
}
@@ -1,128 +0,0 @@
/*
* 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.
*/
#include <stdio.h>
#include "hal_wifiiot_gpio.h"
#include "hal_wifiiot_gpio_ex.h"
#include "hi_gpio.h"
#include "hi_io.h"
#include "hal_wifiiot_errno.h"
unsigned int HalGpioInit(void)
{
return hi_gpio_init();
}
unsigned int HalGpioSetDir(HalWifiIotGpioIdx id, HalWifiIotGpioDir dir)
{
return hi_gpio_set_dir((hi_gpio_idx)id, (hi_gpio_dir)dir);
}
unsigned int HalGpioGetDir(HalWifiIotGpioIdx id, HalWifiIotGpioDir *dir)
{
return hi_gpio_get_dir((hi_gpio_idx)id, (hi_gpio_dir *)dir);
}
unsigned int HalGpioSetOutputVal(HalWifiIotGpioIdx id, HalWifiIotGpioValue val)
{
return hi_gpio_set_ouput_val((hi_gpio_idx)id, (hi_gpio_value)val);
}
unsigned int HalGpioGetOutputVal(HalWifiIotGpioIdx id, HalWifiIotGpioValue *val)
{
return hi_gpio_get_output_val((hi_gpio_idx)id, (hi_gpio_value *)val);
}
unsigned int HalGpioGetInputVal(HalWifiIotGpioIdx id, HalWifiIotGpioValue *val)
{
return hi_gpio_get_input_val((hi_gpio_idx)id, (hi_gpio_value *)val);
}
unsigned int HalGpioRegisterIsrFunc(HalWifiIotGpioIdx id, HalWifiIotGpioIntType intType,
HalWifiIotGpioIntPolarity intPolarity, HalGpioIsrCallbackFunc func, char *arg)
{
return hi_gpio_register_isr_function((hi_gpio_idx)id, (hi_gpio_int_type)intType, (hi_gpio_int_polarity)intPolarity,
(gpio_isr_callback)func, arg);
}
unsigned int HalGpioUnregisterIsrFunc(HalWifiIotGpioIdx id)
{
return hi_gpio_unregister_isr_function((hi_gpio_idx)id);
}
unsigned int HalGpioSetIsrMask(HalWifiIotGpioIdx id, unsigned char mask)
{
return hi_gpio_set_isr_mask((hi_gpio_idx)id, (hi_bool)mask);
}
unsigned int HalGpioSetIsrMode(HalWifiIotGpioIdx id, HalWifiIotGpioIntType intType,
HalWifiIotGpioIntPolarity intPolarity)
{
return hi_gpio_set_isr_mode((hi_gpio_idx)id, (hi_gpio_int_type)intType, (hi_gpio_int_polarity)intPolarity);
}
unsigned int HalGpioDeinit(void)
{
return hi_gpio_deinit();
}
unsigned int HalIoSetPull(HalWifiIotIoName id, HalWifiIotIoPull val)
{
if (id == HAL_WIFI_IOT_IO_NAME_MAX) {
return HAL_WIFI_IOT_ERR_GPIO_INVALID_PARAMETER;
}
return hi_io_set_pull((hi_io_name)id, (hi_io_pull)val);
}
unsigned int HalIoSetFunc(HalWifiIotIoName id, unsigned char val)
{
if (id == HAL_WIFI_IOT_IO_NAME_MAX) {
return HAL_WIFI_IOT_ERR_GPIO_INVALID_PARAMETER;
}
return hi_io_set_func((hi_io_name)id, val);
}
unsigned int HalIoGetPull(HalWifiIotIoName id, HalWifiIotIoPull *val)
{
if (id == HAL_WIFI_IOT_IO_NAME_MAX) {
return HAL_WIFI_IOT_ERR_GPIO_INVALID_PARAMETER;
}
return hi_io_get_pull((hi_io_name)id, (hi_io_pull *)val);
}
unsigned int HalIoGetFunc(HalWifiIotIoName id, unsigned char *val)
{
if (id == HAL_WIFI_IOT_IO_NAME_MAX) {
return HAL_WIFI_IOT_ERR_GPIO_INVALID_PARAMETER;
}
return hi_io_get_func((hi_io_name)id, val);
}
unsigned int HalIOGetDriverStrength(HalWifiIotIoName id, HalWifiIotIoDriverStrength *val)
{
if (id == HAL_WIFI_IOT_IO_NAME_MAX) {
return HAL_WIFI_IOT_ERR_GPIO_INVALID_PARAMETER;
}
return hi_io_get_driver_strength((hi_io_name)id, (hi_io_driver_strength *)val);
}
unsigned int HalIOSetDriverStrength(HalWifiIotIoName id, HalWifiIotIoDriverStrength val)
{
if (id == HAL_WIFI_IOT_IO_NAME_MAX) {
return HAL_WIFI_IOT_ERR_GPIO_INVALID_PARAMETER;
}
return hi_io_set_driver_strength((hi_io_name)id, (hi_io_driver_strength)val);
}
@@ -1,58 +0,0 @@
/*
* 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.
*/
#include "hi_i2c.h"
#include "hal_wifiiot_i2c.h"
#include "hal_wifiiot_i2c_ex.h"
unsigned int HalI2cWrite(HalWifiIotI2cIdx id, unsigned short deviceAddr, const HalWifiIotI2cData *i2cData)
{
return hi_i2c_write((hi_i2c_idx)id, deviceAddr, (const hi_i2c_data *)i2cData);
}
unsigned int HalI2cRead(HalWifiIotI2cIdx id, unsigned short deviceAddr, const HalWifiIotI2cData *i2cData)
{
return hi_i2c_read((hi_i2c_idx)id, deviceAddr, (const hi_i2c_data *)i2cData);
}
unsigned int HalI2cInit(HalWifiIotI2cIdx id, unsigned int baudrate)
{
return hi_i2c_init((hi_i2c_idx)id, baudrate);
}
unsigned int HalI2cDeinit(HalWifiIotI2cIdx id)
{
return hi_i2c_deinit((hi_i2c_idx)id);
}
unsigned int HalI2cSetBaudrate(HalWifiIotI2cIdx id, unsigned int baudrate)
{
return hi_i2c_set_baudrate((hi_i2c_idx)id, baudrate);
}
unsigned int HalI2cWriteread(HalWifiIotI2cIdx id, unsigned short deviceAddr, const HalWifiIotI2cData *i2cData)
{
return hi_i2c_writeread((hi_i2c_idx)id, deviceAddr, (const hi_i2c_data *)i2cData);
}
void HalI2cRegisterResetBusFunc(HalWifiIotI2cIdx id, HalWifiIotI2cFunc pfn)
{
hi_i2c_func hiFun;
hiFun.prepare_func = pfn.prepareFunc;
hiFun.reset_func = pfn.resetFunc;
hiFun.restore_func = pfn.restoreFunc;
return hi_i2c_register_reset_bus_func((hi_i2c_idx)id, hiFun);
}
@@ -1,39 +0,0 @@
/*
* 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.
*/
#include "hi_types_base.h"
#include "hi_i2s.h"
#include "hal_wifiiot_i2s.h"
unsigned int HalI2sInit(const HalWifiIotI2sAttribute *i2sAttribute)
{
return hi_i2s_init((const hi_i2s_attribute *)i2sAttribute);
}
unsigned int HalI2sDeinit(void)
{
return hi_i2s_deinit();
}
unsigned int HalI2sWrite(unsigned char *wrData, unsigned int wrLen, unsigned int timeOutMs)
{
return hi_i2s_write(wrData, wrLen, timeOutMs);
}
unsigned int HalI2sRead(unsigned char *rdData, unsigned int rdLen, unsigned int timeOutMs)
{
return hi_i2s_read(rdData, rdLen, timeOutMs);
}
@@ -1,29 +0,0 @@
/*
* 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.
*/
#include "hi_time.h"
#include "hi_task.h"
#include "hal_wifiiot_kal.h"
BSP_RAM_TEXT_SECTION void HalKalTickRegisterCallback(HalTickIdleKalCallback cb)
{
hi_tick_register_callback(cb);
}
void HalKalThreadRegisterIdleCallback(HalTickIdleKalCallback cb)
{
hi_task_register_idle_callback(cb);
}
@@ -1,133 +0,0 @@
/*
* 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.
*/
#include "hal_wifiiot_sdio.h"
#include <unistd.h>
#include "hi_sdio_device.h"
#include "hal_wifiiot_errno.h"
#define HAL_SDIO_INIT_TIMEOUT 20
#define HAL_SDIO_INIT_SLEEPTIME 1
unsigned int HalSdioInit(void)
{
int timeOut = HAL_SDIO_INIT_TIMEOUT;
while (timeOut) {
if (hi_sdio_host_clk_ready()) {
return hi_sdio_init();
}
timeOut--;
sleep(HAL_SDIO_INIT_SLEEPTIME);
}
return HAL_WIFI_IOT_FAILURE;
}
unsigned int HalSdioReinit(void)
{
int timeOut = HAL_SDIO_INIT_TIMEOUT;
while (timeOut) {
if (hi_sdio_host_clk_ready()) {
return hi_sdio_reinit();
}
timeOut--;
sleep(HAL_SDIO_INIT_SLEEPTIME);
}
return HAL_WIFI_IOT_FAILURE;
}
void HalSdioSoftReset(void)
{
hi_sdio_soft_reset();
}
unsigned int HalSdioRegisterCallback(const HalWifiIotSdioIntcallback *callbackFunc)
{
return hi_sdio_register_callback((const hi_sdio_intcallback *)callbackFunc);
}
unsigned int HalSdioCompleteSend(unsigned char *admaTable, unsigned int admaIndex)
{
return hi_sdio_complete_send(admaTable, admaIndex);
}
unsigned int HalSdioSetPadAdmatab(unsigned int padlen, unsigned char *admatable, unsigned int admaIndex)
{
return hi_sdio_set_pad_admatab(padlen, admatable, admaIndex);
}
unsigned int HalSdioWriteExtinfo(HalWifiIotSdioExtendFunc *extFunc)
{
return hi_sdio_write_extendinfo((hi_sdio_extendfunc *)extFunc);
}
void HalSdioSendData(unsigned int xferBytes)
{
return hi_sdio_send_data(xferBytes);
}
unsigned int HalSdioSetAdmatable(unsigned char *admatable, unsigned int admaIndex,
const unsigned int *dataAddr, unsigned int dataLen)
{
return hi_sdio_set_admatable(admatable, admaIndex, dataAddr, dataLen);
}
unsigned int HalSdioSchedMsg(void)
{
return hi_sdio_sched_msg();
}
unsigned int HalSdioSendSyncMsg(unsigned int msg)
{
return hi_sdio_send_sync_msg(msg);
}
unsigned int HalSdioSendMsgAck(unsigned int msg)
{
return hi_sdio_send_msg_ack(msg);
}
unsigned int HalSdioProcessMsg(unsigned int sendMsg, unsigned int clearMsg)
{
return hi_sdio_process_message(sendMsg, clearMsg);
}
unsigned int HalSdioIsPendingMsg(unsigned int msg)
{
return hi_sdio_is_pending_message(msg);
}
unsigned int HalSdioIsSendingMsg(unsigned int msg)
{
return hi_sdio_is_sending_message(msg);
}
HalWifiIotSdioExtendFunc *HalSdioGetExtendInfo(void)
{
return (HalWifiIotSdioExtendFunc *)hi_sdio_get_extend_info();
}
void HalSdioRegisterNotifyMessageCallback(HalNotifyHostMessageEvent msgEventCallback)
{
return hi_sdio_register_notify_message_callback(msgEventCallback);
}
void HalSdioSetPowerdownWhenDeepSleep(unsigned char powerDown)
{
return hi_sdio_set_powerdown_when_deep_sleep(powerDown);
}
@@ -1,84 +0,0 @@
/*
* 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.
*/
#include "hal_wifiiot_spi.h"
#include <stdio.h>
#include "hi_spi.h"
unsigned int HalSpiSlaveWrite(HalWifiIotSpiIdx spiId, char *writeData, unsigned int byteLen, unsigned int timeOutMs)
{
return hi_spi_slave_write((hi_spi_idx)spiId, writeData, byteLen, timeOutMs);
}
unsigned int HalSpiSlaveRead(HalWifiIotSpiIdx spiId, char *readData, unsigned int byteLen, unsigned int timeOutMs)
{
return hi_spi_slave_read((hi_spi_idx)spiId, readData, byteLen, timeOutMs);
}
unsigned int HalSpiHostWrite(HalWifiIotSpiIdx spiId, char *writeData, unsigned int byteLen)
{
return hi_spi_host_write((hi_spi_idx)spiId, writeData, byteLen);
}
unsigned int HalSpiHostRead(HalWifiIotSpiIdx spiId, char *readData, unsigned int byteLen)
{
return hi_spi_host_read((hi_spi_idx)spiId, readData, byteLen);
}
unsigned int HalSpiHostWriteread(HalWifiIotSpiIdx spiId, char *writeData, char *readData, unsigned int byteLen)
{
return hi_spi_host_writeread((hi_spi_idx)spiId, writeData, readData, byteLen);
}
unsigned int HalSpiSetBasicInfo(HalWifiIotSpiIdx spiId, const HalWifiIotSpiCfgBasicInfo *param)
{
return hi_spi_set_basic_info((hi_spi_idx)spiId, (const hi_spi_cfg_basic_info *)param);
}
unsigned int HalSpiInit(HalWifiIotSpiIdx spiId, HalWifiIotSpiCfgInitParam initParam,
const HalWifiIotSpiCfgBasicInfo *param)
{
hi_spi_cfg_init_param hiInitParam;
hiInitParam.is_slave = initParam.isSlave;
hiInitParam.pad = initParam.pad;
return hi_spi_init((hi_spi_idx)spiId, hiInitParam, (const hi_spi_cfg_basic_info *)param);
}
unsigned int HalSpiDeinit(HalWifiIotSpiIdx spiId)
{
return hi_spi_deinit((hi_spi_idx)spiId);
}
unsigned int HalSpiSetIrqMode(HalWifiIotSpiIdx spiId, unsigned char irqEn)
{
return hi_spi_set_irq_mode((hi_spi_idx)spiId, irqEn);
}
unsigned int HalSpiSetDmaMode(HalWifiIotSpiIdx spiId, unsigned char dmaEn)
{
return hi_spi_set_dma_mode((hi_spi_idx)spiId, dmaEn);
}
unsigned int HalSpiRegisterUsrFunc(HalWifiIotSpiIdx spiId, HalSpiIsrFunc prepareF, HalSpiIsrFunc restoreF)
{
return hi_spi_register_usr_func((hi_spi_idx)spiId, prepareF, restoreF);
}
unsigned int HalSpiSetLoopBackMode(HalWifiIotSpiIdx spiId, unsigned char lbEn)
{
return hi_spi_set_loop_back_mode((hi_spi_idx)spiId, lbEn);
}
@@ -1,68 +0,0 @@
/*
* 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.
*/
#include "hal_wifiiot_uart.h"
#include <stdio.h>
#include "hi_uart.h"
unsigned int HalUartInit(HalWifiIotUartIdx id, const HalWifiIotUartAttribute *param,
const HalWifiIotUartExtraAttr *extraAttr)
{
return hi_uart_init((hi_uart_idx)id, (const hi_uart_attribute *)param, (const hi_uart_extra_attr *)extraAttr);
}
int HalUartRead(HalWifiIotUartIdx id, unsigned char *data, unsigned int dataLen)
{
return hi_uart_read((hi_uart_idx)id, data, dataLen);
}
int HalUartWrite(HalWifiIotUartIdx id, const unsigned char *data, unsigned int dataLen)
{
return hi_uart_write((hi_uart_idx)id, data, dataLen);
}
unsigned int HalUartDeinit(HalWifiIotUartIdx id)
{
return hi_uart_deinit((hi_uart_idx)id);
}
unsigned int HalUartSetFlowCtrl(HalWifiIotUartIdx id, HalWifiIotFlowCtrl flowCtrl)
{
return hi_uart_set_flow_ctrl((hi_uart_idx)id, (hi_flow_ctrl)flowCtrl);
}
unsigned int HalUartIsBufEmpty(HalWifiIotUartIdx id, unsigned char *empty)
{
return hi_uart_is_buf_empty((hi_uart_idx)id, (hi_bool *)empty);
}
int HalUartWriteImmediately(HalWifiIotUartIdx id, const unsigned char *data, unsigned int dataLen)
{
return hi_uart_write_immediately((hi_uart_idx)id, data, dataLen);
}
unsigned int HalUartGetAttribute(HalWifiIotUartIdx id, HalWifiIotUartAttribute *attr,
HalWifiIotUartExtraAttr *extraAttr)
{
return hi_uart_get_attribute((hi_uart_idx)id, (hi_uart_attribute *)attr, (hi_uart_extra_attr *)extraAttr);
}
unsigned int HalUartIsBusy(HalWifiIotUartIdx id, unsigned char *busy)
{
return hi_uart_is_busy((hi_uart_idx)id, (hi_bool *)busy);
}
+23
View File
@@ -0,0 +1,23 @@
# 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/lite/config/component/lite_component.gni")
static_library("hal_update_static") {
sources = [ "hal_hota_board.c" ]
include_dirs = [
"//base/update/ota_lite/hals",
"//base/update/ota_lite/interfaces/kits",
"//device/hisilicon/hispark_pegasus/sdk_liteos/include",
]
}
@@ -0,0 +1,96 @@
/*
* 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.
*/
#include "hal_hota_board.h"
#include "hi_upg_api.h"
#include "stdio.h"
int HotaHalInit(void)
{
hi_u32 result = hi_upg_init();
if (result != HI_ERR_SUCCESS && result != HI_ERR_UPG_INITILIZATION_ALREADY) {
printf("hi_upg_init Failed.Result = %x.\r\n", result);
return OHOS_FAILURE;
}
return OHOS_SUCCESS;
}
int HotaHalGetUpdateIndex(unsigned int *index)
{
if (hi_upg_get_file_index((hi_u8 *)index) != HI_ERR_SUCCESS) {
printf("get upgrade index error\r\n");
return OHOS_FAILURE;
}
return OHOS_SUCCESS;
}
int HotaHalDeInit(void)
{
hi_u32 result = hi_upg_stop();
if (result != HI_ERR_SUCCESS) {
printf("hi_upg_stop Failed.Result = %x.\r\n", result);
return OHOS_FAILURE;
}
return OHOS_SUCCESS;
}
int HotaHalRead(HotaPartition partition, unsigned int offset, unsigned int bufLen, unsigned char *buffer)
{
if ((buffer == NULL) || (bufLen == 0)) {
return OHOS_FAILURE;
}
if (hi_upg_get_content(offset, buffer, bufLen) != HI_ERR_SUCCESS) {
printf("get ota content error! Partition: %d\r\n", partition);
return OHOS_FAILURE;
}
return OHOS_SUCCESS;
}
int HotaHalWrite(HotaPartition partition, unsigned char *buffer, unsigned int offset, unsigned int buffLen)
{
if (partition == PARTITION_INFO_COMP) {
printf("partition == PARTITION_INFO_COMP, skip it.");
return OHOS_SUCCESS;
}
hi_u32 result = hi_upg_transmit(offset, buffer, buffLen);
if (result != HI_ERR_SUCCESS) {
printf("hi_upg_transmit failed. retCode = %x.\r\n", result);
return OHOS_FAILURE;
}
return OHOS_SUCCESS;
}
int HotaHalRestart(void)
{
hi_upg_finish_with_cache();
return OHOS_SUCCESS;
}
int HotaHalSetBootSettings(void)
{
hi_u32 result = hi_upg_transmit_finish_save_cache();
if (result != HI_ERR_SUCCESS) {
printf("hi_upg_transmit_finish failed. retCode = %x.\r\n", result);
return OHOS_FAILURE;
}
return OHOS_SUCCESS;
}
int HotaHalRollback(void)
{
return OHOS_SUCCESS;
}
+22 -24
View File
@@ -1,24 +1,22 @@
# 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/lite/config/component/lite_component.gni")
static_library("hal_file_static") {
sources = [
"src/hal_file.c",
]
include_dirs = [
"//utils/native/lite/hals/file",
"//verdor/hisi/hi3861/hi3861/include",
]
}
# 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/lite/config/component/lite_component.gni")
static_library("hal_file_static") {
sources = [ "src/hal_file.c" ]
include_dirs = [
"//utils/native/lite/hals/file",
"//device/hisilicon/hispark_pegasus/sdk_liteos/include",
]
}
Regular → Executable
+29 -1
View File
@@ -1,4 +1,32 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
lite_component("kal") {
+30 -2
View File
@@ -1,11 +1,39 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
static_library("cmsis") {
sources = [ "cmsis_liteos.c" ]
include_dirs = [
"//vendor/hisi/hi3861/hi3861_adapter/kal/cmsis",
"//device/hisilicon/hispark_pegasus/hi3861_adapter/kal/cmsis",
"//third_party/bounds_checking_function/include",
]
+201
View File
@@ -0,0 +1,201 @@
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
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
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.
@@ -0,0 +1,10 @@
[
{
"Name" : "CMSIS",
"License" : "Apache License V2.0",
"License File" : "LICENSE.txt",
"Version Number" : "5.7.0",
"Upstream URL" : "http://www.arm.com/zh/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php",
"Description" : "The Cortex Microcontroller Software Interface Standard (CMSIS) is a vendor-independent hardware abstraction layer for microcontrollers that are based on Arm® Cortex® processors"
}
]
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
View File
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+29 -1
View File
@@ -1,4 +1,32 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/lite/config/component/lite_component.gni")
static_library("posix") {
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+3 -9
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -34,16 +34,10 @@
#include_next <limits.h>
#ifdef __LITEOS__
#ifndef LOS_TASK_MIN_STACK_SIZE
#define LOS_TASK_MIN_STACK_SIZE LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE
#endif
#ifndef PTHREAD_STACK_MIN
#ifdef __LITEOS__
#define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE
#endif
#endif
#endif
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+10 -3
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -71,6 +71,9 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
}
size_t tmpLen = strlen(cwd) + strlen(path) + 4; // three '/' and one '\0'
if (tmpLen <= 0) {
return 0;
}
char *tmpBuf = (char *)malloc(tmpLen);
if (tmpBuf == NULL) {
return 0;
@@ -134,11 +137,15 @@ static size_t GetCanonicalPath(const char *cwd, const char *path, char *buf, siz
int open(const char *file, int oflag, ...)
{
unsigned flags = O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_LARGEFILE | O_TRUNC | O_EXCL | O_DIRECTORY;
if ((unsigned)oflag & ~flags) {
if (((unsigned)oflag & ~flags) || (file == NULL)) {
errno = EINVAL;
return -1;
}
size_t pathLen = strlen(file) + 1;
if (pathLen <= 0) {
errno = EINVAL;
return -1;
}
char *canonicalPath = (char *)malloc(pathLen);
if (!canonicalPath) {
errno = ENOMEM;
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+8 -4
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -102,7 +102,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
taskInitParam.auwArgs[0] = (UINT32)(UINTPTR)startRoutine;
taskInitParam.auwArgs[1] = (UINT32)(UINTPTR)arg;
if (LOS_TaskCreate(&taskID, &taskInitParam) != LOS_OK) {
if (LOS_TaskCreateOnly(&taskID, &taskInitParam) != LOS_OK) {
free(taskInitParam.pcName);
return EINVAL;
}
@@ -110,6 +110,8 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
/* set pthread default name */
(void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID);
(void)LOS_TaskResume(taskID);
*thread = (pthread_t)taskID;
return 0;
}
@@ -236,7 +238,9 @@ int pthread_setname_np(pthread_t thread, const char *name)
if (strnlen(name, PTHREAD_NAMELEN) >= PTHREAD_NAMELEN) {
return ERANGE;
}
(void)strcpy_s(taskName, PTHREAD_NAMELEN, name);
if (strcpy_s(taskName, PTHREAD_NAMELEN, name) != 0) {
return ERANGE;
}
return 0;
}
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
+35
View File
@@ -0,0 +1,35 @@
# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved.
import("//build/lite/config/component/lite_component.gni")
import("//build/lite/config/subsystem/lite_subsystem.gni")
declare_args() {
enable_hos_vendor_wifiiot_xts = false
}
lite_subsystem("wifiiot_sdk") {
subsystem_components = [ ":sdk" ]
}
build_ext_component("run_wifiiot_scons") {
exec_path = rebase_path(".", root_build_dir)
outdir = rebase_path(root_out_dir)
command = "sh hm_build.sh $outdir"
deps = [
":sdk",
"//base/security/deviceauth/frameworks/deviceauth_lite:hichainsdk",
"//build/lite:ohos",
]
if (enable_hos_vendor_wifiiot_xts) {
deps += [ "//build/lite/config/subsystem/xts:xts" ]
}
}
lite_component("sdk") {
features = []
deps = [
"//build/lite/config/component/cJSON:cjson_static",
"//device/hisilicon/hispark_pegasus/hi3861_adapter/kal",
]
}
View File
+3687
View File
File diff suppressed because it is too large Load Diff
View File
View File
View File
View File
@@ -24,7 +24,7 @@
#include <hi_crash.h>
#include <hi_sal.h>
#include <hi_shell.h>
#include <hos_init.h>
#include <ohos_init.h>
#if defined(CONFIG_AT_COMMAND) || defined(CONFIG_FACTORY_TEST_MODE)
#include <hi_at.h>
#endif
+1 -1
View File
@@ -20,7 +20,7 @@
#define CODEC_DEBUG
#ifdef CODEC_DEBUG
#define codec_print(ftm...) do { printf(ftm); printf("\r\n"); } while (0);
#define codec_print(ftm...) do {printf(ftm);printf("\r\n");} while (0);
#else
#define codec_print(ftm...)
#endif

Some files were not shown because too many files have changed in this diff Show More