MTK RF参数写入代码操作步骤 (2012-09-25 11:43:10)

本文深入解析了MTK设备中使用的META工具的UpdateParameters项如何读出并保存为.ini文件,详细列举了各个部分的具体参数及其含义,并展示了.ini文件的结构和内容。包括但不限于AFC控制、晶振控制、各频段的RX损耗、功率控制、电池补偿等关键参数。
标签: 

杂谈

分类: 电子信息

 

一、     使用MTK提供的META工具的Update Parameters项读出,存为.ini文件。

二、     .ini文件有以下几个部分:

1、【AFC Control】

在m12193.h文件里

#define  PSI_EE               (6519)           

#define  C_PSI_STA  (505) 

2、【Crystal AFC control】

在l1d_custom_rf.h文件里

#define Custom_RF_XO_CapID  12

3、【GSM900 Sub band,RX loss】

在m12193.c文件里

sAGCGAINOFFSET  AGC_PATHLOSS_GSM900[ PLTABLE_SIZE ] =

  {  15,  GAINLOSS( 2.500 ) },

    {  30,  GAINLOSS( 5.875 ) },

    {  40,  GAINLOSS( 7.625 ) },

    {  50,  GAINLOSS( 8.875 ) },

    {  60,  GAINLOSS( 9.500 ) },

    {  70,  GAINLOSS( 9.750 ) },

    {  80,  GAINLOSS( 9.500 ) },

    {  95,  GAINLOSS( 8.250 ) },

    {  110,  GAINLOSS( 5.375 ) },

    {  124,  GAINLOSS( 2.250 ) },

    {  1000,  GAINLOSS( 8.625 ) },

    {  1023,  GAINLOSS( 3.3750 ) },

   

    { TABLE_END }

};

4、【DCS1800 Sub band,RX loss】

在m12193.c文件里:

sAGCGAINOFFSET  AGC_PATHLOSS_DCS1800[ PLTABLE_SIZE ] =

  { 515, GAINLOSS( 0.250 ) },

    { 530, GAINLOSS( 0.500 ) },

    { 550, GAINLOSS( 0.875 ) },

    { 580, GAINLOSS( 1.375 ) },

    { 650, GAINLOSS( 1.375 ) },

    { 680, GAINLOSS( 1.125 ) },

    { 710, GAINLOSS( 0.875 ) },

    { 760, GAINLOSS( 0.625 ) },

    { 830, GAINLOSS( 1.125 ) },

    { 885, GAINLOSS( 1.0 ) },

   

    { TABLE_END }

};

5、【PCS1900 Sub band,RX loss】

在m12193.c文件里:

sAGCGAINOFFSET  AGC_PATHLOSS_PCS1900[ PLTABLE_SIZE ] =

 

    { 512, GAINLOSS( 0.0 ) },

    { 550, GAINLOSS( 0.0 ) },

    { 650, GAINLOSS( 0.0 ) },

    { 750, GAINLOSS( 0.0 ) },

    { 800, GAINLOSS( 0.0 ) },

    { 810, GAINLOSS( 0.0 ) },

   

    { TABLE_END }

};

6、【GSM850 Sub band,RX loss】

在m12193.c文件里:

sAGCGAINOFFSET  AGC_PATHLOSS_GSM850[ PLTABLE_SIZE ] =

 

    { 128, GAINLOSS( 0.0 ) },

    { 140, GAINLOSS( 0.0 ) },

    { 150, GAINLOSS( 0.0 ) },

    { 170, GAINLOSS( 0.0 ) },

    { 190, GAINLOSS( 0.0 ) },

    { 210, GAINLOSS( 0.0 ) },

    { 220, GAINLOSS( 0.0 ) },

    { 230, GAINLOSS( 0.0 ) },

    { 251, GAINLOSS( 0.0 ) },

   

    { TABLE_END }

};

7、【BB TX Parameters】

在l1d_rf.h文件里:

#define  BBTX_CALRCSEL                0

#define  BBTX_CALRCSEL_H              0

#define  BBTX_COMMON_MODE_VOLTAGE     1//COMMON MODE VOLTAGE: 1.5v

#define  BBTX_COMMON_MODE_VOLTAGE_H   1//COMMON MODE VOLTAGE: 1.5v

#define  BBTX_TRIM_I                  -1// wait calibration

