1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef _COMEDI_FC_H
28#define _COMEDI_FC_H
29
30#include "../comedidev.h"
31
32
33extern unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd,
34 void *data,
35 unsigned int num_bytes);
36
37static inline unsigned int cfc_write_to_buffer(struct comedi_subdevice *subd,
38 short data)
39{
40 return cfc_write_array_to_buffer(subd, &data, sizeof(data));
41};
42
43static inline unsigned int cfc_write_long_to_buffer(struct comedi_subdevice
44 *subd, unsigned int data)
45{
46 return cfc_write_array_to_buffer(subd, &data, sizeof(data));
47};
48
49extern unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd,
50 void *data,
51 unsigned int num_bytes);
52
53extern unsigned int cfc_handle_events(struct comedi_device *dev,
54 struct comedi_subdevice *subd);
55
56static inline unsigned int cfc_bytes_per_scan(struct comedi_subdevice *subd)
57{
58 int num_samples;
59 int bits_per_sample;
60
61 switch (subd->type) {
62 case COMEDI_SUBD_DI:
63 case COMEDI_SUBD_DO:
64 case COMEDI_SUBD_DIO:
65 bits_per_sample = 8 * bytes_per_sample(subd);
66 num_samples = (subd->async->cmd.chanlist_len +
67 bits_per_sample - 1) / bits_per_sample;
68 break;
69 default:
70 num_samples = subd->async->cmd.chanlist_len;
71 break;
72 }
73 return num_samples * bytes_per_sample(subd);
74}
75
76#endif
77