21 #ifndef _RTDM_ANALOGY_H 22 #define _RTDM_ANALOGY_H 25 #include <sys/types.h> 28 #include "boilerplate/list.h" 45 #define A4L_BSC_DESC 0x0 51 #define A4L_CPLX_DESC 0x1 110 int a4l_sys_devinfo(
int fd, a4l_dvinfo_t *info);
112 int a4l_sys_subdinfo(
int fd, a4l_sbinfo_t *info);
114 int a4l_sys_nbchaninfo(
int fd,
unsigned int idx_subd,
unsigned int *nb);
116 int a4l_sys_chaninfo(
int fd,
117 unsigned int idx_subd, a4l_chinfo_t *info);
119 int a4l_sys_nbrnginfo(
int fd,
120 unsigned int idx_subd,
121 unsigned int idx_chan,
unsigned int *nb);
123 int a4l_sys_rnginfo(
int fd,
124 unsigned int idx_subd,
125 unsigned int idx_chan, a4l_rnginfo_t *info);
138 unsigned int subd, a4l_sbinfo_t **info);
142 unsigned int chan, a4l_chinfo_t **info);
144 #define a4l_get_chan_max(x) (1ULL << (x)->nb_bits) 146 #define a4l_is_chan_global(x) ((x)->chan_flags & A4L_CHAN_GLOBAL) 151 unsigned int rng, a4l_rnginfo_t **info);
153 #define a4l_is_rng_global(x) ((x)->flags & A4L_RNG_GLOBAL) 160 unsigned int idx_subd,
unsigned long size);
163 unsigned int idx_subd,
unsigned long *size);
165 int a4l_set_wakesize(
a4l_desc_t *dsc,
unsigned long size);
167 int a4l_get_wakesize(
a4l_desc_t *dsc,
unsigned long *size);
170 unsigned int idx_subd,
171 unsigned long cur,
unsigned long *newp);
174 unsigned int idx_subd,
unsigned long ms_timeout);
177 unsigned int idx_subd,
unsigned long size,
void **ptr);
180 void *buf,
size_t nbyte,
unsigned long ms_timeout);
183 void *buf,
size_t nbyte,
unsigned long ms_timeout);
192 unsigned int idx_subd,
193 unsigned int chan_desc,
194 unsigned int delay,
void *buf,
size_t nbyte);
197 unsigned int idx_subd,
198 unsigned int chan_desc,
199 unsigned int delay,
void *buf,
size_t nbyte);
202 unsigned int idx_subd,
unsigned int type, ...);
205 unsigned int idx_subd,
void *mask,
void *buf);
212 unsigned int idx_subd,
213 unsigned int idx_chan,
215 double min,
double max, a4l_rnginfo_t **rng);
217 int a4l_rawtoul(a4l_chinfo_t *chan,
unsigned long *dst,
void *src,
int cnt);
220 a4l_rnginfo_t *rng,
float *dst,
void *src,
int cnt);
223 a4l_rnginfo_t *rng,
double *dst,
void *src,
int cnt);
225 int a4l_ultoraw(a4l_chinfo_t *chan,
void *dst,
unsigned long *src,
int cnt);
228 a4l_rnginfo_t *rng,
void *dst,
float *src,
int cnt);
231 a4l_rnginfo_t *rng,
void *dst,
double *src,
int cnt);
236 int subd,
int chan,
int range,
237 struct a4l_calibration_data *data );
239 int a4l_rawtodcal(a4l_chinfo_t *chan,
double *dst,
void *src,
240 int cnt,
struct a4l_polynomial *converter);
241 int a4l_dcaltoraw(a4l_chinfo_t * chan,
void *dst,
double *src,
int cnt,
242 struct a4l_polynomial *converter);
245 const unsigned dim,
double *x,
double *y);
250 double mean,
double *val,
unsigned nr);
253 double mean,
double *val,
unsigned nr);
int a4l_rawtod(a4l_chinfo_t *chan, a4l_rnginfo_t *rng, double *dst, void *src, int cnt)
Convert raw data (from the driver) to double-typed samples.
Definition: range.c:381
int a4l_sys_write(int fd, void *buf, size_t nbyte)
Write to an Analogy device.
Definition: sys.c:121
int a4l_get_bufsize(a4l_desc_t *dsc, unsigned int idx_subd, unsigned long *size)
Get the size of the asynchronous buffer.
Definition: async.c:184
int a4l_sys_open(const char *fname)
Open an Analogy device.
Definition: sys.c:58
Structure describing the asynchronous instruction.
Definition: analogy.h:289
int a4l_sizeof_subd(a4l_sbinfo_t *subd)
Get the size in memory of a digital acquired element.
Definition: range.c:121
char driver_name[A4L_NAMELEN]
Driver name.
Definition: analogy.h:65
void a4l_math_stddev_of_mean(double *pstddevm, double mean, double *val, unsigned nr)
Calculate the standard deviation of the mean.
Definition: math.c:450
int a4l_rawtof(a4l_chinfo_t *chan, a4l_rnginfo_t *rng, float *dst, void *src, int cnt)
Convert raw data (from the driver) to float-typed samples.
Definition: range.c:308
int a4l_sizeof_chan(a4l_chinfo_t *chan)
Get the size in memory of an acquired element.
Definition: range.c:85
unsigned int magic
Opaque field.
Definition: analogy.h:75
Structure containing device-information useful to users.
Definition: analogy.h:62
int a4l_set_bufsize(a4l_desc_t *dsc, unsigned int idx_subd, unsigned long size)
Change the size of the asynchronous buffer.
Definition: async.c:121
int a4l_get_chinfo(a4l_desc_t *dsc, unsigned int subd, unsigned int chan, a4l_chinfo_t **info)
Get an information structure on a specified channel.
Definition: descriptor.c:427
int a4l_sync_write(a4l_desc_t *dsc, unsigned int idx_subd, unsigned int chan_desc, unsigned int ns_delay, void *buf, size_t nbyte)
Perform a synchronous acquisition write operation.
Definition: sync.c:130
int a4l_poll(a4l_desc_t *dsc, unsigned int idx_subd, unsigned long ms_timeout)
Get the available data count.
Definition: async.c:286
int a4l_dcaltoraw(a4l_chinfo_t *chan, void *dst, double *src, int cnt, struct a4l_polynomial *converter)
Convert double values to raw calibrated data using polynomials.
Definition: calibration.c:420
int idx_read_subd
Input subdevice index.
Definition: analogy.h:69
int a4l_get_softcal_converter(struct a4l_polynomial *converter, int subd, int chan, int range, struct a4l_calibration_data *data)
Get the polynomial that will be use for the software calibration.
Definition: calibration.c:290
int a4l_sys_bufcfg(int fd, unsigned int idx_subd, unsigned long size)
Configure the buffer size.
Definition: sys.c:206
int nb_subd
Subdevices count.
Definition: analogy.h:67
int idx_write_subd
Output subdevice index.
Definition: analogy.h:71
int a4l_get_subdinfo(a4l_desc_t *dsc, unsigned int subd, a4l_sbinfo_t **info)
Get an information structure on a specified subdevice.
Definition: descriptor.c:390
int a4l_open(a4l_desc_t *dsc, const char *fname)
Open an Analogy device and basically fill the descriptor.
Definition: descriptor.c:294
int a4l_mark_bufrw(a4l_desc_t *dsc, unsigned int idx_subd, unsigned long cur, unsigned long *new)
Update the asynchronous buffer state.
Definition: async.c:244
void a4l_math_mean(double *pmean, double *val, unsigned nr)
Calculate the aritmetic mean of an array of values.
Definition: math.c:407
int a4l_sync_read(a4l_desc_t *dsc, unsigned int idx_subd, unsigned int chan_desc, unsigned int ns_delay, void *buf, size_t nbyte)
Perform a synchronous acquisition read operation.
Definition: sync.c:203
int a4l_read_calibration_file(char *name, struct a4l_calibration_data *data)
Read the analogy generated calibration file.
Definition: calibration.c:203
int a4l_sys_detach(int fd)
Detach an Analogy device from a driver.
Definition: sys.c:175
int a4l_dtoraw(a4l_chinfo_t *chan, a4l_rnginfo_t *rng, void *dst, double *src, int cnt)
Convert double-typed samples to raw data (for the driver)
Definition: range.c:587
int a4l_sys_attach(int fd, a4l_lnkdesc_t *arg)
Attach an Analogy device to a driver.
Definition: sys.c:152
int a4l_get_rnginfo(a4l_desc_t *dsc, unsigned int subd, unsigned int chan, unsigned int rng, a4l_rnginfo_t **info)
Get an information structure on a specified range.
Definition: descriptor.c:471
int a4l_rawtodcal(a4l_chinfo_t *chan, double *dst, void *src, int cnt, struct a4l_polynomial *converter)
Convert raw data (from the driver) to calibrated double units.
Definition: calibration.c:348
int a4l_sys_desc(int fd, a4l_desc_t *dsc, int pass)
Get a descriptor on an attached device.
Definition: descriptor.c:234
int a4l_sync_dio(a4l_desc_t *dsc, unsigned int idx_subd, void *mask, void *buf)
Perform a synchronous acquisition digital acquisition.
Definition: sync.c:274
char board_name[A4L_NAMELEN]
Board name.
Definition: analogy.h:63
int a4l_rawtoul(a4l_chinfo_t *chan, unsigned long *dst, void *src, int cnt)
Unpack raw data (from the driver) into unsigned long values.
Definition: range.c:248
void * sbdata
Data buffer pointer.
Definition: analogy.h:79
int a4l_async_write(a4l_desc_t *dsc, void *buf, size_t nbyte, unsigned long ms_timeout)
Perform asynchronous write operation on the analog input subdevice.
Definition: async.c:441
Structure describing the synchronous instruction.
Definition: analogy.h:680
int a4l_ftoraw(a4l_chinfo_t *chan, a4l_rnginfo_t *rng, void *dst, float *src, int cnt)
Convert float-typed samples to raw data (for the driver)
Definition: range.c:517
int sbsize
Data buffer size.
Definition: analogy.h:77
int a4l_sys_read(int fd, void *buf, size_t nbyte)
Read from an Analogy device.
Definition: sys.c:96
int a4l_snd_command(a4l_desc_t *dsc, a4l_cmd_t *cmd)
Send a command to an Analoy device.
Definition: async.c:54
int a4l_ultoraw(a4l_chinfo_t *chan, void *dst, unsigned long *src, int cnt)
Pack unsigned long values into raw data (for the driver)
Definition: range.c:457
void a4l_math_stddev(double *pstddev, double mean, double *val, unsigned nr)
Calculate the standard deviation of an array of values.
Definition: math.c:427
int fd
File descriptor.
Definition: analogy.h:73
int a4l_snd_insn(a4l_desc_t *dsc, a4l_insn_t *arg)
Perform a synchronous acquisition misc operation.
Definition: sync.c:84
int a4l_fill_desc(a4l_desc_t *dsc)
Fill the descriptor with subdevices, channels and ranges data.
Definition: descriptor.c:361
int a4l_find_range(a4l_desc_t *dsc, unsigned int idx_subd, unsigned int idx_chan, unsigned long unit, double min, double max, a4l_rnginfo_t **rng)
Find the must suitable range.
Definition: range.c:166
int a4l_math_polyfit(unsigned r_dim, double *r, double orig, const unsigned dim, double *x, double *y)
Calculate the polynomial fit.
Definition: math.c:365
int a4l_snd_cancel(a4l_desc_t *dsc, unsigned int idx_subd)
Cancel an asynchronous acquisition.
Definition: async.c:81
int a4l_close(a4l_desc_t *dsc)
Close the Analogy device related with the descriptor.
Definition: descriptor.c:336
int a4l_async_read(a4l_desc_t *dsc, void *buf, size_t nbyte, unsigned long ms_timeout)
Perform asynchronous read operation on the analog input subdevice.
Definition: async.c:384
int a4l_mmap(a4l_desc_t *dsc, unsigned int idx_subd, unsigned long size, void **ptr)
Map the asynchronous ring-buffer into a user-space.
Definition: async.c:328
int a4l_sys_close(int fd)
Close an Analogy device.
Definition: sys.c:71
Analogy for Linux, UAPI bits.
int a4l_config_subd(a4l_desc_t *dsc, unsigned int idx_subd, unsigned int type,...)
Configure a subdevice.
Definition: sync.c:369
int a4l_snd_insnlist(a4l_desc_t *dsc, a4l_insnlst_t *arg)
Perform a list of synchronous acquisition misc operations.
Definition: sync.c:58
Structure describing the list of synchronous instructions.
Definition: analogy.h:699