public final class AccesDio extends Iocard
Note that values you write to the ports will read back correctly only in the bits that are set as outputs. The interrupt setup register will always read back as zero.
Not all cards in this family allow you to read an interrupt status, so this feature isn't supported. To track changes you have to save the old port values and compare them to the new ones just after the interrupt.
Some cards offer two banks of port registers. For such cards we support only the first bank.
For the PCI/PCIe/mPCIe cards we can search for the first card we find that comes from Acces I/O. For a particular card among several or for an ISA card you'll have to give the I/O base address and the assigned IRQ.
This driver includes a Linux kernel module iocardk.ko which must be loaded in order
to operate the DIO card. The script load.sh can be run at boot time to load the module
and set the permissions for the device /dev/iocard. There is also a JNI library
libIocard.so which allows you to use the card from Java.
In order to handle interrupts, you register a Java method as a callback with the JNI library. The library acknowledges each interrupt so your callback doesn't need to.
| Modifier and Type | Field and Description |
|---|---|
static int |
CONF_REG
The offset to the I/O direction configuration register.
|
static int |
INPUT_A
Indicates that the A register pins are inputs.
|
static int |
INPUT_B
Indicates that the B register pins are inputs.
|
static int |
INPUT_C_HIGH
Indicates that the high four C register pins are inputs.
|
static int |
INPUT_C_LOW
Indicates that low four C register pins are inputs.
|
static int |
INTERRUPT_A
Indicates that register A pins are to generate change-of-state interrupts.
|
static int |
INTERRUPT_B
Indicates that register B pins are to generate change-of-state interrupts.
|
static int |
INTERRUPT_C
Indicates that register C pins are to generate change-of-state interrupts.
|
static int |
ISA_N_REGS
The number of registers in the old ISA cards.
|
static int |
ISA_STATUS_AND_RESET_REG
The offset to the interrupt status (read) and reset (write) register.
|
static int |
PCI_MIN_IO_ADDR
The minimum I/O port address assigned to PCI cards by the Linux kernel.
|
static int |
PCI_N_REGS
The number of registers in the PCI/PCIe/mPCIe cards
|
static int |
PCI_VENDOR_ID
The vendor ID for PCI cards from Acces I/O.
|
static int |
PORTA_REG
The offset to the A register.
|
static int |
PORTB_REG
The offset to the B register.
|
static int |
PORTC_REG
The offset to the C register.
|
static int |
RESET_REG
The offset to the interrupt reset register.
|
static int |
SETUP_REG
The offset to the interrupt setup register.
|
OPT_CHECK, OPT_READV, OPT_WRITER| Constructor and Description |
|---|
AccesDio()
Deprecated.
|
AccesDio(int base,
int irq)
Finds and initializes a digital I/O card.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attachInt(int mask,
Object cbObj,
String cbMeth,
Object cbParm)
Register a Java callback for interrupt handling.
|
void |
detachInt()
Unregisters the current Java interrupt callback, if any, and disables all
interrupts.
|
void |
dioClrBit(int port,
int bit)
Equivalent to
dioOutBit(port, bit, 0). |
void |
dioConfig(int inputLineMask)
Specify which of the DIO card I/O lines are inputs.
|
int |
dioInp(int port)
Reads all bits from one of the data ports on the DIO card.
|
int |
dioInpBit(int port,
int bit)
Reads one of the data ports on the DIO card and returns the value of the selected bit.
|
void |
dioOut(int port,
int value)
Writes all bits to one of the data ports on the DIO card.
|
void |
dioOutBit(int port,
int bit,
int value)
Uses read-modify-write to update the value of the selected bit in a data port.
|
void |
dioSetBit(int port,
int bit)
Equivalent to
dioOutBit(port, bit, 1). |
int |
getBase()
Gets the I/O space base address of the card.
|
int |
getIrq()
Gets the IRQ line no.
|
int |
getNregs()
Gets the number of I/O space addresses assigned to the card.
|
void |
init(int base,
int irq)
Deprecated.
|
public static final int ISA_N_REGS
public static final int PCI_N_REGS
public static final int PORTA_REG
public static final int PORTB_REG
public static final int PORTC_REG
public static final int CONF_REG
public static final int SETUP_REG
public static final int RESET_REG
public static final int ISA_STATUS_AND_RESET_REG
public static final int PCI_VENDOR_ID
public static final int PCI_MIN_IO_ADDR
public static final int INPUT_A
dioConfig(int),
Constant Field Valuespublic static final int INPUT_B
dioConfig(int),
Constant Field Valuespublic static final int INPUT_C_LOW
dioConfig(int),
Constant Field Valuespublic static final int INPUT_C_HIGH
dioConfig(int),
Constant Field Valuespublic static final int INTERRUPT_A
public static final int INTERRUPT_B
public static final int INTERRUPT_C
public AccesDio(int base,
int irq)
base - The I/O base address of the card. If the value is negative
and a PCI/PCIe/mPCIe bus is present then the bus is searched for
the first card from Acces I/O.irq - The IRQ line no. assigned to the card. Ignored if
a negative base address was given.@Deprecated public AccesDio()
@Deprecated public void init(int base, int irq)
base - irq - AccesDio(int, int)public int getIrq()
public int getBase()
public int getNregs()
public void dioConfig(int inputLineMask)
inputLineMask - The inclusive OR of any combination of
INPUT_A, INPUT_B, INPUT_C_LOW or INPUT_C_HIGH.public int dioInp(int port)
port - One of PORTA_REG, PORTB_REG or PORTC_REG.AccesDioException - if the port number is invalid.public void dioOut(int port,
int value)
port - One of PORTA_REG, PORTB_REG or PORTC_REG.value - The value to be written, 0 <= value <= 255.AccesDioException - if the port number is invalid.public int dioInpBit(int port,
int bit)
port - One of PORTA_REG, PORTB_REG or PORTC_REG.bit - The bit index, 0 <= bit <= 7.(regValue >> bit) & 1AccesDioException - if the port number is invalid.public void dioOutBit(int port,
int bit,
int value)
dioInpBit(int, int) with the same port and bit numbers
will return the new bit value.port - One of PORTA_REG, PORTB_REG or PORTC_REG.bit - The bit index, 0 <= bit <= 7.value - The new bit value, 0 or 1.AccesDioException - if the port number is invalid.public void dioSetBit(int port,
int bit)
dioOutBit(port, bit, 1).port - bit - AccesDioException - if the port number is invalid.dioOutBit(int, int, int)public void dioClrBit(int port,
int bit)
dioOutBit(port, bit, 0).port - bit - AccesDioException - if the port number is invalid.dioOutBit(int, int, int)public void attachInt(int mask,
Object cbObj,
String cbMeth,
Object cbParm)
mask - Specifies which ports are to be sources of interrupts. The logical
OR of any combination of INTERRUPT_A, INTERRUPT_B or INTERRUPT_C.cbObj - The object containing the method to be called.cbMeth - The name of the method to call on cbObj when an interrupt occurs.cbParm - The argument to be given to cbObj.cbMeth()public void detachInt()
Copyright © 2018 LSST. All rights reserved.