Debian Codegraph @

sxccdusb.h

raw symbols SCIP
1 /*
2 Starlight Xpress CCD INDI Driver
3
4 Code is based on SX SDK by David Schmenk and Craig Stark
5 Copyright (c) 2003 David Schmenk
6 All rights reserved.
7
8 Changes for INDI project by Peter Polakovic
9 Copyright (c) 2012-2013 Cloudmakers, s. r. o.
10 All Rights Reserved.
11
12 Permission is hereby granted, free of charge, to any person obtaining a
13 copy of this software and associated documentation files (the
14 "Software"), to deal in the Software without restriction, including
15 without limitation the rights to use, copy, modify, merge, publish,
16 distribute, and/or sell copies of the Software, and to permit persons
17 to whom the Software is furnished to do so, provided that the above
18 copyright notice(s) and this permission notice appear in all copies of
19 the Software and that both the above copyright notice(s) and this
20 permission notice appear in supporting documentation.
21
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
25 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26 HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
27 INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
28 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
29 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
30 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31
32 Except as contained in this notice, the name of a copyright holder
33 shall not be used in advertising or otherwise to promote the sale, use
34 or other dealings in this Software without prior written authorization
35 of the copyright holder.
36 */
37
38 #pragma once
39
40 #ifdef OSX_EMBEDED_MODE
41 #include <libusb.h>
42 #else
43 #include <libusb-1.0/libusb.h>
44 #endif
45
46 /*
47 * CCD color representation.
48 * Packed colors allow individual sizes up to 16 bits.
49 * 2X2 matrix bits are represented as:
50 * 0 1
51 * 2 3
52 */
53 #define SXCCD_COLOR_PACKED_RGBcxx . . $ `sxccdusb.h:53:9`! 0x8000
54 #define SXCCD_COLOR_PACKED_BGRcxx . . $ `sxccdusb.h:54:9`! 0x4000
55 #define SXCCD_COLOR_PACKED_RED_SIZEcxx . . $ `sxccdusb.h:55:9`! 0x0F00
56 #define SXCCD_COLOR_PACKED_GREEN_SIZEcxx . . $ `sxccdusb.h:56:9`! 0x00F0
57 #define SXCCD_COLOR_PACKED_BLUE_SIZEcxx . . $ `sxccdusb.h:57:9`! 0x000F
58 #define SXCCD_COLOR_MATRIX_ALT_EVENcxx . . $ `sxccdusb.h:58:9`! 0x2000
59 #define SXCCD_COLOR_MATRIX_ALT_ODDcxx . . $ `sxccdusb.h:59:9`! 0x1000
60 #define SXCCD_COLOR_MATRIX_2X2cxx . . $ `sxccdusb.h:60:9`! 0x0000
61 #define SXCCD_COLOR_MATRIX_RED_MASKcxx . . $ `sxccdusb.h:61:9`! 0x0F00
62 #define SXCCD_COLOR_MATRIX_GREEN_MASKcxx . . $ `sxccdusb.h:62:9`! 0x00F0
63 #define SXCCD_COLOR_MATRIX_BLUE_MASKcxx . . $ `sxccdusb.h:63:9`! 0x000F
64 #define SXCCD_COLOR_MONOCHROMEcxx . . $ `sxccdusb.h:64:9`! 0x0FFF
65
66 /*
67 * Capabilities (Caps) bit definitions.
68 */
69 #define SXCCD_CAPS_STAR2Kcxx . . $ `sxccdusb.h:69:9`! 0x01
70 #define SXCCD_CAPS_COMPRESScxx . . $ `sxccdusb.h:70:9`! 0x02
71 #define SXCCD_CAPS_EEPROMcxx . . $ `sxccdusb.h:71:9`! 0x04
72 #define SXCCD_CAPS_GUIDERcxx . . $ `sxccdusb.h:72:9`! 0x08
73 #define SXUSB_CAPS_COOLERcxx . . $ `sxccdusb.h:73:9`! 0x10
74 #define SXUSB_CAPS_SHUTTERcxx . . $ `sxccdusb.h:74:9`! 0x20
75
76 /*
77 * CCD command flags bit definitions.
78 */
79 #define CCD_EXP_FLAGS_FIELD_ODDcxx . . $ `sxccdusb.h:79:9`! 0x01
80 #define CCD_EXP_FLAGS_FIELD_EVENcxx . . $ `sxccdusb.h:80:9`! 0x02
81 #define CCD_EXP_FLAGS_FIELD_BOTHcxx . . $ `sxccdusb.h:81:9`! (CCD_EXP_FLAGS_FIELD_EVEN | CCD_EXP_FLAGS_FIELD_ODD)
82 #define CCD_EXP_FLAGS_FIELD_MASKcxx . . $ `sxccdusb.h:82:9`! CCD_EXP_FLAGS_FIELD_BOTH
83 #define CCD_EXP_FLAGS_SPARE2cxx . . $ `sxccdusb.h:83:9`! 0x04
84 #define CCD_EXP_FLAGS_NOWIPE_FRAMEcxx . . $ `sxccdusb.h:84:9`! 0x08
85 #define CCD_EXP_FLAGS_SPARE4cxx . . $ `sxccdusb.h:85:9`! 0x10
86 #define CCD_EXP_FLAGS_TDIcxx . . $ `sxccdusb.h:86:9`! 0x20
87 #define CCD_EXP_FLAGS_NOCLEAR_FRAMEcxx . . $ `sxccdusb.h:87:9`! 0x40
88 #define CCD_EXP_FLAGS_NOCLEAR_REGISTERcxx . . $ `sxccdusb.h:88:9`! 0x80
89
90 // Upper bits in byte of CCD_EXP_FLAGS word
91 #define CCD_EXP_FLAGS_SPARE8cxx . . $ `sxccdusb.h:91:9`! 0x01
92 #define CCD_EXP_FLAGS_SPARE9cxx . . $ `sxccdusb.h:92:9`! 0x02
93 #define CCD_EXP_FLAGS_SPARE10cxx . . $ `sxccdusb.h:93:9`! 0x04
94 #define CCD_EXP_FLAGS_SPARE11cxx . . $ `sxccdusb.h:94:9`! 0x08
95 #define CCD_EXP_FLAGS_SPARE12cxx . . $ `sxccdusb.h:95:9`! 0x10
96 #define CCD_EXP_FLAGS_SHUTTER_MANUALcxx . . $ `sxccdusb.h:96:9`! 0x20
97 #define CCD_EXP_FLAGS_SHUTTER_OPENcxx . . $ `sxccdusb.h:97:9`! 0x40
98 #define CCD_EXP_FLAGS_SHUTTER_CLOSEcxx . . $ `sxccdusb.h:98:9`! 0x80
99
100 /*
101 * Serial port queries.
102 */
103 #define SXCCD_SERIAL_PORT_AVAIL_OUTPUTcxx . . $ `sxccdusb.h:103:9`! 0
104 #define SXCCD_SERIAL_PORT_AVAIL_INPUTcxx . . $ `sxccdusb.h:104:9`! 1
105
106 /*
107 * Limits.
108 */
109 #define SXCCD_MAX_CAMScxx . . $ `sxccdusb.h:109:9`! 2
110
111 /*
112 * libusb types abstraction.
113 */
114
115 #define DEVICEcxx . . $ `sxccdusb.h:115:9`! libusb_device *
116 #define HANDLEcxx . . $ `sxccdusb.h:116:9`! libusb_device_handle *
117
118 /*
119 * Structure to hold camera information.
120 */
121 struct t_sxccd_paramscxx . . $ t_sxccd_params#
122 {
123 unsigned short hfront_porchcxx . . $ t_sxccd_params#hfront_porch.;
124 unsigned short hback_porchcxx . . $ t_sxccd_params#hback_porch.;
125 unsigned short widthcxx . . $ t_sxccd_params#width.;
126 unsigned short vfront_porchcxx . . $ t_sxccd_params#vfront_porch.;
127 unsigned short vback_porchcxx . . $ t_sxccd_params#vback_porch.;
128 unsigned short heightcxx . . $ t_sxccd_params#height.;
129 float pix_widthcxx . . $ t_sxccd_params#pix_width.;
130 float pix_heightcxx . . $ t_sxccd_params#pix_height.;
131 unsigned short color_matrixcxx . . $ t_sxccd_params#color_matrix.;
132 char bits_per_pixelcxx . . $ t_sxccd_params#bits_per_pixel.;
133 char num_serial_portscxx . . $ t_sxccd_params#num_serial_ports.;
134 char extra_capscxx . . $ t_sxccd_params#extra_caps.;
135 char vclk_delaycxx . . $ t_sxccd_params#vclk_delay.;
136 };
137
138 /*
139 * Prototypes.
140 */
141
142 void sxDebugcxx . . $ sxDebug(b45ddcbc8423892c).(bool enable);
143 int sxListcxx . . $ sxList(50e57e8da4d09862).(DEVICEcxx . . $ `sxccdusb.h:115:9`! *sxDevices, const char **names, int maxCount);
144 int sxOpencxx . . $ sxOpen(3650a983e63fb5b2).(HANDLEcxx . . $ `sxccdusb.h:116:9`! *sxHandles);
145 int sxOpencxx . . $ sxOpen(a1a0977d9a332887).(DEVICEcxx . . $ `sxccdusb.h:115:9`! sxDevice, HANDLEcxx . . $ `sxccdusb.h:116:9`! *sxHandle);
146 void sxClosecxx . . $ sxClose(28461513cc228c86).(HANDLEcxx . . $ `sxccdusb.h:116:9`! *sxHandle);
147 unsigned short sxGetCameraModelcxx . . $ sxGetCameraModel(459b435919296140).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle);
148 unsigned long sxGetFirmwareVersioncxx . . $ sxGetFirmwareVersion(ed9bcfc94c0df5f0).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle);
149 unsigned short sxGetBuildNumbercxx . . $ sxGetBuildNumber(459b435919296140).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle);
150 int sxResetcxx . . $ sxReset(dd77b85f23bd2c47).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle);
151 int sxGetCameraParamscxx . . $ sxGetCameraParams(2705c8f2cf1d6a01).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short camIndex, struct t_sxccd_paramscxx . . $ t_sxccd_params# *params);
152 int sxClearPixelscxx . . $ sxClearPixels(8a4227e8a08d1156).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short flags, unsigned short camIndex);
153 int sxLatchPixelscxx . . $ sxLatchPixels(24486226272f5ac2).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short flags, unsigned short camIndex, unsigned short xoffset,
154 unsigned short yoffset, unsigned short width, unsigned short height, unsigned short xbin,
155 unsigned short ybin);
156 int sxExposePixelscxx . . $ sxExposePixels(dd9515813f4191c1).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short flags, unsigned short camIndex, unsigned short xoffset,
157 unsigned short yoffset, unsigned short width, unsigned short height, unsigned short xbin,
158 unsigned short ybin, unsigned long msec);
159 int sxExposePixelsGatedcxx . . $ sxExposePixelsGated(dd9515813f4191c1).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short flags, unsigned short camIndex, unsigned short xoffset,
160 unsigned short yoffset, unsigned short width, unsigned short height, unsigned short xbin,
161 unsigned short ybin, unsigned long msec);
162 int sxReadPixelscxx . . $ sxReadPixels(e0ca4e493c5a31d0).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, void *pixels, unsigned long count);
163 int sxSetShuttercxx . . $ sxSetShutter(91d5ff66deaa7ccc).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short state);
164 int sxSetTimercxx . . $ sxSetTimer(be6dd5a9c1140fdf).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned long msec);
165 unsigned long sxGetTimercxx . . $ sxGetTimer(ed9bcfc94c0df5f0).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle);
166 int sxSetSTAR2000cxx . . $ sxSetSTAR2000(e758aac42c4fb105).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, char star2k);
167 int sxSetSerialPortcxx . . $ sxSetSerialPort(b9e776b0f66b09fd).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short portIndex, unsigned short property, unsigned short value);
168 unsigned short sxGetSerialPortcxx . . $ sxGetSerialPort(bb0bbabe92cf68b9).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short portIndex, unsigned short property);
169 int sxWriteSerialPortcxx . . $ sxWriteSerialPort(1344eadda7b0a471).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short portIndex, unsigned short flush, unsigned short count,
170 char *data);
171 int sxReadSerialPortcxx . . $ sxReadSerialPort(558b13a9b95aee31).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short portIndex, unsigned short count, char *data);
172 int sxReadEEPROMcxx . . $ sxReadEEPROM(558b13a9b95aee31).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned short address, unsigned short count, char *data);
173 int sxSetCoolercxx . . $ sxSetCooler(52ad76553d6fad70).(HANDLEcxx . . $ `sxccdusb.h:116:9`! sxHandle, unsigned char SetStatus, unsigned short SetTemp, unsigned char *RetStatus,
174 unsigned short *RetTemp);
175 bool sxIsInterlacedcxx . . $ sxIsInterlaced(54da1eb615515139).(short model);
176 bool sxIsColorcxx . . $ sxIsColor(54da1eb615515139).(short model);
177 bool sxIsICX453cxx . . $ sxIsICX453(54da1eb615515139).(short model);