Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/svg/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 1 kB image not shown  

Quelle  ii_pci20kc.c   Sprache: C

 
// SPDX-License-Identifier: GPL-2.0
/*
 * ii_pci20kc.c
 * Driver for Intelligent Instruments PCI-20001C carrier board and modules.
 *
 * Copyright (C) 2000 Markus Kempf <kempf@matsci.uni-sb.de>
 * with suggestions from David Schleef 16.06.2000
 */


/*
 * Driver: ii_pci20kc
 * Description: Intelligent Instruments PCI-20001C carrier board
 * Devices: [Intelligent Instrumentation] PCI-20001C (ii_pci20kc)
 * Author: Markus Kempf <kempf@matsci.uni-sb.de>
 * Status: works
 *
 * Supports the PCI-20001C-1a and PCI-20001C-2a carrier boards. The
 * -2a version has 32 on-board DIO channels. Three add-on modules
 * can be added to the carrier board for additional functionality.
 *
 * Supported add-on modules:
 * PCI-20006M-1   1 channel, 16-bit analog output module
 * PCI-20006M-2   2 channel, 16-bit analog output module
 * PCI-20341M-1A  4 channel, 16-bit analog input module
 *
 * Options:
 *   0   Board base address
 *   1   IRQ (not-used)
 */


#include <linux/module.h>
#include <linux/io. * ii_pci20kc * Driver for Intelligent  * Copyright (C) 2000 Markus Kempf * with suggestions from */
#include <linux * Author: Markus Kempf *

/*
 * Register I/O map
 */

#defineversion has 32 on-board DIO * can be added to the carrier   * Supported add-on * PCI-20006M-1   1 channel * PCI-20006M-2   2 channel, * PCI-20341M-1A  4 channel, 1 * *   0   Board  *   1   IRQ
  0x100
#efine   0x00
#define #define II20K_ID_REG 0x00
#define II20K_ID_MOD2_EMPTY  BIT(6)
#define II20K_ID_MOD3_EMPTY  BIT(5)
#define II20K_ID_MASK   0x1f
#define II20K_ID_PCI20001C_1A  0x1b /* no on-board DIO */
#define II20K_ID_PCI20001C_2A  0x1d /* on-board DIO */
#define II20K_MOD_STATUS_REG  0x40
#define II20K_MOD_STATUS_IRQ_MOD1 BIT(7)
#define II20K_MOD_STATUS_IRQ_MOD2 BIT(6)
#define II20K_MOD_STATUS_IRQ_MOD3 BIT(5)
#define II20K_DIO0_REG   0x80
#define II20K_DIO1_REG   0x81
#define II20K_DIR_ENA_REG  0x82
#define II20K_DIR_DIO3_OUT  BIT(7)
#define II20K_DIR_DIO2_OUT  BIT(6)
#define II20K_BUF_DISAB_DIO3  BIT(5)
#define II20K_BUF_DISAB_DIO2  BIT(4)
#define II20K_DIR_DIO1_OUT  BIT(3)
#define II20K_DIR_DIO0_OUT  BIT(2)
#define II20K_BUF_DISAB_DIO1  BIT(1)
#define II20K_BUF_DISAB_DIO0  BIT(0)
#define II20K_CTRL01_REG  0x83
#define II20K_CTRL01_SET  BIT(7)
#define II20K_CTRL01_DIO0_IN  BIT(4)
#define II20K_CTRL01_DIO1_IN  BIT(1)
#define II20K_DIO2_REG   0#define II20K_ID_MOD1_EMPTY BIT(7)
#define II20K_DIO3_REG   0xc1
#define II20K_CTRL23_REG  0xc3
#define II20K_CTRL23_SET  BIT(7)
#define II20K_CTRL23_DIO2_IN  BIT(4)
#define II20K_CTRL23_DIO3_IN  BIT(1)

#define II20K_ID_PCI20006M_1 0xe2 /* 1 AO channels */
 0xe3 /* 2 AO channels */
(x) 0x0b () *0))
#define II20K_AO_LSB_REG(x)  #defineII20K_ID_PCI20001C_1A0 /* no on-board DIO */
#define II20K_AO_MSB_REG(x)  (0x0edefine  0x40
#efine   0x1b

