summaryrefslogtreecommitdiff
path: root/v3/fake-pipeline2/camera_hw.h (plain)
blob: aa1ee66af357a3909ff312df07ababb6508c2c97
1#ifndef __HW_CAMERA_HW_H__
2#define __HW_CAMERA_HW_H__
3#include <linux/videodev2.h>
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <string.h>
8#include <assert.h>
9
10#include <getopt.h> /* getopt_long() */
11
12#include <fcntl.h> /* low-level i/o */
13#include <unistd.h>
14#include <errno.h>
15#include <sys/stat.h>
16#include <sys/types.h>
17#include <sys/time.h>
18#include <sys/mman.h>
19#include <sys/ioctl.h>
20#include <stdbool.h>
21
22#include <linux/videodev2.h>
23#include <DebugUtils.h>
24
25#define NB_BUFFER 6
26#define NB_PIC_BUFFER 2
27#define CLEAR(x) memset(&(x), 0, sizeof(x))
28
29#define V4L2_ROTATE_ID 0x980922 //V4L2_CID_ROTATE
30
31typedef struct FrameV4L2Info {
32 struct v4l2_format format;
33 struct v4l2_buffer buf;
34 struct v4l2_requestbuffers rb;
35}FrameV4L2Info;
36
37struct VideoInfo {
38 struct v4l2_capability cap;
39 FrameV4L2Info preview;
40 FrameV4L2Info picture;
41 void *mem[NB_BUFFER];
42 void *mem_pic[NB_PIC_BUFFER];
43 unsigned int canvas[NB_BUFFER];
44 bool isStreaming;
45 bool isPicture;
46 bool canvas_mode;
47 int width;
48 int height;
49 int formatIn;
50 int framesizeIn;
51 uint32_t idVendor;
52 uint32_t idProduct;
53
54 int idx;
55 int fd;
56
57 int tempbuflen;
58 int dev_status;
59};
60
61
62extern int camera_open(struct VideoInfo *cam_dev);
63extern void camera_close(struct VideoInfo *vinfo);
64extern int setBuffersFormat(struct VideoInfo *cam_dev);
65extern int start_capturing(struct VideoInfo *vinfo);
66extern int start_picture(struct VideoInfo *vinfo,int rotate);
67extern void stop_picture(struct VideoInfo *vinfo);
68extern void releasebuf_and_stop_picture(struct VideoInfo *vinfo);
69extern int stop_capturing(struct VideoInfo *vinfo);
70extern int releasebuf_and_stop_capturing(struct VideoInfo *vinfo);
71
72extern uintptr_t get_frame_phys(struct VideoInfo *vinfo);
73extern void set_device_status(struct VideoInfo *vinfo);
74extern int get_device_status(struct VideoInfo *vinfo);
75
76extern void *get_frame(struct VideoInfo *vinfo);
77extern void *get_picture(struct VideoInfo *vinfo);
78extern int putback_frame(struct VideoInfo *vinfo);
79extern int putback_picture_frame(struct VideoInfo *vinfo);
80#endif
81