super4412下调试cmos驱动是的nternal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM问题解决

本文主要是介绍super4412下调试cmos驱动是的nternal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM问题解决,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一直都觉得友善之臂的4412开发板的cmos硬件接口部分有问题,所以友善官方一直没有更新cmos摄像头驱动,但是还是得试着调,

我用的摄像头模块为ov5642,在把摄像头相关的板级配置都添加好后,编译内核,运行出现了

[    2.970000] v4l2_i2c_subdev_init finished 
[    2.975000] start read ov5642 id 
[    2.975000] ov5642 0-003c: Chip ID 0x5642 detected
[    2.980000] s5p-fimc-md: Registered sensor subdevice ov5642
[    2.985000] ------------[ cut here ]------------
[    2.990000] kernel BUG at drivers/media/media-entity.c:399!
[    2.995000] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[    3.005000] Modules linked in:
[    3.005000] CPU: 0    Not tainted  (3.5.0-FriendlyARM #3)
[    3.010000] PC is at media_entity_create_link+0xe8(地址偏移)/0xec)(总大小)
[    3.015000] LR is at __fimc_md_create_fimc_sink_links+0x13c/0x240
[    3.025000] pc : [<c038fe84>]    lr : [<c0402e10>]    psr: 60000013
[    3.025000] sp : ed043e20  ip : ec97c880  fp : c09186c0
[    3.035000] r10: 00000000  r9 : 00000001  r8 : ed1bce40
[    3.040000] r7 : ec97d8a4  r6 : 00000000  r5 : 00000000  r4 : ec97c880
[    3.045000] r3 : 00000000  r2 : ec97c880  r1 : 00000000  r0 : ed1bce40
[    3.050000] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[    3.060000] Control: 10c5387d  Table: 4000404a  DAC: 00000015
[    3.065000] 
[    3.065000] PC: 0xc038fe04:
[    3.070000] fe04  e08aa08a e1a0a10a e083300a e5873004 e587900c e1a00004 ebffffba e2503000
[    3.080000] fe24  0a00000f e598202c e1a00005 e0826006 e5836000 e594202c e583900c e082a00a
[    3.085000] fe44  e583a004 e5873008 e5837008 e1d432b8 e2833001 e1c432b8 e8bd87f0 e3e0000b
[    3.095000] fe64  e8bd87f0 e1d832b6 e3e0000b e2433001 e1c832b6 e8bd87f0 e7f001f2 e7f001f2
[    3.100000] fe84  e7f001f2 e3500000 012fff1e e5903008 e5933000 e3530000 012fff1e e5933050
[    3.110000] fea4  e5930008 eaf3c260 e92d4010 e2504000 0a000003 e5943008 e5933000 e3530000
[    3.120000] fec4  1a000001 e1a00004 e8bd8010 e5933050 e5930008 ebf3bfc1 e3500000 03a04000
[    3.125000] fee4  e1a00004 e8bd8010 e92d4070 e5902080 e1a04000 e7900182 e3500000 08bd8070
[    3.135000] 
[    3.135000] LR: 0xc0402d90:
[    3.140000] 2d90  e1a03007 e1a00006 1a00000c e5952084 e3520000 0a000009 e592c000 e35c0000
[    3.145000] 2db0  0a000006 e59a202c e59de010 e595107c e082200e e12fff3c e3500000 0a000041
[    3.155000] 2dd0  e1a0000b e28dd024 e8bd8ff0 e59d2048 e284c070 e1a03552 e2033001 e58d300c
[    3.165000] 2df0  e59de00c e1a0200c e3a03000 e1a01009 e1a0000a e58dc008 e58de000 ebfe33e2
[    3.170000] 2e10  e59dc008 e250b000 e59d300c e1a0000c 1affffea e59420a4 e3520000 0affffc4
[    3.180000] 2e30  e592c000 e35c0000 0affffc1 e59a202c e59de010 e594109c e082200e e12fff3c
[    3.190000] 2e50  e3500000 1affffba e59d000c e594c080 e3500000 03a0302d 13a0303d e59a2010
[    3.195000] 2e70  e59d101c e59f0094 e58dc000 eb085a39 e59d100c e59d2014 e2213001 e3520000
[    3.205000] 
[    3.205000] SP: 0xed043da0:
[    3.210000] 3da0  00000000 c005e9cc ed04df00 ed04df00 ed043dd4 00000013 ed04e314 ed04df00
[    3.215000] 3dc0  a0000093 c038fe88 60000013 c0013914 00000000 c00136a8 ed1bce40 00000000
[    3.225000] 3de0  ec97c880 00000000 ec97c880 00000000 00000000 ec97d8a4 ed1bce40 00000001
[    3.235000] 3e00  00000000 c09186c0 ec97c880 ed043e20 c0402e10 c038fe84 60000013 ffffffff
[    3.240000] 3e20  ec97c810 00000000 ec97d810 ec97d8a4 00000000 00000000 ed1bce40 c0402e10
[    3.250000] 3e40  00000001 60000013 ec97c880 00000001 00000000 ed1bce40 ec97dba8 ec97db40
[    3.260000] 3e60  00000002 ec97d810 ed1bce40 00000000 ec97d810 00000000 ec97d8b8 00000001
[    3.265000] 3e80  c09186c0 c04036f0 00000001 00002bb2 ec97db28 ec97db40 ec97db0c ec97c810
[    3.275000] 
[    3.275000] IP: 0xec97c800:
[    3.280000] c800  ec989740 c0918684 c02c0b80 00000000 00000000 00000000 00000001 00000000
[    3.285000] c820  00000000 ec97c824 ec97c824 00000000 c0918530 00000000 c094cbb4 00000000
[    3.295000] c840  c0909da0 c090a8a8 f0c28000 00000000 00000000 ec97c854 ec97c854 ec988300
[    3.305000] c860  ec97db28 ec97dc00 ec9b2780 00000000 00000000 ec97e000 00000000 ec97e400
[    3.310000] c880  ec97e800 ec97e400 ec97d8b8 00000003 ec97c8f0 00020000 00000000 00000000
[    3.320000] c8a0  00000000 00000002 00020000 ec97c968 ec9899c0 c06a2464 00000000 00000000
[    3.325000] c8c0  00000000 00000000 00000000 00000000 ec97ccd0 ec97db30 00000000 00000004
[    3.335000] c8e0  ec97db28 c094cc70 c06a246c 00000000 434d4946 0000302e 00000000 00000000
[    3.345000] 
[    3.345000] FP: 0xc0918640:
[    3.350000] 8640  c091a8c0 00000000 ffffffff 00000000 ed1c0ec0 c0918654 c0918654 00000000
[    3.355000] 8660  00000000 c0908eec c0913550 ed1c0e40 00000000 00000000 00000000 00000000
[    3.365000] 8680  00000000 ec97c800 ec989940 00000000 00000000 00000000 00000000 00000000
[    3.370000] 86a0  00000000 00000000 00000002 c091a8c8 c094cad8 00000000 c07c945c ffffffff
[    3.380000] 86c0  c09325e8 ed0c8500 ed0cb180 c0916f4c c0918b64 c09325f0 ed0812c0 c0932440
[    3.390000] 86e0  ed0cb200 0000000f 00000007 00000000 00000000 00000000 00000000 00000000
[    3.395000] 8700  c0918700 c0918700 ed048000 c09325a8 c094ccdc ed0e4440 00000000 00000000
[    3.405000] 8720  00000000 00000000 c0916fa8 c0918bc0 7fffffff 00000000 00000000 c091873c
[    3.415000] 
[    3.415000] R0: 0xed1bcdc0:
[    3.415000] cdc0  00000000 00000000 00000000 00000000 00000000 ed028480 00000000 00000000
[    3.425000] cde0  00000000 00000000 00000000 00000000 ffffffff ffffffff 00000000 00000000
[    3.435000] ce00  00000000 ed1bce04 ed1bce04 ed1bce0c ed1bce0c ecd0b04c 00000000 00000000
[    3.440000] ce20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.450000] ce40  ec97dafc ec97d480 ec97d8b8 0000000d ed1bceb0 00020000 00000000 00000000
[    3.460000] ce60  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.465000] ce80  00000000 00000000 00000000 00000000 ec97db30 ec97d4d0 00000000 00000001
[    3.475000] cea0  ec97db28 c0947ce8 00000000 00000000 3635766f 30203234 3330302d 00000063
[    3.485000] 
[    3.485000] R2: 0xec97c800:
[    3.485000] c800  ec989740 c0918684 c02c0b80 00000000 00000000 00000000 00000001 00000000
[    3.495000] c820  00000000 ec97c824 ec97c824 00000000 c0918530 00000000 c094cbb4 00000000
[    3.505000] c840  c0909da0 c090a8a8 f0c28000 00000000 00000000 ec97c854 ec97c854 ec988300
[    3.510000] c860  ec97db28 ec97dc00 ec9b2780 00000000 00000000 ec97e000 00000000 ec97e400
[    3.520000] c880  ec97e800 ec97e400 ec97d8b8 00000003 ec97c8f0 00020000 00000000 00000000
[    3.530000] c8a0  00000000 00000002 00020000 ec97c968 ec9899c0 c06a2464 00000000 00000000
[    3.535000] c8c0  00000000 00000000 00000000 00000000 ec97ccd0 ec97db30 00000000 00000004
[    3.545000] c8e0  ec97db28 c094cc70 c06a246c 00000000 434d4946 0000302e 00000000 00000000
[    3.550000] 
[    3.550000] R4: 0xec97c800:
[    3.555000] c800  ec989740 c0918684 c02c0b80 00000000 00000000 00000000 00000001 00000000
[    3.565000] c820  00000000 ec97c824 ec97c824 00000000 c0918530 00000000 c094cbb4 00000000
[    3.575000] c840  c0909da0 c090a8a8 f0c28000 00000000 00000000 ec97c854 ec97c854 ec988300
[    3.580000] c860  ec97db28 ec97dc00 ec9b2780 00000000 00000000 ec97e000 00000000 ec97e400
[    3.590000] c880  ec97e800 ec97e400 ec97d8b8 00000003 ec97c8f0 00020000 00000000 00000000
[    3.595000] c8a0  00000000 00000002 00020000 ec97c968 ec9899c0 c06a2464 00000000 00000000
[    3.605000] c8c0  00000000 00000000 00000000 00000000 ec97ccd0 ec97db30 00000000 00000004
[    3.615000] c8e0  ec97db28 c094cc70 c06a246c 00000000 434d4946 0000302e 00000000 00000000
[    3.620000] 
[    3.620000] R7: 0xec97d824:
[    3.625000] d824  ed1bce40 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.635000] d844  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.640000] d864  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
[    3.650000] d884  c0909ce8 00000000 05b8d800 c0909d44 00000000 00000000 00000000 00000000
[    3.660000] d8a4  ec97c810 ec97cc10 ec97d010 ec97d410 00000000 c09186c0 00000000 c0677398
[    3.665000] d8c4  00000000 c09186c0 ec988c00 ec9b22c0 ec97dc64 ec979c0c c09186c8 ed0812c0
[    3.675000] d8e4  c0932440 ec9b2340 00000003 00000007 00000000 00000000 00000001 00000000
[    3.685000] d904  00000000 ec97d908 ec97d908 00000000 c0944838 00000000 00000000 00000000
[    3.690000] 
[    3.690000] R8: 0xed1bcdc0:
[    3.695000] cdc0  00000000 00000000 00000000 00000000 00000000 ed028480 00000000 00000000
[    3.705000] cde0  00000000 00000000 00000000 00000000 ffffffff ffffffff 00000000 00000000
[    3.710000] ce00  00000000 ed1bce04 ed1bce04 ed1bce0c ed1bce0c ecd0b04c 00000000 00000000
[    3.720000] ce20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.730000] ce40  ec97dafc ec97d480 ec97d8b8 0000000d ed1bceb0 00020000 00000000 00000000
[    3.735000] ce60  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    3.745000] ce80  00000000 00000000 00000000 00000000 ec97db30 ec97d4d0 00000000 00000001
[    3.755000] cea0  ec97db28 c0947ce8 00000000 00000000 3635766f 30203234 3330302d 00000063
[    3.760000] Process swapper/0 (pid: 1, stack limit = 0xed0422f8)
[    3.765000] Stack: (0xed043e20 to 0xed044000)
[    3.770000] 3e20: ec97c810 00000000 ec97d810 ec97d8a4 00000000 00000000 ed1bce40 c0402e10
[    3.780000] 3e40: 00000001 60000013 ec97c880 00000001 00000000 ed1bce40 ec97dba8 ec97db40
[    3.785000] 3e60: 00000002 ec97d810 ed1bce40 00000000 ec97d810 00000000 ec97d8b8 00000001
[    3.795000] 3e80: c09186c0 c04036f0 00000001 00002bb2 ec97db28 ec97db40 ec97db0c ec97c810
[    3.805000] 3ea0: ec97d8b8 c09186c0 00000001 6b6c6373 6d61635f c0140031 c09186c0 c0057364
[    3.810000] 3ec0: 00000000 ec988b80 ed0cb200 ec9a8c58 c09e679c c09186c0 c09e679c c09e67a4
[    3.820000] 3ee0: 00000000 c094ccdc c08d9b64 c08a71c0 00000000 c02bfaf4 c02bfae0 c02be8bc
[    3.830000] 3f00: 00000000 c09186c0 c094ccdc c09186f4 00000000 c08c335c c08a71c0 c02beac0
[    3.835000] 3f20: c094ccdc ed043f30 c02bea34 c02bd180 ed029c60 ed0c8538 00000000 c094ccdc
[    3.845000] 3f40: c09325a8 ec988b80 00000000 c02be0b0 c07c945c c0257724 ed029c00 c094ccdc
[    3.855000] 3f60: c09917c0 ed042000 00000000 c08c335c c08a71c0 c02befe4 c08d10cc c09917c0
[    3.860000] 3f80: ed042000 00000000 c08c335c c00086a4 c080d88c c0872c04 00000006 00000006
[    3.870000] 3fa0: c091d82c c08d10c8 00000006 c08d10cc 00000006 c08d10ac c09917c0 0000015d
[    3.875000] 3fc0: c08a71c0 c08a7918 00000006 00000006 c08a71c0 00000000 00000000 c08a781c
[    3.885000] 3fe0: c0014b58 00000013 00000000 00000000 00000000 c0014b58 ffffffff ffffffff
[    3.895000] [<c038fe84>] (media_entity_create_link+0xe8/0xec) from [<c0402e10>] (__fimc_md_create_fimc_sink_links+0x13c/0x240)
[    3.905000] [<c0402e10>] (__fimc_md_create_fimc_sink_links+0x13c/0x240) from [<c04036f0>] (fimc_md_probe+0x6c8/0x91c)
[    3.915000] [<c04036f0>] (fimc_md_probe+0x6c8/0x91c) from [<c02bfaf4>] (platform_drv_probe+0x14/0x18)
[    3.925000] [<c02bfaf4>] (platform_drv_probe+0x14/0x18) from [<c02be8bc>] (driver_probe_device+0x9c/0x214)
[    3.935000] [<c02be8bc>] (driver_probe_device+0x9c/0x214) from [<c02beac0>] (__driver_attach+0x8c/0x90)
[    3.945000] [<c02beac0>] (__driver_attach+0x8c/0x90) from [<c02bd180>] (bus_for_each_dev+0x58/0x80)
[    3.955000] [<c02bd180>] (bus_for_each_dev+0x58/0x80) from [<c02be0b0>] (bus_add_driver+0x180/0x248)
[    3.960000] [<c02be0b0>] (bus_add_driver+0x180/0x248) from [<c02befe4>] (driver_register+0x78/0x12c)
[    3.970000] [<c02befe4>] (driver_register+0x78/0x12c) from [<c00086a4>] (do_one_initcall+0x30/0x174)
[    3.980000] [<c00086a4>] (do_one_initcall+0x30/0x174) from [<c08a7918>] (kernel_init+0xfc/0x1c8)
[    3.990000] [<c08a7918>] (kernel_init+0xfc/0x1c8) from [<c0014b58>] (kernel_thread_exit+0x0/0x8)
[    4.000000] Code: e1c832b6 e8bd87f0 e7f001f2 e7f001f2 (e7f001f2) 
[    4.005000] ---[ end trace bed4e52213d7da6d ]---
[    4.010000] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    4.010000] 
[    4.015000] CPU1: stopping
[    4.015000] [<c001aa44>] (unwind_backtrace+0x0/0xf0) from [<c00192fc>] (handle_IPI+0x184/0x1b8)
[    4.015000] [<c00192fc>] (handle_IPI+0x184/0x1b8) from [<c0008514>] (gic_handle_irq+0x60/0x68)
[    4.015000] [<c0008514>] (gic_handle_irq+0x60/0x68) from [<c0013600>] (__irq_svc+0x40/0x70)
[    4.015000] Exception stack(0xed067f90 to 0xed067fd8)
[    4.015000] 7f80:                                     ffffffed 00000001 01a33000 00000000
[    4.015000] 7fa0: ed066000 c0991888 c0900058 c061fb18 c0908728 413fc090 00000000 00000000
[    4.015000] 7fc0: 00000008 ed067fd8 c0014bb8 c0014bbc 60000013 ffffffff
[    4.015000] [<c0013600>] (__irq_svc+0x40/0x70) from [<c0014bbc>] (default_idle+0x28/0x30)
[    4.015000] [<c0014bbc>] (default_idle+0x28/0x30) from [<c0014fb0>] (cpu_idle+0xf4/0x11c)
[    4.015000] [<c0014fb0>] (cpu_idle+0xf4/0x11c) from [<40616614>] (0x40616614)
[    4.015000] CPU2: stopping
[    4.015000] [<c001aa44>] (unwind_backtrace+0x0/0xf0) from [<c00192fc>] (handle_IPI+0x184/0x1b8)
[    4.015000] [<c00192fc>] (handle_IPI+0x184/0x1b8) from [<c0008514>] (gic_handle_irq+0x60/0x68)
[    4.015000] [<c0008514>] (gic_handle_irq+0x60/0x68) from [<c0013600>] (__irq_svc+0x40/0x70)
[    4.015000] Exception stack(0xed069f90 to 0xed069fd8)
[    4.015000] 9f80:                                     ffffffed 00000002 01a3b000 00000000
[    4.015000] 9fa0: ed068000 c0991888 c0900058 c061fb18 c0908728 413fc090 00000000 00000000
[    4.015000] 9fc0: c09b6690 ed069fd8 c0014bb8 c0014bbc 60000013 ffffffff
[    4.015000] [<c0013600>] (__irq_svc+0x40/0x70) from [<c0014bbc>] (default_idle+0x28/0x30)
[    4.015000] [<c0014bbc>] (default_idle+0x28/0x30) from [<c0014fb0>] (cpu_idle+0xf4/0x11c)
[    4.015000] [<c0014fb0>] (cpu_idle+0xf4/0x11c) from [<40616614>] (0x40616614)
[    4.015000] CPU3: stopping
[    4.015000] [<c001aa44>] (unwind_backtrace+0x0/0xf0) from [<c00192fc>] (handle_IPI+0x184/0x1b8)
[    4.015000] [<c00192fc>] (handle_IPI+0x184/0x1b8) from [<c0008514>] (gic_handle_irq+0x60/0x68)
[    4.015000] [<c0008514>] (gic_handle_irq+0x60/0x68) from [<c0013600>] (__irq_svc+0x40/0x70)
[    4.015000] Exception stack(0xed06bf90 to 0xed06bfd8)
[    4.015000] bf80:                                     ffffffed 00000003 01a43000 00000000
[    4.015000] bfa0: ed06a000 c0991888 c0900058 c061fb18 c0908728 413fc090 00000000 00000000
[    4.015000] bfc0: 00000008 ed06bfd8 c0014bb8 c0014bbc 60000013 ffffffff
[    4.015000] [<c0013600>] (__irq_svc+0x40/0x70) from [<c0014bbc>] (default_idle+0x28/0x30)
[    4.015000] [<c0014bbc>] (default_idle+0x28/0x30) from [<c0014fb0>] (cpu_idle+0xf4/0x11c)
[    4.015000] [<c0014fb0>] (cpu_idle+0xf4/0x11c) from [<40616614>] (0x40616614)
根据上面打印信息可知,导致内核启动中断的地方是
media_entity_create_link+0xe8/0xec) from [<c0402e10>] (__fimc_md_create_fimc_sink_links+0x13c/0x240)
还有一个更准确的信息是
[    2.990000] kernel BUG at drivers/media/media-entity.c:399!

