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
007public class DMAJNI extends JNIWrapper {
008  public static native int initialize();
009
010  public static native void free(int handle);
011
012  public static native void setPause(int handle, boolean pause);
013
014  public static native void setTimedTrigger(int handle, double periodSeconds);
015
016  public static native void setTimedTriggerCycles(int handle, int cycles);
017
018  public static native void addEncoder(int handle, int encoderHandle);
019
020  public static native void addEncoderPeriod(int handle, int encoderHandle);
021
022  public static native void addCounter(int handle, int counterHandle);
023
024  public static native void addCounterPeriod(int handle, int counterHandle);
025
026  public static native void addDigitalSource(int handle, int digitalSourceHandle);
027
028  public static native void addDutyCycle(int handle, int dutyCycleHandle);
029
030  public static native void addAnalogInput(int handle, int analogInputHandle);
031
032  public static native void addAveragedAnalogInput(int handle, int analogInputHandle);
033
034  public static native void addAnalogAccumulator(int handle, int analogInputHandle);
035
036  public static native int setExternalTrigger(
037      int handle, int digitalSourceHandle, int analogTriggerType, boolean rising, boolean falling);
038
039  public static native void clearSensors(int handle);
040
041  public static native void clearExternalTriggers(int handle);
042
043  public static native void startDMA(int handle, int queueDepth);
044
045  public static native void stopDMA(int handle);
046
047  // 0-21 channelOffsets
048  // 22: capture size
049  // 23: triggerChannels (bitflags)
050  // 24: remaining
051  // 25: read status
052  public static native long readDMA(
053      int handle, double timeoutSeconds, int[] buffer, int[] sampleStore);
054
055  public static native DMAJNISample.BaseStore getSensorReadData(int handle);
056}