usb摄像头驱动的移植

相关软件下载地址:http://pan.baidu.com/s/16yo8Y

 

1.使用摄像头型号ov9650

①修改、配置内核

 

1.修改vi drivers/i2c/busses/Kconfig

 

(参考实验二十六 I2C驱动编写及测试)

 

修改

 

config I2C_S3C2410

    tristate "S3C2410 I2C Driver"

    depends on ARCH_S3C2410 || ARCH_S3C64XX

    help

      Say Y here to include support for I2C controller in the

      Samsung S3C2410 based System-on-Chip devices.

为:

config I2C_S3C2410

    tristate "S3C2410 I2C Driver"

    depends on ARCH_S3C2410 || ARCH_S3C64XX || ARCH_S5PC100

    help

      Say Y here to include support for I2C controller in the

      Samsung S3C2410 based System-on-Chip devices.

配置内核驱动:

$ make menuconfig

Device Drivers  --->

       <*> I2C support  --->

              <*>   I2C device interface

                     I2C Hardware Bus support  --->

                            <*> S3C2410 I2C Driver

修改arch/arm/mach-s5pc100/mach-smdkc100.c

查看原理图可以知道我们的摄像头是接在I2C-1上所以修改i2c_devs1添加ov9650的内容,主要是ov9650的地址,这个在芯片手册上可以查到是0x30

修改:

static struct i2c_board_info i2c_devs1[] __initdata = {

};

为:

static struct i2c_board_info i2c_devs1[] __initdata = {

    {

       I2C_BOARD_INFO("ov9650", 0x30),

    },

};

添加s5pc100 摄像头控制器平台设备相关内容,这些内容我们可以通过查看S5PC100的芯片手册查到.

static struct resource s3c_camif_resource[] = {

    [0] = {

       .start = 0xEE200000,

       .end   = 0xEE200000 + SZ_1M - 1,

       .flags = IORESOURCE_MEM,

    },

    [1] = {

       .start = IRQ_FIMC0,

       .end   = IRQ_FIMC0,

       .flags = IORESOURCE_IRQ,

    }

};

 

static u64 s3c_device_camif_dmamask = 0xffffffffUL;

 

struct platform_device s3c_device_camif = {

    .name        = "s5pc100-camif",

    .id      = 0,

    .num_resources      = ARRAY_SIZE(s3c_camif_resource),

    .resource    = s3c_camif_resource,

    .dev              = {

       .dma_mask = &s3c_device_camif_dmamask,

       .coherent_dma_mask = 0xffffffffUL

    }

};

EXPORT_SYMBOL(s3c_device_camif);

注册摄像头控制平台设备:

在smdkc100_devices中添加s3c_device_camif.

static struct platform_device *smdkc100_devices[] __initdata = {

    &s3c_device_camif, //添加内容

};

添加驱动(video):

Make menuconfig

Device Drivers  --->

      <*> Multimedia support  --->

             <*>   Video For Linux

[*]     Enable Video For Linux API 1 (DEPRECATED) (NEW)

[*]   Video capture adapters (NEW)  --->

[*]   V4L USB devices (NEW)  --->   make

<*>   USB Video Class (UVC)

[*]     UVC input events device support (NEW)

 <*>   USB ZC0301[P] webcam support (DEPRECATED)

②重新编译内核

make zImage

cp arch/arm/boot/zImage /tftpboot

2.使用摄像头型号ZC3XX

1、配置内核是内核支持芯片为ZC3xx的摄像头(必须先配置USB驱动,否则[*] V4L USB devices (NEW) --->出不来)

Make menuconfig
  Device Drivers --->
       <*> Multimedia support --->
             <*> Video For Linux
             [*] Enable Video For Linux API 1 (DEPRECATED) (NEW)
             [*] Video capture adapters (NEW) --->
                    [*] V4L USB devices (NEW) --->
                           <*> GSPCA based webcams--->  
                                  <*> ZC3XX USB Camera Driver  
                            <*> USB Video Class (UVC)
                           [*] UVC input events device support (NEW)
                     <*> USB ZC0301[P] webcam support (DEPRECATED)


2
、重新编译内核
修改文件drivers/media/video/gspac/gspca.c添加红色语句:


              220 goto error_buffer;
              221 }
               urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP;
              222 usb_fill_int_urb(urb, dev,
              223 usb_rcvintpipe(dev, ep->

make  zImage重新编译内核


       通过上面两个步骤就可以驱动我们的摄像头了。但是这个驱动是基于V4l2的。以前基于V4L的一些上层应用就不能用了,或需要做大量的修改!这里我们要实现网络视频的功能,以前都是用servfox这个网络视频服务器,但是这个服务器就是基于V4L的,我们如果想用的话就得对servfox的源码进行修改。这里我们选用另外一种方案mjpg-stream。

 

 

转载于:https://www.cnblogs.com/vsyf/p/4974680.html

你可能感兴趣的:(usb摄像头驱动的移植)