对应的函数为

int
media_entity_create_link(struct media_entity *source, u16 source_pad,struct media_entity *sink, u16 sink_pad, u32 flags)
{struct media_link *link;struct media_link *backlink;BUG_ON(source == NULL || sink == NULL);BUG_ON(source_pad >= source->num_pads);BUG_ON(sink_pad >= sink->num_pads);link = media_entity_add_link(source);if (link == NULL)return -ENOMEM;link->source = &source->pads[source_pad];link->sink = &sink->pads[sink_pad];link->flags = flags;/* Create the backlink. Backlinks are used to help graph traversal and* are not reported to userspace.*/backlink = media_entity_add_link(sink);if (backlink == NULL) {source->num_links--;return -ENOMEM;}backlink->source = &source->pads[source_pad];backlink->sink = &sink->pads[sink_pad];backlink->flags = flags;link->reverse = backlink;backlink->reverse = link;sink->num_backlinks++;return 0;
}
339行对应的地方为
BUG_ON(source_pad >= source->num_pads);
说明上面这句程序里操作的变量有问题,但是这句只是一个调试的一句话,看不出实际问题,所以把这句话屏蔽了

然后编译内核,

打印信息为

[    2.620000] !---senor-----__fimc_md_create_fimc_sink_links
[    2.620000] !---__fimc_md_create_fimc_sink_links to 1 media_entity_create_link
[    2.620000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    2.620000] pgd = c0004000
[    2.620000] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[    2.620000] Modules linked in:
[    2.620000] CPU: 0    Not tainted  (3.5.0-FriendlyARM #6)
[    2.620000] PC is at fimc_link_setup+0x4/0x6c
[    2.620000] LR is at __fimc_md_create_fimc_sink_links+0x1e0/0x288
[    2.620000] pc : [<c0400158>]    lr : [<c0402e64>]    psr: a0000013
[    2.620000] sp : ed043e28  ip : ed1bce40  fp : ec9adba8
[    2.620000] r10: c0400154  r9 : ed1bce40  r8 : 00000000
[    2.620000] r7 : ec9ad810  r6 : ec9ad8a4  r5 : ec9ac810  r4 : 00000000
[    2.620000] r3 : 00000001  r2 : 00000000  r1 : ec9ac968  r0 : ec9ac880
[    2.620000] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
[    2.620000] Control: 10c5387d  Table: 4000404a  DAC: 00000015
[    2.620000] 
[    2.620000] PC: 0xc04000d8:
[    2.620000] 00d8  e5853008 e5943004 e585300c eb0867af e3a00000 e8bd80f8 e5910008 e5926004
[    2.620000] 00f8  e2800058 ebfaf83d e1d032b4 e1560003 2a00000f e594303c e0866106 e0834206
[    2.620000] 0118  e285c008 e8b4000f e8ac000f e8b4000f e8ac000f e894000f e88c000f e3a00000
[    2.620000] 0138  e8bd80f8 e59f000c e30015ff ebf0c120 eaffffe0 e7f001f2 c081edb8 e92d4010
[    2.620000] 0158  e5922000 e5904094 e5922014 e20228ff e3520802 13e00015 18bd8010 e3540000
[    2.620000] 0178  0a00000a e2133001 05843328 01a00003 08bd8010 e5943328 e3530000 05902090
[    2.620000] 0198  13e0000f 01a00003 05842328 e8bd8010 e59f000c e3001598 ebf0c105 e1a00004
[    2.620000] 01b8  e8bd8010 c081edb8 e92d4070 e5d030f0 e2212001 e7c33192 e1a05001 e5c030f0
[    2.620000] 
[    2.620000] LR: 0xc0402de4:
[    2.620000] 2de4  e1a0a452 e59f0118 e20aa001 e58d3020 e58dc010 e58da00c eb085a61 e59dc010
[    2.620000] 2e04  e59d1018 e1a0000c e59d2020 e3a03000 e58da000 ebfe33cf e3500000 e59dc010
[    2.620000] 2e24  1a000033 e59530a4 e3530000 0affffaf e5933000 e3530000 e58d3024 0affffab
[    2.620000] 2e44  e59c202c e59da014 e595109c e082200a e59d300c e59d0020 e59da024 e12fff3a
[    2.620000] 2e64  e3500000 e59dc010 1affffa0 e59d000c e595e080 e3500000 e59c2010 03a0302d
[    2.620000] 2e84  13a0303d e59d101c e59f0070 e58dc010 e58de000 eb085a3a e59d100c e59dc010
[    2.620000] 2ea4  e2213001 e3590000 03833001 e3530000 1affff8b e5995098 e2743001 33a03000
[    2.620000] 2ec4  e3550000 03a03000 e3530000 0affff84 e1a0000b eb0866c3 e5973094 e1a01000
[    2.620000] 
[    2.620000] SP: 0xed043da8:
[    2.620000] 3da8  a0000013 000184c0 00000000 00000000 00000000 c00cfdcc 00000020 000000d0
[    2.620000] 3dc8  c0400158 a0000013 ffffffff ed043e14 00000000 c0013598 ec9ac880 ec9ac968
[    2.620000] 3de8  00000000 00000001 00000000 ec9ac810 ec9ad8a4 ec9ad810 00000000 ed1bce40
[    2.620000] 3e08  c0400154 ec9adba8 ed1bce40 ed043e28 c0402e64 c0400158 a0000013 ffffffff
[    2.620000] 3e28  00000000 c0402e64 00000001 ec9ad810 ed1bce40 00000001 ed1bce40 00000000
[    2.620000] 3e48  00000000 ec9adb40 ec9ac880 c0400154 c081f23c ec9ad810 ed1bce40 ed1bce40
[    2.620000] 3e68  00000001 ec9ad810 ec9ad8b8 00000000 c0918678 c04036c8 00000001 c014c8d0
[    2.620000] 3e88  c07e82b8 00002b92 ec9adb28 ec9adb40 ec9adb0c 00000001 ec9ad8b8 c0918678
[    2.620000] 
[    2.620000] IP: 0xed1bcdc0:
[    2.620000] cdc0  00000000 00000000 00000000 00000000 00000000 ed028480 00000000 00000000
[    2.620000] cde0  00000000 00000000 00000000 00000000 ffffffff ffffffff 00000000 00000000
[    2.620000] ce00  00000000 ed1bce04 ed1bce04 ed1bce0c ed1bce0c ecd0b04c 00000000 00000000
[    2.620000] ce20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.620000] ce40  ec9adafc ec9ad480 ec9ad8b8 0000000d ed1bceb0 00020000 00000000 00000000
[    2.620000] ce60  00000000 00010000 00020000 00000000 ec987040 00000000 00000000 00000000
[    2.620000] ce80  00000000 00000000 00000000 00000000 ec9adb30 ec9ad4d0 00000000 00000001
[    2.625000] cea0  ec9adb28 c0947ca8 00000000 00000000 3635766f 30203234 3330302d 00000063
[    2.625000] 
[    2.625000] FP: 0xec9adb28:
[    2.625000] db28  c0918678 ec9ad8b8 ec9ac8d0 ed1bce90 00000000 00000000 2d703573 636d6966
[    2.625000] db48  00646d2d 00000000 00000000 00000000 00000000 00000000 00000000 c04026e4
[    2.625000] db68  00000000 00000000 00000000 00000000 00000000 00000001 00000000 00000000
[    2.625000] db88  ec9adb88 ec9adb88 00000000 00000009 00000000 c0918670 00000000 ec978c58
[    2.625000] dba8  00000000 00000000 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[    2.625000] dbc8  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[    2.625000] dbe8  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ec9ae400 ec9adafc
[    2.625000] dc08  ec9ad8b8 00000001 ec9adddc 00010001 00000000 00000000 00000000 00000000
[    2.625000] 
[    2.625000] R0: 0xec9ac800:
[    2.625000] c800  ec9b9740 c091863c c02c0b40 00000000 00000000 00000000 00000001 00000000
[    2.625000] c820  00000000 ec9ac824 ec9ac824 00000000 c09184e8 00000000 c094cb74 00000000
[    2.625000] c840  c0909da0 c090a8a8 f0c28000 00000000 00000000 ec9ac854 ec9ac854 ec9b8380
[    2.625000] c860  ec9adb28 ec9adc00 ec982780 00000000 00000000 ec9ae000 00000000 ec9ae400
[    2.625000] c880  ec9ae800 ec9ae400 ec9ad8b8 00000003 ec9ac8f0 00020000 00000000 00000000
[    2.625000] c8a0  00000000 00010002 00020001 ec9ac968 ec9b99c0 c06a2464 00000000 00000000
[    2.625000] c8c0  00000000 00000000 00000000 00000000 ec9accd0 ec9adb30 00000000 00000004
[    2.625000] c8e0  ec9adb28 c094cc30 c06a246c 00000000 434d4946 0000302e 00000000 00000000
[    2.625000] 
[    2.625000] R1: 0xec9ac8e8:
[    2.625000] c8e8  c06a246c 00000000 434d4946 0000302e 00000000 00000000 00000000 00000000
[    2.625000] c908  00000000 00000000 00000800 ec9ac810 00000000 00000000 ec978c58 00000000
[    2.625000] c928  ec9f4814 ec9ae400 00000000 00000001 00000000 00000000 00000000 00000000
[    2.625000] c948  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] c968  ec9ac880 00000000 00000001 ec9ac880 00000001 00000002 ec9ac980 ec9ac980
[    2.625000] c988  ec9ac988 ec9ac988 c0818904 00000009 00000003 00000000 c094cc08 c0679ffc
[    2.625000] c9a8  ec9ae000 000002bc 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] c9c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] 
[    2.625000] R5: 0xec9ac790:
[    2.625000] c790  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] c7b0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] c7d0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] c7f0  00000000 00000000 00000000 00000000 ec9b9740 c091863c c02c0b40 00000000
[    2.625000] c810  00000000 00000000 00000001 00000000 00000000 ec9ac824 ec9ac824 00000000
[    2.625000] c830  c09184e8 00000000 c094cb74 00000000 c0909da0 c090a8a8 f0c28000 00000000
[    2.625000] c850  00000000 ec9ac854 ec9ac854 ec9b8380 ec9adb28 ec9adc00 ec982780 00000000
[    2.625000] c870  00000000 ec9ae000 00000000 ec9ae400 ec9ae800 ec9ae400 ec9ad8b8 00000003
[    2.625000] 
[    2.625000] R6: 0xec9ad824:
[    2.625000] d824  ed1bce40 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] d844  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] d864  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001
[    2.625000] d884  c0909ce8 00000000 05b8d800 c0909d44 00000000 00000000 00000000 00000000
[    2.625000] d8a4  ec9ac810 ec9acc10 ec9ad010 ec9ad410 00000000 c0918678 00000000 c0677398
[    2.625000] d8c4  00000000 c0918678 ec9b8c80 ec9822c0 ec9adc64 ec9a9c0c c0918680 ed0812c0
[    2.625000] d8e4  c0932400 ec982340 00000003 00000007 00000000 00000000 00000001 00000000
[    2.625000] d904  00000000 ec9ad908 ec9ad908 00000000 c09447f8 00000000 00000000 00000000
[    2.625000] 
[    2.625000] R7: 0xec9ad790:
[    2.625000] d790  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[    2.625000] d7b0  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[    2.625000] d7d0  ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
[    2.625000] d7f0  ffffffff ffffffff ffffffff ffffffff c09187c4 c09187c4 c02c0b40 00000000
[    2.625000] d810  00000000 00000000 00000000 00000000 c0910418 ed1bce40 00000000 00000000
[    2.625000] d830  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] d850  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] d870  00000000 00000000 00000000 00000000 00000001 c0909ce8 00000000 05b8d800
[    2.625000] 
[    2.625000] R9: 0xed1bcdc0:
[    2.625000] cdc0  00000000 00000000 00000000 00000000 00000000 ed028480 00000000 00000000
[    2.625000] cde0  00000000 00000000 00000000 00000000 ffffffff ffffffff 00000000 00000000
[    2.625000] ce00  00000000 ed1bce04 ed1bce04 ed1bce0c ed1bce0c ecd0b04c 00000000 00000000
[    2.625000] ce20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    2.625000] ce40  ec9adafc ec9ad480 ec9ad8b8 0000000d ed1bceb0 00020000 00000000 00000000
[    2.625000] ce60  00000000 00010000 00020000 00000000 ec987040 00000000 00000000 00000000
[    2.625000] ce80  00000000 00000000 00000000 00000000 ec9adb30 ec9ad4d0 00000000 00000001
[    2.625000] cea0  ec9adb28 c0947ca8 00000000 00000000 3635766f 30203234 3330302d 00000063
[    2.625000] 
[    2.625000] R10: 0xc04000d4:
[    2.625000] 00d4  e1a00006 e5853008 e5943004 e585300c eb0867af e3a00000 e8bd80f8 e5910008
[    2.625000] 00f4  e5926004 e2800058 ebfaf83d e1d032b4 e1560003 2a00000f e594303c e0866106
[    2.625000] 0114  e0834206 e285c008 e8b4000f e8ac000f e8b4000f e8ac000f e894000f e88c000f
[    2.625000] 0134  e3a00000 e8bd80f8 e59f000c e30015ff ebf0c120 eaffffe0 e7f001f2 c081edb8
[    2.625000] 0154  e92d4010 e5922000 e5904094 e5922014 e20228ff e3520802 13e00015 18bd8010
[    2.625000] 0174  e3540000 0a00000a e2133001 05843328 01a00003 08bd8010 e5943328 e3530000
[    2.625000] 0194  05902090 13e0000f 01a00003 05842328 e8bd8010 e59f000c e3001598 ebf0c105
[    2.625000] 01b4  e1a00004 e8bd8010 c081edb8 e92d4070 e5d030f0 e2212001 e7c33192 e1a05001
[    2.625000] Process swapper/0 (pid: 1, stack limit = 0xed0422f8)
[    2.625000] Stack: (0xed043e28 to 0xed044000)
[    2.625000] 3e20:                   00000000 c0402e64 00000001 ec9ad810 ed1bce40 00000001
[    2.625000] 3e40: ed1bce40 00000000 00000000 ec9adb40 ec9ac880 c0400154 c081f23c ec9ad810
[    2.625000] 3e60: ed1bce40 ed1bce40 00000001 ec9ad810 ec9ad8b8 00000000 c0918678 c04036c8
[    2.625000] 3e80: 00000001 c014c8d0 c07e82b8 00002b92 ec9adb28 ec9adb40 ec9adb0c 00000001
[    2.625000] 3ea0: ec9ad8b8 c0918678 00000001 6b6c6373 6d61635f c0140031 c0918678 c0057334
[    2.625000] 3ec0: 00000000 ec9b8c00 ed103200 ec978c58 c09e675c c0918678 c09e675c c09e6764
[    2.625000] 3ee0: 00000000 c094cc9c c08d9ae4 c08a71c0 00000000 c02bfab4 c02bfaa0 c02be87c
[    2.625000] 3f00: 00000000 c0918678 c094cc9c c09186ac 00000000 c08c32e8 c08a71c0 c02bea80
[    2.625000] 3f20: c094cc9c ed043f30 c02be9f4 c02bd140 ed029c60 ed100538 00000000 c094cc9c
[    2.625000] 3f40: c0932568 ec9b8c00 00000000 c02be070 c07c93b0 c02576e4 ed029c00 c094cc9c
[    2.625000] 3f60: c0991780 ed042000 00000000 c08c32e8 c08a71c0 c02befa4 c08d1054 c0991780
[    2.625000] 3f80: ed042000 00000000 c08c32e8 c00086a4 c080d7e0 c0872c98 00000006 00000006
[    2.625000] 3fa0: c091d7ec c08d1050 00000006 c08d1054 00000006 c08d1034 c0991780 0000015d
[    2.625000] 3fc0: c08a71c0 c08a7918 00000006 00000006 c08a71c0 00000000 00000000 c08a781c
[    2.625000] 3fe0: c0014b58 00000013 00000000 00000000 00000000 c0014b58 ffffffff ffffffff
[    2.625000] [<c0400158>] (fimc_link_setup+0x4/0x6c) from [<c0402e64>] (__fimc_md_create_fimc_sink_links+0x1e0/0x288)
[    2.625000] [<c0402e64>] (__fimc_md_create_fimc_sink_links+0x1e0/0x288) from [<c04036c8>] (fimc_md_probe+0x6a8/0x948)
[    2.625000] [<c04036c8>] (fimc_md_probe+0x6a8/0x948) from [<c02bfab4>] (platform_drv_probe+0x14/0x18)
[    2.625000] [<c02bfab4>] (platform_drv_probe+0x14/0x18) from [<c02be87c>] (driver_probe_device+0x9c/0x214)
[    2.625000] [<c02be87c>] (driver_probe_device+0x9c/0x214) from [<c02bea80>] (__driver_attach+0x8c/0x90)
[    2.625000] [<c02bea80>] (__driver_attach+0x8c/0x90) from [<c02bd140>] (bus_for_each_dev+0x58/0x80)
[    2.625000] [<c02bd140>] (bus_for_each_dev+0x58/0x80) from [<c02be070>] (bus_add_driver+0x180/0x248)
[    2.625000] [<c02be070>] (bus_add_driver+0x180/0x248) from [<c02befa4>] (driver_register+0x78/0x12c)
[    2.625000] [<c02befa4>] (driver_register+0x78/0x12c) from [<c00086a4>] (do_one_initcall+0x30/0x174)
[    2.625000] [<c00086a4>] (do_one_initcall+0x30/0x174) from [<c08a7918>] (kernel_init+0xfc/0x1c8)
[    2.625000] [<c08a7918>] (kernel_init+0xfc/0x1c8) from [<c0014b58>] (kernel_thread_exit+0x0/0x8)
根据上面的打印信息,
[    2.620000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
程序里出现了空指针,
[    2.620000] PC is at fimc_link_setup+0x4/0x6c
[    2.620000] pc : [<c0400158>]  
这里的打印信息给出了出错的函数,如果没给出具体的函数,就要反编译内核,找到对应的函数,

根据分析,发现是内核中的fimc_link_setup这个函数里有出现空指针

static int fimc_link_setup(struct media_entity *entity,const struct media_pad *local,const struct media_pad *remote, u32 flags)
{struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);struct fimc_dev *fimc = v4l2_get_subdevdata(sd);if (media_entity_type(remote->entity) != MEDIA_ENT_T_V4L2_SUBDEV)return -EINVAL;if (WARN_ON(fimc == NULL))return 0;dbg("%s --> %s, flags: 0x%x. input: 0x%x",local->entity->name, remote->entity->name, flags,fimc->vid_cap.input);if (flags & MEDIA_LNK_FL_ENABLED) {if (fimc->vid_cap.input != 0)return -EBUSY;fimc->vid_cap.input = sd->grp_id;return 0;}fimc->vid_cap.input = 0;return 0;
}
static const struct media_entity_operations fimc_sd_media_ops = {.link_setup = fimc_link_setup,
};