#define  BBTX_TRIM_I_H                0// wait calibration

#define  BBTX_TRIM_Q                  0// wait calibration

#define  BBTX_TRIM_Q_H                0// wait calibration

#define  BBTX_OFFSET_I                -3// wait calibration

#define  BBTX_OFFSET_I_H              0// wait calibration

#define  BBTX_OFFSET_Q                7// wait calibration

#define  BBTX_OFFSET_Q_H              0// wait calibration

#define  BBTX_PHSEL                   0// wait calibration

#define  BBTX_PHSEL_H                 0// wait calibration

#define  BBTX_COARSGAIN               0 //XXXXX no use?

8、【GSM900 level,ramp】

在m12193.c文件里:

sRAMPDATA  GSM_RampData ={};

9、【DCS1800 level,ramp】

在m12193.c文件里:

sRAMPDATA  DCS_RampData ={}

10、【PCS1900 level,ramp】

在m12193.c文件里:

sRAMPDATA  PCS_RampData ={}

11、【GSM850 level,ramp】

在m12193.c文件里:

sRAMPDATA  GSM850_RampData ={}

12、【BT Info】

13、【ADC control】

在chr_parameter.c文件里:

bmt_customized_struct  bmt_custom_chr_def ={}

三、     ini文件内容:

[AFC control]

Initial value=6519

Slope=8.1109

[Crystal AFC control]

cap_id=12

[GSM900 Sub band, RX loss]

Max ARFCN=15,30,40,50,60,70,80,95,110,124,1000,1023

RX loss=2.500,5.875,7.625,8.875,9.500,9.750,9.500,8.250,5.375,2.250,8.625,3.3750

[DCS1800 Sub band, RX loss]

Max ARFCN=515,530,550,580,650,680,710,760,830,885,-1,0

RX loss=0.250,0.500,0.875,1.375,1.375,1.125,0.875,0.625,1.125,1.000,0.000,0.0000

[PCS1900 Sub band, RX loss]

Max ARFCN=512,550,650,750,800,810,-1,0,0,0,0,0

RX loss=0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.0000

[GSM850 Sub band, RX loss]

Max ARFCN=128,140,150,170,190,210,220,230,251,-1,0,0

RX loss=0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.0000

[BB TX Parameters]

BB TX common mode voltage=1

BB TX gain=0

BB TX calrcsel=0

APC bat low voltage=3.50000

APC bat high voltage=4.00000

APC bat low temperature=0.00000

APC bat high temperature=50.00000

Trim I=-1

Trim Q=0

Offset I=-3

Offset Q=7

Calibrated flag=0

BB TX phasesel=0

[GSM900 level, ramp]

APC dc offset=120

Low APC dc offset=0

APC lowest power=5

TX power level=142,163,185,212,242,276,314,359,408,464,528,602,685,752,859,859

profile 0 ramp up=0,0,0,4,6,13,28,61,98,141,177,226,255,255,255,255

profile 0 ramp down=255,255,255,254,154,53,33,19,0,0,0,0,0,0,0,0

profile 1 ramp up=0,0,0,3,6,14,22,36,57,95,134,186,220,255,255,255

profile 1 ramp down=255,255,255,188,78,0,0,0,0,0,0,0,0,0,0,0

profile 2 ramp up=0,0,0,0,4,7,11,20,35,62,119,177,222,255,255,255

profile 2 ramp down=255,255,255,156,66,0,0,0,0,0,0,0,0,0,0,0

profile 3 ramp up=0,0,0,3,8,13,18,40,64,102,145,195,232,255,255,255

profile 3 ramp down=255,255,255,191,86,0,0,0,0,0,0,0,0,0,0,0

profile 4 ramp up=0,0,0,4,8,13,24,37,66,105,142,187,228,255,255,255

profile 4 ramp down=255,255,255,142,0,0,0,0,0,0,0,0,0,0,0,0

profile 5 ramp up=0,0,0,0,6,11,17,30,62,96,140,183,223,255,255,255

profile 5 ramp down=255,255,255,179,120,39,0,0,0,0,0,0,0,0,0,0

profile 6 ramp up=0,0,0,0,0,8,15,35,54,91,128,177,225,255,255,255

profile 6 ramp down=255,255,248,224,125,86,23,5,0,0,0,0,0,0,0,0

