unsigned int ai_inttrig_start; /* TRIG_INT for start */
};
-#define devpriv ((struct pci9118_private *)dev->private)
-#define this_board ((struct boardtype *)dev->board_ptr)
-
/*
==============================================================================
*/
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct pci9118_private *devpriv = dev->private;
int n, timeout;
devpriv->AdControlReg = AdControl_Int & 0xff;
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct pci9118_private *devpriv = dev->private;
int n, chanreg, ch;
ch = CR_CHAN(insn->chanspec);
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct pci9118_private *devpriv = dev->private;
int n, chan;
chan = CR_CHAN(insn->chanspec);
*/
static void interrupt_pci9118_ai_mode4_switch(struct comedi_device *dev)
{
+ struct pci9118_private *devpriv = dev->private;
+
devpriv->AdFunctionReg =
AdFunction_PDTrg | AdFunction_PETrg | AdFunction_AM;
outl(devpriv->AdFunctionReg, dev->iobase + PCI9118_ADFUNC);
short *dma_buffer,
unsigned int num_samples)
{
+ struct pci9118_private *devpriv = dev->private;
unsigned int i = 0, j = 0;
unsigned int start_pos = devpriv->ai_add_front,
stop_pos = devpriv->ai_add_front + devpriv->ai_n_chan;
short *dma_buffer,
unsigned int num_samples)
{
+ struct pci9118_private *devpriv = dev->private;
unsigned int num_bytes;
num_samples = defragment_dma_buffer(dev, s, dma_buffer, num_samples);
struct comedi_subdevice *s,
unsigned char m)
{
+ struct pci9118_private *devpriv = dev->private;
+
if (m & 0x100) {
comedi_error(dev, "A/D FIFO Full status (Fatal Error!)");
devpriv->ai_maskerr &= ~0x100L;
unsigned int num_bytes,
unsigned int start_chan_index)
{
+ struct pci9118_private *devpriv = dev->private;
unsigned int i, num_samples = num_bytes / sizeof(short);
short *array = data;
unsigned int int_amcc,
unsigned short int_daq)
{
+ struct pci9118_private *devpriv = dev->private;
register short sampl;
s->async->events = 0;
unsigned int int_amcc,
unsigned short int_daq)
{
+ struct pci9118_private *devpriv = dev->private;
unsigned int next_dma_buf, samplesinbuf, sampls, m;
if (int_amcc & MASTER_ABORT_INT) {
static irqreturn_t interrupt_pci9118(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct pci9118_private *devpriv = dev->private;
unsigned int int_daq = 0, int_amcc, int_adstat;
if (!dev->attached)
static int pci9118_ai_inttrig(struct comedi_device *dev,
struct comedi_subdevice *s, unsigned int trignum)
{
+ struct pci9118_private *devpriv = dev->private;
+
if (trignum != devpriv->ai_inttrig_start)
return -EINVAL;
struct comedi_subdevice *s,
struct comedi_cmd *cmd)
{
+ const struct boardtype *this_board = comedi_board(dev);
+ struct pci9118_private *devpriv = dev->private;
int err = 0;
int tmp;
unsigned int divisor1 = 0, divisor2 = 0;
*/
static int Compute_and_setup_dma(struct comedi_device *dev)
{
+ struct pci9118_private *devpriv = dev->private;
unsigned int dmalen0, dmalen1, i;
DPRINTK("adl_pci9118 EDBG: BGN: Compute_and_setup_dma()\n");
static int pci9118_ai_docmd_sampl(struct comedi_device *dev,
struct comedi_subdevice *s)
{
+ struct pci9118_private *devpriv = dev->private;
+
DPRINTK("adl_pci9118 EDBG: BGN: pci9118_ai_docmd_sampl(%d,) [%d]\n",
dev->minor, devpriv->ai_do);
switch (devpriv->ai_do) {
static int pci9118_ai_docmd_dma(struct comedi_device *dev,
struct comedi_subdevice *s)
{
+ struct pci9118_private *devpriv = dev->private;
+
DPRINTK("adl_pci9118 EDBG: BGN: pci9118_ai_docmd_dma(%d,) [%d,%d]\n",
dev->minor, devpriv->ai_do, devpriv->usedma);
Compute_and_setup_dma(dev);
*/
static int pci9118_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
+ const struct boardtype *this_board = comedi_board(dev);
+ struct pci9118_private *devpriv = dev->private;
struct comedi_cmd *cmd = &s->async->cmd;
unsigned int addchans = 0;
int ret = 0;
struct comedi_subdevice *s, int n_chan,
unsigned int *chanlist, int frontadd, int backadd)
{
+ const struct boardtype *this_board = comedi_board(dev);
+ struct pci9118_private *devpriv = dev->private;
unsigned int i, differencial = 0, bipolar = 0;
/* correct channel and range number check itself comedi/range.c */
unsigned int *chanlist, int rot, int frontadd,
int backadd, int usedma, char useeos)
{
+ struct pci9118_private *devpriv = dev->private;
unsigned int i, differencial = 0, bipolar = 0;
unsigned int scanquad, gain, ssh = 0x00;
unsigned int *div1, unsigned int *div2,
char usessh, unsigned int chnsshfront)
{
+ const struct boardtype *this_board = comedi_board(dev);
+ struct pci9118_private *devpriv = dev->private;
+
DPRINTK
("adl_pci9118 EDBG: BGN: pci9118_calc_divisors"
"(%d,%d,.,%u,%u,%u,%d,.,.,,%u,%u)\n",
*/
static int pci9118_exttrg_add(struct comedi_device *dev, unsigned char source)
{
+ struct pci9118_private *devpriv = dev->private;
+
if (source > 3)
return -1; /* incorrect source */
devpriv->exttrg_users |= (1 << source);
*/
static int pci9118_exttrg_del(struct comedi_device *dev, unsigned char source)
{
+ struct pci9118_private *devpriv = dev->private;
+
if (source > 3)
return -1; /* incorrect source */
devpriv->exttrg_users &= ~(1 << source);
static int pci9118_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
+ struct pci9118_private *devpriv = dev->private;
+
if (devpriv->usedma)
outl(inl(devpriv->iobase_a + AMCC_OP_REG_MCSR) &
(~EN_A2P_TRANSFERS),
*/
static int pci9118_reset(struct comedi_device *dev)
{
+ struct pci9118_private *devpriv = dev->private;
+
devpriv->IntControlReg = 0;
devpriv->exttrg_users = 0;
inl(dev->iobase + PCI9118_INTCTRL);
static struct pci_dev *pci9118_find_pci(struct comedi_device *dev,
struct comedi_devconfig *it)
{
+ const struct boardtype *this_board = comedi_board(dev);
struct pci_dev *pcidev = NULL;
int bus = it->options[0];
int slot = it->options[1];
static int pci9118_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
+ const struct boardtype *this_board = comedi_board(dev);
+ struct pci9118_private *devpriv;
struct pci_dev *pcidev;
struct comedi_subdevice *s;
int ret, pages, i;
else
master = 1;
- ret = alloc_private(dev, sizeof(struct pci9118_private));
+ ret = alloc_private(dev, sizeof(*devpriv));
if (ret < 0) {
printk(" - Allocation failed!\n");
return -ENOMEM;
}
+ devpriv = dev->private;
pcidev = pci9118_find_pci(dev, it);
if (!pcidev)
static void pci9118_detach(struct comedi_device *dev)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+ struct pci9118_private *devpriv = dev->private;
- if (dev->private) {
+ if (devpriv) {
if (devpriv->valid)
pci9118_reset(dev);
if (dev->irq)