经过打印消息,const struct media_pad *remote这个传进来的参数是空的,哪里调用了这个函数呢

_fimc_md_create_fimc_sink_links(struct fimc_md *fmd, struct media_entity *source,  struct v4l2_subdev *sensor,  int pad, int link_mask)

函数里的

ret = media_entity_call(sink, link_setup, &sink->pads[0],

&source->pads[pad], flags);

这个调用是执行(entity)->ops.link_setup,

struct fimc_md *fmd参数中带进来的&fmd->fimc[i]->vid_cap.subdev.entity也就是struct media_entity类型的结构,

它的操作函数link_setup也就是fimc_link_setup函数,后面的&sink->pads[0]和&source->pads[pad]为带入的参数,在此设置一个打印信息,确认传进去的指针的地址值,,&sink->pads[0]来自struct fimc_md *fmd,,而&source->pads[pad]来自于struct media_entity *source形参,

经过打印变量的地址值,

发现,struct media_entity *source变量的地址不为空,但是&source->pads[pad]值为空,这就是问题所在

就是说struct media_entity *source变量的struct media_pad *pads成员,没有进行初始化,为空,


然后,哪个地方调用的__fimc_md_create_fimc_sink_links函数呢,在这个static int fimc_md_create_links(struct fimc_md *fmd)函数里,

