/********************************************************************************************************
* @file mesh_node.c
*
* @brief for TLSR chips
*
* @author telink
* @date Sep. 30, 2010
*
* @par Copyright (c) 2017, Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
* All rights reserved.
*
* 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 "proj_lib/ble/ll/ll.h"
#include "proj_lib/ble/blt_config.h"
#include "proj_lib/sig_mesh/app_mesh.h"
#include "vendor/common/remote_prov.h"
#include "vendor/common/fast_provision_model.h"
#include "vendor/common/app_heartbeat.h"
#include "vendor/common/app_health.h"
#include "vendor/common/directed_forwarding.h"
#include "subnet_bridge.h"
#include "vendor/common/mesh_ota.h"
#include "vendor/common/lighting_model_LC.h"
#include "vendor/common/op_agg_model.h"
#include "vendor/common/solicitation_rpl_cfg_model.h"
#include "version.h"
#include "app_privacy_beacon.h"
#include "proj/mcu/watchdog_i.h"
#include "proj_lib/ble/service/ble_ll_ota.h"
#ifdef WIN32
#include "sig_mesh_json_info.h"
#endif
#if (MI_API_ENABLE)
#include "vendor/common/mi_api/telink_sdk_mesh_api.h"
#endif
#if (ALI_MD_TIME_EN)
#include "user_ali_time.h"
#endif
#if (DU_ENABLE)
#include "user_du.h"
#endif
#if (TLV_ENABLE)
#include "tlv_flash.h"
#endif
#if (__PROJECT_MESH_SWITCH__ && (0 == PM_DEEPSLEEP_RETENTION_ENABLE))
#define MESH_CMD_SNO_SAVE_DELTA (0x04) // can't set too much, becaush of deep sleep
#else
#define MESH_CMD_SNO_SAVE_DELTA (0x80)
#endif
/** @addtogroup Mesh_Common
* @{
*/
#if EXTENDED_ADV_ENABLE
_attribute_no_retention_bss_ rf_packet_adv_t pkt_adv;
#endif
/** @defgroup Mesh_Node
* @brief Mesh Node Code.
* @{
*/
void app_key_del2(mesh_app_key_t *p_appkey);
void check_prov_timeout();
u16 ele_adr_primary = 0; // save in configure server model.
u8 g_ele_cnt = ELE_CNT;
u8 g_bind_key_max = BIND_KEY_MAX;
u8 key_bind_all_ele_en = 0;
u8 node_need_store_misc=1;
u32 node_binding_tick = 0; // key add command also refresh this tick
static u32 mesh_key_addr = FLASH_ADR_MESH_KEY;
static u32 mesh_misc_addr = FLASH_ADR_MISC;
static u32 mesh_adv_tx_cmd_sno_last;
mesh_iv_idx_st_t iv_idx_st = {
/*.cur = */IV_IDX_CUR, // store in big endianness
};
mesh_key_t mesh_key = {{0}}; // not init here to decrease firmware size.
#if FEATURE_LOWPOWER_EN
friend_key_t mesh_fri_key_lpn[NET_KEY_MAX][2];
#else
friend_key_t mesh_fri_key_fn[MAX_LPN_NUM][2];
#endif
#if MD_DF_EN
directed_key_t directed_key[NET_KEY_MAX][2];
#endif
mesh_tid_t mesh_tid;
//#if(__TL_LIB_8258__ || (MCU_CORE_TYPE == MCU_CORE_8258) || (MCU_CORE_TYPE == MCU_CORE_8278))
#if WIN32
u8 my_rf_power_index ; // win32 use
#else
u8 my_rf_power_index = MY_RF_POWER_INDEX; // use in library
u8 tx_bear_extend_en = (MESH_DLE_MODE == MESH_DLE_MODE_EXTEND_BEAR);
#endif
//#endif
/*PTS test*/
u8 pts_test_en = PTS_TEST_EN;
#if (FEATURE_LOWPOWER_EN || GATT_LPN_EN)
u8 proxy_message_between_gatt_and_adv_en = 0;
#else
u8 proxy_message_between_gatt_and_adv_en = FEATURE_PROXY_EN;
#endif
MYFIFO_INIT(mesh_adv_cmd_fifo, sizeof(mesh_cmd_bear_t)+DELTA_EXTEND_AND_NORMAL_ALIGN4_BUF, MESH_ADV_CMD_BUF_CNT);
#if (FEATURE_RELAY_EN || WIN32)
MYFIFO_INIT_NO_RET(mesh_adv_fifo_relay, sizeof(mesh_relay_buf_t)+DELTA_EXTEND_AND_NORMAL_ALIGN4_BUF, MESH_ADV_BUF_RELAY_CNT);
#endif
#if MESH_BLE_NOTIFY_FIFO_EN
#define BLT_NOTIFY_FIFO_SIZE 36 // if need to change, should not use blt_notify_fifo and push blt_txfifo_ directly.
#if __PROJECT_SPIRIT_LPN__
MYFIFO_INIT_NO_RET(blt_notify_fifo, BLT_NOTIFY_FIFO_SIZE, 64);//save retention
#elif (FEATURE_LOWPOWER_EN || GATT_LPN_EN || __PROJECT_MESH_SWITCH__||DU_LPN_EN)
MYFIFO_INIT(blt_notify_fifo, BLT_NOTIFY_FIFO_SIZE, 8);
#else
MYFIFO_INIT(blt_notify_fifo, BLT_NOTIFY_FIFO_SIZE, 64);
#endif
#endif
STATIC_ASSERT(sizeof(mesh_net_key_t) % 16 == 0);
STATIC_ASSERT(sizeof(mesh_app_key_t) % 4 == 0);
STATIC_ASSERT(ARRAY_SIZE(mesh_key.net_key) == ARRAY_SIZE(mesh_fri_key_lpn));
STATIC_ASSERT(ARRAY_SIZE(mesh_key.net_key[0]) == ARRAY_SIZE(mesh_fri_key_lpn[0]));
STATIC_ASSERT(ARRAY_SIZE(mesh_key.net_key[0]) == ARRAY_SIZE(mesh_fri_key_fn[0]));
STATIC_ASSERT(ARRAY_SIZE(mesh_key.net_key[0]) == ARRAY_SIZE(directed_key[0]));
STATIC_ASSERT(NET0 == 0);
STATIC_ASSERT(ELE_CNT <= ELE_CNT_MAX_LIB); // don't cancle this assert
STATIC_ASSERT((NET_KEY_MAX <= 255) && (APP_KEY_MAX <= 255)); // only one byte for array index
STATIC_ASSERT(MD_SERVER_EN || MD_CLIENT_EN);
STATIC_ASSERT((BUILD_VERSION & 0x00FF0000) != 0x00A50000); // because ram[840004] is a special flag which is 0xA5, in cstartup_S.
STATIC_ASSERT((SW_VERSION_SPEC < 16)&&(SW_VERSION_MAJOR < 16)&&(SW_VERSION_MINOR < 16)&&(SW_VERSION_2ND_MINOR < 16));
#if (!WIN32)
#if MESH_DLE_MODE
STATIC_ASSERT(((DLE_LEN_MAX_RX >= MAX_OCTETS_DATA_LEN_EXTENSION)||((DLE_LEN_MAX_RX + 8) % 16 == 0)) && (DLE_LEN_MAX_RX > 40)); // because DLE is 27 if "<=40".
STATIC_ASSERT(((DLE_LEN_MAX_TX >= MAX_OCTETS_DATA_LEN_EXTENSION)||(DLE_LEN_MAX_TX % 4 == 0)) && (DLE_LEN_MAX_TX > 28)); // because DLE is 27 if "<=28".
#endif
#if EXTENDED_ADV_ENABLE
STATIC_ASSERT((MESH_DLE_MODE == MESH_DLE_MODE_EXTEND_BEAR) && (DLE_LEN_MAX_RX == MAX_OCTETS_DATA_LEN_EXTENSION));
#endif
#endif
// composition data struct
#if MD_CFG_CLIENT_EN
#define MD_ID_ARRAY_CFG_CLIENT SIG_MD_CFG_CLIENT,
#else
#define MD_ID_ARRAY_CFG_CLIENT
#endif
#if MD_REMOTE_PROV
#if MD_CLIENT_EN
#define MD_ID_REMOTE_PROV_CLIENT SIG_MD_REMOTE_PROV_CLIENT,
#endif
#if MD_SERVER_EN
#define MD_ID_REMOTE_PROV_SERVER SIG_MD_REMOTE_PROV_SERVER,
#endif
#endif
#ifndef MD_ID_REMOTE_PROV_SERVER
#define MD_ID_REMOTE_PROV_SERVER
#endif
#ifndef MD_ID_REMOTE_PROV_CLIENT
#define MD_ID_REMOTE_PROV_CLIENT
#endif
#define MD_ID_ARRAY_REMOTE_PROV MD_ID_REMOTE_PROV_SERVER MD_ID_REMOTE_PROV_CLIENT
#if MD_PRIVACY_BEA
#if MD_CLIENT_EN
#define MD_ID_PRIVACY_BEA_CLIENT SIG_MD_PRIVATE_BEACON_CLIENT,
#endif
#if MD_SERVER_EN
#define MD_ID_PRIVACY_BEA_SERVER SIG_MD_PRIVATE_BEACON_SERVER,
#endif
#endif
#ifndef MD_ID_PRIVACY_BEA_SERVER
#define MD_ID_PRIVACY_BEA_SERVER
#endif
#ifndef MD_ID_PRIVACY_BEA_CLIENT
#define MD_ID_PRIVACY_BEA_CLIENT
#endif
#if MD_DF_EN
#if MD_CLIENT_EN
#define MD_ID_DF_CFG_CLIENT SIG_MD_DF_CFG_C,
#endif
#if MD_SERVER_EN
#define MD_ID_DF_CFG_SERVER SIG_MD_DF_CFG_S,
#endif
#endif
#ifndef MD_ID_DF_CFG_SERVER
#define MD_ID_DF_CFG_SERVER
#endif
#ifndef MD_ID_DF_CFG_CLIENT
#define MD_ID_DF_CFG_CLIENT
#endif
#if MD_SBR_EN
#if MD_CLIENT_EN
#define MD_ID_BRIDGE_CFG_CLIENT SIG_MD_BRIDGE_CFG_CLIENT,
#endif
#if MD_SERVER_EN
#define MD_ID_BRIDGE_CFG_SERVER SIG_MD_BRIDGE_CFG_SERVER,
#endif
#endif
#ifndef MD_ID_BRIDGE_CFG_SERVER
#define MD_ID_BRIDGE_CFG_SERVER
#endif
#ifndef MD_ID_BRIDGE_CFG_CLIENT
#define MD_ID_BRIDGE_CFG_CLIENT
#endif
#if MD_SAR_EN
#if MD_CLIENT_EN
#define MD_ID_SAR_CFG_CLIENT SIG_MD_SAR_CFG_C,
#endif
#if MD_SERVER_EN
#define MD_ID_SAR_CFG_SERVER SIG_MD_SAR_CFG_S,
#e
没有合适的资源?快使用搜索试试~ 我知道了~
TB-03 二次开发环境搭建指导
共828个文件
h:499个
c:217个
a:27个
1 下载量 36 浏览量
2024-05-16
11:55:52
上传
评论
收藏 6.8MB ZIP 举报
温馨提示
TB二次开发SDK
资源推荐
资源详情
资源评论
收起资源包目录
TB-03 二次开发环境搭建指导 (828个子文件)
libhk_softAuth_8258.a 418KB
libhk_mfi20C_8258.a 415KB
libhk_mfi30_8258.a 415KB
libhk_nonMfi_8258.a 415KB
liblt_8258_mesh.a 242KB
liblt_8278_mesh.a 233KB
liblt_8267_kma_dongle.a 227KB
libsig_mesh_prov_8269.a 203KB
libsig_mesh_prov_825x.a 202KB
libsig_mesh_gw_node_825x.a 202KB
libsig_mesh_monitor.a 197KB
libsig_mesh_8269.a 196KB
libsig_mesh_825x.a 194KB
liblt_8258_mesh_homekit.a 190KB
libsig_mesh_LPN_8269.a 185KB
libsig_mesh_LPN_825x.a 183KB
liblt_8269_mesh.a 166KB
liblt_8269_mesh_16M.a 166KB
micro_ecc_m4f_le.a 124KB
libsoft-fp.a 98KB
stand-auth-cortex-m4f.a 14KB
stand-auth-cortex-m4.a 14KB
stand-auth-cortex-m33f.a 14KB
stand-auth-cortex-m33.a 14KB
stand-auth-cortex-m3.a 14KB
stand-auth-cortex-m0plus.a 14KB
libtangseng_ble_mesh_auth_eclipse_telink.a 932B
mesh_node.c 178KB
app_provison.c 136KB
generic_model.c 111KB
mesh_common.c 107KB
uECC.c 56KB
light.c 48KB
lighting_model.c 48KB
telink_sdk_mible_api.c 45KB
user_du.c 41KB
mible_api.c 39KB
mesh_fn.c 38KB
vendor_model.c 36KB
app.c 36KB
app_att.c 34KB
mesh_lpn.c 33KB
app.c 31KB
dual_mode_adapt.c 29KB
flash.c 28KB
app.c 28KB
user_ali_time.c 27KB
app.c 26KB
gpio_8278.c 26KB
gpio_8258.c 26KB
telink_sdk_mesh_api.c 25KB
usbdesc.c 25KB
lighting_model_LC.c 25KB
reg_simu.c 23KB
app_proxy.c 23KB
app_att.c 22KB
app_att.c 22KB
app_att.c 22KB
app_att.c 22KB
sensors_model.c 22KB
audio.c 21KB
ble_ll_ota.c 21KB
cmd_interface.c 21KB
usb.c 21KB
ccm.c 21KB
fast_provision_model.c 20KB
config_model.c 20KB
cbc.c 20KB
scheduler.c 19KB
audio.c 19KB
keyboard.c 19KB
battery_check_827x.c 19KB
uart.c 18KB
lighting_model_HSL.c 17KB
app.c 17KB
uart.c 17KB
tlv_flash.c 17KB
time_model.c 17KB
aeskey.c 17KB
tl_audio.c 16KB
app.c 16KB
adc.c 15KB
aestab.c 15KB
audio.c 15KB
scene.c 15KB
vendor_model_mi.c 15KB
i2c.c 15KB
i2c.c 14KB
adc.c 14KB
user_ali.c 14KB
battery_check.c 14KB
emi.c 13KB
uart.c 13KB
uart_simu.c 13KB
emi.c 13KB
printf.c 13KB
ctr.c 13KB
factory_reset.c 13KB
tc32.c 13KB
i2c.c 13KB
共 828 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
qq_54193285
- 粉丝: 587
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功