profile 7 ramp up=0,0,0,0,0,0,0,0,8,25,65,145,219,255,255,255

profile 7 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 8 ramp up=0,0,0,0,0,0,0,0,8,25,65,145,219,255,255,255

profile 8 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 9 ramp up=0,0,0,0,0,0,5,11,22,47,98,150,213,255,255,255

profile 9 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 10 ramp up=0,0,0,0,0,4,12,25,54,97,137,181,222,255,255,255

profile 10 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 11 ramp up=0,0,0,0,0,6,15,31,55,96,136,177,218,255,255,255

profile 11 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 12 ramp up=0,0,0,0,0,4,13,31,55,92,133,182,226,255,255,255

profile 12 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 13 ramp up=0,0,0,0,0,7,19,43,71,106,148,186,222,255,255,255

profile 13 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 14 ramp up=0,0,0,0,0,4,10,23,53,93,136,175,221,240,255,255

profile 14 ramp down=255,255,239,197,138,78,32,10,0,0,0,0,0,0,0,0

profile 15 ramp up=0,0,0,0,0,0,0,0,0,8,25,65,145,219,255,255

profile 15 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

Subband max arfcn=0,20,40,65,80,100,124,975,1000,1010,1023

Subband mid level=12,12,12,12,12,12,12,12,12,12,12

Subband high weight=1.030,1.020,1.010,1.000,0.995,0.990,0.980,1.050,1.040,1.035,1.0300

Subband low weight=1.035,1.025,1.015,1.000,0.995,0.990,0.980,1.058,1.045,1.040,1.0350

Battery compensate, low voltage, low temperature=1.00000

Battery compensate, low voltage, mid temperature=1.00000

Battery compensate, low voltage, high temperature=1.00000

Battery compensate, mid voltage, low temperature=1.00000

Battery compensate, mid voltage, mid temperature=1.00000

Battery compensate, mid voltage, high temperature=1.00000

Battery compensate, high voltage, low temperature=1.00000

Battery compensate, high voltage, mid temperature=1.00000

Battery compensate, high voltage, high temperature=1.00000

TX AFC DAC offset=0

[DCS1800 level, ramp]

APC dc offset=80

Low APC dc offset=0

APC lowest power=0

TX power level=117,123,135,147,162,182,206,234,268,308,358,415,483,559,651,802

profile 0 ramp up=0,0,0,0,0,4,9,18,52,91,168,231,255,255,255,255

profile 0 ramp down=255,255,255,255,213,123,44,10,0,0,0,0,0,0,0,0

profile 1 ramp up=0,0,0,0,0,0,0,0,0,13,40,145,219,255,255,255

profile 1 ramp down=255,255,228,125,60,10,0,0,0,0,0,0,0,0,0,0

profile 2 ramp up=0,0,0,0,0,0,0,0,0,13,40,145,219,255,255,255

profile 2 ramp down=255,255,255,195,95,10,0,0,0,0,0,0,0,0,0,0

profile 3 ramp up=0,0,0,0,0,0,0,0,0,13,40,145,219,255,255,255

profile 3 ramp down=255,255,255,125,35,10,0,0,0,0,0,0,0,0,0,0

profile 4 ramp up=0,0,0,0,0,0,0,0,0,13,40,145,219,255,255,255

profile 4 ramp down=255,255,255,152,88,38,0,0,0,0,0,0,0,0,0,0

profile 5 ramp up=0,0,0,0,0,0,0,0,0,13,40,145,219,255,255,255

profile 5 ramp down=255,255,255,215,141,81,34,13,0,0,0,0,0,0,0,0

profile 6 ramp up=0,0,0,0,0,0,0,0,8,30,65,145,219,255,255,255

profile 6 ramp down=255,255,255,220,170,80,15,10,0,0,0,0,0,0,0,0

profile 7 ramp up=0,0,0,0,0,0,0,0,8,30,65,145,219,255,255,255

profile 7 ramp down=255,255,255,220,170,80,15,10,0,0,0,0,0,0,0,0

profile 8 ramp up=0,0,0,0,0,0,0,0,8,50,99,159,204,255,255,255

profile 8 ramp down=255,255,255,198,157,99,22,10,0,0,0,0,0,0,0,0

profile 9 ramp up=0,0,0,0,0,0,0,0,8,50,99,159,213,255,255,255