case FIMC_ITU_601...FIMC_ITU_656:
source = &sensor->entity;
pad = 0;
break;default:
v4l2_err(&fmd->v4l2_dev, "Wrong bus_type: %x\n",pdata->bus_type);
return -EINVAL;
}
if (source == NULL)
continue;link_mask = 1 << fimc_id++;
ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor,pad, link_mask);
}
上面函数的形参只有一个 struct fimc_md *fmd,而
 __fimc_md_create_fimc_sink_links(fmd, source, sensor,pad, link_mask)
的关键形参还有source和sensor,

由上面函数里的具体代码可知

source = &sensor->entity;

sensor = fmd->sensor[i].subdev;

看出source是从&sensor->entity继承来的

Sensor是从md->sensor[i].subdev这里继承来的

所以上面的参数source从md->sensor[i].subdev->entity来,

fimc_md_create_links在哪被调用呢,在 fimc_md_probe(struct platform_device *pdev)ret = fimc_md_create_links(fmd);

然后上面提到的fmd->sensor[i].subdev>entity在哪里赋值的呢,在fimc_md_probe函数的

if (pdev->dev.platform_data) {

ret = fimc_md_register_sensor_entities(fmd);

if (ret)

goto err_unlock;

}

在 fimc_md_register_sensor_entities(fmd)函数里有

