8442 uts: startup_bios_disk() should check for BIOS
[unleashed.git] / include / sys / dcam / dcam1394_io.h
blob054d26cf01ea3383f8eb2485670f5126ef333457
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_DCAM_DCAM1394_IO_H
28 #define _SYS_DCAM_DCAM1394_IO_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/time.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 /* macros for manipulating dcam1394_param_list_t structure */
39 #define PARAM_LIST_INIT(list) bzero(list, sizeof (list))
40 #define PARAM_LIST_ADD(list, param, subparam) list[param][subparam].flag = 1
41 #define PARAM_LIST_REMOVE(list, param, subparam) list[param][subparam].flag = 0
42 #define PARAM_LIST_IS_ENTRY(list, param, subparam) list[param][subparam].flag
43 #define PARAM_VAL(list, param, subparam) list[param][subparam].val
44 #define PARAM_ERR(list, param, subparam) list[param][subparam].err
46 #define DCAM1394_NUM_PARAM 30
47 #define DCAM1394_NUM_SUBPARAM 24
49 /* parameters */
50 #define DCAM1394_PARAM_CAP_POWER_CTRL 0x0
51 #define DCAM1394_PARAM_CAP_VID_MODE 0x1
52 #define DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_0 0x2
53 #define DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_1 0x3
54 #define DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_2 0x4
55 #define DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_3 0x5
56 #define DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_4 0x6
57 #define DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_5 0x7
58 #define DCAM1394_PARAM_POWER 0x8
59 #define DCAM1394_PARAM_VID_MODE 0x9
60 #define DCAM1394_PARAM_FRAME_RATE 0xA
61 #define DCAM1394_PARAM_RING_BUFF_CAPACITY 0xB
62 #define DCAM1394_PARAM_RING_BUFF_NUM_FRAMES_READY 0xC
63 #define DCAM1394_PARAM_RING_BUFF_READ_PTR_INCR 0xD
64 #define DCAM1394_PARAM_FRAME_NUM_BYTES 0xE
65 #define DCAM1394_PARAM_STATUS 0xF
66 #define DCAM1394_PARAM_BRIGHTNESS 0x10
67 #define DCAM1394_PARAM_EXPOSURE 0x11
68 #define DCAM1394_PARAM_SHARPNESS 0x12
69 #define DCAM1394_PARAM_WHITE_BALANCE 0x13
70 #define DCAM1394_PARAM_HUE 0x14
71 #define DCAM1394_PARAM_SATURATION 0x15
72 #define DCAM1394_PARAM_GAMMA 0x16
73 #define DCAM1394_PARAM_SHUTTER 0x17
74 #define DCAM1394_PARAM_GAIN 0x18
75 #define DCAM1394_PARAM_IRIS 0x19
76 #define DCAM1394_PARAM_FOCUS 0x1A
77 #define DCAM1394_PARAM_ZOOM 0x1B
78 #define DCAM1394_PARAM_PAN 0x1C
79 #define DCAM1394_PARAM_TILT 0x1D
81 /* subparameters */
83 /* for DCAM1394_PARAM_CAP_VID_MODE */
84 #define DCAM1394_SUBPARAM_VID_MODE_0 0x0
85 #define DCAM1394_SUBPARAM_VID_MODE_YUV_444_160_120 0x0
86 #define DCAM1394_SUBPARAM_VID_MODE_1 0x1
87 #define DCAM1394_SUBPARAM_VID_MODE_YUV_422_320_240 0x1
88 #define DCAM1394_SUBPARAM_VID_MODE_2 0x2
89 #define DCAM1394_SUBPARAM_VID_MODE_YUV_411_640_480 0x2
90 #define DCAM1394_SUBPARAM_VID_MODE_3 0x3
91 #define DCAM1394_SUBPARAM_VID_MODE_YUV_422_640_480 0x3
92 #define DCAM1394_SUBPARAM_VID_MODE_4 0x4
93 #define DCAM1394_SUBPARAM_VID_MODE_RGB_640_480 0x4
94 #define DCAM1394_SUBPARAM_VID_MODE_5 0x5
95 #define DCAM1394_SUBPARAM_VID_MODE_Y_640_480 0x5
97 /* for DCAM1394_PARAM_CAP_FRAME_RATE_VID_MODE_0 */
98 #define DCAM1394_SUBPARAM_FRAME_RATE_0 0x6
99 #define DCAM1394_SUBPARAM_FRAME_RATE_3_75_FPS 0x6
100 #define DCAM1394_SUBPARAM_FRAME_RATE_1 0x7
101 #define DCAM1394_SUBPARAM_FRAME_RATE_7_5_FPS 0x7
102 #define DCAM1394_SUBPARAM_FRAME_RATE_2 0x8
103 #define DCAM1394_SUBPARAM_FRAME_RATE_15_FPS 0x8
104 #define DCAM1394_SUBPARAM_FRAME_RATE_3 0x9
105 #define DCAM1394_SUBPARAM_FRAME_RATE_30_FPS 0x9
106 #define DCAM1394_SUBPARAM_FRAME_RATE_4 0xA
107 #define DCAM1394_SUBPARAM_FRAME_RATE_60_FPS 0xA
109 /* for features */
110 #define DCAM1394_SUBPARAM_PRESENCE 0xB
111 #define DCAM1394_SUBPARAM_CAP_READ 0xC
112 #define DCAM1394_SUBPARAM_CAP_ON_OFF 0xD
113 #define DCAM1394_SUBPARAM_CAP_CTRL_AUTO 0xE
114 #define DCAM1394_SUBPARAM_CAP_CTRL_MANUAL 0xF
115 #define DCAM1394_SUBPARAM_MIN_VAL 0x10
116 #define DCAM1394_SUBPARAM_MAX_VAL 0x11
117 #define DCAM1394_SUBPARAM_ON_OFF 0x12
118 #define DCAM1394_SUBPARAM_CTRL_MODE 0x13
119 #define DCAM1394_SUBPARAM_VALUE 0x14
121 /* for white balance feature */
122 #define DCAM1394_SUBPARAM_U_VALUE 0x15
123 #define DCAM1394_SUBPARAM_V_VALUE 0x16
125 #define DCAM1394_SUBPARAM_NONE 0x17
127 /* parameter values */
129 /* for video mode param */
131 #define DCAM1394_VID_MODE_0 0x0
132 #define DCAM1394_VID_MODE_YUV_444_160_120 0x0
134 #define DCAM1394_VID_MODE_1 0x1
135 #define DCAM1394_VID_MODE_YUV_422_320_240 0x1
137 #define DCAM1394_VID_MODE_2 0x2
138 #define DCAM1394_VID_MODE_YUV_411_640_480 0x2
140 #define DCAM1394_VID_MODE_3 0x3
141 #define DCAM1394_VID_MODE_YUV_422_640_480 0x3
143 #define DCAM1394_VID_MODE_4 0x4
144 #define DCAM1394_VID_MODE_RGB_640_480 0x4
146 #define DCAM1394_VID_MODE_5 0x5
147 #define DCAM1394_VID_MODE_Y_640_480 0x5
149 /* for frame rate param */
151 #define DCAM1394_FRAME_RATE_0 0x6
152 #define DCAM1394_3_75_FPS 0x6
154 #define DCAM1394_FRAME_RATE_1 0x7
155 #define DCAM1394_7_5_FPS 0x7
157 #define DCAM1394_FRAME_RATE_2 0x8
158 #define DCAM1394_15_FPS 0x8
160 #define DCAM1394_FRAME_RATE_3 0x9
161 #define DCAM1394_30_FPS 0x9
163 #define DCAM1394_FRAME_RATE_4 0xA
164 #define DCAM1394_60_FPS 0xA
166 /* for feature control mode subparam */
168 #define DCAM1394_CTRL_AUTO 0x1
169 #define DCAM1394_CTRL_MANUAL 0x0
171 /* for power control subparam */
173 #define DCAM1394_POWER_OFF 0x0
174 #define DCAM1394_POWER_ON 0x1
176 /* ioctl() commands */
178 #define DCAM1394_IOC ('d' << 8)
180 #define DCAM1394_CMD_REG_READ (DCAM1394_IOC | 0)
181 #define DCAM1394_CMD_REG_WRITE (DCAM1394_IOC | 1)
183 #define DCAM1394_CMD_CAM_RESET (DCAM1394_IOC | 2)
184 #define DCAM1394_CMD_PARAM_GET (DCAM1394_IOC | 3)
185 #define DCAM1394_CMD_PARAM_SET (DCAM1394_IOC | 4)
186 #define DCAM1394_CMD_FRAME_RCV_START (DCAM1394_IOC | 5)
187 #define DCAM1394_CMD_FRAME_RCV_STOP (DCAM1394_IOC | 6)
188 #define DCAM1394_CMD_RING_BUFF_FLUSH (DCAM1394_IOC | 7)
189 #define DCAM1394_CMD_FRAME_SEQ_NUM_COUNT_RESET (DCAM1394_IOC | 8)
191 #define DCAM1394_RING_BUFF_OFFS 0x1
193 /* for DCAM1394_PARAM_STATUS */
195 #define DCAM1394_STATUS_FRAME_RCV_DONE 0x1
196 #define DCAM1394_STATUS_RING_BUFF_LOST_FRAME 0x2
197 #define DCAM1394_STATUS_PARAM_CHANGE 0x4
198 #define DCAM1394_STATUS_FRAME_SEQ_NUM_COUNT_OVERFLOW 0x8
199 #define DCAM1394_STATUS_CAM_UNPLUG 0x10
201 typedef struct dcam1394_param_list_entry_s {
202 int flag;
203 int err;
204 unsigned int val;
206 } dcam1394_param_list_entry_t;
208 typedef dcam1394_param_list_entry_t
209 dcam1394_param_list_t[DCAM1394_NUM_PARAM][DCAM1394_NUM_SUBPARAM];
211 typedef dcam1394_param_list_entry_t
212 (*dcam1394_param_list_p_t)[DCAM1394_NUM_PARAM][DCAM1394_NUM_SUBPARAM];
214 typedef struct dcam1394_frame_s {
215 unsigned int vid_mode;
216 unsigned int seq_num;
217 hrtime_t timestamp;
218 unsigned char *buff;
219 } dcam1394_frame_t;
221 typedef struct dcam1394_reg_io_s {
222 unsigned int offs;
223 unsigned int val;
225 } dcam1394_reg_io_t;
227 #ifdef __cplusplus
229 #endif
231 #endif /* _SYS_DCAM_DCAM1394_IO_H */