digital io commands.
#include "comedi_fc.h"
-static inline unsigned int bytes_per_scan( comedi_subdevice *subd )
-{
- int num_samples;
- int bits_per_sample;
-
- switch( subd->type )
- {
- case COMEDI_SUBD_DI:
- case COMEDI_SUBD_DO:
- case COMEDI_SUBD_DIO:
- bits_per_sample = 8 * bytes_per_sample(subd);
- num_samples = (subd->async->cmd.chanlist_len + bits_per_sample - 1) / bits_per_sample;
- break;
- default:
- num_samples = subd->async->cmd.chanlist_len;
- break;
- }
- return num_samples * bytes_per_sample( subd );
-}
-
static void increment_scan_progress( comedi_subdevice *subd, unsigned int num_bytes )
{
comedi_async *async = subd->async;
- unsigned int scan_length = bytes_per_scan( subd );
+ unsigned int scan_length = cfc_bytes_per_scan(subd);
async->scan_progress += num_bytes;
if( async->scan_progress >= scan_length )
extern unsigned int cfc_handle_events( comedi_device *dev, comedi_subdevice *subd );
+inline unsigned int cfc_bytes_per_scan(comedi_subdevice *subd)
+{
+ int num_samples;
+ int bits_per_sample;
+
+ switch(subd->type)
+ {
+ case COMEDI_SUBD_DI:
+ case COMEDI_SUBD_DO:
+ case COMEDI_SUBD_DIO:
+ bits_per_sample = 8 * bytes_per_sample(subd);
+ num_samples = (subd->async->cmd.chanlist_len + bits_per_sample - 1) / bits_per_sample;
+ break;
+ default:
+ num_samples = subd->async->cmd.chanlist_len;
+ break;
+ }
+ return num_samples * bytes_per_sample(subd);
+}
+
#endif /* _COMEDI_FC_H */
//#define USE_KMALLOC
+#include "mite.h"
+
+#include "comedi_fc.h"
#include <linux/comedidev.h>
#include <linux/pci.h>
#include <asm/system.h>
-#include "mite.h"
#define PCI_MITE_SIZE 4096
#define PCI_DAQ_SIZE 4096
{
int count;
unsigned int nbytes, old_alloc_count;
- unsigned int bytes_per_scan = bytes_per_sample(async->subdevice) * async->cmd.chanlist_len;
+ const unsigned bytes_per_scan = cfc_bytes_per_scan(async->subdevice);
old_alloc_count = async->buf_write_alloc_count;
// write alloc as much as we can
int count;
u32 nbytes_ub, nbytes_lb;
unsigned int old_alloc_count;
- u32 stop_count = async->cmd.stop_arg * bytes_per_sample(async->subdevice) *
- async->cmd.chanlist_len; //FIXME will be wrong for digital commands
+ u32 stop_count = async->cmd.stop_arg * cfc_bytes_per_scan(async->subdevice);
old_alloc_count = async->buf_read_alloc_count;
// read alloc as much as we can