profile 9 ramp down=255,255,255,198,160,99,22,10,0,0,0,0,0,0,0,0

profile 10 ramp up=0,0,0,0,0,0,0,8,40,81,132,173,235,255,255,255

profile 10 ramp down=255,255,255,234,177,124,90,22,10,0,0,0,0,0,0,0

profile 11 ramp up=0,0,0,0,0,0,0,0,8,50,99,159,209,255,255,255

profile 11 ramp down=255,255,255,198,148,99,22,10,0,0,0,0,0,0,0,0

profile 12 ramp up=0,0,0,0,0,0,0,0,8,50,99,159,211,255,255,255

profile 12 ramp down=255,255,255,198,167,99,22,10,0,0,0,0,0,0,0,0

profile 13 ramp up=0,0,0,0,0,0,0,8,50,99,159,219,255,255,255,255

profile 13 ramp down=255,255,255,255,198,133,99,22,10,0,0,0,0,0,0,0

profile 14 ramp up=0,0,0,0,0,0,0,8,50,99,159,221,255,255,255,255

profile 14 ramp down=255,255,255,255,198,151,99,22,10,0,0,0,0,0,0,0

profile 15 ramp up=0,0,0,0,0,0,0,8,50,99,159,214,255,255,255,255

profile 15 ramp down=255,255,255,255,198,156,99,22,10,0,0,0,0,0,0,0

Subband max arfcn=520,560,600,630,660,700,720,760,800,830,885

Subband mid level=7,7,7,7,7,7,7,7,7,7,7

Subband high weight=1.050,1.050,1.050,1.050,1.050,1.000,0.965,0.965,0.965,0.965,0.9650

Subband low weight=1.090,1.090,1.090,1.090,1.090,1.000,0.960,0.960,0.960,0.960,0.9600

Battery compensate, low voltage, low temperature=1.00000

Battery compensate, low voltage, mid temperature=1.00000

Battery compensate, low voltage, high temperature=1.00000

Battery compensate, mid voltage, low temperature=1.00000

Battery compensate, mid voltage, mid temperature=1.00000

Battery compensate, mid voltage, high temperature=1.00000

Battery compensate, high voltage, low temperature=1.00000

Battery compensate, high voltage, mid temperature=1.00000

Battery compensate, high voltage, high temperature=1.00000

TX AFC DAC offset=0

[PCS1900 level, ramp]

APC dc offset=125

Low APC dc offset=0

APC lowest power=0

TX power level=38,44,50,60,71,85,100,120,150,190,230,280,350,430,480,590

profile 0 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 0 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 1 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 1 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 2 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 2 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 3 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 3 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 4 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 4 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 5 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 5 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 6 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 6 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 7 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 7 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 8 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 8 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 9 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 9 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 10 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 10 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 11 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 11 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 12 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 12 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 13 ramp up=0,0,0,0,0,0,1,4,8,30,65,145,219,255,255,255

profile 13 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 14 ramp up=0,0,0,0,0,0,0,1,4,8,30,65,145,219,255,255

profile 14 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 15 ramp up=0,0,0,0,0,0,0,1,4,8,30,65,145,219,255,255

profile 15 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

Subband max arfcn=520,560,600,630,660,680,720,730,750,800,810

Subband mid level=12,12,12,12,12,12,12,12,12,12,12

Subband high weight=1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.0000

Subband low weight=1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.0000

Battery compensate, low voltage, low temperature=1.00000

Battery compensate, low voltage, mid temperature=1.00000

Battery compensate, low voltage, high temperature=1.00000

Battery compensate, mid voltage, low temperature=1.00000

Battery compensate, mid voltage, mid temperature=1.00000

Battery compensate, mid voltage, high temperature=1.00000

Battery compensate, high voltage, low temperature=1.00000

Battery compensate, high voltage, mid temperature=1.00000

Battery compensate, high voltage, high temperature=1.00000

TX AFC DAC offset=0

[GSM850 level, ramp]

APC dc offset=125

Low APC dc offset=0

APC lowest power=5

TX power level=58,64,74,89,107,128,157,187,223,264,313,377,449,522,610,610

