Commit eb5e029e authored by Bill Pemberton's avatar Bill Pemberton Committed by Greg Kroah-Hartman

Staging: comedi: Remove s626_board typedef

Signed-off-by: default avatarBill Pemberton <wfp5p@virginia.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d80235ce
...@@ -82,7 +82,7 @@ MODULE_AUTHOR("Gianluca Palli <gpalli@deis.unibo.it>"); ...@@ -82,7 +82,7 @@ MODULE_AUTHOR("Gianluca Palli <gpalli@deis.unibo.it>");
MODULE_DESCRIPTION("Sensoray 626 Comedi driver module"); MODULE_DESCRIPTION("Sensoray 626 Comedi driver module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
typedef struct s626_board_struct { struct s626_board {
const char *name; const char *name;
int ai_chans; int ai_chans;
int ai_bits; int ai_bits;
...@@ -91,9 +91,9 @@ typedef struct s626_board_struct { ...@@ -91,9 +91,9 @@ typedef struct s626_board_struct {
int dio_chans; int dio_chans;
int dio_banks; int dio_banks;
int enc_chans; int enc_chans;
} s626_board; };
static const s626_board s626_boards[] = { static const struct s626_board s626_boards[] = {
{ {
name: "s626", name: "s626",
ai_chans : S626_ADC_CHANNELS, ai_chans : S626_ADC_CHANNELS,
...@@ -106,7 +106,7 @@ static const s626_board s626_boards[] = { ...@@ -106,7 +106,7 @@ static const s626_board s626_boards[] = {
} }
}; };
#define thisboard ((const s626_board *)dev->board_ptr) #define thisboard ((const struct s626_board *)dev->board_ptr)
#define PCI_VENDOR_ID_S626 0x1131 #define PCI_VENDOR_ID_S626 0x1131
#define PCI_DEVICE_ID_S626 0x7146 #define PCI_DEVICE_ID_S626 0x7146
...@@ -128,7 +128,7 @@ static comedi_driver driver_s626 = { ...@@ -128,7 +128,7 @@ static comedi_driver driver_s626 = {
detach : s626_detach, detach : s626_detach,
}; };
typedef struct { struct s626_private {
struct pci_dev *pdev; struct pci_dev *pdev;
void *base_addr; void *base_addr;
int got_regions; int got_regions;
...@@ -158,9 +158,9 @@ typedef struct { ...@@ -158,9 +158,9 @@ typedef struct {
/* I2C device address for onboard EEPROM (board rev dependent). */ /* I2C device address for onboard EEPROM (board rev dependent). */
/* short I2Cards; */ /* short I2Cards; */
lsampl_t ao_readback[S626_DAC_CHANNELS]; lsampl_t ao_readback[S626_DAC_CHANNELS];
} s626_private; };
typedef struct { struct dio_private {
uint16_t RDDIn; uint16_t RDDIn;
uint16_t WRDOut; uint16_t WRDOut;
uint16_t RDEdgSel; uint16_t RDEdgSel;
...@@ -170,9 +170,9 @@ typedef struct { ...@@ -170,9 +170,9 @@ typedef struct {
uint16_t RDCapFlg; uint16_t RDCapFlg;
uint16_t RDIntSel; uint16_t RDIntSel;
uint16_t WRIntSel; uint16_t WRIntSel;
} dio_private; };
static dio_private dio_private_A = { static struct dio_private dio_private_A = {
RDDIn:LP_RDDINA, RDDIn:LP_RDDINA,
WRDOut : LP_WRDOUTA, WRDOut : LP_WRDOUTA,
RDEdgSel : LP_RDEDGSELA, RDEdgSel : LP_RDEDGSELA,
...@@ -184,7 +184,7 @@ static dio_private dio_private_A = { ...@@ -184,7 +184,7 @@ static dio_private dio_private_A = {
WRIntSel : LP_WRINTSELA, WRIntSel : LP_WRINTSELA,
}; };
static dio_private dio_private_B = { static struct dio_private dio_private_B = {
RDDIn:LP_RDDINB, RDDIn:LP_RDDINB,
WRDOut : LP_WRDOUTB, WRDOut : LP_WRDOUTB,
RDEdgSel : LP_RDEDGSELB, RDEdgSel : LP_RDEDGSELB,
...@@ -196,7 +196,7 @@ static dio_private dio_private_B = { ...@@ -196,7 +196,7 @@ static dio_private dio_private_B = {
WRIntSel : LP_WRINTSELB, WRIntSel : LP_WRINTSELB,
}; };
static dio_private dio_private_C = { static struct dio_private dio_private_C = {
RDDIn:LP_RDDINC, RDDIn:LP_RDDINC,
WRDOut : LP_WRDOUTC, WRDOut : LP_WRDOUTC,
RDEdgSel : LP_RDEDGSELC, RDEdgSel : LP_RDEDGSELC,
...@@ -209,15 +209,15 @@ static dio_private dio_private_C = { ...@@ -209,15 +209,15 @@ static dio_private dio_private_C = {
}; };
/* to group dio devices (48 bits mask and data are not allowed ???) /* to group dio devices (48 bits mask and data are not allowed ???)
static dio_private *dio_private_word[]={ static struct dio_private *dio_private_word[]={
&dio_private_A, &dio_private_A,
&dio_private_B, &dio_private_B,
&dio_private_C, &dio_private_C,
}; };
*/ */
#define devpriv ((s626_private *)dev->private) #define devpriv ((struct s626_private *)dev->private)
#define diopriv ((dio_private *)s->private) #define diopriv ((struct dio_private *)s->private)
COMEDI_PCI_INITCLEANUP_NOMODULE(driver_s626, s626_pci_table); COMEDI_PCI_INITCLEANUP_NOMODULE(driver_s626, s626_pci_table);
...@@ -278,67 +278,67 @@ static void DEBIreplace(comedi_device *dev, uint16_t addr, uint16_t mask, ...@@ -278,67 +278,67 @@ static void DEBIreplace(comedi_device *dev, uint16_t addr, uint16_t mask,
static void CloseDMAB(comedi_device *dev, DMABUF *pdma, size_t bsize); static void CloseDMAB(comedi_device *dev, DMABUF *pdma, size_t bsize);
/* COUNTER OBJECT ------------------------------------------------ */ /* COUNTER OBJECT ------------------------------------------------ */
typedef struct enc_private_struct { struct enc_private {
/* Pointers to functions that differ for A and B counters: */ /* Pointers to functions that differ for A and B counters: */
uint16_t(*GetEnable) (comedi_device *dev, struct enc_private_struct *); /* Return clock enable. */ uint16_t(*GetEnable) (comedi_device *dev, struct enc_private *); /* Return clock enable. */
uint16_t(*GetIntSrc) (comedi_device *dev, struct enc_private_struct *); /* Return interrupt source. */ uint16_t(*GetIntSrc) (comedi_device *dev, struct enc_private *); /* Return interrupt source. */
uint16_t(*GetLoadTrig) (comedi_device *dev, struct enc_private_struct *); /* Return preload trigger source. */ uint16_t(*GetLoadTrig) (comedi_device *dev, struct enc_private *); /* Return preload trigger source. */
uint16_t(*GetMode) (comedi_device *dev, struct enc_private_struct *); /* Return standardized operating mode. */ uint16_t(*GetMode) (comedi_device *dev, struct enc_private *); /* Return standardized operating mode. */
void (*PulseIndex) (comedi_device *dev, struct enc_private_struct *); /* Generate soft index strobe. */ void (*PulseIndex) (comedi_device *dev, struct enc_private *); /* Generate soft index strobe. */
void (*SetEnable) (comedi_device *dev, struct enc_private_struct *, uint16_t enab); /* Program clock enable. */ void (*SetEnable) (comedi_device *dev, struct enc_private *, uint16_t enab); /* Program clock enable. */
void (*SetIntSrc) (comedi_device *dev, struct enc_private_struct *, uint16_t IntSource); /* Program interrupt source. */ void (*SetIntSrc) (comedi_device *dev, struct enc_private *, uint16_t IntSource); /* Program interrupt source. */
void (*SetLoadTrig) (comedi_device *dev, struct enc_private_struct *, uint16_t Trig); /* Program preload trigger source. */ void (*SetLoadTrig) (comedi_device *dev, struct enc_private *, uint16_t Trig); /* Program preload trigger source. */
void (*SetMode) (comedi_device *dev, struct enc_private_struct *, uint16_t Setup, uint16_t DisableIntSrc); /* Program standardized operating mode. */ void (*SetMode) (comedi_device *dev, struct enc_private *, uint16_t Setup, uint16_t DisableIntSrc); /* Program standardized operating mode. */
void (*ResetCapFlags) (comedi_device *dev, struct enc_private_struct *); /* Reset event capture flags. */ void (*ResetCapFlags) (comedi_device *dev, struct enc_private *); /* Reset event capture flags. */
uint16_t MyCRA; /* Address of CRA register. */ uint16_t MyCRA; /* Address of CRA register. */
uint16_t MyCRB; /* Address of CRB register. */ uint16_t MyCRB; /* Address of CRB register. */
uint16_t MyLatchLsw; /* Address of Latch least-significant-word */ uint16_t MyLatchLsw; /* Address of Latch least-significant-word */
/* register. */ /* register. */
uint16_t MyEventBits[4]; /* Bit translations for IntSrc -->RDMISC2. */ uint16_t MyEventBits[4]; /* Bit translations for IntSrc -->RDMISC2. */
} enc_private; /* counter object */ };
#define encpriv ((enc_private *)(dev->subdevices+5)->private) #define encpriv ((struct enc_private *)(dev->subdevices+5)->private)
/* counters routines */ /* counters routines */
static void s626_timer_load(comedi_device *dev, enc_private *k, int tick); static void s626_timer_load(comedi_device *dev, struct enc_private *k, int tick);
static uint32_t ReadLatch(comedi_device *dev, enc_private *k); static uint32_t ReadLatch(comedi_device *dev, struct enc_private *k);
static void ResetCapFlags_A(comedi_device *dev, enc_private *k); static void ResetCapFlags_A(comedi_device *dev, struct enc_private *k);
static void ResetCapFlags_B(comedi_device *dev, enc_private *k); static void ResetCapFlags_B(comedi_device *dev, struct enc_private *k);
static uint16_t GetMode_A(comedi_device *dev, enc_private *k); static uint16_t GetMode_A(comedi_device *dev, struct enc_private *k);
static uint16_t GetMode_B(comedi_device *dev, enc_private *k); static uint16_t GetMode_B(comedi_device *dev, struct enc_private *k);
static void SetMode_A(comedi_device *dev, enc_private *k, uint16_t Setup, static void SetMode_A(comedi_device *dev, struct enc_private *k, uint16_t Setup,
uint16_t DisableIntSrc); uint16_t DisableIntSrc);
static void SetMode_B(comedi_device *dev, enc_private *k, uint16_t Setup, static void SetMode_B(comedi_device *dev, struct enc_private *k, uint16_t Setup,
uint16_t DisableIntSrc); uint16_t DisableIntSrc);
static void SetEnable_A(comedi_device *dev, enc_private *k, uint16_t enab); static void SetEnable_A(comedi_device *dev, struct enc_private *k, uint16_t enab);
static void SetEnable_B(comedi_device *dev, enc_private *k, uint16_t enab); static void SetEnable_B(comedi_device *dev, struct enc_private *k, uint16_t enab);
static uint16_t GetEnable_A(comedi_device *dev, enc_private *k); static uint16_t GetEnable_A(comedi_device *dev, struct enc_private *k);
static uint16_t GetEnable_B(comedi_device *dev, enc_private *k); static uint16_t GetEnable_B(comedi_device *dev, struct enc_private *k);
static void SetLatchSource(comedi_device *dev, enc_private *k, static void SetLatchSource(comedi_device *dev, struct enc_private *k,
uint16_t value); uint16_t value);
/* static uint16_t GetLatchSource(comedi_device *dev, enc_private *k ); */ /* static uint16_t GetLatchSource(comedi_device *dev, struct enc_private *k ); */
static void SetLoadTrig_A(comedi_device *dev, enc_private *k, uint16_t Trig); static void SetLoadTrig_A(comedi_device *dev, struct enc_private *k, uint16_t Trig);
static void SetLoadTrig_B(comedi_device *dev, enc_private *k, uint16_t Trig); static void SetLoadTrig_B(comedi_device *dev, struct enc_private *k, uint16_t Trig);
static uint16_t GetLoadTrig_A(comedi_device *dev, enc_private *k); static uint16_t GetLoadTrig_A(comedi_device *dev, struct enc_private *k);
static uint16_t GetLoadTrig_B(comedi_device *dev, enc_private *k); static uint16_t GetLoadTrig_B(comedi_device *dev, struct enc_private *k);
static void SetIntSrc_B(comedi_device *dev, enc_private *k, static void SetIntSrc_B(comedi_device *dev, struct enc_private *k,
uint16_t IntSource); uint16_t IntSource);
static void SetIntSrc_A(comedi_device *dev, enc_private *k, static void SetIntSrc_A(comedi_device *dev, struct enc_private *k,
uint16_t IntSource); uint16_t IntSource);
static uint16_t GetIntSrc_A(comedi_device *dev, enc_private *k); static uint16_t GetIntSrc_A(comedi_device *dev, struct enc_private *k);
static uint16_t GetIntSrc_B(comedi_device *dev, enc_private *k); static uint16_t GetIntSrc_B(comedi_device *dev, struct enc_private *k);
/* static void SetClkMult(comedi_device *dev, enc_private *k, uint16_t value ) ; */ /* static void SetClkMult(comedi_device *dev, struct enc_private *k, uint16_t value ) ; */
/* static uint16_t GetClkMult(comedi_device *dev, enc_private *k ) ; */ /* static uint16_t GetClkMult(comedi_device *dev, struct enc_private *k ) ; */
/* static void SetIndexPol(comedi_device *dev, enc_private *k, uint16_t value ); */ /* static void SetIndexPol(comedi_device *dev, struct enc_private *k, uint16_t value ); */
/* static uint16_t GetClkPol(comedi_device *dev, enc_private *k ) ; */ /* static uint16_t GetClkPol(comedi_device *dev, struct enc_private *k ) ; */
/* static void SetIndexSrc( comedi_device *dev,enc_private *k, uint16_t value ); */ /* static void SetIndexSrc( comedi_device *dev,struct enc_private *k, uint16_t value ); */
/* static uint16_t GetClkSrc( comedi_device *dev,enc_private *k ); */ /* static uint16_t GetClkSrc( comedi_device *dev,struct enc_private *k ); */
/* static void SetIndexSrc( comedi_device *dev,enc_private *k, uint16_t value ); */ /* static void SetIndexSrc( comedi_device *dev,struct enc_private *k, uint16_t value ); */
/* static uint16_t GetIndexSrc( comedi_device *dev,enc_private *k ); */ /* static uint16_t GetIndexSrc( comedi_device *dev,struct enc_private *k ); */
static void PulseIndex_A(comedi_device *dev, enc_private *k); static void PulseIndex_A(comedi_device *dev, struct enc_private *k);
static void PulseIndex_B(comedi_device *dev, enc_private *k); static void PulseIndex_B(comedi_device *dev, struct enc_private *k);
static void Preload(comedi_device *dev, enc_private *k, uint32_t value); static void Preload(comedi_device *dev, struct enc_private *k, uint32_t value);
static void CountersInit(comedi_device *dev); static void CountersInit(comedi_device *dev);
/* end internal routines */ /* end internal routines */
...@@ -352,8 +352,8 @@ static void CountersInit(comedi_device *dev); ...@@ -352,8 +352,8 @@ static void CountersInit(comedi_device *dev);
/* Translation table to map IntSrc into equivalent RDMISC2 event flag bits. */ /* Translation table to map IntSrc into equivalent RDMISC2 event flag bits. */
/* static const uint16_t EventBits[][4] = { EVBITS(0), EVBITS(1), EVBITS(2), EVBITS(3), EVBITS(4), EVBITS(5) }; */ /* static const uint16_t EventBits[][4] = { EVBITS(0), EVBITS(1), EVBITS(2), EVBITS(3), EVBITS(4), EVBITS(5) }; */
/* enc_private; */ /* struct enc_private; */
static enc_private enc_private_data[] = { static struct enc_private enc_private_data[] = {
{ {
GetEnable:GetEnable_A, GetEnable:GetEnable_A,
GetIntSrc : GetIntSrc_A, GetIntSrc : GetIntSrc_A,
...@@ -500,7 +500,7 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it) ...@@ -500,7 +500,7 @@ static int s626_attach(comedi_device *dev, comedi_devconfig *it)
comedi_subdevice *s; comedi_subdevice *s;
struct pci_dev *pdev; struct pci_dev *pdev;
if (alloc_private(dev, sizeof(s626_private)) < 0) if (alloc_private(dev, sizeof(struct s626_private)) < 0)
return -ENOMEM; return -ENOMEM;
for (pdev = pci_get_device(PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, for (pdev = pci_get_device(PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626,
...@@ -973,7 +973,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d PT_REGS_ARG) ...@@ -973,7 +973,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d PT_REGS_ARG)
comedi_device *dev = d; comedi_device *dev = d;
comedi_subdevice *s; comedi_subdevice *s;
comedi_cmd *cmd; comedi_cmd *cmd;
enc_private *k; struct enc_private *k;
unsigned long flags; unsigned long flags;
int32_t *readaddr; int32_t *readaddr;
uint32_t irqtype, irqstatus; uint32_t irqtype, irqstatus;
...@@ -1078,7 +1078,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d PT_REGS_ARG) ...@@ -1078,7 +1078,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d PT_REGS_ARG)
irqbit = 0; irqbit = 0;
/* read interrupt type */ /* read interrupt type */
irqbit = DEBIread(dev, irqbit = DEBIread(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->RDCapFlg); group)->private)->RDCapFlg);
/* check if interrupt is generated from dio channels */ /* check if interrupt is generated from dio channels */
...@@ -1678,7 +1678,7 @@ static int s626_ai_cmd(comedi_device *dev, comedi_subdevice *s) ...@@ -1678,7 +1678,7 @@ static int s626_ai_cmd(comedi_device *dev, comedi_subdevice *s)
uint8_t ppl[16]; uint8_t ppl[16];
comedi_cmd *cmd = &s->async->cmd; comedi_cmd *cmd = &s->async->cmd;
enc_private *k; struct enc_private *k;
int tick; int tick;
DEBUG("s626_ai_cmd: entering command function\n"); DEBUG("s626_ai_cmd: entering command function\n");
...@@ -2187,18 +2187,18 @@ static int s626_dio_set_irq(comedi_device *dev, unsigned int chan) ...@@ -2187,18 +2187,18 @@ static int s626_dio_set_irq(comedi_device *dev, unsigned int chan)
/* set channel to capture positive edge */ /* set channel to capture positive edge */
status = DEBIread(dev, status = DEBIread(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->RDEdgSel); group)->private)->RDEdgSel);
DEBIwrite(dev, DEBIwrite(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->WREdgSel, bitmask | status); group)->private)->WREdgSel, bitmask | status);
/* enable interrupt on selected channel */ /* enable interrupt on selected channel */
status = DEBIread(dev, status = DEBIread(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->RDIntSel); group)->private)->RDIntSel);
DEBIwrite(dev, DEBIwrite(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->WRIntSel, bitmask | status); group)->private)->WRIntSel, bitmask | status);
/* enable edge capture write command */ /* enable edge capture write command */
...@@ -2206,10 +2206,10 @@ static int s626_dio_set_irq(comedi_device *dev, unsigned int chan) ...@@ -2206,10 +2206,10 @@ static int s626_dio_set_irq(comedi_device *dev, unsigned int chan)
/* enable edge capture on selected channel */ /* enable edge capture on selected channel */
status = DEBIread(dev, status = DEBIread(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->RDCapSel); group)->private)->RDCapSel);
DEBIwrite(dev, DEBIwrite(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->WRCapSel, bitmask | status); group)->private)->WRCapSel, bitmask | status);
return 0; return 0;
...@@ -2225,7 +2225,7 @@ static int s626_dio_reset_irq(comedi_device *dev, unsigned int group, ...@@ -2225,7 +2225,7 @@ static int s626_dio_reset_irq(comedi_device *dev, unsigned int group,
/* enable edge capture on selected channel */ /* enable edge capture on selected channel */
DEBIwrite(dev, DEBIwrite(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->WRCapSel, mask); group)->private)->WRCapSel, mask);
return 0; return 0;
...@@ -2241,7 +2241,7 @@ static int s626_dio_clear_irq(comedi_device *dev) ...@@ -2241,7 +2241,7 @@ static int s626_dio_clear_irq(comedi_device *dev)
for (group = 0; group < S626_DIO_BANKS; group++) { for (group = 0; group < S626_DIO_BANKS; group++) {
/* clear pending events and interrupt */ /* clear pending events and interrupt */
DEBIwrite(dev, DEBIwrite(dev,
((dio_private *) (dev->subdevices + 2 + ((struct dio_private *) (dev->subdevices + 2 +
group)->private)->WRCapSel, 0xffff); group)->private)->WRCapSel, 0xffff);
} }
...@@ -2266,7 +2266,7 @@ static int s626_enc_insn_config(comedi_device *dev, comedi_subdevice *s, ...@@ -2266,7 +2266,7 @@ static int s626_enc_insn_config(comedi_device *dev, comedi_subdevice *s,
/* uint32_t Preloadvalue; //Counter initial value */ /* uint32_t Preloadvalue; //Counter initial value */
uint16_t valueSrclatch = LATCHSRC_AB_READ; uint16_t valueSrclatch = LATCHSRC_AB_READ;
uint16_t enab = CLKENAB_ALWAYS; uint16_t enab = CLKENAB_ALWAYS;
enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)];
DEBUG("s626_enc_insn_config: encoder config\n"); DEBUG("s626_enc_insn_config: encoder config\n");
...@@ -2286,7 +2286,7 @@ static int s626_enc_insn_read(comedi_device *dev, comedi_subdevice *s, ...@@ -2286,7 +2286,7 @@ static int s626_enc_insn_read(comedi_device *dev, comedi_subdevice *s,
{ {
int n; int n;
enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)];
DEBUG("s626_enc_insn_read: encoder read channel %d \n", DEBUG("s626_enc_insn_read: encoder read channel %d \n",
CR_CHAN(insn->chanspec)); CR_CHAN(insn->chanspec));
...@@ -2303,7 +2303,7 @@ static int s626_enc_insn_write(comedi_device *dev, comedi_subdevice *s, ...@@ -2303,7 +2303,7 @@ static int s626_enc_insn_write(comedi_device *dev, comedi_subdevice *s,
comedi_insn *insn, lsampl_t *data) comedi_insn *insn, lsampl_t *data)
{ {
enc_private *k = &encpriv[CR_CHAN(insn->chanspec)]; struct enc_private *k = &encpriv[CR_CHAN(insn->chanspec)];
DEBUG("s626_enc_insn_write: encoder write channel %d \n", DEBUG("s626_enc_insn_write: encoder write channel %d \n",
CR_CHAN(insn->chanspec)); CR_CHAN(insn->chanspec));
...@@ -2322,7 +2322,7 @@ static int s626_enc_insn_write(comedi_device *dev, comedi_subdevice *s, ...@@ -2322,7 +2322,7 @@ static int s626_enc_insn_write(comedi_device *dev, comedi_subdevice *s,
return 1; return 1;
} }
static void s626_timer_load(comedi_device *dev, enc_private *k, int tick) static void s626_timer_load(comedi_device *dev, struct enc_private *k, int tick)
{ {
uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */
/* index. */ /* index. */
...@@ -2768,7 +2768,7 @@ static void CloseDMAB(comedi_device *dev, DMABUF *pdma, size_t bsize) ...@@ -2768,7 +2768,7 @@ static void CloseDMAB(comedi_device *dev, DMABUF *pdma, size_t bsize)
/* Read a counter's output latch. */ /* Read a counter's output latch. */
static uint32_t ReadLatch(comedi_device *dev, enc_private *k) static uint32_t ReadLatch(comedi_device *dev, struct enc_private *k)
{ {
register uint32_t value; register uint32_t value;
/* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */ /* DEBUG FIXME DEBUG("ReadLatch: Read Latch enter\n"); */
...@@ -2787,13 +2787,13 @@ static uint32_t ReadLatch(comedi_device *dev, enc_private *k) ...@@ -2787,13 +2787,13 @@ static uint32_t ReadLatch(comedi_device *dev, enc_private *k)
/* Reset a counter's index and overflow event capture flags. */ /* Reset a counter's index and overflow event capture flags. */
static void ResetCapFlags_A(comedi_device *dev, enc_private *k) static void ResetCapFlags_A(comedi_device *dev, struct enc_private *k)
{ {
DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL),
CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A);
} }
static void ResetCapFlags_B(comedi_device *dev, enc_private *k) static void ResetCapFlags_B(comedi_device *dev, struct enc_private *k)
{ {
DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL),
CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B); CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B);
...@@ -2802,7 +2802,7 @@ static void ResetCapFlags_B(comedi_device *dev, enc_private *k) ...@@ -2802,7 +2802,7 @@ static void ResetCapFlags_B(comedi_device *dev, enc_private *k)
/* Return counter setup in a format (COUNTER_SETUP) that is consistent */ /* Return counter setup in a format (COUNTER_SETUP) that is consistent */
/* for both A and B counters. */ /* for both A and B counters. */
static uint16_t GetMode_A(comedi_device *dev, enc_private *k) static uint16_t GetMode_A(comedi_device *dev, struct enc_private *k)
{ {
register uint16_t cra; register uint16_t cra;
register uint16_t crb; register uint16_t crb;
...@@ -2840,7 +2840,7 @@ static uint16_t GetMode_A(comedi_device *dev, enc_private *k) ...@@ -2840,7 +2840,7 @@ static uint16_t GetMode_A(comedi_device *dev, enc_private *k)
return setup; return setup;
} }
static uint16_t GetMode_B(comedi_device *dev, enc_private *k) static uint16_t GetMode_B(comedi_device *dev, struct enc_private *k)
{ {
register uint16_t cra; register uint16_t cra;
register uint16_t crb; register uint16_t crb;
...@@ -2886,7 +2886,7 @@ static uint16_t GetMode_B(comedi_device *dev, enc_private *k) ...@@ -2886,7 +2886,7 @@ static uint16_t GetMode_B(comedi_device *dev, enc_private *k)
* ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc. * ClkPol, ClkEnab, IndexSrc, IndexPol, LoadSrc.
*/ */
static void SetMode_A(comedi_device *dev, enc_private *k, uint16_t Setup, static void SetMode_A(comedi_device *dev, struct enc_private *k, uint16_t Setup,
uint16_t DisableIntSrc) uint16_t DisableIntSrc)
{ {
register uint16_t cra; register uint16_t cra;
...@@ -2944,7 +2944,7 @@ static void SetMode_A(comedi_device *dev, enc_private *k, uint16_t Setup, ...@@ -2944,7 +2944,7 @@ static void SetMode_A(comedi_device *dev, enc_private *k, uint16_t Setup,
(uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), crb); (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), crb);
} }
static void SetMode_B(comedi_device *dev, enc_private *k, uint16_t Setup, static void SetMode_B(comedi_device *dev, struct enc_private *k, uint16_t Setup,
uint16_t DisableIntSrc) uint16_t DisableIntSrc)
{ {
register uint16_t cra; register uint16_t cra;
...@@ -3008,7 +3008,7 @@ static void SetMode_B(comedi_device *dev, enc_private *k, uint16_t Setup, ...@@ -3008,7 +3008,7 @@ static void SetMode_B(comedi_device *dev, enc_private *k, uint16_t Setup,
/* Return/set a counter's enable. enab: 0=always enabled, 1=enabled by index. */ /* Return/set a counter's enable. enab: 0=always enabled, 1=enabled by index. */
static void SetEnable_A(comedi_device *dev, enc_private *k, uint16_t enab) static void SetEnable_A(comedi_device *dev, struct enc_private *k, uint16_t enab)
{ {
DEBUG("SetEnable_A: SetEnable_A enter 3541\n"); DEBUG("SetEnable_A: SetEnable_A enter 3541\n");
DEBIreplace(dev, k->MyCRB, DEBIreplace(dev, k->MyCRB,
...@@ -3016,19 +3016,19 @@ static void SetEnable_A(comedi_device *dev, enc_private *k, uint16_t enab) ...@@ -3016,19 +3016,19 @@ static void SetEnable_A(comedi_device *dev, enc_private *k, uint16_t enab)
(uint16_t) (enab << CRBBIT_CLKENAB_A)); (uint16_t) (enab << CRBBIT_CLKENAB_A));
} }
static void SetEnable_B(comedi_device *dev, enc_private *k, uint16_t enab) static void SetEnable_B(comedi_device *dev, struct enc_private *k, uint16_t enab)
{ {
DEBIreplace(dev, k->MyCRB, DEBIreplace(dev, k->MyCRB,
(uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_B)), (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_B)),
(uint16_t) (enab << CRBBIT_CLKENAB_B)); (uint16_t) (enab << CRBBIT_CLKENAB_B));
} }
static uint16_t GetEnable_A(comedi_device *dev, enc_private *k) static uint16_t GetEnable_A(comedi_device *dev, struct enc_private *k)
{ {
return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_A) & 1; return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_A) & 1;
} }
static uint16_t GetEnable_B(comedi_device *dev, enc_private *k) static uint16_t GetEnable_B(comedi_device *dev, struct enc_private *k)
{ {
return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_B) & 1; return (DEBIread(dev, k->MyCRB) >> CRBBIT_CLKENAB_B) & 1;
} }
...@@ -3038,7 +3038,7 @@ static uint16_t GetEnable_B(comedi_device *dev, enc_private *k) ...@@ -3038,7 +3038,7 @@ static uint16_t GetEnable_B(comedi_device *dev, enc_private *k)
* latches B. * latches B.
*/ */
static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value) static void SetLatchSource(comedi_device *dev, struct enc_private *k, uint16_t value)
{ {
DEBUG("SetLatchSource: SetLatchSource enter 3550 \n"); DEBUG("SetLatchSource: SetLatchSource enter 3550 \n");
DEBIreplace(dev, k->MyCRB, DEBIreplace(dev, k->MyCRB,
...@@ -3049,7 +3049,7 @@ static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value) ...@@ -3049,7 +3049,7 @@ static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value)
} }
/* /*
* static uint16_t GetLatchSource(comedi_device *dev, enc_private *k ) * static uint16_t GetLatchSource(comedi_device *dev, struct enc_private *k )
* { * {
* return ( DEBIread( dev, k->MyCRB) >> CRBBIT_LATCHSRC ) & 3; * return ( DEBIread( dev, k->MyCRB) >> CRBBIT_LATCHSRC ) & 3;
* } * }
...@@ -3061,25 +3061,25 @@ static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value) ...@@ -3061,25 +3061,25 @@ static void SetLatchSource(comedi_device *dev, enc_private *k, uint16_t value)
* 2=OverflowA (B counters only), 3=disabled. * 2=OverflowA (B counters only), 3=disabled.
*/ */
static void SetLoadTrig_A(comedi_device *dev, enc_private *k, uint16_t Trig) static void SetLoadTrig_A(comedi_device *dev, struct enc_private *k, uint16_t Trig)
{ {
DEBIreplace(dev, k->MyCRA, (uint16_t) (~CRAMSK_LOADSRC_A), DEBIreplace(dev, k->MyCRA, (uint16_t) (~CRAMSK_LOADSRC_A),
(uint16_t) (Trig << CRABIT_LOADSRC_A)); (uint16_t) (Trig << CRABIT_LOADSRC_A));
} }
static void SetLoadTrig_B(comedi_device *dev, enc_private *k, uint16_t Trig) static void SetLoadTrig_B(comedi_device *dev, struct enc_private *k, uint16_t Trig)
{ {
DEBIreplace(dev, k->MyCRB, DEBIreplace(dev, k->MyCRB,
(uint16_t) (~(CRBMSK_LOADSRC_B | CRBMSK_INTCTRL)), (uint16_t) (~(CRBMSK_LOADSRC_B | CRBMSK_INTCTRL)),
(uint16_t) (Trig << CRBBIT_LOADSRC_B)); (uint16_t) (Trig << CRBBIT_LOADSRC_B));
} }
static uint16_t GetLoadTrig_A(comedi_device *dev, enc_private *k) static uint16_t GetLoadTrig_A(comedi_device *dev, struct enc_private *k)
{ {
return (DEBIread(dev, k->MyCRA) >> CRABIT_LOADSRC_A) & 3; return (DEBIread(dev, k->MyCRA) >> CRABIT_LOADSRC_A) & 3;
} }
static uint16_t GetLoadTrig_B(comedi_device *dev, enc_private *k) static uint16_t GetLoadTrig_B(comedi_device *dev, struct enc_private *k)
{ {
return (DEBIread(dev, k->MyCRB) >> CRBBIT_LOADSRC_B) & 3; return (DEBIread(dev, k->MyCRB) >> CRBBIT_LOADSRC_B) & 3;
} }
...@@ -3089,7 +3089,7 @@ static uint16_t GetLoadTrig_B(comedi_device *dev, enc_private *k) ...@@ -3089,7 +3089,7 @@ static uint16_t GetLoadTrig_B(comedi_device *dev, enc_private *k)
* 2=IndexOnly, 3=IndexAndOverflow. * 2=IndexOnly, 3=IndexAndOverflow.
*/ */
static void SetIntSrc_A(comedi_device *dev, enc_private *k, static void SetIntSrc_A(comedi_device *dev, struct enc_private *k,
uint16_t IntSource) uint16_t IntSource)
{ {
/* Reset any pending counter overflow or index captures. */ /* Reset any pending counter overflow or index captures. */
...@@ -3106,7 +3106,7 @@ static void SetIntSrc_A(comedi_device *dev, enc_private *k, ...@@ -3106,7 +3106,7 @@ static void SetIntSrc_A(comedi_device *dev, enc_private *k,
MyEventBits[IntSource]; MyEventBits[IntSource];
} }
static void SetIntSrc_B(comedi_device *dev, enc_private *k, static void SetIntSrc_B(comedi_device *dev, struct enc_private *k,
uint16_t IntSource) uint16_t IntSource)
{ {
uint16_t crb; uint16_t crb;
...@@ -3129,80 +3129,80 @@ static void SetIntSrc_B(comedi_device *dev, enc_private *k, ...@@ -3129,80 +3129,80 @@ static void SetIntSrc_B(comedi_device *dev, enc_private *k,
MyEventBits[IntSource]; MyEventBits[IntSource];
} }
static uint16_t GetIntSrc_A(comedi_device *dev, enc_private *k) static uint16_t GetIntSrc_A(comedi_device *dev, struct enc_private *k)
{ {
return (DEBIread(dev, k->MyCRA) >> CRABIT_INTSRC_A) & 3; return (DEBIread(dev, k->MyCRA) >> CRABIT_INTSRC_A) & 3;
} }
static uint16_t GetIntSrc_B(comedi_device *dev, enc_private *k) static uint16_t GetIntSrc_B(comedi_device *dev, struct enc_private *k)
{ {
return (DEBIread(dev, k->MyCRB) >> CRBBIT_INTSRC_B) & 3; return (DEBIread(dev, k->MyCRB) >> CRBBIT_INTSRC_B) & 3;
} }
/* Return/set the clock multiplier. */ /* Return/set the clock multiplier. */
/* static void SetClkMult(comedi_device *dev, enc_private *k, uint16_t value ) */ /* static void SetClkMult(comedi_device *dev, struct enc_private *k, uint16_t value ) */
/* { */ /* { */
/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKMULT ) | ( value << STDBIT_CLKMULT ) ), FALSE ); */ /* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKMULT ) | ( value << STDBIT_CLKMULT ) ), FALSE ); */
/* } */ /* } */
/* static uint16_t GetClkMult(comedi_device *dev, enc_private *k ) */ /* static uint16_t GetClkMult(comedi_device *dev, struct enc_private *k ) */
/* { */ /* { */
/* return ( k->GetMode(dev, k ) >> STDBIT_CLKMULT ) & 3; */ /* return ( k->GetMode(dev, k ) >> STDBIT_CLKMULT ) & 3; */
/* } */ /* } */
/* Return/set the clock polarity. */ /* Return/set the clock polarity. */
/* static void SetClkPol( comedi_device *dev,enc_private *k, uint16_t value ) */ /* static void SetClkPol( comedi_device *dev,struct enc_private *k, uint16_t value ) */
/* { */ /* { */
/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKPOL ) | ( value << STDBIT_CLKPOL ) ), FALSE ); */ /* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKPOL ) | ( value << STDBIT_CLKPOL ) ), FALSE ); */
/* } */ /* } */
/* static uint16_t GetClkPol(comedi_device *dev, enc_private *k ) */ /* static uint16_t GetClkPol(comedi_device *dev, struct enc_private *k ) */
/* { */ /* { */
/* return ( k->GetMode(dev, k ) >> STDBIT_CLKPOL ) & 1; */ /* return ( k->GetMode(dev, k ) >> STDBIT_CLKPOL ) & 1; */
/* } */ /* } */
/* Return/set the clock source. */ /* Return/set the clock source. */
/* static void SetClkSrc( comedi_device *dev,enc_private *k, uint16_t value ) */ /* static void SetClkSrc( comedi_device *dev,struct enc_private *k, uint16_t value ) */
/* { */ /* { */
/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKSRC ) | ( value << STDBIT_CLKSRC ) ), FALSE ); */ /* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_CLKSRC ) | ( value << STDBIT_CLKSRC ) ), FALSE ); */
/* } */ /* } */
/* static uint16_t GetClkSrc( comedi_device *dev,enc_private *k ) */ /* static uint16_t GetClkSrc( comedi_device *dev,struct enc_private *k ) */
/* { */ /* { */
/* return ( k->GetMode(dev, k ) >> STDBIT_CLKSRC ) & 3; */ /* return ( k->GetMode(dev, k ) >> STDBIT_CLKSRC ) & 3; */
/* } */ /* } */
/* Return/set the index polarity. */ /* Return/set the index polarity. */
/* static void SetIndexPol(comedi_device *dev, enc_private *k, uint16_t value ) */ /* static void SetIndexPol(comedi_device *dev, struct enc_private *k, uint16_t value ) */
/* { */ /* { */
/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXPOL ) | ( (value != 0) << STDBIT_INDXPOL ) ), FALSE ); */ /* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXPOL ) | ( (value != 0) << STDBIT_INDXPOL ) ), FALSE ); */
/* } */ /* } */
/* static uint16_t GetIndexPol(comedi_device *dev, enc_private *k ) */ /* static uint16_t GetIndexPol(comedi_device *dev, struct enc_private *k ) */
/* { */ /* { */
/* return ( k->GetMode(dev, k ) >> STDBIT_INDXPOL ) & 1; */ /* return ( k->GetMode(dev, k ) >> STDBIT_INDXPOL ) & 1; */
/* } */ /* } */
/* Return/set the index source. */ /* Return/set the index source. */
/* static void SetIndexSrc(comedi_device *dev, enc_private *k, uint16_t value ) */ /* static void SetIndexSrc(comedi_device *dev, struct enc_private *k, uint16_t value ) */
/* { */ /* { */
/* DEBUG("SetIndexSrc: set index src enter 3700\n"); */ /* DEBUG("SetIndexSrc: set index src enter 3700\n"); */
/* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXSRC ) | ( (value != 0) << STDBIT_INDXSRC ) ), FALSE ); */ /* k->SetMode(dev, k, (uint16_t)( ( k->GetMode(dev, k ) & ~STDMSK_INDXSRC ) | ( (value != 0) << STDBIT_INDXSRC ) ), FALSE ); */
/* } */ /* } */
/* static uint16_t GetIndexSrc(comedi_device *dev, enc_private *k ) */ /* static uint16_t GetIndexSrc(comedi_device *dev, struct enc_private *k ) */
/* { */ /* { */
/* return ( k->GetMode(dev, k ) >> STDBIT_INDXSRC ) & 1; */ /* return ( k->GetMode(dev, k ) >> STDBIT_INDXSRC ) & 1; */
/* } */ /* } */
/* Generate an index pulse. */ /* Generate an index pulse. */
static void PulseIndex_A(comedi_device *dev, enc_private *k) static void PulseIndex_A(comedi_device *dev, struct enc_private *k)
{ {
register uint16_t cra; register uint16_t cra;
...@@ -3214,7 +3214,7 @@ static void PulseIndex_A(comedi_device *dev, enc_private *k) ...@@ -3214,7 +3214,7 @@ static void PulseIndex_A(comedi_device *dev, enc_private *k)
DEBIwrite(dev, k->MyCRA, cra); DEBIwrite(dev, k->MyCRA, cra);
} }
static void PulseIndex_B(comedi_device *dev, enc_private *k) static void PulseIndex_B(comedi_device *dev, struct enc_private *k)
{ {
register uint16_t crb; register uint16_t crb;
...@@ -3225,7 +3225,7 @@ static void PulseIndex_B(comedi_device *dev, enc_private *k) ...@@ -3225,7 +3225,7 @@ static void PulseIndex_B(comedi_device *dev, enc_private *k)
/* Write value into counter preload register. */ /* Write value into counter preload register. */
static void Preload(comedi_device *dev, enc_private *k, uint32_t value) static void Preload(comedi_device *dev, struct enc_private *k, uint32_t value)
{ {
DEBUG("Preload: preload enter\n"); DEBUG("Preload: preload enter\n");
DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */ DEBIwrite(dev, (uint16_t) (k->MyLatchLsw), (uint16_t) value); /* Write value to preload register. */
...@@ -3237,7 +3237,7 @@ static void Preload(comedi_device *dev, enc_private *k, uint32_t value) ...@@ -3237,7 +3237,7 @@ static void Preload(comedi_device *dev, enc_private *k, uint32_t value)
static void CountersInit(comedi_device *dev) static void CountersInit(comedi_device *dev)
{ {
int chan; int chan;
enc_private *k; struct enc_private *k;
uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */ uint16_t Setup = (LOADSRC_INDX << BF_LOADSRC) | /* Preload upon */
/* index. */ /* index. */
(INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */ (INDXSRC_SOFT << BF_INDXSRC) | /* Disable hardware index. */
......
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