当前位置:网站首页>sns_sensor_instance_api
sns_sensor_instance_api
2022-07-23 14:46:00 【哈哈哈,少年】
//
如图所示:
spl07_inst_init 这个 函数是在什么地方开始执行的呢…

当然 对于这种确定函数在哪里调用的话,有种通用的方法:就是打印堆栈,然后分析elf 文件,就可以找的出来。但是 高通的 adsp 编译出来的 elf 文件,不知道怎样解析出来…
尝试用 objdump 或者 arm的 objdump工具 都解析不出来.
瞬间就卡主了 ???
还好,在网上看到了一篇这个,就记录下…
看下高通的文档的
instance 是 由 客户端(也可以是 sensor ) 创建的…
sns_sensor_init_fw
看下这个函数
sns_rc
sns_sensor_init_fw(void)
{
.....
sensor_cb = (sns_sensor_cb)
{
.struct_len = sizeof(sensor_cb),
.get_service_manager = &get_service_manager,
.get_sensor_instance = &get_sensor_instance,
.create_instance = &sns_sensor_instance_init,
.remove_instance = &sns_sensor_instance_deinit,
.get_library_sensor = &get_library_sensor,
.get_registration_index = &get_registration_index,
.create_instance_v2 = &sns_sensor_instance_init_v2,
};
......
}
create_instance 这个我们在点进去 看下
看下 create_instance 这个注释:
分配和初始化 sensor 的 实例
会调用 init . 不知道是 哪个 init ???
因为
.create_instance = &sns_sensor_instance_init,
进去看下 sns_sensor_instance_init
SNS_SECTION(".text.sns") sns_sensor_instance*
sns_sensor_instance_init(sns_sensor *sensor, uint32_t state_len)
{
return sns_sensor_instance_init_v2(sensor, state_len, 0);
}
在看下 sns_sensor_instance_init_v2
SNS_SECTION(".text.sns") sns_sensor_instance*
sns_sensor_instance_init_v2(sns_sensor *sensor, uint32_t state_len,
uint32_t state_len_ni)
{
...... // sensor 的数量
uint32_t sensors_cnt = fw_sensor->library->sensors.cnt;
.... 绑定 instance.cb
instance->instance.cb = &instance_cb;
// 初始化 一些链表...
// instance->client_req_lists 为空 ,instance->data_streams 为空
sns_isafe_list_init(&instance->client_req_lists);
sns_isafe_list_init(&instance->data_streams);
// 用 instance 初始化 instance->list_entry
sns_isafe_list_item_init(&instance->list_entry, instance);
...... 不知道干啥的
for(uint8_t i = 0; i < ARR_SIZE(state_init); i++)
if(NULL != state_init[i].init)
state_init[i].init(instance, fw_sensor);
// ---- 这个 会调用到 具体驱动的
// 比如: sns_sensor_instance_api sns_see_spl07_sensor_instance_api
rv = sensor->instance_api->init(
(sns_sensor_instance*)instance, sensor->state);
}
那么问题来了,是谁会调用呢?
spl07_sensor_set_client_request 这个函数 里面有
create_instance : 会进入上面讲的
instance = this->cb->create_instance(this, sizeof(spl07_instance_state));
rv = sensor->instance_api->init(
(sns_sensor_instance*)instance, sensor->state);
更新传感器的客户端请求 (.set_client_request())
这里可以 看出 instance 是 sensor 的 实例,你有需要,我就创建…
所以 这个 也是属于 sns_sensor_api 里面的
边栏推荐
- What about the new retail e-commerce platform? Can we realize the digital transformation of traditional retail enterprises?
- Can debug/release versions of dynamic library *.dll files be mixed (cross used)?
- 封玩家IP和机器码以及解开被封的教程
- Kubernetes kubelet hard core knowledge architecture
- 蓝桥杯真题:卡片[通俗易懂]
- 线程池,我是谁?我在哪儿?
- 食品安全|喝鲜奶可能感染结核病?带你了解什么是牛奶灭菌
- 食品安全|听起来很健康的植物肉,是什么来头?
- 日志瘦身骚操作:从5G优化到1G!
- Food safety chocolate is also true or false? How much do you know about it
猜你喜欢

Sorting - introduction, code ideas, usage suggestions, code implementation -1

12张图+6K字图解ZGC垃圾回收器及调优技巧
![[introduction series of redis] data types and related commands of redis](/img/de/7322362f4a27acd264c29f325e45a2.png)
[introduction series of redis] data types and related commands of redis

SQL报错盲注详解

Software configuration | Anaconda download, installation, environment configuration and uninstall

【mysql集群故障恢复】

keras——accuracy_score公式

Pymoo学习 (2):带约束的双目标优化问题

OpenCV求两个区域的交集

封玩家IP和机器码以及解开被封的教程
随机推荐
Pymoo learning (3): use multi-objective optimization to find the set of optimal solutions
可视化机房管理
Function secondary development / plug-in development of JMeter (detailed version)
Explain SQL optimization in detail
Food safety | what is the origin of plant meat that sounds very healthy?
[MySQL Cluster fault recovery]
树
简单了解首个 EVM 等效的 zkEVM Polygon 为何全力押注
LQR 控制学习-LQR控制 MATLAB官方教程-LQR 控制器_状态空间系统Matlab/Simulink建模分析
Food safety chocolate is also true or false? How much do you know about it
Failure analysis and solution of vscode PIO creation project
转账业务追加日志(事务的传播行为).
股票历史数据下载接口汇总(动态更新)
[mysql] I. MySQL starts
日期格式化
食品安全|巧克力也有真假?关于它你了解多少
深度学习学习记录-优化器的学习率的更新
oracle 数据库 11C 之后版本使用 memory_target 自动内存管理
Mysql: MySQL problem that is not a MySQL problem
Kubernetes kubelet manages pod core process