• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

libfli-libfli.h

Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (c) 2002 Finger Lakes Instrumentation (FLI), L.L.C.
00004   All rights reserved.
00005 
00006   Redistribution and use in source and binary forms, with or without
00007   modification, are permitted provided that the following conditions
00008   are met:
00009 
00010         Redistributions of source code must retain the above copyright
00011         notice, this list of conditions and the following disclaimer.
00012 
00013         Redistributions in binary form must reproduce the above
00014         copyright notice, this list of conditions and the following
00015         disclaimer in the documentation and/or other materials
00016         provided with the distribution.
00017 
00018         Neither the name of Finger Lakes Instrumentation (FLI), LLC
00019         nor the names of its contributors may be used to endorse or
00020         promote products derived from this software without specific
00021         prior written permission.
00022 
00023   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027   REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034   POSSIBILITY OF SUCH DAMAGE.
00035 
00036   ======================================================================
00037 
00038   Finger Lakes Instrumentation, L.L.C. (FLI)
00039   web: http://www.fli-cam.com
00040   email: support@fli-cam.com
00041 
00042 */
00043 
00044 #ifndef _LIBFLI_LIBFLI_H_
00045 #define _LIBFLI_LIBFLI_H_
00046 
00047 #include <string.h>
00048 
00049 #ifdef WIN32
00050 #define LIBFLIAPI __declspec(dllexport) long __stdcall
00051 #endif
00052 
00053 #include "libfli.h"
00054 #include "libfli-sys.h"
00055 #include "libfli-debug.h"
00056 
00057 #define __STRINGIFY(x) ___STRINGIFY(x)
00058 #define ___STRINGIFY(x) #x
00059 
00060 #define __LIBFLIVER_MAJOR__ 1
00061 #define __LIBFLIVER__ __STRINGIFY(__LIBFLIVER_MAJOR__) "."  \
00062   __STRINGIFY(__LIBFLI_MINOR__)
00063 
00064 #define CHKDEVICE(xdev)                     \
00065   do {                              \
00066     if((xdev < 0) || (xdev >= MAX_OPEN_DEVICES))        \
00067     {                               \
00068       debug(FLIDEBUG_WARN,                  \
00069         "Attempt to use a device out of range (%d)", xdev); \
00070       return -EINVAL;                       \
00071     }                               \
00072     if(devices[xdev] == NULL)                   \
00073     {                               \
00074       debug(FLIDEBUG_WARN,                  \
00075         "Attempt to use a NULL device (%d)", xdev);     \
00076       return -EINVAL;                       \
00077     }                               \
00078   } while(0)
00079 
00080 #define CHKFUNCTION(func)                   \
00081   do {                              \
00082     if(func == NULL)                        \
00083     {                               \
00084       debug(FLIDEBUG_WARN,                  \
00085         "Attempt to use a NULL function (" #func ")");  \
00086       return -EINVAL;                       \
00087     }                               \
00088   } while(0)
00089 
00090 #define IO(dev, buf, wlen, rlen)                \
00091   do {                              \
00092     int err;                            \
00093     if((err = devices[dev]->fli_io(dev, buf, wlen, rlen)))  \
00094     {                               \
00095       debug(FLIDEBUG_WARN, "Communication error: %d [%s]",  \
00096         err, strerror(-err));               \
00097       return err;                       \
00098     }                               \
00099   } while(0)
00100 
00101 #define COMMAND(function)                   \
00102   do {                              \
00103     int err;                            \
00104     if((err = function))                    \
00105     {                               \
00106       debug(FLIDEBUG_WARN,                  \
00107         "Function `" #function "' failed, error: %d [%s]",  \
00108         err, strerror(-err));               \
00109       return err;                       \
00110     }                               \
00111   } while(0)
00112 
00113 #define FLIUSB_VENDORID 0xf18
00114 #define FLIUSB_CAM_ID 0x02
00115 #define FLIUSB_FILTER_ID 0x07
00116 #define FLIUSB_FOCUSER_ID 0x06
00117 
00118 #define MAX_OPEN_DEVICES (32)
00119 #define MAX_SEARCH_LIST (16)
00120 
00121 /* Common device information */
00122 typedef struct {
00123   long type;
00124   long fwrev;
00125   long hwrev;
00126   long devid;
00127   long serno;
00128   char *model;
00129   char *devnam;
00130 } flidevinfo_t;
00131 
00132 /* A specific device instance */
00133 typedef struct {
00134   char *name;           /* The device name */
00135   long domain;          /* The device's domain */
00136   flidevinfo_t devinfo;     /* Device information */
00137   long io_timeout;      /* Timeout in msec for all I/O */
00138   void *io_data;        /* For holding I/O specific data */
00139   void *device_data;        /* For holding device specific data */
00140   void *sys_data;       /* For holding system specific data */
00141 
00142   /* System-specific functions */
00143   long (*fli_lock)(flidev_t dev);
00144   long (*fli_unlock)(flidev_t dev);
00145 
00146   /* Domain-specific functions */
00147   long (*fli_io)(flidev_t dev, void *buf, long *wlen, long *rlen);
00148 
00149   /* Device-specific functions */
00150   long (*fli_open)(flidev_t dev);
00151   long (*fli_close)(flidev_t dev);
00152   long (*fli_command)(flidev_t dev, int cmd, int argc, ...);
00153 } flidevdesc_t;
00154 
00155 extern const char* version;
00156 
00157 extern flidevdesc_t *devices[MAX_OPEN_DEVICES];
00158 #define DEVICE devices[dev]
00159 
00160 /* Device commands, the format is FLI_COMMAND(<command name>, <number of args>) */
00161 #define FLI_COMMANDS                \
00162   FLI_COMMAND(FLI_NONE, 0)          \
00163   FLI_COMMAND(FLI_GET_PIXEL_SIZE, 2)        \
00164   FLI_COMMAND(FLI_GET_ARRAY_AREA, 4)        \
00165   FLI_COMMAND(FLI_GET_VISIBLE_AREA, 4)      \
00166   FLI_COMMAND(FLI_SET_EXPOSURE_TIME, 1)     \
00167   FLI_COMMAND(FLI_SET_IMAGE_AREA, 4)        \
00168   FLI_COMMAND(FLI_SET_HBIN, 1)          \
00169   FLI_COMMAND(FLI_SET_VBIN, 1)          \
00170   FLI_COMMAND(FLI_SET_FRAME_TYPE, 1)        \
00171   FLI_COMMAND(FLI_CANCEL_EXPOSURE, 0)       \
00172   FLI_COMMAND(FLI_GET_EXPOSURE_STATUS, 1)   \
00173   FLI_COMMAND(FLI_SET_TEMPERATURE, 1)       \
00174   FLI_COMMAND(FLI_GET_TEMPERATURE, 1)       \
00175   FLI_COMMAND(FLI_GRAB_ROW, 2)          \
00176   FLI_COMMAND(FLI_EXPOSE_FRAME, 0)      \
00177   FLI_COMMAND(FLI_FLUSH_ROWS, 2)        \
00178   FLI_COMMAND(FLI_SET_FLUSHES, 1)       \
00179   FLI_COMMAND(FLI_SET_BIT_DEPTH, 1)     \
00180   FLI_COMMAND(FLI_READ_IOPORT, 1)       \
00181   FLI_COMMAND(FLI_WRITE_IOPORT, 1)      \
00182   FLI_COMMAND(FLI_CONFIGURE_IOPORT, 1)      \
00183   FLI_COMMAND(FLI_CONTROL_SHUTTER, 1)       \
00184   FLI_COMMAND(FLI_CONTROL_BGFLUSH, 1)       \
00185   FLI_COMMAND(FLI_SET_FILTER_POS, 1)        \
00186   FLI_COMMAND(FLI_GET_FILTER_POS, 1)        \
00187   FLI_COMMAND(FLI_GET_FILTER_COUNT, 1)      \
00188   FLI_COMMAND(FLI_STEP_MOTOR, 1)        \
00189   FLI_COMMAND(FLI_GET_STEPPER_POS, 1)       \
00190   FLI_COMMAND(FLI_HOME_FOCUSER, 0)
00191 
00192 /* Enumerate the commands */
00193 enum {
00194 #define FLI_COMMAND(name, args) name,
00195   FLI_COMMANDS
00196 #undef FLI_COMMAND
00197 };
00198 
00199 #endif /* _LIBFLI_LIBFLI_H_ */

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal