Xenomai API  2.6.5
analogy.h
Go to the documentation of this file.
1 
22 #ifndef __ANALOGY_ANALOGY__
23 #define __ANALOGY_ANALOGY__
24 
25 #include <unistd.h>
26 
27 #include <analogy/types.h>
28 #include <analogy/descriptor.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef DOXYGEN_CPP
35 
36 /* --- Level 0 API (not supposed to be used) --- */
37 
38 int a4l_sys_open(const char *fname);
39 
40 int a4l_sys_close(int fd);
41 
42 int a4l_sys_read(int fd, void *buf, size_t nbyte);
43 
44 int a4l_sys_write(int fd, void *buf, size_t nbyte);
45 
46 int a4l_sys_attach(int fd, a4l_lnkdesc_t *arg);
47 
48 int a4l_sys_detach(int fd);
49 
50 int a4l_sys_bufcfg(int fd, unsigned int idx_subd, unsigned long size);
51 
52 int a4l_sys_desc(int fd, a4l_desc_t *dsc, int pass);
53 
54 int a4l_sys_devinfo(int fd, a4l_dvinfo_t *info);
55 
56 int a4l_sys_subdinfo(int fd, a4l_sbinfo_t *info);
57 
58 int a4l_sys_nbchaninfo(int fd, unsigned int idx_subd, unsigned int *nb);
59 
60 int a4l_sys_chaninfo(int fd,
61  unsigned int idx_subd, a4l_chinfo_t *info);
62 
63 int a4l_sys_nbrnginfo(int fd,
64  unsigned int idx_subd,
65  unsigned int idx_chan, unsigned int *nb);
66 
67 int a4l_sys_rnginfo(int fd,
68  unsigned int idx_subd,
69  unsigned int idx_chan, a4l_rnginfo_t *info);
70 
71 /* --- Level 1 API (supposed to be used) --- */
72 
73 int a4l_get_desc(int fd, a4l_desc_t *dsc, int pass);
74 
75 int a4l_open(a4l_desc_t *dsc, const char *fname);
76 
77 int a4l_close(a4l_desc_t *dsc);
78 
79 int a4l_fill_desc(a4l_desc_t *dsc);
80 
82  unsigned int subd, a4l_sbinfo_t **info);
83 
84 int a4l_get_chinfo(a4l_desc_t *dsc,
85  unsigned int subd,
86  unsigned int chan, a4l_chinfo_t **info);
87 
88 #define a4l_get_chan_max(x) (1ULL << (x)->nb_bits)
89 
90 #define a4l_is_chan_global(x) ((x)->chan_flags & A4L_CHAN_GLOBAL)
91 
93  unsigned int subd,
94  unsigned int chan,
95  unsigned int rng, a4l_rnginfo_t **info);
96 
97 #define a4l_is_rng_global(x) ((x)->flags & A4L_RNG_GLOBAL)
98 
99 int a4l_snd_command(a4l_desc_t *dsc, a4l_cmd_t *cmd);
100 
101 int a4l_snd_cancel(a4l_desc_t *dsc, unsigned int idx_subd);
102 
103 int a4l_set_bufsize(a4l_desc_t *dsc,
104  unsigned int idx_subd, unsigned long size);
105 
106 int a4l_get_bufsize(a4l_desc_t *dsc,
107  unsigned int idx_subd, unsigned long *size);
108 
109 int a4l_set_wakesize(a4l_desc_t *dsc, unsigned long size);
110 
111 int a4l_get_wakesize(a4l_desc_t *dsc, unsigned long *size);
112 
113 int a4l_mark_bufrw(a4l_desc_t *dsc,
114  unsigned int idx_subd,
115  unsigned long cur, unsigned long *newp);
116 
117 int a4l_poll(a4l_desc_t *dsc,
118  unsigned int idx_subd, unsigned long ms_timeout);
119 
120 int a4l_mmap(a4l_desc_t *dsc,
121  unsigned int idx_subd, unsigned long size, void **ptr);
122 
123 int a4l_async_read(a4l_desc_t *dsc,
124  void *buf, size_t nbyte, unsigned long ms_timeout);
125 
126 int a4l_async_write(a4l_desc_t *dsc,
127  void *buf, size_t nbyte, unsigned long ms_timeout);
128 
130 
131 int a4l_snd_insn(a4l_desc_t *dsc, a4l_insn_t *arg);
132 
133 /* --- Level 2 API (supposed to be used) --- */
134 
135 int a4l_sync_write(a4l_desc_t *dsc,
136  unsigned int idx_subd,
137  unsigned int chan_desc,
138  unsigned int delay, void *buf, size_t nbyte);
139 
140 int a4l_sync_read(a4l_desc_t *dsc,
141  unsigned int idx_subd,
142  unsigned int chan_desc,
143  unsigned int delay, void *buf, size_t nbyte);
144 
145 int a4l_config_subd(a4l_desc_t *dsc,
146  unsigned int idx_subd, unsigned int type, ...);
147 
148 int a4l_sync_dio(a4l_desc_t *dsc,
149  unsigned int idx_subd, void *mask, void *buf);
150 
151 int a4l_sizeof_chan(a4l_chinfo_t *chan);
152 
153 int a4l_sizeof_subd(a4l_sbinfo_t *subd);
154 
155 int a4l_find_range(a4l_desc_t *dsc,
156  unsigned int idx_subd,
157  unsigned int idx_chan,
158  unsigned long unit,
159  double min, double max, a4l_rnginfo_t **rng);
160 
161 int a4l_rawtoul(a4l_chinfo_t *chan, unsigned long *dst, void *src, int cnt);
162 
163 int a4l_rawtof(a4l_chinfo_t *chan,
164  a4l_rnginfo_t *rng, float *dst, void *src, int cnt);
165 
166 int a4l_rawtod(a4l_chinfo_t *chan,
167  a4l_rnginfo_t *rng, double *dst, void *src, int cnt);
168 
169 int a4l_ultoraw(a4l_chinfo_t *chan, void *dst, unsigned long *src, int cnt);
170 
171 int a4l_ftoraw(a4l_chinfo_t *chan,
172  a4l_rnginfo_t *rng, void *dst, float *src, int cnt);
173 
174 int a4l_dtoraw(a4l_chinfo_t *chan,
175  a4l_rnginfo_t *rng, void *dst, double *src, int cnt);
176 
177 #endif /* !DOXYGEN_CPP */
178 
179 #ifdef __cplusplus
180 }
181 #endif
182 #endif /* __ANALOGY_ANALOGY__ */
int a4l_open(a4l_desc_t *dsc, const char *fname)
Open an Analogy device and basically fill the descriptor.
Definition: descriptor.c:297
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:187
int a4l_snd_insnlist(a4l_desc_t *dsc, a4l_insnlst_t *arg)
Perform a list of synchronous acquisition misc operations.
Definition: sync.c:61
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:247
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:309
int a4l_config_subd(a4l_desc_t *dsc, unsigned int idx_subd, unsigned int type,...)
Configure a subdevice.
Definition: sync.c:372
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:387
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:474
Structure describing the asynchronous instruction.
Definition: command.h:198
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:124
int a4l_snd_insn(a4l_desc_t *dsc, a4l_insn_t *arg)
Perform a synchronous acquisition misc operation.
Definition: sync.c:87
int a4l_fill_desc(a4l_desc_t *dsc)
Fill the descriptor with subdevices, channels and ranges data.
Definition: descriptor.c:364
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:206
Structure containing device-information useful to users.
Definition: descriptor.h:66
int a4l_sys_open(const char *fname)
Open an Analogy device.
Definition: sys.c:60
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:249
Analogy for Linux, descriptor related features.
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:459
int a4l_snd_cancel(a4l_desc_t *dsc, unsigned int idx_subd)
Cancel an asynchronous acquisition.
Definition: async.c:84
int a4l_sizeof_subd(a4l_sbinfo_t *subd)
Get the size in memory of a digital acquired element.
Definition: range.c:121
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:589
int a4l_sys_attach(int fd, a4l_lnkdesc_t *arg)
Attach an Analogy device to a driver.
Definition: sys.c:154
int a4l_sys_write(int fd, void *buf, size_t nbyte)
Write to an Analogy device.
Definition: sys.c:123
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:382
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:277
int a4l_sizeof_chan(a4l_chinfo_t *chan)
Get the size in memory of an acquired element.
Definition: range.c:85
int a4l_close(a4l_desc_t *dsc)
Close the Analogy device related with the descriptor.
Definition: descriptor.c:339
int a4l_poll(a4l_desc_t *dsc, unsigned int idx_subd, unsigned long ms_timeout)
Get the available data count.
Definition: async.c:289
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:331
int a4l_sys_detach(int fd)
Detach an Analogy device from a driver.
Definition: sys.c:177
Structure describing the synchronous instruction.
Definition: instruction.h:169
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:393
Analogy for Linux, misc declarations.
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:444
int a4l_sys_desc(int fd, a4l_desc_t *dsc, int pass)
Get a descriptor on an attached device.
Definition: descriptor.c:237
int a4l_sys_bufcfg(int fd, unsigned int idx_subd, unsigned long size)
Configure the buffer size.
Definition: sys.c:208
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_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:519
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:430
int a4l_sys_close(int fd)
Close an Analogy device.
Definition: sys.c:73
int a4l_snd_command(a4l_desc_t *dsc, a4l_cmd_t *cmd)
Send a command to an Analoy device.
Definition: async.c:57
int a4l_sys_read(int fd, void *buf, size_t nbyte)
Read from an Analogy device.
Definition: sys.c:98
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:133
Structure describing the list of synchronous instructions.
Definition: instruction.h:188