sd = fimc_md_register_sensor(fmd, &fmd->sensor[i]);

ret = __fimc_md_set_camclk(fmd, &fmd->sensor[i], false);

 

if (!IS_ERR(sd)) {

fmd->sensor[i].subdev = sd;

       }

这里有

sd = fimc_md_register_sensor(fmd, &fmd->sensor[i]);

    fmd->sensor[i].subdev = sd;

fimc_md_register_sensor函数展开为

/** Sensor subdevice helper functions*/
static struct v4l2_subdev *fimc_md_register_sensor(struct fimc_md *fmd,struct fimc_sensor_info *s_info)
{struct i2c_adapter *adapter;struct v4l2_subdev *sd = NULL;if (!s_info || !fmd)return NULL;if(s_info->pdata->use_isp){fmd->fimc[0]->is_s5k6a3 = true;fmd->fimc[1]->is_s5k6a3 = true;return fmd->fimc_is_subdev;}adapter = i2c_get_adapter(s_info->pdata->i2c_bus_num);通过I2C号得到I2C适配器,if (!adapter) {v4l2_warn(&fmd->v4l2_dev,"Failed to get I2C adapter %d, deferring probe\n",s_info->pdata->i2c_bus_num);return ERR_PTR(-EPROBE_DEFER);}sd = v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,s_info->pdata->board_info, NULL);if (IS_ERR_OR_NULL(sd)) {i2c_put_adapter(adapter);v4l2_warn(&fmd->v4l2_dev,"Failed to acquire subdev %s, deferring probe\n",s_info->pdata->board_info->type);return ERR_PTR(-EPROBE_DEFER);}v4l2_set_subdev_hostdata(sd, s_info);sd->grp_id = SENSOR_GROUP_ID;v4l2_info(&fmd->v4l2_dev, "Registered sensor subdevice %s\n",s_info->pdata->board_info->type);fmd->fimc[0]->is_m5mo = true;fmd->fimc[1]->is_m5mo = true;return sd;
}

