"

2013 FRC Java API

"

com.ni.rio
Class NiFpga

java.lang.Object
  extended by com.ni.rio.NiFpga
All Implemented Interfaces:
NiRioConstants

public class NiFpga
extends Object
implements NiRioConstants

The NiFpga class provides access to the FPGA on the cRIO. This is a wrapper around the accessors in NiFpga.h


Field Summary
 
Fields inherited from interface com.ni.rio.NiRioConstants
kRioAddressSpace, kRioAddressSpaceFpga, kRioAddressSpaceMite, kRioBusInterfaceType, kRioBusNum, kRioBusNumMask, kRioBusNumShift, kRioBusTypeMask, kRioBusTypePci, kRioBusTypeShift, kRioChassisNum, kRioClientIsBigEndian, kRioCurrentVersion, kRioDefaultTimeout, kRioDeviceAccessAllow, kRioDeviceAccessDeny, kRioDeviceBB, kRioDeviceCRio, kRioDeviceDaq, kRioDeviceFW, kRioDeviceIMAQ, kRioDeviceMgr, kRioDeviceNum, kRioDevicePxi, kRioDeviceSync, kRIODevUserDataKey, kRioDustMite, kRioDustMiteNT, kRioDynamicRpcServerPort, kRioEventFirstEvent, kRioEventInvalidEvent, kRioEventMaxNumberOfEvents, kRioEventPCIInterrupt, kRioEventRemoval, kRioFpgaControlOffset, kRioFpgaInterruptControlOffset, kRioFpgaInterruptEnable, kRioFpgaResetOffset, kRioFpgaResetWidthInBits, kRioFuncNum, kRioFunctionNumMask, kRioFunctionNumShift, kRioHasDeviceAccess, kRioHostAlias, kRioHostAliases, kRioHostCurrentVersion, kRioHostDeviceAccess, kRioHostDeviceDiscoveryTimeout, kRioHostHasDeviceAccess, kRioHostOldestCompatibleVersion, kRioHostRecentDevices, kRioHostRpcServerPort, kRioHostRpcSessionTimeout, kRioHostRpcTimeout, kRioInitialized, kRioInterfaceNum, kRioInvalid, kRioInvalidHandle, kRioIoAttributeAccessByteWidthMask, kRioIoAttributeDustMiteNtFlashBitstream, kRioIoAttributeFpgaIncrement, kRioIrqNodeReserve, kRioIsItOkToDownload, kRioLocalFifoDefaultDepth, kRioLocalFifoRatio, kRioMaxLen, kRioMemBaseBar0, kRioMemBaseBar1, kRioMemSizeBar0, kRioMemSizeBar1, kRioNumMemWindows, kRioOldestCompatibleVersion, kRioPersonalityLockTimeout, kRioProductName, kRioProductNum, kRioResetIfLastSession, kRioResourceName, kRioRestrictedAccess, kRioRsrcType, kRioSerialNum, kRioSessionState, kRioSignature, kRioSlotNum, kRioSocketNumMask, kRioSocketNumShift, kRioSSExclusive, kRioSSInvariant, kRioSSNothing, kRioSSOverride, kRioSTC2, kRioTimeoutInfinite, kRioTimeoutZero, kRioTriggerBusNum, kRioTriggerReservedLines, kRioTriggerReserveLine, kRioTriggerUnreserveLine, kRioVendorNum, kRioWhatFpgaIsDoing
 
Method Summary
static void configureFifo(int hClient, int channel, int fifoDepthInElements, NiRioStatus status)
          Specifies the depth of the host memory part of the DMA FIFO.
static void readFifoU32(int hClient, int channel, Pointer buf, int num, int timeout, IntByReference remaining, NiRioStatus status)
          Reads from a target-to-host FIFO of unsigned 32-bit integers.
static int readU32(int hClient, int offset, NiRioStatus status)
          Reads an unsigned 32-bit integer value from a given offset
static void reserveIrqContext(int hClient, IntByReference context, NiRioStatus status)
          IRQ contexts are single-threaded; only one thread can wait with a particular context at any given time.
static void startFifo(int hClient, int channel, NiRioStatus status)
          Starts a FIFO.
static void stopFifo(int hClient, int channel, NiRioStatus status)
          Stops a FIFO.
