v4l2驱动1-linux-3.0.8的v4l2_dev.h分析

本文详细分析Linux内核3.0.8版本中的v4l2_dev.h驱动文件,探讨videodev.ko编译所需的源文件,并引用了多个关于v4l2驱动编写和使用的资源,旨在为读者提供深入理解。
摘要由CSDN通过智能技术生成
看一下drivers/media/video下的Makefile你会发现:

videodev-objs:=v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \

                        v4l2-event.o v4l2-ctrls.o v4l2-subdev.o

这是生成videodev.ko必要的文件。网上有很多讲解v4l2驱动编写的文章。推荐网址:

这是主要说用户使用:

http://linuxtv.org/downloads/v4l-dvb-apis/

这是说驱动编写:

http://lwn.net/Articles/203924/

对应的中文翻译(用户的不是很全)

http://download.csdn.net/detail/xxxxxlllllxl/7076235

我的博客将从Makefile中涉及的文件对应的头文件去分析:先从v4l2_dev.h开始

/*
 *
 *	V 4 L 2   D R I V E R   H E L P E R   A P I
 *
 * Moved from videodev2.h//从videodev2.h中移出来的
 *
 *	Some commonly needed functions for drivers (v4l2-common.o module)
 */
#ifndef _V4L2_DEV_H
#define _V4L2_DEV_H

#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/cdev.h>
#include <linux/mutex.h>
#include <linux/videodev2.h>

#include <media/media-entity.h>

#define VIDEO_MAJOR	81

//下面不同的宏生成的设备名不一样
#define VFL_TYPE_GRABBER	0 //"video"
#define VFL_TYPE_VBI		1 //"vbi"
#define VFL_TYPE_RADIO		2 //"radio"
#define VFL_TYPE_SUBDEV		3 //"v4l-subdev"
#define VFL_TYPE_MAX		4

struct v4l2_ioctl_callbacks;
struct video_device;
struct v4l2_device;
struct v4l2_ctrl_handler;

/* Flag to mark the video_device struct as registered.
   Drivers can clear this flag if they want to block all future
   device access. It is cleared by video_unregister_device. */
#define V4L2_FL_REGISTERED	(0)//标记设备是否被注册
/* file->private_data points to struct v4l2_fh */
#define V4L2_FL_USES_V4L2_FH	(1) //使用文件操作
/* Use the prio field of v4l2_fh for core priority checking */
#define V4
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值