};
*/
-#define devpriv ((struct s626_private *)dev->private)
#define diopriv ((struct dio_private *)s->private)
/* COUNTER OBJECT ------------------------------------------------ */
/* critical section. */
static void DEBItransfer(struct comedi_device *dev)
{
+ struct s626_private *devpriv = dev->private;
+
/* Initiate upload of shadow RAM to DEBI control register. */
MC_ENABLE(P_MC2, MC2_UPLD_DEBI);
static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr)
{
+ struct s626_private *devpriv = dev->private;
uint16_t retval;
/* Set up DEBI control register value in shadow RAM. */
/* Write a value to a gate array register. */
static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata)
{
+ struct s626_private *devpriv = dev->private;
/* Set up DEBI control register value in shadow RAM. */
WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr);
static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask,
uint16_t wdata)
{
+ struct s626_private *devpriv = dev->private;
/* Copy target gate array register into P_DEBIAD register. */
WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr);
static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val)
{
+ struct s626_private *devpriv = dev->private;
+
/* Write I2C command to I2C Transfer Control shadow register. */
WR7146(P_I2CCTRL, val);
/* Read uint8_t from EEPROM. */
static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr)
{
+ struct s626_private *devpriv = dev->private;
uint8_t rtnval;
/* Send EEPROM target address. */
*/
static void SendDAC(struct comedi_device *dev, uint32_t val)
{
+ struct s626_private *devpriv = dev->private;
/* START THE SERIAL CLOCK RUNNING ------------- */
/* Private helper function: Write setpoint to an application DAC channel. */
static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata)
{
+ struct s626_private *devpriv = dev->private;
register uint16_t signmask;
register uint32_t WSImage;
static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan,
uint8_t DacData)
{
+ struct s626_private *devpriv = dev->private;
uint32_t chan;
/* Save the new setpoint in case the application needs to read it back later. */
static irqreturn_t s626_irq_handler(int irq, void *d)
{
struct comedi_device *dev = d;
+ struct s626_private *devpriv = dev->private;
struct comedi_subdevice *s;
struct comedi_cmd *cmd;
struct enc_private *k;
*/
static void ResetADC(struct comedi_device *dev, uint8_t *ppl)
{
+ struct s626_private *devpriv = dev->private;
register uint32_t *pRPS;
uint32_t JmpAdrs;
uint16_t i;
/* static int s626_ai_rinsn(struct comedi_device *dev,struct comedi_subdevice *s,struct comedi_insn *insn,unsigned int *data) */
/* { */
+/* struct s626_private *devpriv = dev->private; */
/* register uint8_t i; */
/* register int32_t *readaddr; */
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct s626_private *devpriv = dev->private;
uint16_t chan = CR_CHAN(insn->chanspec);
uint16_t range = CR_RANGE(insn->chanspec);
uint16_t AdcSpec = 0;
static int s626_ai_inttrig(struct comedi_device *dev,
struct comedi_subdevice *s, unsigned int trignum)
{
+ struct s626_private *devpriv = dev->private;
+
if (trignum != 0)
return -EINVAL;
/* TO COMPLETE */
static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
{
-
+ struct s626_private *devpriv = dev->private;
uint8_t ppl[16];
struct comedi_cmd *cmd = &s->async->cmd;
struct enc_private *k;
static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
{
+ struct s626_private *devpriv = dev->private;
+
/* Stop RPS program in case it is currently running. */
MC_DISABLE(P_MC1, MC1_ERPS1);
static int s626_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
-
+ struct s626_private *devpriv = dev->private;
int i;
uint16_t chan = CR_CHAN(insn->chanspec);
int16_t dacdata;
static int s626_ao_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
{
+ struct s626_private *devpriv = dev->private;
int i;
for (i = 0; i < insn->n; i++)
static void SetMode_A(struct comedi_device *dev, struct enc_private *k,
uint16_t Setup, uint16_t DisableIntSrc)
{
+ struct s626_private *devpriv = dev->private;
register uint16_t cra;
register uint16_t crb;
register uint16_t setup = Setup; /* Cache the Standard Setup. */
static void SetMode_B(struct comedi_device *dev, struct enc_private *k,
uint16_t Setup, uint16_t DisableIntSrc)
{
+ struct s626_private *devpriv = dev->private;
register uint16_t cra;
register uint16_t crb;
register uint16_t setup = Setup; /* Cache the Standard Setup. */
static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k,
uint16_t IntSource)
{
+ struct s626_private *devpriv = dev->private;
+
/* Reset any pending counter overflow or index captures. */
DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL),
CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A);
static void SetIntSrc_B(struct comedi_device *dev, struct enc_private *k,
uint16_t IntSource)
{
+ struct s626_private *devpriv = dev->private;
uint16_t crb;
/* Cache writeable CRB register image. */
static int s626_allocate_dma_buffers(struct comedi_device *dev)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+ struct s626_private *devpriv = dev->private;
void *addr;
dma_addr_t appdma;
static void s626_initialize(struct comedi_device *dev)
{
+ struct s626_private *devpriv = dev->private;
dma_addr_t pPhysBuf;
uint16_t chan;
int i;
static int s626_attach_pci(struct comedi_device *dev, struct pci_dev *pcidev)
{
+ struct s626_private *devpriv;
struct comedi_subdevice *s;
int ret;
comedi_set_hw_dev(dev, &pcidev->dev);
dev->board_name = dev->driver->driver_name;
- if (alloc_private(dev, sizeof(struct s626_private)) < 0)
- return -ENOMEM;
+ ret = alloc_private(dev, sizeof(*devpriv));
+ if (ret)
+ return ret;
+ devpriv = dev->private;
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
static void s626_detach(struct comedi_device *dev)
{
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+ struct s626_private *devpriv = dev->private;
if (devpriv) {
/* stop ai_command */