staging: comedi: range: introduce some simple mA ranges

The simple mA ranges 0 to 20, 4 to 20, and 0 to 32 are fairly common.
Introduce them in the comedi core and use them in the drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2013-04-03 13:40:13 -07:00 committed by Greg Kroah-Hartman
parent ebde53ec1a
commit 2c71c4ff57
5 changed files with 10 additions and 12 deletions

View File

@ -295,6 +295,9 @@ extern const struct comedi_lrange range_bipolar2_5;
extern const struct comedi_lrange range_unipolar10;
extern const struct comedi_lrange range_unipolar5;
extern const struct comedi_lrange range_unipolar2_5;
extern const struct comedi_lrange range_0_20mA;
extern const struct comedi_lrange range_4_20mA;
extern const struct comedi_lrange range_0_32mA;
extern const struct comedi_lrange range_unknown;
#define range_digital range_unipolar5

View File

@ -61,12 +61,6 @@ Configuration options:
#include <linux/ioport.h>
#include <linux/delay.h>
static const struct comedi_lrange
range_dt2815_ao_32_current = {1, {RANGE_mA(0, 32)} };
static const struct comedi_lrange
range_dt2815_ao_20_current = {1, {RANGE_mA(4, 20)} };
#define DT2815_SIZE 2
#define DT2815_DATA 0
@ -199,7 +193,7 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->range_table_list = devpriv->range_type_list;
current_range_type = (it->options[3])
? &range_dt2815_ao_20_current : &range_dt2815_ao_32_current;
? &range_4_20mA : &range_0_32mA;
voltage_range_type = (it->options[2])
? &range_bipolar5 : &range_unipolar5;
for (i = 0; i < 8; i++) {

View File

@ -94,8 +94,6 @@ struct ni_670x_private {
unsigned int ao_readback[32];
};
static struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} };
static int ni_670x_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)

View File

@ -90,9 +90,6 @@ Interrupts are not supported.
#define PCL727_DI_HI 0
#define PCL727_DI_LO 1
static const struct comedi_lrange range_4_20mA = { 1, {RANGE_mA(4, 20)} };
static const struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} };
static const struct comedi_lrange *const rangelist_726[] = {
&range_unipolar5, &range_unipolar10,
&range_bipolar5, &range_bipolar10,

View File

@ -37,6 +37,12 @@ const struct comedi_lrange range_unipolar5 = { 1, {UNI_RANGE(5)} };
EXPORT_SYMBOL(range_unipolar5);
const struct comedi_lrange range_unipolar2_5 = { 1, {UNI_RANGE(2.5)} };
EXPORT_SYMBOL(range_unipolar2_5);
const struct comedi_lrange range_0_20mA = { 1, {RANGE_mA(0, 20)} };
EXPORT_SYMBOL(range_0_20mA);
const struct comedi_lrange range_4_20mA = { 1, {RANGE_mA(4, 20)} };
EXPORT_SYMBOL(range_4_20mA);
const struct comedi_lrange range_0_32mA = { 1, {RANGE_mA(0, 32)} };
EXPORT_SYMBOL(range_0_32mA);
const struct comedi_lrange range_unknown = { 1, {{0, 1000000, UNIT_none} } };
EXPORT_SYMBOL(range_unknown);