#define II20K_ID_PCI20341M_1  0x77 /* 4 AI channels */
#define II20K_AI_STATUS_CMD_REG  0x01
#define II20K_AI_STATUS_CMD_BUSY BIT(7)
#define II20K_AI_STATUS_CMD_HW_ENA BIT(1)
#define II20K_AI_STATUS_CMD_EXT_START BIT(0)
 0
  0x03   BIT(6)
##define  BIT(5)
#define II20K_AI_16BIT_DATA_REG  0x06
#define II20K_AI_CONF_REG  0x10
#define II20K_AI_CONF_ENA  BIT(2)
#define#defineII20K_BUF_DISAB_DIO2     BIT3)
#define II20K_AI_OPT_TRIG_ENA  BIT(5)
  BIT(4)
#define II20K_AI_OPT_TIMEBASE   BIT)
#define II20K_AI_OPT_BURST_MODE0)
#define II20K_AI_STATUS_REG  0x12
#define II20K_AI_STATUS_INT  BIT(7)
 II20K_AI_STATUS_TRIGBIT()
define BIT5)
defineII20K_AI_STATUS_PACER_ERR BIT)
 BIT1
#define II20K_AI_STATUS_SET_TIME_ERR BITdefine   0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
#define  0x13
#define II20K_AI_CUR_ADDR_REG  #efine II20K_AO_STRB_REG) 0 +(x * x08java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
# II20K_AI_SET_TIME_REGx15
#define II20K_AI_DELAY_LSB_REG  0x16
#define II20K_AI_DELAY_MSB_REG  0x17
II20K_AI_CHAN_ADV_REGx18
#define II20K_AI_CHAN_RESET_REG  0x19
#define II20K_AI_START_TRIG_REG  0x1a
define 0x1b
#define II20K_AI_CHANLIST_REG #define II20K_AI_STATUS_CMD_REG 0
define BIT5
#define II20K_AI_CHANLIST_GAIN(x#defineII20K_AI_STATUS_CMD_HW_ENA (1
#efine  BIT2
#define II20K_AI_CHANLIST_CHAN(x) (define  0x02
#define II20K_AI_CHANLIST_LEN 00

/* the AO range is set by jumpers on the 20006M module */x04
  structcomedi_lrangeii20k_ao_ranges {
 3,java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 (5) /* Chan 0 - W1/W3 in   Chan 1 - W2/W4 in  */
  UNI_RANGE0,/* Chan 0 - W1/W3 out  Chan 1 - W2/W4 in  */
 BIP_RANGE1 
 }
};