展开v4l2_i2c_new_subdev_board(&fmd->v4l2_dev, adapter,s_info->pdata->board_info, NULL);函数

/* Load an i2c sub-device. */
struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,struct i2c_adapter *adapter, struct i2c_board_info *info,const unsigned short *probe_addrs)
{struct v4l2_subdev *sd = NULL;struct i2c_client *client;BUG_ON(!v4l2_dev);request_module(I2C_MODULE_PREFIX "%s", info->type);/* Create the i2c client */if (info->addr == 0 && probe_addrs)client = i2c_new_probed_device(adapter, info, probe_addrs,NULL);elseclient = i2c_new_device(adapter, info);/* Note: by loading the module first we are certain that c->driverwill be set if the driver was found. If the module was not loadedfirst, then the i2c core tries to delay-load the module for us,and then c->driver is still NULL until the module is finallyloaded. This delay-load mechanism doesn't work if other driverswant to use the i2c device, so explicitly loading the moduleis the best alternative. */if (client == NULL || client->driver == NULL)goto error;/* Lock the module so we can safely get the v4l2_subdev pointer */if (!try_module_get(client->driver->driver.owner))goto error;sd = i2c_get_clientdata(client);/* Register with the v4l2_device which increases the module'suse count as well. */if (v4l2_device_register_subdev(v4l2_dev, sd))sd = NULL;/* Decrease the module use count to match the first try_module_get. */module_put(client->driver->driver.owner);error:/* If we have a client but no subdev, then something went wrong andwe must unregister the client. */if (client && sd == NULL)i2c_unregister_device(client);return sd;
}
根据