profile 0 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 0 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 1 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 1 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 2 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 2 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 3 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 3 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 4 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 4 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 5 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 5 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 6 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 6 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 7 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 7 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 8 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 8 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 9 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 9 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 10 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 10 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 11 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 11 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 12 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 12 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 13 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 13 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 14 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 14 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

profile 15 ramp up=0,0,0,0,0,0,10,20,40,60,80,145,219,255,255,255

profile 15 ramp down=255,239,197,138,78,32,10,0,0,0,0,0,0,0,0,0

Subband max arfcn=150,170,190,210,230,251,-1,0,0,0,0

Subband mid level=16,16,16,16,16,16,19,19,19,19,19

Subband high weight=1.000,1.000,1.000,1.000,1.000,1.000,0.000,0.000,0.000,0.000,0.0000

Subband low weight=1.000,1.000,1.000,1.000,1.000,1.000,0.000,0.000,0.000,0.000,0.0000

Battery compensate, low voltage, low temperature=1.00000

Battery compensate, low voltage, mid temperature=1.00000

Battery compensate, low voltage, high temperature=1.00000

Battery compensate, mid voltage, low temperature=1.00000

Battery compensate, mid voltage, mid temperature=1.00000

Battery compensate, mid voltage, high temperature=1.00000

Battery compensate, high voltage, low temperature=1.00000

Battery compensate, high voltage, mid temperature=1.00000

Battery compensate, high voltage, high temperature=1.00000

TX AFC DAC offset=0

[BT Info]

Crystal CAP ID=255

[ADC control]

offset=32049,27476,32

