001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.hal;
006
007@SuppressWarnings("AbbreviationAsWordInName")
008public class DMAJNI extends JNIWrapper {
009  public static native int initialize();
010
011  public static native void free(int handle);
012
013  public static native void setPause(int handle, boolean pause);
014
015  public static native void setTimedTrigger(int handle, double periodSeconds);
016
017  public static native void setTimedTriggerCycles(int handle, int cycles);
018
019  public static native void addEncoder(int handle, int encoderHandle);
020
021  public static native void addEncoderPeriod(int handle, int encoderHandle);
022
023  public static native void addCounter(int handle, int counterHandle);
024
025  public static native void addCounterPeriod(int handle, int counterHandle);
026
027  public static native void addDigitalSource(int handle, int digitalSourceHandle);
028
029  public static native void addDutyCycle(int handle, int dutyCycleHandle);
030
031  public static native void addAnalogInput(int handle, int analogInputHandle);
032
033  public static native void addAveragedAnalogInput(int handle, int analogInputHandle);
034
035  public static native void addAnalogAccumulator(int handle, int analogInputHandle);
036
037  public static native int setExternalTrigger(
038      int handle, int digitalSourceHandle, int analogTriggerType, boolean rising, boolean falling);
039
040  public static native void clearSensors(int handle);
041
042  public static native void clearExternalTriggers(int handle);
043
044  public static native void startDMA(int handle, int queueDepth);
045
046  public static native void stopDMA(int handle);
047
048  // 0-21 channelOffsets
049  // 22: capture size
050  // 23: triggerChannels (bitflags)
051  // 24: remaining
052  // 25: read status
053  public static native long readDMA(
054      int handle, double timeoutSeconds, int[] buffer, int[] sampleStore);
055
056  public static native DMAJNISample.BaseStore getSensorReadData(int handle);
057}