分享

菜鸟学Linux移植lesson3之WebCamera

 dwlinux 2014-04-06

网络摄像机

1、CMOS摄像头驱动的移植

准备好CMOS摄像头驱动源码,包含2个文件:ov9650.cov9650.h(光盘资料/源码包/驱动源码/camera 驱动),将这2个文件复制到drivers/media/video目录下。26

 

修改drivers/media/目录下Kconfig文件,在 101 行加入:

config S 3C2440_CAMERA

tristate "OV9650 on the S3C2440 driver"

depends on VIDEO_DEV && ARCH_S3C2410

default y if (VIDEO_DEV && ARCH_S3C2410)

修改drivers/media/video目录下Makefile文件,在166行加入:

obj-$(CONFIG_S3C2440_CAMERA) += ov9650.o

配置内核,支持CMOS摄像头:

Device Drivers --->

<*> Multimedia support --->

<*> OV9650 on the S3C2440 driver

 

系统启动之前将摄像头模块和开发板连接好,然后启动系统输出:

initializing s3c2440 camera interface......

s3c2440 camif init done

Loading OV9650 driver.........

OV9650 address 0x60, manufacture ID 0x7FA2, expect 0x7FA2

OV9650 address 0x60, product ID 0x9652, expect 0x9650

OV9650 init done!

Try to bring eth0 interface up ...
/etc/rc.d/init.d/leds: line 16: led-player: not found
ifconfig eth0 hw ether 10:23:45:67:89:ab
/etc/rc.d/init.d/httpd: line 16: /sbin/boa: not found
eth0: link down
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
add default gw 192.168.1.2
Done

Please press Enter to activate this console.
[root@EmbedSky /]# eth0: link up, 100Mbps, full-duplex, lpa 0x45E1

关于实现mjpg-streamer(start_uvc.sh)开机自启动全过程
http://blog.sina.com.cn/s/blog_43bce9bb0100q4pn.html

2、测试CMOS摄像头

[root@EmbedSky /]# mjpg_streamer -i "/lib/WebCam/input_cmoscamera.so -r 320x256"
 -o "/lib/WebCam/output_http.so -w 192.168.1.6:8080"
MJPG-streamer [473]: starting application
MJPG Streamer Version.: 2.0
MJPG-streamer [473]: MJPG Streamer Version.: 2.0

 i: Using CMOS Camera device.: /dev/camera
MJPG-streamer [473]: Using CMOS Camera device.: /dev/camera

 i: Desired Resolution: 320 x 256
MJPG-streamer [473]: Desired Resolution: 320 x 256

 i: Frames Per Second.: 5
MJPG-streamer [473]: Frames Per Second.: 5

 i: Format............: YUV
MJPG-streamer [473]: Format............: YUV

 i: JPEG Quality......: 80
MJPG-streamer [473]: JPEG Quality......: 80

 Init Camera interface failed !! exit fatal
 i: init_VideoIn failed
MJPG-streamer [473]: init_VideoIn failed

百度了一下,发现有用友善之臂的开发板有解释说是由于mjpg软件并不支持所使用的摄像头类型,解决方法1、更换其他摄像头尝试;2、自行修改mjpg源代码以支持摄像头驱动程序接口。

对友善解释的这个原因还是保留意见,不过解决方法2还是值得学习。今天周六了,问题先留着,下周再找找原因,顺便提一下今天遇到的小插曲。今天烧写文件系统的时候,烧不进去,DNW传输一点点就卡住了,重新烧了几次,发现除了内核能够烧写成功,U-BOOT及文件系统均烧写失败,串口打印显示RECEIVED FILE SIZE: ,开发板的S3C2440芯片还其烫无比。擦除了2次NAND FLASH 最后才回归正常。

Now, Downloading [ADDRESS:30000000h,TOTAL:1219130]
RECEIVED FILE SIZE:    

 

--------------------7.12移植情况----------

