Author: Reed Lai
Description: PCI-1002 device driver for Linux
Keywords: driver,pci-1002,pci1002

# PCI-1002

Visitor 351 | Last updated Thursday, 20-Mar-2003 16:23:03 CST

Supported Models
PCI-1002 PCI-1202 PCI-1602 PCI-1800/1802 PCI-P16R16/P16C16/P16POR16 PCI-P8R8 PCI-TMC12

Source Code Tour for IxPCI
Device ID
Device File
ioctl Commands
Data Structures
Registers
Examples

### Device ID

PCI_1002

### Device File

/dev/ixpcin

The n is the IXPCI device number.

### ioctl Commands

IXPCI_GET_INFO
  Retrieve a device's information, and put it into the ixpci_devinfo (ixpci_devinfo_t) structure. Example: list.c.
IXPCI_READ_REG
  Read a specified register's value, and put the value into the ixpci_reg (ixpci_reg_t) structure. Example: ixpci1002/dio.c
IXPCI_WRITE_REG
  Write a given value to a specified register. Example: ixpci1002/dio.c
IXPCI_SET_SIG
  Set interrupt signaling condition. Example: pci1002/int.c
IXPCI_IOCTL_DI
  Digital input. Example: pci1002/dio2.c
IXPCI_IOCTL_DO
  Digital output. Example: pci1002/dio2.c
IXPCI_RESET
  Reset device.
  - Stop the timer0/1/2.
  - Reset the control register to 0.
    - General trigger mode.
    - No interrupt source (disable all interrupts).
  - Write 0 to DO.
  Example: ixpci1002/rst.c
IXPCI_TIME_SPAN IXPCI_BLOCK IXPCI_DELAY IXPCI_WAIT
  IXPCI_TIME_SPAN uses the 8254 counter-2 to be the machine-indepent-timer by the internal 8 MHz clock. Command will be blocked before the countering has finished. The maximum counter value is 8190 micro-seconds. IXPCI_TIME_SPAN, IXPCI_BLOCK, IXPCI_DELAY, and IXPCI_WAIT all are identical. Example: ixpci1002/time_span.c.

### Data Structures

ixpci_devinfo_t
  The data type of structure ixpci_devinfo which contains a device's id, base address, and so on. Example: list.c
ixpci_reg_t
  The data type of structure ixpci_reg which contains a register's id and value. Example: pci1002/*
ixpci_signal_t
  The data type of structure ixpio_signal that contains process id, signal id, and signaling conditions. Example: pci1002/int.c

### Registers

R=Readable W=Writable

Available registers that can be used in structure ixpci_reg for PCI-1002.

IXPCI_PICR R W
  PCI Interrupt Control Register.
IXPCI_8254C0 R W
  8254 Counter 0.
IXPCI_8254C1 R W
  8254 Counter 0.
IXPCI_8254C2 R W
  8254 Counter 2.
IXPCI_8254CR R W
  8254 Control Register.
IXPCI_AICR R W
  Analog Input Channel Control Register.
IXPCI_SR R W
  Status Register.
IXPCI_AIGR R W
  Analog Input Gain Control Register.
IXPCI_CR R W
  Control Register.
IXPCI_ADST R W
  AD Software Trigger.
IXPCI_DI R W
  Digital Input.
IXPCI_DO R W
  Digital Output.
IXPCI_AI R W
  Analog Input (A/D Data Register).

  IXPCI_AI lets you read the 12-bit A/D data register by four modes - `IXPCI_RM_RAW`, `IXPCI_RM_NORMAL`, `IXPCI_RM_TRIGGER`, and `IXPCI_RM_READY`.

  The IXPCI_RM_RAW reads the A/D data register directly and rawly, without pre-trigger and data-masking.

  The IXPCI_RM_NORMAL reads the A/D data register directly and does the A/D data masking that masks out the channel bits in the data register. Example: pci1002/ai_pacer.c

  The IXPCI_RM_TRIGGER does software trigger and then checks the AD_BUSY flag before reading the data register. The IXPCI_RM_TRIGGER also masks out the channel bits in the data register. Example: pci1002/ai_soft.c

  The IXPCI_RM_READY checks the A/D Busy flag before reading the data register. The IXPCI_RM_READY masks out the channel bits in the data register.

### Examples

list.c
  An example for ioctl command IXPCI_GET_INFO.
pci1002/ai_soft.c
  An example for analog input by software trigger.
pci1002/ai_pacer.c
  An example for analog input by pacer trigger.
ixpci1002/dio.c
  An example for digital I/O.
pci1002/int.c
  An example for signaling interrupt operation.
pci1002/rst.c
  An example for ioctl command IXPCI_RESET.
pci1002/time_span.c
  An example for ioctl command IXPCI_TIME_SPAN.