3 * Copyright 2011 Daniel Borkmann <dborkma@tik.ee.ethz.ch>
6 * Faculty of Computer Science, Mathematics and Natural Sciences,
7 * Leipzig University of Applied Sciences (HTWK Leipzig)
15 #include <asm/types.h>
16 #include <linux/videodev2.h>
18 #ifndef V4L2_CID_AUTOEXPOSURE
19 # define V4L2_CID_AUTOEXPOSURE (V4L2_CID_BASE + 32)
21 #ifndef V4L2_CID_CAM_INIT
22 # define V4L2_CID_CAM_INIT (V4L2_CID_BASE + 33)
24 #ifndef V4L2_CID_AUDIO_MUTE
25 # define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE + 9)
27 #ifndef V4L2_CID_POWER_LINE_FREQUENCY
28 # define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE + 24)
29 enum v4l2_power_line_frequency
{
30 V4L2_CID_POWER_LINE_FREQUENCY_DISABLED
= 0,
31 V4L2_CID_POWER_LINE_FREQUENCY_50HZ
= 1,
32 V4L2_CID_POWER_LINE_FREQUENCY_60HZ
= 2,
35 #ifndef V4L2_CID_HUE_AUTO
36 # define V4L2_CID_HUE_AUTO (V4L2_CID_BASE + 25)
38 #ifndef V4L2_CID_WHITE_BALANCE_TEMPERATURE
39 # define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE + 26)
41 #ifndef V4L2_CID_SHARPNESS
42 # define V4L2_CID_SHARPNESS (V4L2_CID_BASE + 27)
44 #ifndef V4L2_CID_BACKLIGHT_COMPENSATION
45 # define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE + 28)
47 #ifndef V4L2_CID_CAMERA_CLASS_BASE
48 # define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
50 #ifndef V4L2_CID_CAMERA_CLASS
51 # define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
53 #ifndef V4L2_CID_EXPOSURE_AUTO
54 # define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE + 1)
55 enum v4l2_exposure_auto_type
{
56 V4L2_EXPOSURE_MANUAL
= 0,
57 V4L2_EXPOSURE_AUTO
= 1,
58 V4L2_EXPOSURE_SHUTTER_PRIORITY
= 2,
59 V4L2_EXPOSURE_APERTURE_PRIORITY
= 3
62 #ifndef V4L2_CID_EXPOSURE_ABSOLUTE
63 # define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE + 2)
65 #ifndef V4L2_CID_EXPOSURE_AUTO_PRIORITY
66 # define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE + 3)
68 #ifndef V4L2_CID_PAN_RELATIVE
69 # define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE + 4)
71 #ifndef V4L2_CID_TILT_RELATIVE
72 # define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE + 5)
74 #ifndef V4L2_CID_PAN_RESET
75 # define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE + 6)
77 #ifndef V4L2_CID_TILT_RESET
78 # define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE + 7)
80 #ifndef V4L2_CID_PAN_ABSOLUTE
81 # define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE + 8)
83 #ifndef V4L2_CID_TILT_ABSOLUTE
84 # define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE + 9)
86 #ifndef V4L2_CID_FOCUS_ABSOLUTE
87 # define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE + 10)
89 #ifndef V4L2_CID_FOCUS_RELATIVE
90 # define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE + 11)
92 #ifndef V4L2_CID_FOCUS_AUTO
93 # define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE + 12)
106 * 4) start_v4l_capturing
107 * 5) while ... read_v4l_frame
108 * 6) stop_v4l_capturing
109 * 7) cleanup_v4l_device
110 * 8) close_vl4_device
113 extern void convert_v4l_yuyv_to_rgb24(const uint8_t *src
,
114 uint8_t *dest
, int width
, int height
);
115 extern int read_v4l_frame(int fd
, unsigned int nbuffs
,
116 struct v4l_buff
*buffs
,
117 int (*rx_v4l_cb
)(uint8_t *frame
, size_t len
));
118 extern int open_v4l_device(char *dev
);
119 extern void close_vl4_device(int fd
);
120 extern int start_v4l_capturing(int fd
, unsigned int nbuffs
);
121 extern int stop_v4l_capturing(int fd
);
122 extern int init_mmap(int fd
, const char *dev
, unsigned int *nbuffs
,
123 struct v4l_buff
**buffs
, int frames
);
124 extern int cleanup_v4l_device(int fd
, unsigned int nbuffs
,
125 struct v4l_buff
*buffs
);
126 extern void set_v4l_ctl_or_die(int fd
, unsigned int id
, int value
);
127 extern int init_v4l_device(int fd
, int width
, int height
);
128 extern void debug_v4l_struct_buffer(struct v4l2_buffer
*img
);
129 extern int i2c_select_lower_cam(void);
130 extern int i2c_select_upper_cam(void);
132 #endif /* NAONET_H */