Commit 8bd48c9e authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: comedi_test: make samples unsigned

Represent the fake samples as unsigned shorts instead of signed shorts,
as this is the usual Comedi convention.  There is no change to the
actual binary representation, although the `cfc_write_to_buffer()` call
currently expects a signed short for some bizarre reason.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ea4f72b2
...@@ -85,7 +85,8 @@ static const struct comedi_lrange waveform_ai_ranges = { ...@@ -85,7 +85,8 @@ static const struct comedi_lrange waveform_ai_ranges = {
} }
}; };
static short fake_sawtooth(struct comedi_device *dev, unsigned int range_index, static unsigned short fake_sawtooth(struct comedi_device *dev,
unsigned int range_index,
unsigned long current_time) unsigned long current_time)
{ {
struct waveform_private *devpriv = dev->private; struct waveform_private *devpriv = dev->private;
...@@ -109,7 +110,7 @@ static short fake_sawtooth(struct comedi_device *dev, unsigned int range_index, ...@@ -109,7 +110,7 @@ static short fake_sawtooth(struct comedi_device *dev, unsigned int range_index,
return offset + value; return offset + value;
} }
static short fake_squarewave(struct comedi_device *dev, static unsigned short fake_squarewave(struct comedi_device *dev,
unsigned int range_index, unsigned int range_index,
unsigned long current_time) unsigned long current_time)
{ {
...@@ -131,15 +132,17 @@ static short fake_squarewave(struct comedi_device *dev, ...@@ -131,15 +132,17 @@ static short fake_squarewave(struct comedi_device *dev,
return offset + value; return offset + value;
} }
static short fake_flatline(struct comedi_device *dev, unsigned int range_index, static unsigned short fake_flatline(struct comedi_device *dev,
unsigned int range_index,
unsigned long current_time) unsigned long current_time)
{ {
return dev->read_subdev->maxdata / 2; return dev->read_subdev->maxdata / 2;
} }
/* generates a different waveform depending on what channel is read */ /* generates a different waveform depending on what channel is read */
static short fake_waveform(struct comedi_device *dev, unsigned int channel, static unsigned short fake_waveform(struct comedi_device *dev,
unsigned int range, unsigned long current_time) unsigned int channel, unsigned int range,
unsigned long current_time)
{ {
enum { enum {
SAWTOOTH_CHAN, SAWTOOTH_CHAN,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment