forked from baohaojun/system-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.code-reading
713 lines (582 loc) · 31.7 KB
/
.code-reading
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
****************
这个东西实际上是external clock的pinmux
/scp:bhj@r889:/home/bhj/src/rayzerlink-pad/hardware/tegra/core/drivers/nvrm/nvrmkernel/core/ap15/ap15rm_pinmux_tables.c:794: &g_Ap15MuxCdev[0],
/* Array of all the controller types in the system, pointing to the array of
* instances of each controller. Indexed using the NvRmIoModule value.
*/
static const NvU32** g_Ap15MuxControllers[] = {
...
=> &g_Ap15MuxCdev[0],
****************
这个函数就是 pfnGetExtClockFreq 是怎么实现的,根据ap的版本不同有可能会调用不同的版本。
/scp:bhj@r889:/home/bhj/src/rayzerlink-pad/hardware/tegra/core/drivers/nvrm/nvrmkernel/core/common/nvrm_pinmux.c:136: NvRmPrivAp15GetExternalClockSourceFreq,
static NvPinmuxPrivMethods* NvRmPrivGetPinmuxMethods(NvRmDeviceHandle hDevice)
{
...
{
...
=> NvRmPrivAp15GetExternalClockSourceFreq,
****************
/scp:bhj@r889:/home/bhj/src/android-nv-froyo/hardware/tegra/core/utils/nvos/aos/aos_semihost.h:44: void (*SemiDebugString)( const char *msg );
/**
* AOS supports several file i/o (semihosting) implementations.
*/
typedef struct NvAosSemihostRec
{
...
=> void (*SemiDebugString)( const char *msg );
****************
/scp:bhj@r889:/home/bhj/src/android-nv-froyo/frameworks/base/include/ui/KeycodeLabels.h:28: { "HOME", 3 },
static const KeycodeLabel KEYCODES[] = {
...
=> { "HOME", 3 },
****************
/usr/share/pyshared/html2text.py:207: def handle_tag(self, tag, attrs, start):
class _html2text(sgmllib.SGMLParser):
...
=> def handle_tag(self, tag, attrs, start):
****************
/usr/share/pyshared/html2text.py:270: if a:
class _html2text(sgmllib.SGMLParser):
...
def handle_tag(self, tag, attrs, start):
...
if tag == "a":
...
else:
if self.astack:
...
=> if a:
****************
这个地方应该是nv里配置哪个uart使用相关的代码。
/scp:bhj@r889:/home/bhj/src/theatre-p2/hardware/tegra/core/utils/nvos/aos/nvap/aos_uart.c:76: TRISTATE_UART(B,UAA);
static NvError aos_EnableUartA(NvU32 configuration)
{
...
case NvOdmUartPinMap_Config1:
=> TRISTATE_UART(B,UAA);
****************
这段代码很奇怪,(0?x)在C语言里根本不合法呀,到底是什么意思呢?
但是仔细看了一下,原来如果x也是一个宏的话,比如18:17,那么就又有意义了。
/scp:bhj@r889:/home/bhj/src/android-byd/hardware/tegra/core/include/nvrm_drf.h:55: #define NV_FIELD_SHIFT(x) ((0?x)%32)
/*
* The NV_FIELD_* macros are helper macros for the public NV_DRF_* macros.
*/
#define NV_FIELD_LOWBIT(x) (0?x)
#define NV_FIELD_HIGHBIT(x) (1?x)
...
=> #define NV_FIELD_SHIFT(x) ((0?x)%32)
****************
这个临时文件是通过gcc -E用了上面的这个.h文件的一个.c文件出来的,APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE的定义用gtags都搜不到,但是用grep的话可以看见,它的定义如下:
#define APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE 18:18
ooo:2025: TristateReg = NvRead32((void *)(0x70000000 + APB_MISC_PP_TRISTATE_REG_B_0)); TristateReg = (((TristateReg) & ~((0xFFFFFFFFUL>>(31-((1?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32)+((0?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32)))<< (((0?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32)))) | ((APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_NORMAL) << ((0?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32))); NvWrite32((void *)(0x70000000 + APB_MISC_PP_TRISTATE_REG_B_0),(TristateReg));;
static NvError aos_EnableUartA(NvU32 configuration)
{
...
case NvOdmUartPinMap_Config1:
=> TristateReg = NvRead32((void *)(0x70000000 + APB_MISC_PP_TRISTATE_REG_B_0)); TristateReg = (((TristateReg) & ~((0xFFFFFFFFUL>>(31-((1?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32)+((0?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32)))<< (((0?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32)))) | ((APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_NORMAL) << ((0?APB_MISC_PP_TRISTATE_REG_B_0_Z_UAA_RANGE)%32))); NvWrite32((void *)(0x70000000 + APB_MISC_PP_TRISTATE_REG_B_0),(TristateReg));;
****************
在这里设置用哪个终端出log
/scp:bhj@r889:/home/bhj/src/android-byd/hardware/tegra/odm/harmony/odm_kit/query/nvodm_query.c:330: return NvOdmDebugConsole_UartD;
NvOdmDebugConsole
NvOdmQueryDebugConsole(void)
{
=> return NvOdmDebugConsole_UartD;
****************
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/hardware/tegra/core/drivers/nvdispmgr/server/nvdispmgr.c:2322: pOut->TotalCount = 0;
//===========================================================================
// NvDispMgrDisplayListModesImpl() - list the modes for a display
//===========================================================================
static NvError NvDispMgrDisplayListModesImpl(
NvDispMgr *dm,
NvDispMgrClient *cl,
NvDispMgrDisplayListModesIn *pIn,
NvDispMgrDisplayListModesOut *pOut)
{
...
=> pOut->TotalCount = 0;
****************
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/hardware/tegra/core/drivers/nvdispmgr/server/nvdispmgr.c:2680: DM_FUNC(DisplayListModes,1); // NvDispMgrDisplayListModesImpl()
//===========================================================================
// NvDispMgrInitFunctionTable() - initialize pointers to each function
//===========================================================================
void NvDispMgrInitFunctionTable(NvDispMgr *dm)
{
...
=> DM_FUNC(DisplayListModes,1); // NvDispMgrDisplayListModesImpl()
****************
i2c是在这里配置的:
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/hardware/tegra/core/drivers/nvrm/nvrmkernel/core/ap20/ap20rm_pinmux_tables.c:200: CONFIG(A,G,PTA,I2C2),CONFIGEND(),
static const NvU32 g_Ap20Mux_I2c2[] = {
...
=> CONFIG(A,G,PTA,I2C2),CONFIGEND(),
****************
pmu之外的外部电源用的是哪个gpio
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/hardware/tegra/odm/ventana/odm_kit/query/subboards/nvodm_query_discovery_pm275_addresses.h:218: { NvOdmIoModule_Gpio, 'v'-'a', 5, 0 },
static const NvOdmIoAddress s_Vddio_Vid_En[] = {
=> { NvOdmIoModule_Gpio, 'v'-'a', 5, 0 },
****************
这个pmu上还有一些gpio,可以控制输出电压?
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/hardware/tegra/odm/template/odm_kit/adaptations/pmu/tps6586x/nvodm_pmu_tps6586x.c:536: Ext_TPS72012PmuSupply_LDO,
/* FIXME: Change getVoltage/setVoltage according to your fuse */
static const TPS6586xPmuSupplyInfo tps6586xSupplyInfoTable[] =
{
...
{
=> Ext_TPS72012PmuSupply_LDO,
****************
注册中断的方法:
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/kernel/arch/arm/mach-tegra/odm_kit/platform/accelerometer/nvodm_accelerometer_kxtf9.c:385: if (NvOdmGpioInterruptRegister(hDevice->hGpioINT,
static NvBool ConfigInterrupt(NvOdmAccelHandle hDevice)
{
...
=> if (NvOdmGpioInterruptRegister(hDevice->hGpioINT,
****************
这里应该是每个i2c上选的哪个pinmux配置?
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/hardware/tegra/odm/ventana/odm_kit/query/nvodm_query_pinmux.c:43: static const NvU32 s_NvOdmPinMuxConfig_I2c[] = {
static const NvU32 s_NvOdmPinMuxConfig_Twc[] = {
0
...
=> static const NvU32 s_NvOdmPinMuxConfig_I2c[] = {
Nvidia 自带了用gpio模拟i2c的代码,回头电源代码可以用这个来试一下。
/scp:bhj@r889:/home/bhj/src/rayzerlink-ventana/kernel/arch/arm/mach-tegra/nvrm/io/common/nvrm_i2c.c:539: if ((Transaction[0].Flags & NVRM_I2C_SOFTWARE_CONTROLLER) ||
NvError NvRmI2cTransaction(
NvRmI2cHandle hI2c,
NvU32 I2cPinMap,
NvU32 WaitTimeoutInMilliSeconds,
NvU32 ClockSpeedKHz,
NvU8 *Data,
NvU32 DataLength,
NvRmI2cTransactionInfo * Transaction,
NvU32 NumOfTransactions)
{
...
=> if ((Transaction[0].Flags & NVRM_I2C_SOFTWARE_CONTROLLER) ||
****************
这里是battery太低的时候,系统会关机的code所在的地方。
/scp:bhj@r889:/home/bhj/src/theatre-p2/frameworks/base/services/java/com/android/server/BatteryService.java:187: Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
/**
* <p>BatteryService monitors the charging status, and charge level of the device
* battery. When these values change this service broadcasts the new values
* to all {@link android.content.BroadcastReceiver IntentReceivers} that are
* watching the {@link android.content.Intent#ACTION_BATTERY_CHANGED
* BATTERY_CHANGED} action.</p>
* <p>The new values are stored in the Intent data and can be retrieved by
* calling {@link android.content.Intent#getExtra Intent.getExtra} with the
* following keys:</p>
* <p>"scale" - int, the maximum value for the charge level</p>
* <p>"level" - int, charge level, from 0 through "scale" inclusive</p>
* <p>"status" - String, the current charging status.<br />
* <p>"health" - String, the current battery health.<br />
* <p>"present" - boolean, true if the battery is present<br />
* <p>"icon-small" - int, suggested small icon to use for this state</p>
* <p>"plugged" - int, 0 if the device is not plugged in; 1 if plugged
* into an AC power adapter; 2 if plugged in via USB.</p>
* <p>"voltage" - int, current battery voltage in millivolts</p>
* <p>"temperature" - int, current battery temperature in tenths of
* a degree Centigrade</p>
* <p>"technology" - String, the type of battery installed, e.g. "Li-ion"</p>
*/
class BatteryService extends Binder {
...
private final void shutdownIfNoPower() {
...
if (mBatteryLevel == 0 && !isPowered() && ActivityManagerNative.isSystemReady()) {
=> Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
****************
这个gpio就是ventana代码里控制充电enable/disable的位置。
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/odm_kit/query/ventana/nvodm_query_gpio.c:162: {NVODM_PORT('r'), 6, NvOdmGpioPinActiveState_Low},
static const NvOdmGpioPinInfo s_Battery[] = {
...
=> {NVODM_PORT('r'), 6, NvOdmGpioPinActiveState_Low},
****************
这里是配哪个是中断唤醒源的地方,NV的工程师建议把所有的NV_TRUE都改成
NV_FALSE试一试。
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/odm_kit/query/ventana/nvodm_query.c:45: {NV_FALSE, 2, NvOdmWakeupPadPolarity_High}, // Wake Event 2 - dvi_d3
#define BOARD_ID_VENTANA 0x024B
// Wake Events
static NvOdmWakeupPadInfo s_NvOdmWakeupPadInfo[] =
{
...
=> {NV_FALSE, 2, NvOdmWakeupPadPolarity_High}, // Wake Event 2 - dvi_d3
****************
这个是配置哪个gpio是中断源,上面那个是配置哪个中断源有效,以及有效电平
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/board-nvodm.c:1581: gpio_to_irq(TEGRA_GPIO_PC7), gpio_to_irq(TEGRA_GPIO_PS2),
static void __init tegra_setup_suspend(void)
{
#ifdef CONFIG_ARCH_TEGRA_2x_SOC
const int wakepad_irq[] = {
...
=> gpio_to_irq(TEGRA_GPIO_PC7), gpio_to_irq(TEGRA_GPIO_PS2),
****************
maverick或下一个版本的usb-creator已经可以在debian上做dpkg-buildpackage并安装使用了,但是需要改一个地方:
/usr/share/pyshared/usbcreator/install.py:256: contents = f.readline().split()
class install(Thread):
...
def mangle_syslinux(self):
...
for filename in glob.iglob(os.path.join(self.target, 'syslinux', '*.cfg')):
...
if os.path.exists(os.path.join(self.target, '.disk', 'info')):
with open(os.path.join(self.target, '.disk', 'info'),'r') as f:
=> contents = f.readline().split()
****************
<6>[ 7.097367] mmcblk3: mmc2:0001 SEM08G 7.37 GiB
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/drivers/mmc/card/block.c:643: printk(KERN_INFO "%s: %s %s %s %s\n",
static int mmc_blk_probe(struct mmc_card *card)
{
...
=> printk(KERN_INFO "%s: %s %s %s %s\n",
****************
这个位置很有意思,为什么tegra-10.9.7会把原来i2c bus3上面的东西,变成了bus4?因为在bus1上多了一种config!
也就是多了一条bus出来了啦。
/scp:[email protected]:/home/bhj/src/theatre-p2/kernel/drivers/i2c/busses/i2c-tegra.c:256: i2c_bus->pinmux = plat->bus_mux[i];
static int tegra_i2c_probe(struct platform_device *pdev)
{
...
for (i=0; i<nbus; i++) {
...
=> i2c_bus->pinmux = plat->bus_mux[i];
****************
下面的python *empty_entry_tuple用法看这篇文章,
file:///usr/share/doc/python2.6/html/reference/expressions.html#grammar-token-positional_arguments
到5.3.4. Calls. 这个用法出现在参数列表里,我们就去看一下参数列表的BNF。
/scp:[email protected]:/home/bhj/src/theatre-p2/vendor/nvidia/scripts/ota/patch.py:463: empty_entry = struct.pack('=4sIII', *empty_entry_tuple)
# Create updater-script
# print 'Generate updater-script'
...
if number > 0:
...
=> empty_entry = struct.pack('=4sIII', *empty_entry_tuple)
****************
扫描分区?
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/fs/partitions/check.c:544: if (bdev->bd_part_count)
int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
{
...
=> if (bdev->bd_part_count)
****************
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/core/system/fastboot/linux_cmdline.c:324: /* Remain -= Idx; */
/* Creates the command line, and adds it to the TAG list */
void FastbootCommandLine(
NvAbootHandle hAboot,
const PartitionNameMap *PartitionList,
NvU32 NumPartitions,
NvU32 SecondaryBootDevice,
NvBool HasInitRamDisk,
const unsigned char *ProductName)
{
...
=> /* Remain -= Idx; */
****************
/* NvOsSnprintf(ptr, Remain, "%s ", "no_console_suspend"); */
/* Idx = NvOsStrlen(ptr); */
/* ptr += Idx; */
/* Remain -= Idx; */
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/core/system/fastboot/linux_cmdline.c:324: /* Remain -= Idx; */
/* Creates the command line, and adds it to the TAG list */
void FastbootCommandLine(
NvAbootHandle hAboot,
const PartitionNameMap *PartitionList,
NvU32 NumPartitions,
NvU32 SecondaryBootDevice,
NvBool HasInitRamDisk,
const unsigned char *ProductName)
{
...
=> /* Remain -= Idx; */
****************
/scp:[email protected]:/home/bhj/src/virtualbox/virtualbox-ose-3.2.10-dfsg/src/VBox/Devices/Graphics/BIOS/vbetables-gen.c:31: { 1024, 600, 16 , 0x114},
{ 320, 200, 24 , 0x10F},
{ 640, 480, 15 , 0x110},
{ 640, 480, 16 , 0x111},
{ 640, 480, 24 , 0x112},
...
=> { 1024, 600, 16 , 0x114},
****************
下面这个值是odmdata里的,跟bct也有关系。
/scp:[email protected]:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/odm_kit/query/ventana/nvodm_query.c:763: PowerStateInfo.LowestPowerState = ((LPStateSelection != TEGRA_DEVKIT_BCT_CUSTOPT_0_LPSTATE_LP1)?
/**
* Gets the lowest soc power state supported by the hardware
*
* @returns information about the SocPowerState
*/
const NvOdmSocPowerStateInfo* NvOdmQueryLowestSocPowerState(void)
{
...
{
...
=> PowerStateInfo.LowestPowerState = ((LPStateSelection != TEGRA_DEVKIT_BCT_CUSTOPT_0_LPSTATE_LP1)?
****************
在哪里定义en_wifi_pwr
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/odm/ventana/odm_kit/query/subboards/nvodm_query_discovery_pm275_addresses.h:222: { NvOdmIoModule_Gpio, 'p'-'a', 0, 0 },
static const NvOdmIoAddress s_Vddio_Wifi_En[] = {
=> { NvOdmIoModule_Gpio, 'p'-'a', 0, 0 },
****************
pinmux group怎么定义
/scp:[email protected]:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/pinmux-t2-tables.c:851: PINGROUP(DAP3, BB, DAP3, RSVD, RSVD, RSVD, DAP3, 0x14, 9, 0x88, 24, 0xA0, 14),
static const struct tegra_pingroup_desc pingroups[TEGRA_MAX_PINGROUP] = {
...
=> PINGROUP(DAP3, BB, DAP3, RSVD, RSVD, RSVD, DAP3, 0x14, 9, 0x88, 24, 0xA0, 14),
****************
/scp:[email protected]:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/include/mach/pinmux.h:26: typedef enum {
#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
#include "pinmux-t2.h"
#else
#error "Undefined Tegra architecture"
...
=> typedef enum {
****************
/scp:[email protected]:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/include/mach/pinmux-t2.h:147: TEGRA_MUX_ ## f0, \
#define PINGROUP(pg_name, vdd, f0, f1, f2, f3, f_safe, \
...
[TEGRA_PINGROUP_ ## pg_name] = { \
...
.funcs = { \
=> TEGRA_MUX_ ## f0, \
****************
这个好像会把所有硬件模块的pinmux都设一遍。可能也包括kbc。需要查一下
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/core/drivers/nvrm/nvrmkernel/core/common/nvrm_pinmux.c:239: (p->pfnSetPinMuxCtl)(hDevice, *ModulePrograms, *OdmConfigs);
static void NvRmPrivApplyAllModuleTypePinMuxes(
NvRmDeviceHandle hDevice,
NvU32 Module,
NvBool ApplyReset,
NvBool ApplyActual)
{
...
{
...
{
=> (p->pfnSetPinMuxCtl)(hDevice, *ModulePrograms, *OdmConfigs);
****************
设置电压
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/odm/template/odm_kit/adaptations/pmu/tps6586x/nvodm_pmu_tps6586x.c:1320: if (! Tps6586xWriteVoltageReg(hDevice, vddRail, MilliVolts, pSettleMicroSeconds))
NvBool
Tps6586xSetVoltage(
NvOdmPmuDeviceHandle hDevice,
NvU32 vddRail,
NvU32 MilliVolts,
NvU32* pSettleMicroSeconds)
{
...
{
=> if (! Tps6586xWriteVoltageReg(hDevice, vddRail, MilliVolts, pSettleMicroSeconds))
****************
/scp:bhj@r889:/home/bhj/src/gb-p2/vendor/nvidia/tegra/hal/liboverlay/overlay.cpp:195: case OVERLAY_FORMAT_RGBA_8888:
static overlay_t* overlay_createOverlay(struct overlay_control_device_t *dev,
uint32_t w, uint32_t h, int32_t format)
{
...
switch (format) {
=> case OVERLAY_FORMAT_RGBA_8888:
****************
/scp:bhj@r889:/home/bhj/src/gb-p2/hardware/libhardware/modules/gralloc/framebuffer.cpp:355: const_cast<int&>(dev->device.format) = HAL_PIXEL_FORMAT_RGB_565;
int fb_device_open(hw_module_t const* module, const char* name,
hw_device_t** device)
{
...
if (!strcmp(name, GRALLOC_HARDWARE_FB0)) {
...
if (status >= 0) {
...
=> const_cast<int&>(dev->device.format) = HAL_PIXEL_FORMAT_RGB_565;
****************
看看能不能直接进recovery模式,而不需要按recovery键。
/scp:bhj@r889:/home/bhj/src/theatre-p2/hardware/tegra/core/system/nvaboot/nvaboot.c:469: RecoveryMode = NvBlQueryGetNv3pServerFlag();
NvError NvAbootOpen(
NvAbootHandle *phAboot,
NvU32 *EnterNv3pServer,
NvU32 *Boot)
{
...
=> RecoveryMode = NvBlQueryGetNv3pServerFlag();
****************
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/include/ap20/project_relocation_table.h:459: #define NV_RELOCATION_TABLE_INIT \
// relocation table data (stored in boot rom)
// ------------------------------------------------------------
// relocation table pointer stored at NV_RELOCATION_TABLE_OFFSET
#define NV_RELOCATION_TABLE_PTR_OFFSET 64
...
=> #define NV_RELOCATION_TABLE_INIT \
****************
/scp:bhj@r889:/home/bhj/src/theatre-p2/hardware/tegra/core/system/fastboot/recovery_utils.c:769: NvOsStrncpy(partName, "CAC", NvOsStrlen("CAC"));
NvError UpdateDevice(NvAbootHandle hAboot, CommandType *Command)
{
...
{
...
{
...
{
=> NvOsStrncpy(partName, "CAC", NvOsStrlen("CAC"));
****************
这段代码是nvidia软件的核心
/scp:bhj@r889:/home/bhj/src/theatre-p2/hardware/tegra/core/mobile_linux/daemons/nvrm/app/server.c:502: NV_DAEMON_MODULES(DO_DISPATCH)
#define DO_DISPATCH(DAEMON) \
...
=> NV_DAEMON_MODULES(DO_DISPATCH)
****************
这个地方是会调到nv的display manager的入口
/scp:bhj@r889:/home/bhj/src/theatre-p2/hardware/tegra/core/drivers/nvdispmgr/client/dispmgr_local.h:81: NvDispMgrEntry(Client, InSize, In, OutSize);
//===========================================================================
// NvDispMgrCall()
//===========================================================================
static NV_INLINE NvError NvDispMgrCall(
NvDispMgrClientHandle Client,
NvDispMgrCmd Command,
NvU32 Id,
NvU32 Flags,
NvU32 InSize,
NvDispMgrCommonInParams *In,
NvU32 OutSize,
NvDispMgrCommonOutParams *Out,
NvDispMgrStateSequence *StateSequenceNumber)
{
...
=> NvDispMgrEntry(Client, InSize, In, OutSize);
****************
这个地方说我们用的是支持32位的?
/scp:bhj@r889:/home/bhj/src/theatre-p2/hardware/tegra/hal/libgralloc/nvgrfb.c:266: int ModeFormat = HAL_PIXEL_FORMAT_RGBA_8888;
dev->Base.common.tag = HARDWARE_DEVICE_TAG;
dev->Base.common.version = 0;
dev->Base.common.module = &mod->Base.common;
dev->Base.common.close = NvGrFbDevClose;
dev->Base.setSwapInterval = NvGrSetSwapInterval;
dev->Base.setUpdateRect = NULL; //NvGrSetUpdateRect;
dev->Base.compositionComplete = NvGrCompositionComplete;
dev->Base.post = NvGrPost;
#ifdef GRALLOC_FB_READ_SUPPORTED
dev->Base.read = NvGrFbRead;
#endif
...
{
...
=> int ModeFormat = HAL_PIXEL_FORMAT_RGBA_8888;
****************
mmc_cid_show: 这个函数用ctags不能查到,因为它是在一个宏里被定义的:
/scp:bhj@r889:/home/bhj/src/theatre-p2/kernel/drivers/mmc/core/mmc.c:275: MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1],
return err;
...
=> MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1],
****************
/scp:[email protected]:/home/bhj/src/theatre-p2/frameworks/base/services/java/com/android/server/KeyInputQueue.java:980: System.arraycopy(ms.mNextData, 0,
public abstract class KeyInputQueue {
...
Thread mThread = new Thread("InputDeviceReader") {
public void run() {
...
while (true) {
try {
...
synchronized (mFirst) {
...
} else if (send || (ev.type == RawInputEvent.EV_SYN
...
if (mDisplay != null) {
...
if (ms.changed) {
...
} else {
...
=> System.arraycopy(ms.mNextData, 0,
****************
这里是分发nv daemon消息的地方。这里会根据不同的消息进行打印。
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/core/drivers/nvdispmgr/server/nvdispmgr.c:592: A(DisplaySetAttrs)
#define NV_DISP_MGR_LOG_COMMANDS 0
#if NV_DISP_MGR_LOG_COMMANDS
{
...
{
...
NvOsDebugPrintf(
...
=> A(DisplaySetAttrs)
****************
这个是NV的消息处理函数定义的地方,比如 DisplaySetAttrs 会被定义出一个 NvDispMgrDisplaySetAttrsImpl 的函数。
/scp:[email protected]:/home/bhj/src/theatre-p2/hardware/tegra/core/drivers/nvdispmgr/server/nvdispmgr.c:2691: cmd->InOutWords[1] = isvar?0:(sizeof(NvDispMgr##name##Out)/4)
//===========================================================================
// NvDispMgrInitFunctionTable() - initialize pointers to each function
//===========================================================================
void NvDispMgrInitFunctionTable(NvDispMgr *dm)
{
...
#define DM_FUNC(name,isvar) \
...
=> cmd->InOutWords[1] = isvar?0:(sizeof(NvDispMgr##name##Out)/4)
****************
2.6.36在reboot时和NV用的方法不一样
/scp:[email protected]:/home/bhj/src/theatre-p2/kernel/arch/arm/mach-tegra/include/mach/system.h:39: while(1);
static inline void arch_reset(char mode, const char *cmd)
{
...
=> while(1);
****************
/home/bhj/src/theatre/hardware/tegra/odm/ventana/odm_kit/query/nvodm_query.c:456: { NV_FALSE, 0, NV_FALSE, 0x4, NvOdmQuerySdioSlotUsage_Boot },
const NvOdmQuerySdioInterfaceProperty* NvOdmQueryGetSdioInterfaceProperty(
NvU32 Instance)
{
...
{
...
=> { NV_FALSE, 0, NV_FALSE, 0x4, NvOdmQuerySdioSlotUsage_Boot },
****************
这个地方在设所有的东东的clock?
/home/bhj/src/arena/hardware/tegra/core/drivers/nvrm/nvrmkernel/core/ap15/ap15rm_clock_misc.c:192: CLK_RST_CONTROLLER_CLK_SOURCE_##ClkModule##_0, reg); \
#define NVRM_SET_OSC_CLOCK(ClkModule, RstModule, H_L) \
do\
{\
...
{\
...
NV_REGW(rm, NVRM_MODULE_ID( NvRmPrivModuleID_ClockAndReset, 0 ), \
=> CLK_RST_CONTROLLER_CLK_SOURCE_##ClkModule##_0, reg); \
****************
/scp:[email protected]:/home/bhj/src/ics-sultan/vendor/marvell/generic/ttc_telephony/drivers/genlib/atparser/src/atParser.c:6290: if ((rc = utlExecuteBasicAtCommand(parser_p, " ", FALSE, ¶meter_value, string_off)) == utlAT_RESULT_CODE_ERROR)
* executing it when found. Note that as-per the standard, only the first
* collection of AT commands on each line is parsed and executed.
*---------------------------------------------------------------------------*/
static utlAtResultCode_T utlParseLine(const utlAtParser_P parser_p,
char *string_p,
const size_t string_off)
{
...
{
...
=> if ((rc = utlExecuteBasicAtCommand(parser_p, " ", FALSE, ¶meter_value, string_off)) == utlAT_RESULT_CODE_ERROR)
****************
这个文件里的 $a.int是怎么回事?请看接下来的分析
/home/bhj/src/antlr/code/walking/patterns/Simplify.g:20: zeroX : ^('*' a=INT b=INT {$a.int==0}?) -> $a ; // 0*x -> 0
=> zeroX : ^('*' a=INT b=INT {$a.int==0}?) -> $a ; // 0*x -> 0
****************
在编译之后,它会生成这样的代码:
/home/bhj/src/antlr/code/walking/patterns/Simplify.java:484: throw new FailedPredicateException(input, "zeroX", "$a.int==0");
public class Simplify extends TreeRewriter {
...
public final Simplify.zeroX_return zeroX() throws RecognitionException {
...
try {
...
if ( !(((a!=null?Integer.valueOf(a.getText()):0)==0)) ) {
...
=> throw new FailedPredicateException(input, "zeroX", "$a.int==0");
****************
所以我们只要在antlr的代码里grep Integer.valueOf就可以知道是怎么回事,并且我们可以发现除了.int之外更多的东西:
/home/bhj/src/antlr/antlr3-3.2/tool/src/main/resources/org/antlr/codegen/templates/Java/Java.stg:1294: "(<scope>!=null?Integer.valueOf(<scope>.getText()):0)"
lexerRuleLabelPropertyRef_pos(scope,attr) ::=
"(<scope>!=null?<scope>.getCharPositionInLine():-1)"
lexerRuleLabelPropertyRef_channel(scope,attr) ::=
"(<scope>!=null?<scope>.getChannel():0)"
lexerRuleLabelPropertyRef_index(scope,attr) ::=
"(<scope>!=null?<scope>.getTokenIndex():0)"
lexerRuleLabelPropertyRef_text(scope,attr) ::=
"(<scope>!=null?<scope>.getText():null)"
lexerRuleLabelPropertyRef_int(scope,attr) ::=
=> "(<scope>!=null?Integer.valueOf(<scope>.getText()):0)"
****************
这个nnmaildir--prepare是干什么的?
/usr/share/emacs/24.2/lisp/gnus/nnmaildir.el.gz:730: (setq group (nnmaildir--prepare nil gname)
(defun nnmaildir--scan (gname scan-msgs groups method srv-dir srv-ls)
(catch 'return
(let ((36h-ago (- (car (current-time)) 2))
...
=> (setq group (nnmaildir--prepare nil gname)