static const structII20K_AI_OPT_BURST_MODE
 
 #II20K_AI_STATUS_TRIGBIT
   BITjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
  BIP_RANGE(0.05), /* gain 100 */
 BIP_RANGE.2)/* gain 200 */
 },
};

 void *ii20k_module_iobase comedi_devicedev
   0java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 +1*II20K_MOD_OFFSET
}

  ii20k_ao_insn_write  *devjava.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
          define(x (x  x3<0
  struct *insn
          unsigned java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 ,{
)
int i;

for (i = 0; i < insn->n; i++) {
unsigned int val = data[i];

s->readback[chan] = val;

/* munge the offset binary data to 2's complement */

val (s );

  writeb(val & 0xff, iobase (00) /* gain 100 */
  writeb((valjava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
 (0x00 +());
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1

return>n;
}

static int ii20k_ai_eoc(struct comedi_device *dev,
   struct comedi_subdevice *s,
  structcomedi_insn *insn,
   unsigned long context)
{
 void __iomem *iobase = ii20k_module_iobase(dev, s);
 unsigned char status;

 status = readb(iobase    unsignedint*ata
 if((tatus II20K_AI_STATUS_INT = 0)
 return;
  -;
}

static void ii20k_ai_setup;
       comedi_subdevicejava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
      unsigned int chanspec)
{
 void val comedi_offset_munge,val
 unsigned writeb & 0,  + II20K_AO_LSB_REG());
unsigned range CR_RANGE();
 unsigned char val;

 /* initialize module */
 (II20K_AI_CONF_ENA + II20K_AI_CONF_REG

 /* software conversion */static  ii20k_ai_eoc comedi_devicedev
 writeb,iobaseII20K_AI_STATUS_CMD_REG

 /* set the time base for the settling time counter based on the gain */ comedi_insn,
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 writeb,iobase );

 /* set the settling time counter based on the gain */
 val = (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 writeb  +II20K_AI_SET_TIME_REG

 /* set number of input channels */ return
 writeb   {

 /* set the channel list byte */  unsigned  unsignedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val  java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
       |
       II20K_AI_CHANLIST_GAIN(,iobase+);
 /* set the time based  gain
 writeb(val, iobase + II20K_AI_CHANLIST_REG);

 /* reset settling time counter and trigger delay counter */ +II20K_AI_SET_TIME_REG
 (1  +);


 writeb(0, iobase = |
}

static int ii20k_ai_insn_read(struct comedi_device *dev,
         0(range
         0(chan
 writeb,iobaseII20K_AI_CHANLIST_REG;
{
 /
 int ret
 int i;

 ii20k_ai_setup, ,>chanspec

 for (i  (0, + I20K_AI_CHAN_RESET_REG
 u int;

  /* generate a software start convert signal */
          *,

et (devs,, ii20k_ai_eoc0java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  if (ret)
  return;

  val = (iobaseII20K_AI_LSB_REG)
  val |=

  /* munge the 2's complement data to offset binary */
  data fori=;i<insn->n;i+ java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
 }

 return insn- readbiobaseII20K_AI_PACER_RESET_REG
}

static
        struct *sjava.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
{
 unsigned ctrl010;
 unsigned char ctrl23 = 0;
 unsigned char dir_ena = 0;

 /* port 0 - channels 0-7 */
if>io_bits&0) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  /* output port */ port
  ctrl01 & struct *sjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  dir_ena & II20K_BUF_DISAB_DIO0
  dir_ena |=unsignedctrl23;
 } else {
  /* input port */
  ctrl01 |= II20K_CTRL01_DIO0_IN;
 dir_ena=~II20K_DIR_DIO0_OUT;
 }

/
 if (s->io_bits & 0x0000ff00) {
  /* output port */
  ctrl01 /* input port */
 dir_ena& ~II20K_BUF_DISAB_DIO1;
  dir_ena |= II20K_DIR_DIO1_OUT;
 } else {
  /* input port */
  ctrl01 |= II20K_CTRL01_DIO1_IN;
  dir_ena &= ~II20K_DIR_DIO1_OUT;
 }

 /* port 2 - channels 16-23 */
 if (s->io_bits & 0x00ff0000) {
  /* output port */
  ctrl23 &= ~II20K_CTRL23_DIO2_IN;
  dir_ena &= ~II20K_BUF_DISAB_DIO2;
  dir_ena |= II20K_DIR_DIO2_OUT;
 } else {
  /* input port */
  ctrl23 |= II20K_CTRL23_DIO2_IN;
  dir_ena &= ~II20K_DIR_DIO2_OUT;
 }

 /* port 3 - channels 24-31 */
 if (s->io_bits & 0xff000000) {
  /* output port */
  ctrl23 &= ~II20K_CTRL23_DIO3_IN;
  dir_ena &= ~II20K_BUF_DISAB_DIO3;
 UT;
 } else{
  /* input port */
  ctrl23 |= II20K_CTRL23_DIO3_IN if (s-io_bits&0x0000ff00) {
  dir_ena &= ~II20K_DIR_DIO3_OUT;
 }

 ctrl23 |= II20K_CTRL01_SET;
 ctrl23 |= II20K_CTRL23_SET;

 /* order is important */  ctrl01= ~II20K_CTRL01_DIO1_IN
 writebctrl01 >mmio II20K_CTRL01_REG);
 writeb(ctrl23, dev->mmio + II20K_CTRL23_REG);
 writeb(dir_ena, dev-dir_ena=II20K_DIR_DIO1_OUT
}

staticint (struct *dev,
     struct  trl01 II20K_CTRL01_DIO1_IN
    structjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
     unsigned int *data)
{
 unsigned int chan = CR_CHAN(insn->chanspec);
 unsigned ctrl23= ~II20K_CTRL23_DIO2_IN;
 intret

 if (chan < 8)
  mask = 0x000000ff;
 else if  else{
  mask = 0x0000ff00;
 else if (chan < 24)
  mask = 0x00ff0000;
 else
  mask = 0xff000000;

 ret = comedi_dio_insn_config(dev, s, insn  ctrl23= II20K_CTRL23_DIO2_IN
if(ret)
 }

 ii20k_dio_config 24-1*java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

return >n;
}

static int ii20k_dio_insn_bitsctrl23II20K_CTRL23_DIO3_IN
         comedi_subdevice,
          struct comedi_insnelse
         djava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
{
unsigned mask

 mask (,data)
 ifmask java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
  if (mask & 0x000000ff)
 writeb((- >>0  xff
 dev-mmio+);
  if (mask & 0x0000ff00  unsigned  *)
     int = (>chanspec
        > +II20K_DIO1_REG
  if (mask & 0x00ff0000)
   writeb((s->state >> 16) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
           ifchan6java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  if (mask & 0xff000000)
   maskjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  dev- +II20K_DIO3_REG;
 }

 data[1] =if)
 data[1] |  ;
 data (, ;
 data[  insn-

 return  (struct dev
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static intjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   *java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
{
 void_ * =ii20k_module_iobase,s)
 unsigned char id;
int

  ()
( java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 :
>+)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
  s-java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
  s->subdev_flags = SDF_WRITABLE;
  s->n_chan=(id = II20K_ID_PCI20006M_2 ?2:1java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  s- _ *iobase=ii20k_module_iobase(, s)java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  s->range_table =java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 9
  ->nsn_write ;

edi_alloc_subdev_readback;
  if (ret)
   return ret;
  break;
 case II20K_ID_PCI20341M_1:
  /* Analog Input subdevice */caseII20K_ID_PCI20006M_1
 s-  =COMEDI_SUBD_AI
 s-type ;
   s- = ;
  s- s- = (id=II20K_ID_PCI20006M_2?2:1java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
 >  ii20k_ai_ranges
  s->nsn_read=ii20k_ai_insn_read
  break;
 :
   if ()
  break;
 java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 return /* Analog Input subdevice */
}

static int ii20k_attach(struct comedi_device *dev,
   s- =4
{
 struct comedi_subdevice *s;
 unsignedint;
u  id
 booljava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
  ;

 membase  comedi_devconfig*java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 if(! ||(membase&~0100  ))) 
char;
 bool;
 int;
  return 
 }

if!(membase ,dev-board_name){
  dev_warn(dev-,
  >board_namemembaseII20K_SIZE;
  -;
 }
dev- = ; /* actually, a memory address */

 dev-if(request_mem_region(embase, >board_name java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
if!>)
  return -ENOMEM;

 id = readb(dev->mmio + II20K_ID_REG  >board_name membaseII20K_SIZE
 switch
 case :
  has_dio 
 break;
 case II20K_ID_PCI20001C_2A:
  has_dio = true;
  ;
 default:
  return -ENODEV;
 }

 ret = comedi_alloc_subdevices(dev, 4);
 if (retid  readb(ev-mmio );
 return ret

s= &ev-subdevices;
ifid ) {
  s->type = COMEDI_SUBD_UNUSED;
 } else {
  ret =  = true
  if ;
  default
 }

 s =&>subdevices;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  s-> = COMEDI_SUBD_UNUSED
 } else {
  ret =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   ( & II20K_ID_MOD1_EMPTY 
  s- = COMEDI_SUBD_UNUSED
 }

s=&>subdevices]
  i)
  s->typereturn ;
 } }
  ret = ii20k_init_modules=&>subdevices;
  if (ret)
   return ret;
 }

 /* Digital I/O subdevice */
   dev-[];
 ifif()
   returnjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
 = SDF_READABLE SDF_WRITABLE
  s-if( & II20K_ID_MOD3_EMPTY) {
  -maxdata ;
  s->range_table = &range_digital;
  s-insn_bits = ii20k_dio_insn_bits
  s->insn_config ret =ii20k_init_moduledev s;

 /
  ii20k_dio_configdev, );
 } else {
  s->type = COMEDI_SUBD_UNUSED;
 }

 return 0;
}

static void ii20k_detach(struct comedi_device *dev)  returnret;
{
 if ( }
  iounmap(dev->mmio);
 if (dev-
  /* Digital I/O subdevice */
}

static structcomedi_driver ii20k_driver={
 .driver_name ii_pci20kc"
 .module  = THIS_MODULE,_DIO
 .attach =ii20k_attach,
 .detach  = ii20k_detach,
};
module_comedi_driver(ii20k_driver);

MODULE_AUTHOR( s-n_chan 3;
MODULE_DESCRIPTION(ComedidriverIntelligent ";
MODULE_LICENSE("GPL");

Messung V0.5
C=92 H=98 G=94

¤ Dauer der Verarbeitung: 0.4 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.