00001
00022 #ifndef __ANALOGY_ANALOGY__
00023 #define __ANALOGY_ANALOGY__
00024
00025 #include <unistd.h>
00026
00027 #include <analogy/types.h>
00028 #include <analogy/descriptor.h>
00029
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033
00034 #ifndef DOXYGEN_CPP
00035
00036
00037
00038 int a4l_sys_open(const char *fname);
00039
00040 int a4l_sys_close(int fd);
00041
00042 int a4l_sys_read(int fd, void *buf, size_t nbyte);
00043
00044 int a4l_sys_write(int fd, void *buf, size_t nbyte);
00045
00046 int a4l_sys_attach(int fd, a4l_lnkdesc_t * arg);
00047
00048 int a4l_sys_detach(int fd);
00049
00050 int a4l_sys_desc(int fd, a4l_desc_t * dsc, int pass);
00051
00052 int a4l_sys_devinfo(int fd, a4l_dvinfo_t * info);
00053
00054 int a4l_sys_subdinfo(int fd, a4l_sbinfo_t * info);
00055
00056 int a4l_sys_nbchaninfo(int fd, unsigned int idx_subd, unsigned int *nb);
00057
00058 int a4l_sys_chaninfo(int fd,
00059 unsigned int idx_subd, a4l_chinfo_t * info);
00060
00061 int a4l_sys_nbrnginfo(int fd,
00062 unsigned int idx_subd,
00063 unsigned int idx_chan, unsigned int *nb);
00064
00065 int a4l_sys_rnginfo(int fd,
00066 unsigned int idx_subd,
00067 unsigned int idx_chan, a4l_rnginfo_t * info);
00068
00069
00070
00071 int a4l_get_desc(int fd, a4l_desc_t *dsc, int pass);
00072
00073 int a4l_open(a4l_desc_t *dsc, const char *fname);
00074
00075 int a4l_close(a4l_desc_t *dsc);
00076
00077 int a4l_fill_desc(a4l_desc_t *dsc);
00078
00079 int a4l_get_subdinfo(a4l_desc_t *dsc,
00080 unsigned int subd, a4l_sbinfo_t **info);
00081
00082 int a4l_get_chinfo(a4l_desc_t *dsc,
00083 unsigned int subd,
00084 unsigned int chan, a4l_chinfo_t **info);
00085
00086 #define a4l_get_chan_max(x) (1ULL << (x)->nb_bits)
00087
00088 #define a4l_is_chan_global(x) ((x)->chan_flags & A4L_CHAN_GLOBAL)
00089
00090 int a4l_get_rnginfo(a4l_desc_t *dsc,
00091 unsigned int subd,
00092 unsigned int chan,
00093 unsigned int rng, a4l_rnginfo_t ** info);
00094
00095 #define a4l_is_rng_global(x) ((x)->flags & A4L_RNG_GLOBAL)
00096
00097 int a4l_snd_command(a4l_desc_t * dsc, a4l_cmd_t *cmd);
00098
00099 int a4l_snd_cancel(a4l_desc_t * dsc, unsigned int idx_subd);
00100
00101 int a4l_set_bufsize(a4l_desc_t * dsc,
00102 unsigned int idx_subd, unsigned long size);
00103
00104 int a4l_get_bufsize(a4l_desc_t * dsc,
00105 unsigned int idx_subd, unsigned long *size);
00106
00107 int a4l_mark_bufrw(a4l_desc_t * dsc,
00108 unsigned int idx_subd,
00109 unsigned long cur, unsigned long *newp);
00110
00111 int a4l_poll(a4l_desc_t * dsc,
00112 unsigned int idx_subd, unsigned long ms_timeout);
00113
00114 int a4l_mmap(a4l_desc_t * dsc,
00115 unsigned int idx_subd, unsigned long size, void **ptr);
00116
00117 int a4l_async_read(a4l_desc_t * dsc,
00118 void *buf, size_t nbyte, unsigned long ms_timeout);
00119
00120 int a4l_async_write(a4l_desc_t * dsc,
00121 void *buf, size_t nbyte, unsigned long ms_timeout);
00122
00123 int a4l_snd_insnlist(a4l_desc_t * dsc, a4l_insnlst_t * arg);
00124
00125 int a4l_snd_insn(a4l_desc_t * dsc, a4l_insn_t *arg);
00126
00127
00128
00129 int a4l_sync_write(a4l_desc_t * dsc,
00130 unsigned int idx_subd,
00131 unsigned int chan_desc,
00132 unsigned int delay, void *buf, size_t nbyte);
00133
00134 int a4l_sync_read(a4l_desc_t * dsc,
00135 unsigned int idx_subd,
00136 unsigned int chan_desc,
00137 unsigned int delay, void *buf, size_t nbyte);
00138
00139 int a4l_config_subd(a4l_desc_t * dsc,
00140 unsigned int idx_subd, unsigned int type, ...);
00141
00142 int a4l_sync_dio(a4l_desc_t *dsc,
00143 unsigned int idx_subd, void *mask, void *buf);
00144
00145 int a4l_sizeof_chan(a4l_chinfo_t * chan);
00146
00147 int a4l_sizeof_subd(a4l_sbinfo_t *subd);
00148
00149 int a4l_find_range(a4l_desc_t * dsc,
00150 unsigned int idx_subd,
00151 unsigned int idx_chan,
00152 unsigned long unit,
00153 double min, double max, a4l_rnginfo_t ** rng);
00154
00155 int a4l_rawtoul(a4l_chinfo_t * chan, unsigned long *dst, void *src, int cnt);
00156
00157 int a4l_rawtof(a4l_chinfo_t * chan,
00158 a4l_rnginfo_t * rng, float *dst, void *src, int cnt);
00159
00160 int a4l_rawtod(a4l_chinfo_t * chan,
00161 a4l_rnginfo_t * rng, double *dst, void *src, int cnt);
00162
00163 int a4l_ultoraw(a4l_chinfo_t * chan, void *dst, unsigned long *src, int cnt);
00164
00165 int a4l_ftoraw(a4l_chinfo_t * chan,
00166 a4l_rnginfo_t * rng, void *dst, float *src, int cnt);
00167
00168 int a4l_dtoraw(a4l_chinfo_t * chan,
00169 a4l_rnginfo_t * rng, void *dst, double *src, int cnt);
00170
00171 #endif
00172
00173 #ifdef __cplusplus
00174 }
00175 #endif
00176 #endif