sd = i2c_get_clientdata(client);这句,知道sd这个结构体是从i2c client得到的,所以

要从i2c client初始化的地方去找 md->sensor[i].subdev-> entity
i2c client 的初始化在ov5642的i2c driver方面,

在ov5642.c的static int ov5642_probe(struct i2c_client *client,const struct i2c_device_id *did)

函数中添加

struct v4l2_subdev *sd;//add

 sd=&priv->subdev;//add
 priv->pad.flags=MEDIA_PAD_FL_SOURCE;//add

sd->entity.type=MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;//add
ret=media_entity_init(&sd->entity, 1, &priv->pad, 0);//add
if(ret)//add  goto error;//add    

这样oops打印的错误就解决了,但是在super 4412下的cmos摄像头驱动还是没搞好,硬件上没有成功的案例,总让我怀疑是硬件问题,































































































这篇关于super4412下调试cmos驱动是的nternal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM问题解决的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1086324

相关文章

好题——hdu2522(小数问题:求1/n的第一个循环节)

好喜欢这题,第一次做小数问题,一开始真心没思路,然后参考了网上的一些资料。 知识点***********************************无限不循环小数即无理数,不能写作两整数之比*****************************(一开始没想到,小学没学好) 此题1/n肯定是一个有限循环小数,了解这些后就能做此题了。 按照除法的机制,用一个函数表示出来就可以了,代码如下

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

如何解决线上平台抽佣高 线下门店客流少的痛点!

目前,许多传统零售店铺正遭遇客源下降的难题。尽管广告推广能带来一定的客流,但其费用昂贵。鉴于此,众多零售商纷纷选择加入像美团、饿了么和抖音这样的大型在线平台,但这些平台的高佣金率导致了利润的大幅缩水。在这样的市场环境下,商家之间的合作网络逐渐成为一种有效的解决方案,通过资源和客户基础的共享,实现共同的利益增长。 以最近在上海兴起的一个跨行业合作平台为例,该平台融合了环保消费积分系统,在短

购买磨轮平衡机时应该注意什么问题和技巧

在购买磨轮平衡机时,您应该注意以下几个关键点: 平衡精度 平衡精度是衡量平衡机性能的核心指标,直接影响到不平衡量的检测与校准的准确性,从而决定磨轮的振动和噪声水平。高精度的平衡机能显著减少振动和噪声,提高磨削加工的精度。 转速范围 宽广的转速范围意味着平衡机能够处理更多种类的磨轮,适应不同的工作条件和规格要求。 振动监测能力 振动监测能力是评估平衡机性能的重要因素。通过传感器实时监

缓存雪崩问题

缓存雪崩是缓存中大量key失效后当高并发到来时导致大量请求到数据库,瞬间耗尽数据库资源,导致数据库无法使用。 解决方案: 1、使用锁进行控制 2、对同一类型信息的key设置不同的过期时间 3、缓存预热 1. 什么是缓存雪崩 缓存雪崩是指在短时间内,大量缓存数据同时失效,导致所有请求直接涌向数据库,瞬间增加数据库的负载压力,可能导致数据库性能下降甚至崩溃。这种情况往往发生在缓存中大量 k

ASIO网络调试助手之一:简介

多年前,写过几篇《Boost.Asio C++网络编程》的学习文章,一直没机会实践。最近项目中用到了Asio,于是抽空写了个网络调试助手。 开发环境: Win10 Qt5.12.6 + Asio(standalone) + spdlog 支持协议: UDP + TCP Client + TCP Server 独立的Asio(http://www.think-async.com)只包含了头文件,不依

6.1.数据结构-c/c++堆详解下篇(堆排序,TopK问题)

上篇:6.1.数据结构-c/c++模拟实现堆上篇(向下,上调整算法,建堆,增删数据)-CSDN博客 本章重点 1.使用堆来完成堆排序 2.使用堆解决TopK问题 目录 一.堆排序 1.1 思路 1.2 代码 1.3 简单测试 二.TopK问题 2.1 思路(求最小): 2.2 C语言代码(手写堆) 2.3 C++代码(使用优先级队列 priority_queue)

如何在Visual Studio中调试.NET源码

今天偶然在看别人代码时,发现在他的代码里使用了Any判断List<T>是否为空。 我一般的做法是先判断是否为null,再判断Count。 看了一下Count的源码如下: 1 [__DynamicallyInvokable]2 public int Count3 {4 [__DynamicallyInvokable]5 get

Linux_kernel驱动开发11

一、改回nfs方式挂载根文件系统         在产品将要上线之前,需要制作不同类型格式的根文件系统         在产品研发阶段,我们还是需要使用nfs的方式挂载根文件系统         优点:可以直接在上位机中修改文件系统内容,延长EMMC的寿命         【1】重启上位机nfs服务         sudo service nfs-kernel-server resta