@echo off setlocal enabledelayedexpansion echo ************************************************************************************** echo Display Team Buffer Dump Tool. echo Refer to "https://odocs.myoas.com/docs/5rk9d8JLO0C69Qqx" for detail infomation. echo ************************************************************************************** @rem ***** History ***** @rem 2024.12.09 自动删除15s之前dump的buffer,节省sdcard空间 @REM ******************** globals ****************** set name="all" @REM ******************** globals for SurfaceFlinger raw dump ****************** @REM ******************** globals for bufferqueue dump ****************** set dump_buffer_stage=acquire set /a pixel_sample_rate=8 set /a disable_gpu_proprietary=1 set /a async_mode=1 @rem cache size in MB set /a frame_cache_size=500 set /a wait_present_fence=1 @REM private NOT modify set /a mtk=1 set all_options="" set /a full_reboot=0 @REM ************************************************************************************* :MAIN :SELECT_DUMP_METHOD echo. echo 1. Recommended - SurfaceFlinger raw dump with defaults echo 2. Bufferqueue dump with defaults (reboot needed) echo 3. SurfaceFlinger raw dump echo 4. Bufferqueue dump (reboot needed) set /p method=Select a method you want: set /a method_idx=method if "%method%" == "" goto DISP_RAW_DUMP if %method_idx% EQU 1 ( goto START_LAYER_DUMP ) else if %method_idx% EQU 2 ( goto START_DUMP_DEFAULT ) else if %method_idx% EQU 3 ( goto DISP_RAW_DUMP ) else if %method_idx% EQU 4 ( goto BUFFERQUEUE_DUMP ) else ( goto SELECT_DUMP_METHOD ) @REM ---------------------------- display raw dump ---------------------------------------- :DISP_RAW_DUMP :SELECT_LAYER_NAME echo. echo collecting layers ... adb shell "dumpsys SurfaceFlinger | grep -A 40 'HWC layers:' | sed -nr 's/^ +(.*)#[0-9]+$/\1/p' | sort -u >> /data/layerlist" adb shell "cat /data/layerlist | sort -u" > layerlist set /a N=0 for /f "delims=" %%i in (layerlist) do ( set lylist[!N!]=%%i set /a N+=1 ) set /a stop=N-1 for /l %%I in (0,1,%stop%) do ( set /a list_idx=%%I set /a list_idx+=1 echo !list_idx!. !lylist[%%I]! ) set /p idx=Step 1. Select Layer, refresh(r) list, manually(m) input a name or quit(q): (num/a/r/m/q) if "%idx%" == "" ( goto SELECT_LAYER_NAME ) else if "%idx%" == "q" ( goto DONE_DISP_RAW_DUMP ) else if "%idx%" == "r" ( goto SELECT_LAYER_NAME ) set /a idx_num=%idx% if %idx_num% EQU 0 ( goto SELECT_LAYER_NAME ) else if %idx_num% GTR %N% ( goto SELECT_LAYER_NAME ) else ( set /a idx_num-=1 goto ASSIGN_LAYER_NAME ) :ASSIGN_LAYER_NAME set name=!lylist[%idx_num%]! goto DONE_SELECT_LAYER_NAME :DONE_SELECT_LAYER_NAME goto START_LAYER_DUMP :START_LAYER_DUMP adb shell "dumpsys SurfaceFlinger --dps -dumpcontinue 3 '%name%'" > nul :WAIT_LAYER_DUMP_FINISH echo. set /p finish_hint=Step 2. Re-produce the issue and press a key to finish(d) or quit(q): if "%finish_hint%" == "d" ( adb pull /data/persist_log/sf goto DONE_DISP_RAW_DUMP ) else if "%finish_hint%" == "q" ( goto DONE_DISP_RAW_DUMP ) else ( goto WAIT_FINISH ) :DONE_DISP_RAW_DUMP adb shell "dumpsys SurfaceFlinger --dps -dumpcontinue 0" >nul echo clearing dump cache ... adb shell "find /data/persist_log/sf -type f -exec rm -f {} \; 2>/dev/null" adb shell "rm /data/layerlist 2>/dev/null" del layerlist goto DONE @REM ---------------------------- bufferqueue dump ---------------------------------------- :BUFFERQUEUE_DUMP @REM ---------------------------- options ---------------------------------------- :SELECT_OPTION echo. set /p more_option=Step 1. Use defaut(d) options, more(m) options or quit(q): (d/m/q) if "%more_option%" == "d" ( goto DONE_SELECT_OPTION ) else if "%more_option%" == "" ( goto DONE_SELECT_OPTION ) else if "%more_option%" == "m" ( goto MORE_OPTION ) else if "%more_option%" == "q" ( goto CLEAR_AND_EXIT ) else ( goto SELECT_OPTION ) :DONE_SELECT_OPTION for /f "delims=" %%i in ('adb shell getprop ro.vendor.pq.mtk_aal_support') do set /a mtk=%%i if %disable_gpu_proprietary% EQU 1 ( if %mtk% EQU 1 ( adb shell "setprop debug.gpu.afbc.disable 1" adb shell "setprop debug.mediatek.disp_decompress 0" adb shell "pkill alloc" ) else ( set /a full_reboot=1 ) ) if %full_reboot% EQU 1 ( adb reboot ) else ( adb shell "stop;start" ) goto SELECT_NAME :MORE_OPTION echo 1. disable gpu proprietary format to enable rgb raw view. (default:disable) echo 2. modify pixel sampling to improve performance. (default:x4) echo 3. specify dump buffer stage. (default:queue) echo 4. specify dump sync/async. (default:async) echo 5. specify frame cache. only take effect under asyn mode (default:500) echo 6. wait for present fence or not. (defaut:enable) echo 7. done set /p option=Select an option to modify: if "%option%" == "" ( goto MORE_OPTION ) set /a opt=option if %opt% EQU 1 ( goto DISABEL_GPU_PROPRIETARY ) else if %opt% EQU 2 ( goto SAMPLING_RATE ) else if %opt% EQU 3 ( goto BUFFER_STAGE ) else if %opt% EQU 4 ( goto SYNC_ASYNC ) else if %opt% EQU 5 ( goto FRAME_CACHE ) else if %opt% EQU 6 ( goto WAIT_FENCE ) else if %opt% EQU 7 ( goto SELECT_OPTION ) else ( goto MORE_OPTION ) :DISABEL_GPU_PROPRIETARY echo Disable gpu proprietary format to enable rgb raw view set /p input=Disable (d) Enable(e) Quit(q): if "%input%" == "d" ( set /a disable_gpu_proprietary=1 ) else if "%input%" == "e" ( set /a disable_gpu_proprietary=0 ) else if "%input%" == "q" ( goto MORE_OPTION ) else ( goto DISABEL_GPU_PROPRIETARY ) goto MORE_OPTION :SAMPLING_RATE echo Modify pixel sampling rate to improve performance set /p input=1. x1 2. x2 3. x4 4. x8 5. x16: 6. quit set /a rate=input if %rate% EQU 1 ( set /a pixel_sample_rate=1 ) else if %rate% EQU 2 ( set /a pixel_sample_rate=2 ) else if %rate% EQU 3 ( set /a pixel_sample_rate=4 ) else if %rate% EQU 4 ( set /a pixel_sample_rate=8 ) else if %rate% EQU 5 ( set /a pixel_sample_rate=16 ) else if %rate% EQU 6 ( goto MORE_OPTION ) else ( goto SAMPLING_RATE ) goto MORE_OPTION :BUFFER_STAGE echo Specify dump buffer stage set /p input= 1. queue 2. aquire 3. all 4. quit set /a stage=input if %stage% EQU 1 ( set dump_buffer_stage=queue ) else if %stage% EQU 2 ( set dump_buffer_stage=acquire ) else if %stage% EQU 3 ( set dump_buffer_stage=all ) else if %stage% EQU 4 ( goto MORE_OPTION ) else ( goto BUFFER_STAGE ) goto MORE_OPTION :SYNC_ASYNC echo Specify dump sync/async. Async mode may drop some frames but more performance friendly. set /p input=1. Async 2. sync 3. quit set /a async=input if %async% EQU 1 ( set /a async_mode=1 else if %async% EQU 2 ( set /a async_mode=0 ) else if %async% EQU 3 ( goto MORE_OPTION ) else ( goto SYNC_ASYNC ) :FRAME_CACHE echo Specify frame cache. It will enable async mode implicitly. set /p input=1. 100 2. 200 3. 400 4. 600 5. 800 6. quit set /a cachesize=input if %cachesize% EQU 1 ( set /a async_mode=1 set /a frame_cache_size=100 ) else if %cachesize% EQU 2 ( set /a async_mode=1 set /a frame_cache_size=200 ) else if %cachesize% EQU 3 ( set /a async_mode=1 set /a frame_cache_size=400 ) else if %cachesize% EQU 4 ( set /a async_mode=1 set /a frame_cache_size=600 ) else if %cachesize% EQU 5 ( set /a async_mode=1 set /a frame_cache_size=800 ) else if %cachesize% EQU 6 ( goto MORE_OPTION else ( goto FRAME_CACHE ) goto MORE_OPTION :WAIT_FENCE echo Wait for present fence or not. It will slightly change bufferqueue timing but guarantees buffer granularity. set /p input=1. enable 2. disable 3. quit set /a waitfence=input if %waitfence% EQU 1 ( set /a wait_present_fence=1 ) else if %waitfence% EQU 2 ( set /a wait_present_fence=2 ) else if %waitfence% EQU 3 ( goto MORE_OPTION ) else ( goto WAIT_FENCE ) goto MORE_OPTION @REM ---------------------------- name ---------------------------------------- :SELECT_NAME echo. echo collecting bufferqueue ... adb shell "setprop debug.bufferqueue.dumpbuffer.enable 1" adb shell "setprop debug.bufferqueue.dumpbuffer.verbose 1" adb shell "logcat -d | sed -nr 's/^.* +([0-9]+) +[0-9]+.*GraphicDumper: prepare ([^#]*).*: need.*$/\1 \2/p' | sort -u >> /data/bqlist" adb shell "cat /data/bqlist | sort -u" > bufferqueuelist set /a N=0 for /f "delims=" %%i in (bufferqueuelist) do ( for /f "delims=" %%b in ('adb shell "echo '%%i' | sed -nr 's/[0-9]+ (.*)/\1/p'"') do ( set bqlist[!N!]=%%b ) for /f "delims=" %%p in ('adb shell "echo '%%i' | sed -nr 's/([0-9]+).*/\1/p'"') do ( set process[!N!]=%%p for /f "delims=" %%n in ('adb shell "cat /proc/%%p/comm 2>/dev/null"') do ( set process[!N!]=%%n ) ) set /a N+=1 ) set /a stop=N-1 for /l %%I in (0,1,%stop%) do ( set /a list_idx=%%I set /a list_idx+=1 echo !list_idx!. !bqlist[%%I]! process:!process[%%I]! ) set /p idx=Step 2. Select bufferqueue, dump all(a), refresh(r) list, manually(m) input a name or quit(q): (num/a/r/m/q) if "%idx%" == "" ( goto SELECT_NAME ) else if "%idx%" == "q" ( goto CLEAR_AND_EXIT ) else if "%idx%" == "m" ( goto INPUT_NAME ) else if "%idx%" == "a" ( set name=all goto DONE_SELECT_NAME ) set /a idx_num=%idx% if %idx_num% EQU 0 ( goto SELECT_NAME ) else if %idx_num% GTR %N% ( set /a idx_num=0 goto SELECT_NAME ) else ( set /a idx_num-=1 goto ASSIGN_NAME ) :ASSIGN_NAME set name=!bqlist[%idx_num%]! goto DONE_SELECT_NAME :INPUT_NAME set /p name=Input case sensitive bufferqueue name: if "%name%" == "" ( echo Please input a valid name goto SELECT_NAME ) else ( goto DONE_SELECT_NAME ) :DONE_SELECT_NAME: adb shell "setprop debug.bufferqueue.dumpbuffer.verbose 0" goto START_DUMP @REM ---------------------------- dump ---------------------------------------- :START_DUMP_DEFAULT for /f "delims=" %%i in ('adb shell getprop ro.vendor.pq.mtk_aal_support') do set /a mtk=%%i if %disable_gpu_proprietary% EQU 1 ( if %mtk% EQU 1 ( adb shell "setprop debug.gpu.afbc.disable 1" adb shell "setprop debug.mediatek.disp_decompress 0" adb shell "pkill alloc" ) else ( set /a full_reboot=1 ) ) if %full_reboot% EQU 1 ( adb reboot ) else ( adb shell "stop;start" ) :START_DUMP if %async_mode% EQU 1 ( set str_asyn=loose%frame_cache_size% ) else ( set str_asyn=strict ) if %disable_gpu_proprietary% EQU 0 ( set /a pixel_sample_rate=1 ) set str_scale=downscale%pixel_sample_rate% set str_fence= if %wait_present_fence% EQU 0 ( set str_fence=ignorefence ) set "all_options=%str_asyn%|%str_scale%|%str_fence%" adb wait-for-device adb shell "setprop debug.bufferqueue.dumpbuffer.enable 1" adb shell "setprop debug.bufferqueue.dumpbuffer.name '%name%'" adb shell "setprop debug.bufferqueue.dumpbuffer.mode '%all_options%'" adb shell "setprop debug.bufferqueue.dumpbuffer.type %dump_buffer_stage%" adb shell "setenforce 0" :WAIT_FINISH adb shell "mkdir -p /data/persist_log/bufferqueue/working" adb shell "nohup sh -c 'while [ -d /data/persist_log/bufferqueue/working ]; do find /data/persist_log/bufferqueue -type f -mtime +10s -exec rm {} \;; sleep 1; done' &>/dev/null &" echo. set /p finish_hint=Step 3. Re-produce the issue and press a key to finish(d) or quit(q): if "%finish_hint%" == "d" ( adb shell "rm -rf /data/persist_log/bufferqueue/working" adb pull /data/persist_log/bufferqueue goto CLEAR_AND_EXIT ) else if "%finish_hint%" == "q" ( goto CLEAR_AND_EXIT ) else ( goto WAIT_FINISH ) @REM ---------------------------- done & quit ---------------------------------------- :CLEAR_AND_EXIT adb shell "rm -rf /data/persist_log/bufferqueue/working" adb shell "setprop debug.bufferqueue.dumpbuffer.name ''" adb shell "setprop debug.bufferqueue.dumpbuffer.type ''" adb shell "setprop debug.bufferqueue.dumpbuffer.enable 0" adb shell "setenforce 1" echo clearing dump cache ... adb shell "find /data/persist_log/bufferqueue -type f -exec rm -f {} \; 2>/dev/null" adb shell "rm /data/bqlist 2>/dev/null" del bufferqueuelist 2>nul if %disable_gpu_proprietary% EQU 1 ( if %mtk% EQU 1 ( adb shell "setprop debug.gpu.afbc.disable 0" adb shell "setprop debug.mediatek.disp_decompress 1" adb shell "pkill alloc" ) else ( adb shell "sed -i 'disable_ubwc/s/1/0/g' /vendor/build.prop" ) ) goto DONE @REM ---------------------------- exit ---------------------------------------- :DONE pause 根据这个脚本,看下我这个报错的原因 collecting layers ... 拒绝访问。 系统找不到文件 layerlist。
最新发布
11-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值