v4l2 驱动

本文详细介绍了V4L2驱动中BUFFERREQUEST与VIDIOC_STREAMON命令的处理流程,从用户空间请求到内核空间处理,涉及v4l2-ioctl.c、videobuf2-core.c及fimc-capture.c等核心文件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

v4l2驱动的switch结构是在kernel/drivers/media/video/v4l2-ioctl.c 文件里头实现的。

一、BUFFER REQUEST:VIDIOC_REQBUFS

1.__video_do_ioctl(path: .../v4l2-ioctl.c)

In v4l2-ioctl.c file,there is a function:__video_do_ioctl, commands form user space distributed according to different macros,through ops->XXX(arg1,arg2),such as 

ops->vidioc_g_priority(file, fh, p),

2.fimc_capture_ioctl_ops(path:kernel/drivers/media/video/s5p-fimc/fimc-capture.c)

functions in structrue fimc_capture_ioctl_ops,whic in kernel/drivers/media/video/s5p-fimc/fimc-capture.c ,will be incoked.

Then  fimc_cap_reqbufs invoked,key funcition in fimc_cap_reqbufs is vb2_reqbufs

3.vb2_reqbufs (path:kernel/drivers/media/video/vidoebuf2-core.c)

in vb2_reqbufs,__vb2_queue_alloc be used to allocate a memory.

二.VIDIOC_STREAMON:streamon (start data collection),users use the command to start data collection

Base on the above procedure(beginning is :__video_do_ioctl)

1.vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type) (path: kernel/drivers/media/video/videobuf2-core.c)

In this function ret = call_qop(q, start_streaming, q, atomic_read(&q->queued_count)); is key function.start_streaming decleared in kernel/drivers/media/video/videobuf2-core.h, and be realized in file fimc-capture.c (drivers/media/video/s5p-fimc)。

FIMC is a camera controll interface,it is also undertake output function adn overlay function.

2.static int start_streaming(struct vb2_queue *q, unsigned int count)(path:kernel/drivers/media/video/s5p-fimc/fimc-capture.c)

in start_stream function ,key function fimc_pipeline_s_stream(fimc, 1); be invoked.

3.int fimc_pipeline_s_stream(struct fimc_dev *fimc, int on) (path:kernel/drivers/media/video/s5p-fimc/fimc-mdevices.c)

in this function ,ret = v4l2_subdev_call(on ? p->sensor : p->csis,video, s_stream, on);  we use this function to call subdevice's function,the subdevices function was defined in driver file,such as XXX_v4l2.c file. s_stream is a function of  v4l2_subdev_ops.now ,data collection is beginning.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值