##### EmbedSky BIOS for SKY2440/TQ2440 #####
Press Space key to Download Mode !
Booting Linux ...
Copy linux kernel from 0x00200000 to 0x30008000, size = 0x00300000 ... Copy Kernel to SDRAM done,NOW, Booting Linux......
Uncompressing Linux......................................................................................................................... done, booting the kernel.
Linux version 2.6.30.4-EmbedSky (root@localhost.localdomain) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-176) ) #14 Mon Jul 11 16:46:36 CST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 400.000 MHz, memory 100.000 MHz, peripheral 50.000 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
NR_IRQS:85
irq: clearing pending ext status 00080000
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60876KB available (3488K code, 374K data, 112K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 199.47 BogoMIPS (lpj=498688)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 296 bytes
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 97 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
yaffs Jul 11 2011 15:26:42 Installing.
msgmni has been set to 119
alg: No test for stdrng (krng)
io scheduler noop registered (default)
Console: switching to colour frame buffer device 40x15
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: tq2440_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: tq2440_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: tq2440_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
loop: module loaded
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
dm9000 Ethernet Driver, V1.31
Now use the default MAC address:10:23:45:67:89:ab
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000e at c4810000,c4814004 IRQ 51 MAC: 10:23:45:67:89:ab (EmbedSky)
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=2, 20ns Twrph0=3 30ns, Twrph1=2 20ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 653 at 0x0000051a0000
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "EmbedSky_Board_uboot"
0x000000200000-0x000000400000 : "EmbedSky_Board_kernel"
0x000000400000-0x00000ff80000 : "EmbedSky_Board_yaffs2"
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.30.4-EmbedSky ohci_hcd
usb usb1: SerialNumber: s3c24xx
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
usbserial: USB Serial Driver core
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
s3c2410_udc: debugfs dir creation failed -19
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
Linux video capture interface: v2.00
zc0301: V4L2 driver for ZC0301[P] Image Processor and Control Chip v1:1.10
usbcore: registered new interface driver zc0301
gspca: main v2.5.0 registered
usbcore: registered new interface driver uvcvideo
USB Video Class driver (v0.1.0)
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: starting watchdog timer
s3c2410-wdt s3c2410-wdt: watchdog active, reset abled, irq enabled
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.18a.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
lib80211: common routines for IEEE802.11 drivers
s3c2410-rtc s3c2410-rtc: setting system clock to 2011-07-12 11:31:24 UTC (1310470284)
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: auto selecting yaffs2
block 622 is bad
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 112K
Try to bring eth0 interface up ...
ifconfig eth0 hw ether 10:23:45:67:89:ab
eth0: link down
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
add default gw 192.168.1.2
Done
/etc/init.d/rcS: line 33: qtopia: not found
insmod: cannot insert '/lib/input-polldev.ko': unknown symbol in module, or unknown parameter
insmod: cannot insert '/lib/mac80211.ko': unknown symbol in module, or unknown parameter
insmod: cannot insert '/lib/rt2x00lib.ko': unknown symbol in module, or unknown parameter
insmod: cannot insert '/lib/rt2x00usb.ko': unknown symbol in module, or unknown parameter
insmod: cannot insert '/lib/rt73usb.ko': unknown symbol in module, or unknown parameter
insmod: cannot insert '/lib/zd1211rw.ko': unknown symbol in module, or unknown parameter
insmod: cannot insert '/lib/ov9650.ko': unknown symbol in module, or unknown parameter
Try to bring eth0 interface up ...
/etc/rc.d/init.d/leds: line 16: led-player: not found
ifconfig eth0 hw ether 10:23:45:67:89:ab
/etc/rc.d/init.d/httpd: line 16: /sbin/boa: not found
eth0: link down
ifconfig eth0 192.168.1.6 netmask 255.255.255.0 up
add default gw 192.168.1.2
Done

Please press Enter to activate this console.

 

----------------------------WebCamera_CMOS测试成功----------------

菜鸟学Linux移植lesson3之WebCamera_CMOS测试

之前未成功是因为未将ov9650编译成模块,然后其加入/lib目录下开机自动运行即可。

测试效果:很卡,延时严重。

这个流程先告一段落,接下来移植基于Saa7113h解码的CCD摄像头网络测试。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多