static void unreserveIrqContext(int hClient, IntByReference context, NiRioStatus status)
          Unreserves an IRQ context obtained from reserveIrqContext.
static int waitOnIrqs(int hClient, IntByReference context, int irqs, int timeout, NiRioStatus status)
          This is a blocking function that stops the calling thread until the FPGA asserts any IRQ in the irqs parameter, or until the function call times out.
static void writeU32(int hClient, int offset, int value, NiRioStatus status)
          Writes an unsigned 32-bit integer value to a given control or indicator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

configureFifo

public static void configureFifo(int hClient,
                                 int channel,
                                 int fifoDepthInElements,
                                 NiRioStatus status)
Specifies the depth of the host memory part of the DMA FIFO. This method is optional. In order to see the actual depth configured, use NiFpga_ConfigureFifo2.

Parameters:
hClient - handle to a currently open session
channel - FIFO to configure
fifoDepthInElements - requested number of elements in the host memory part of the DMA FIFO
status - result of the call

startFifo

public static void startFifo(int hClient,
                             int channel,
                             NiRioStatus status)
Starts a FIFO. This method is optional.

Parameters:
hClient - handle to a currently open session
channel - FIFO to start
status - result of the call

stopFifo

public static void stopFifo(int hClient,
                            int channel,
                            NiRioStatus status)
Stops a FIFO. This method is optional.

Parameters:
hClient - handle to a currently open session
channel - FIFO to start
status - result of the call

readFifoU32

public static void readFifoU32(int hClient,
                               int channel,
                               Pointer buf,
                               int num,
                               int timeout,
                               IntByReference remaining,
                               NiRioStatus status)
Reads from a target-to-host FIFO of unsigned 32-bit integers.

Parameters:
hClient - handle to a currently open session
channel - target-to-host FIFO from which to read
buf - outputs the data that was read
num - number of elements to read
timeout - timeout in milliseconds, or NiFpga_InfiniteTimeout
remaining - outputs the number of elements remaining in the host memory part of the DMA FIFO
status - result of the call

writeU32

public static void writeU32(int hClient,
                            int offset,
                            int value,
                            NiRioStatus status)
Writes an unsigned 32-bit integer value to a given control or indicator.

Parameters:
hClient - handle to a currently open session
offset - control or indicator to which to write
value - value to write
status - result of the call

readU32

public static int readU32(int hClient,
                          int offset,
                          NiRioStatus status)
Reads an unsigned 32-bit integer value from a given offset

Parameters:
hClient - handle to a currently open session
offset - indicator or control from which to read
status - result of the call
Returns:
outputs the value that was read

reserveIrqContext

public static void reserveIrqContext(int hClient,
                                     IntByReference context,
                                     NiRioStatus status)
IRQ contexts are single-threaded; only one thread can wait with a particular context at any given time. Clients must reserve as many contexts as the application requires. If a context is successfully reserved (the returned status is not an error), it must be unreserved later. Otherwise a memory leak will occur.

Parameters:
hClient - handle to a currently open session
context - outputs the IRQ context
NiRioStatus - result of the call

unreserveIrqContext

public static void unreserveIrqContext(int hClient,
                                       IntByReference context,
                                       NiRioStatus status)
Unreserves an IRQ context obtained from reserveIrqContext.

Parameters:
session - handle to a currently open session
context - IRQ context to unreserve

waitOnIrqs

public static int waitOnIrqs(int hClient,
                             IntByReference context,
                             int irqs,
                             int timeout,
                             NiRioStatus status)
This is a blocking function that stops the calling thread until the FPGA asserts any IRQ in the irqs parameter, or until the function call times out. Before calling this function, you must use NiFpga_ReserveIrqContext to reserve an IRQ context. No other threads can use the same context when this function is called. You can use the irqsAsserted parameter to determine which IRQs were asserted for each function call.

Parameters:
hClient - handle to a currently open session
context - IRQ context with which to wait
irqs - bitwise OR of NiFpga_Irqs
timeout - timeout in milliseconds, or NiFpga_InfiniteTimeout
irqsAsserted - if non-NULL, outputs bitwise OR of IRQs that were asserted
timedOut - if non-NULL, outputs whether the timeout expired
Returns:
bitwise OR of IRQs that were asserted

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"