当前位置:网站首页>[semidrive source code analysis] [x9 chip startup process] 26 - LK of R5 safetyos_ INIT_ LEVEL_ Target phase code flow analysis (TP drvier, audio server initialization)
[semidrive source code analysis] [x9 chip startup process] 26 - LK of R5 safetyos_ INIT_ LEVEL_ Target phase code flow analysis (TP drvier, audio server initialization)
2022-06-12 13:44:00 【CielleeX】
【SemiDrive Source code analysis 】【X9 Chip startup process 】26 - R5 SafetyOS And LK_INIT_LEVEL_TARGET Stage code flow analysis (TP Drvier、Audio Server initialization )
Ben SemiDrive Source code analysis And Yocto Source code analysis The series is summarized below :
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】01 - yocto/base Directory source code analysis ( Compilation environment initialization process )》
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】02 - yocto/meta-openembedded Directory source code analysis 》
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】03 - yocto/meta-semidrive Contents and Yocto Kernel Compile process analysis ( On )》
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】04 - yocto/meta-semidrive Contents and Yocto Kernel Compile process analysis ( Next )》
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】05 - Look for it Yocto Kernel All during compilation Task Where is the source code defined ?》
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】06 - Kernel Compile generated Image.bin、Image_nobt.dtb、modules.tgz How are these three files generated ?》
- 《【SemiDrive Source code analysis 】【Yocto Source code analysis 】07 - core-image-base-x9h_ref_serdes.rootfs.ext4 How the file system is generated 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】08 - X9 platform lk Directory source code analysis And catalogue 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】09 - X9 Platform system startup process analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】10 - BareMetal_Suite Catalog R5 DIL.bin Bootstrap source code analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】11 - freertos_safetyos Catalog Cortex-R5 DIL2.bin Bootstrap source code analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】12 - freertos_safetyos Catalog Cortex-R5 DIL2.bin And sdm_display_init Display initialization source code analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip driver debugging 】13 - GPIO Configuration method 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】14 - freertos_safetyos Catalog Cortex-R5 SafetyOS/RTOS Workflow analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】15 - freertos_safetyos Catalog R5 SafetyOS And tcpip_init() Code flow analysis 》
- 《【SemiDrive Source code analysis 】【X9 Audio Audio module analysis 】16 - Audio module block diagram and hardware schematic diagram analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】17 - R5 SafetyOS And LK_INIT_LEVEL_PLATFORM Stage code flow analysis ( On )dcf_init Inter core communication initialization 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】18 - R5 SafetyOS And LK_INIT_LEVEL_PLATFORM Phase code flow ( Next ) start-up QNX、Android》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】19 - MailBox Introduction to inter core communication mechanism ( Theory Chapter )》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】20 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And MailBox for RTOS piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】21 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And Mailbox for Linux piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】22 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And RPMSG-VIRTIO Kernel piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】23 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And RPMSG-IPCC Kernel piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】24 - MailBox Inter core communication mechanism related register introduction 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】25 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And RPMSG-IPCC RTOS & QNX piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】26 - R5 SafetyOS And LK_INIT_LEVEL_TARGET Stage code flow analysis (TP Drvier、Audio Server initialization )》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】27 - R5 SafetyOS And .apps Application startup code flow analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】28 - Android Preloader Start process analysis 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】29 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And Property piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】30 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And RPCall piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】31 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And Notify piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】32 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And Socket piece 》
- 《【SemiDrive Source code analysis 】【X9 Chip startup process 】33 - MailBox Introduction to inter core communication mechanism ( Code analysis ) And /dev/vircan piece 》
Some time ago , We are analyzing MailBox, Although not all of them have been analyzed , but MailBox I have almost understood the principle of ,
As the project is about to start , Considering the time is no longer supported to continue the detailed analysis MailBox 了 , So start with this article , Continue the analysis of the regression initialization process , Finish the startup process as soon as possible , as for MailBox Let's see later .
in front 《【SemiDrive Source code analysis 】【X9 Chip startup process 】14 - freertos_safetyos Catalog Cortex-R5 SafetyOS/RTOS Workflow analysis 》 in ,
We analyzed ,R5 SafetyOS And LK_INIT_LEVEL_TARGET The stage mainly runs the following functions :register_touch_driver_entry(),hal_vpu_create_mutex(),cospi_early_init(),hal_crypto_init(),(lk_init_hook)res_fs_init(),(lk_init_hook)audio_server_init()
One 、register_touch_driver_entry() register TP drive
It can be seen that , The touch drive is driven by register_touch_driver() To detect initialization TP Of ,
Registration time , First call get_touch_device(&tsc, &tsc_num); obtain TP Relevant configuration information is saved in tsc[i] in ,
Then call the driver switch probe function , The ginseng tsc[i] Configuration parameters
# buildsystem\rtos\lk_boot\framework\service\input\include\touch_driver.h
#define register_touch_driver(drv) \ static void register_touch_driver_entry(uint level) \ {
\ __register_touch_driver(&drv); \ } \ LK_INIT_HOOK(touch_driver##drv, register_touch_driver_entry, LK_INIT_LEVEL_TARGET)
# buildsystem\rtos\lk_boot\framework\service\input\touch_driver.c
void __register_touch_driver(struct touch_driver *driver)
{
struct ts_board_config *tsc = NULL;
int tsc_num = 0;
get_touch_device(&tsc, &tsc_num);
for (int i = 0; i < tsc_num; i++) {
if (tsc[i].enable && driver->probe && !strcmp(tsc[i].device_name, driver->driver_name))
driver->probe(&tsc[i]);
}
}
1.1 TP Configuration parameters ts_board_config
The following is X9HP default TP Configuration parameters , The following is used LVDS3 and LVDS4 Two interfaces
# buildsystem\rtos\lk_boot\target\reference_x9\safety\touch_device.c
static struct ts_board_config tsc[] = {
{
/*---LVDS4---*/
TS_ENABLE, "goodix", RES_I2C_I2C15, 0x5d,
TS_SUPPORT_CTRLPANEL_MAIN, CONTROLPANEL,
{
1920, 720, 10, 0, 0, 0},
{
false, 12, 0x75, TCA9539_P07},
{
true, TI_SERDES, TI947_SINGLE, TI948, 0x1a, 0x2c, 3, 2},
{
0}, //reset-pin:0 not used yet
{
PortConf_PIN_I2S_MC_SD7, //irq-pin:131
{
0, 0}
}
},
{
/*---LVDS3---*/
TS_DISABLE, "goodix", RES_I2C_I2C14, 0x5d,
TS_SUPPORT_CTRLPANEL_AUX1, ENTERTAINMENT,
{
1920, 720, 10, 0, 0, 0},
{
false, 12, 0x75, TCA9539_P06},
{
false, TI_SERDES, TI947_SINGLE, TI948, 0x0, 0x0, 0, 0},
{
0}, //reset-pin:0 not used yet
{
PortConf_PIN_I2S_MC_SD6, //irq-pin:130
{
0, 0}
}
},
};
Its structure is defined as follows :
# buildsystem\rtos\lk_boot\framework\service\input\include\touch_device.h
struct ts_board_config {
bool enable;
const char *device_name;
u32 res_id;
u16 i2c_addr;
u16 ts_domain_support;
enum DISPLAY_SCREEN screen_id;
struct ts_coord_config coord_config;
struct port_expand_config port_config;
struct ts_serdes_config serdes_config;
struct ts_pin_config reset_pin;
struct ts_pin_config irq_pin;
};
TP Using serial 、 The chip for unthreading is TI947_SINGLE、TI948
# buildsystem\rtos\lk_boot\framework\service\input\include\touch_device.h
enum ts_serdes_type {
TI_SERDES,
TS_SERDES_MAX,
};
enum ts_ser_type {
TI941_SINGLE,
TI941_SECOND,
TI941_DUAL,
TI947_SINGLE,
TI947_SECOND,
TI947_DUAL,
TS_SER_MAX,
};
enum ts_des_type {
TI948,
TS_DES_MAX
};
1.2 TP Configuration parameters
We use goodix.c For example , have a look TP What was done during initialization :
# buildsystem\rtos\lk_boot\exdev\touch\src\goodix.c
static struct touch_driver goodix_driver = {
"goodix",
goodix_probe_device,
};
register_touch_driver(goodix_driver);
We enter goodix_probe_device() function , Start probe initialization :
- Apply and initialize
goodixStructure , analysisdev_irq_pin_numRespectively130and131 - obtain
I2CHandleinstance, Save ingoodix->i2c_handlein - analysis Serial 、 Deserialization
confParameters , Configure the serial deserialization link : CheckserdesWhether the link is connected 、 Can makeTI947_SINGLEchip 、 Write register0x17by0x9e( start-up i2cpass) - Check
serdesWhether the link is connected , adoptI2CDirect reading0x6register , In which the correspondingdesAddress - Reset device , Read the version number .
# buildsystem\rtos\lk_boot\exdev\touch\src\goodix.c
static int goodix_probe_device(const struct ts_board_config *conf)
{
struct goodix_ts_data *goodix = NULL;
// 1. Apply and initialize goodix Structure , analysis dev_irq_pin_num Respectively 130 and 131
goodix = malloc(sizeof(struct goodix_ts_data));
memset(goodix, 0, sizeof(struct goodix_ts_data));
goodix->conf = conf; // reference_x9\safety\touch_device.c
goodix->instance = goodix->conf->ts_domain_support; // 0x5d
goodix->dev_irq = goodix->conf->irq_pin.pin_num; // PortConf_PIN_I2S_MC_SD7:131, PortConf_PIN_I2S_MC_SD6:130
// 2. obtain RES_I2C_I2C15 and RES_I2C_I2C14 Of I2C Handle instance, Save in goodix->i2c_handle in
hal_i2c_creat_handle(&goodix->i2c_handle, goodix->conf->res_id); // RES_I2C_I2C15、RES_I2C_I2C14
=====> instance = hal_i2c_get_instance(i2c_res_glb_idx);
// 3. analysis Serial 、 Deserialization conf Parameters , Configure the serial deserialization link : Check serdes Whether the link is connected 、 Can make TI947_SINGLE chip 、 Write register 0x17 by 0x9e( start-up i2c pass)
if (goodix->conf->serdes_config.enable) {
if (goodix->conf->serdes_config.serdes_type == TI_SERDES) {
enum ts_ser_type ser_type = goodix->conf->serdes_config.ser_type; // TI947_SINGLE
enum ts_des_type des_type = goodix->conf->serdes_config.des_type; // TI948
u16 ser_addr = goodix->conf->serdes_config.ser_addr; // 0x1a
u16 des_addr = goodix->conf->serdes_config.des_addr; // 0x2c
// 4. Check serdes Whether the link is connected , adopt I2C Direct reading 0x6 register , In which the corresponding des Address .
ret = ti_serdes_link_check(goodix->i2c_handle, ser_addr, ser_type, des_addr, des_type);
// 5. Can make TI947_SINGLE chip , Write register 0x1e=0x01
ret = ti_ser_enable_port(goodix->i2c_handle, ser_addr, ser_type);
// 6. Write register 0x17 by 0x9e: start-up i2c pas
ret = ti_ser_enable_i2c_passthrough(goodix->i2c_handle, ser_addr, ser_type);
}
}
// 7. Reset device , Read the version number .
do {
goodix_reset_device(goodix);
if (!goodix_read_version(goodix))
break;
} while (++count < 3);
ret = goodix_firmware_upgrade(goodix);
ret = goodix_config_device(goodix);
goodix->safe_ts_dev = safe_ts_alloc_device();
goodix->safe_ts_dev->instance = goodix->conf->ts_domain_support;
goodix->safe_ts_dev->screen_id = goodix->conf->screen_id;
goodix->safe_ts_dev->vinfo.id = goodix->id;
goodix->safe_ts_dev->vinfo.version = goodix->version;
goodix->safe_ts_dev->vinfo.vendor = goodix->vendor;
goodix->safe_ts_dev->vinfo.name = goodix->conf->device_name;
goodix->safe_ts_dev->vinfo.ser_addr = goodix->conf->serdes_config.ser_addr;
goodix->safe_ts_dev->vinfo.des_addr = goodix->conf->serdes_config.des_addr;
goodix->safe_ts_dev->vinfo.ts_addr = goodix->conf->i2c_addr;
goodix->safe_ts_dev->cinfo.max_touch_num = goodix->conf->coord_config.max_touch_num;
goodix->safe_ts_dev->cinfo.swapped_x_y = goodix->conf->coord_config.swapped_x_y;
goodix->safe_ts_dev->cinfo.inverted_x = goodix->conf->coord_config.inverted_x;
goodix->safe_ts_dev->cinfo.inverted_y = goodix->conf->coord_config.inverted_y;
goodix->safe_ts_dev->set_inited = goodix_set_inited;
goodix->safe_ts_dev->vendor_priv = goodix;
ret = safe_ts_register_device(goodix->safe_ts_dev);
if (ret) {
safe_ts_delete_device(goodix->safe_ts_dev);
dprintf(CRITICAL, "%s: safe_ts_register_device fail, instance=%#x\n",
__func__, goodix->instance);
goto err;
}
dprintf(ALWAYS, "%s, instance=%#x, done ok\n", __func__, goodix->instance);
return 0;
err1:
hal_i2c_release_handle(goodix->i2c_handle);
err:
free(goodix);
return -1;
}
Two 、hal_vpu_create_mutex()
3、 ... and 、cospi_early_init()
Four 、hal_crypto_init()
5、 ... and 、(lk_init_hook)res_fs_init()
6、 ... and 、(lk_init_hook)audio_server_init()
边栏推荐
- Encryptor and client authenticate with each other
- Script引入CDN链接提示net::ERR_FILE_NOT_FOUND问题
- 安装MySQL时出错,照着下面这个链接,做到cmd就不行了
- 高通平台开发系列讲解(协议篇)QMI简单介绍及使用方法
- 1414: [17noip popularization group] score
- Implementing tensorflow deep learning framework similarflow with numpy
- 关于#SQLite写注册功能时,数据表查询出错#的问题,如何解决?
- Cocoapods的相关知识点
- [WUSTCTF2020]颜值成绩查询-1
- 2063: [example 1.4] cattle eat grass
猜你喜欢

简历 NFT 平台 TrustRecruit 加入章鱼网络成为候选应用链

Implementing pytorch style deep learning framework similartorch with numpy

Paw 高级使用指南

【刷题篇】抽牌获胜的概率

Tensorrt, onnx to tensorrt in mmclas

一种快速创建测试窗口的方法

Xcode debugging OpenGLES

xcode 调试openGLES

torch_ About the geometric Mini batch

Octopus network progress monthly report | may 1-May 31, 2022
随机推荐
618 entered the second half of the period, apple occupied the high-end market, and the domestic mobile phones finally undercut the price competition
Informatics Olympiad all in one 2059: [example 3.11] buy a pen
Explanation of static and extern keywords
Software construction 03 regular expression
Codeforces 1638 B. odd swap sort - tree array, no, simple thinking
AWLive 结构体的使用
C language array and pointer
简历 NFT 平台 TrustRecruit 加入章鱼网络成为候选应用链
Script引入CDN链接提示net::ERR_FILE_NOT_FOUND问题
基于华为云鲲鹏弹性云服务器ECS部署openGauss数据库【这次高斯不是数学家】
NVIDIA Jetson Nano Developer Kit 入门
Codeforces 1637 A. sorting parts - simple thinking
Innovation training (XII) project summary
Cdeforces 1638 C. inversion graph - simple thinking
GPUImage链式纹理的简单实现
1414: [17noip popularization group] score
Wechat web developer tools tutorial, web development issues
Pre research of image scanning tool
C language implementation of string and memory library functions
Codeforces 1629 A. download more RAM - simple greed