GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / staging / comedi / drivers / comedi_fc.h
blob4b2cfd3279951c946378da1d503e6efb34a4a354
1 /*
2 comedi_fc.h
4 This is a place for code driver writers wish to share between
5 two or more drivers. These functions are meant to be used only
6 by drivers, they are NOT part of the kcomedilib API!
8 Author: Frank Mori Hess <fmhess@users.sourceforge.net>
9 Copyright (C) 2002 Frank Mori Hess
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 ************************************************************************/
27 #ifndef _COMEDI_FC_H
28 #define _COMEDI_FC_H
30 #include "../comedidev.h"
32 /* Writes an array of data points to comedi's buffer */
33 extern unsigned int cfc_write_array_to_buffer(struct comedi_subdevice *subd,
34 void *data,
35 unsigned int num_bytes);
37 static inline unsigned int cfc_write_to_buffer(struct comedi_subdevice *subd,
38 short data)
40 return cfc_write_array_to_buffer(subd, &data, sizeof(data));
43 static inline unsigned int cfc_write_long_to_buffer(struct comedi_subdevice
44 *subd, unsigned int data)
46 return cfc_write_array_to_buffer(subd, &data, sizeof(data));
49 extern unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *subd,
50 void *data,
51 unsigned int num_bytes);
53 extern unsigned int cfc_handle_events(struct comedi_device *dev,
54 struct comedi_subdevice *subd);
56 static inline unsigned int cfc_bytes_per_scan(struct comedi_subdevice *subd)
58 int num_samples;
59 int bits_per_sample;
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;
73 return num_samples * bytes_per_sample(subd);
76 #endif /* _COMEDI_FC_H */