mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
[hal, wpilib] Remove DMA (#7701)
This commit is contained in:
@@ -1,418 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <wpi/jni_util.h>
|
||||
|
||||
#include "HALUtil.h"
|
||||
#include "edu_wpi_first_hal_DMAJNI.h"
|
||||
#include "hal/DMA.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace wpi::java;
|
||||
|
||||
namespace hal {
|
||||
bool GetEncoderBaseHandle(HAL_EncoderHandle handle,
|
||||
HAL_FPGAEncoderHandle* fpgaEncoderHandle,
|
||||
HAL_CounterHandle* counterHandle);
|
||||
} // namespace hal
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: initialize
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_initialize
|
||||
(JNIEnv* env, jclass)
|
||||
{
|
||||
int32_t status = 0;
|
||||
auto handle = HAL_InitializeDMA(&status);
|
||||
CheckStatusForceThrow(env, status);
|
||||
return handle;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: free
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_free
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
if (handle != HAL_kInvalidHandle) {
|
||||
HAL_FreeDMA(handle);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: setPause
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_setPause
|
||||
(JNIEnv* env, jclass, jint handle, jboolean pause)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetDMAPause(handle, pause, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: setTimedTrigger
|
||||
* Signature: (ID)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_setTimedTrigger
|
||||
(JNIEnv* env, jclass, jint handle, jdouble seconds)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetDMATimedTrigger(handle, seconds, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: setTimedTriggerCycles
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_setTimedTriggerCycles
|
||||
(JNIEnv* env, jclass, jint handle, jint cycles)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetDMATimedTriggerCycles(handle, static_cast<uint32_t>(cycles), &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addEncoder
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addEncoder
|
||||
(JNIEnv* env, jclass, jint handle, jint encoderHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMAEncoder(handle, encoderHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addEncoderPeriod
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addEncoderPeriod
|
||||
(JNIEnv* env, jclass, jint handle, jint encoderHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMAEncoderPeriod(handle, encoderHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addCounter
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addCounter
|
||||
(JNIEnv* env, jclass, jint handle, jint counterHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMACounter(handle, counterHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addCounterPeriod
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addCounterPeriod
|
||||
(JNIEnv* env, jclass, jint handle, jint counterHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMACounterPeriod(handle, counterHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addDutyCycle
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addDutyCycle
|
||||
(JNIEnv* env, jclass, jint handle, jint dutyCycleHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMADutyCycle(handle, dutyCycleHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addDigitalSource
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addDigitalSource
|
||||
(JNIEnv* env, jclass, jint handle, jint digitalSourceHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMADigitalSource(handle, digitalSourceHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addAnalogInput
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addAnalogInput
|
||||
(JNIEnv* env, jclass, jint handle, jint analogInputHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMAAnalogInput(handle, analogInputHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addAveragedAnalogInput
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addAveragedAnalogInput
|
||||
(JNIEnv* env, jclass, jint handle, jint analogInputHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMAAveragedAnalogInput(handle, analogInputHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: addAnalogAccumulator
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_addAnalogAccumulator
|
||||
(JNIEnv* env, jclass, jint handle, jint analogInputHandle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_AddDMAAnalogAccumulator(handle, analogInputHandle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: setExternalTrigger
|
||||
* Signature: (IIIZZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_setExternalTrigger
|
||||
(JNIEnv* env, jclass, jint handle, jint digitalSourceHandle,
|
||||
jint analogTriggerType, jboolean rising, jboolean falling)
|
||||
{
|
||||
int32_t status = 0;
|
||||
int32_t idx = HAL_SetDMAExternalTrigger(
|
||||
handle, digitalSourceHandle,
|
||||
static_cast<HAL_AnalogTriggerType>(analogTriggerType), rising, falling,
|
||||
&status);
|
||||
CheckStatus(env, status);
|
||||
return idx;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: clearSensors
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_clearSensors
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_ClearDMASensors(handle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: clearExternalTriggers
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_clearExternalTriggers
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_ClearDMAExternalTriggers(handle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: startDMA
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_startDMA
|
||||
(JNIEnv* env, jclass, jint handle, jint queueDepth)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_StartDMA(handle, queueDepth, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: stopDMA
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_stopDMA
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_StopDMA(handle, &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: readDMA
|
||||
* Signature: (ID[I[I)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_readDMA
|
||||
(JNIEnv* env, jclass, jint handle, jdouble timeoutSeconds, jintArray buf,
|
||||
jintArray store)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_DMASample dmaSample;
|
||||
std::memset(&dmaSample, 0, sizeof(dmaSample));
|
||||
int32_t remaining = 0;
|
||||
HAL_DMAReadStatus readStatus =
|
||||
HAL_ReadDMA(handle, &dmaSample, timeoutSeconds, &remaining, &status);
|
||||
CheckStatus(env, status);
|
||||
|
||||
static_assert(sizeof(uint32_t) == sizeof(jint), "Java ints must be 32 bits");
|
||||
|
||||
env->SetIntArrayRegion(buf, 0, dmaSample.captureSize,
|
||||
reinterpret_cast<jint*>(dmaSample.readBuffer));
|
||||
|
||||
CriticalJSpan<jint> nativeArr{env, store};
|
||||
|
||||
std::copy_n(
|
||||
dmaSample.channelOffsets,
|
||||
sizeof(dmaSample.channelOffsets) / sizeof(dmaSample.channelOffsets[0]),
|
||||
nativeArr.data());
|
||||
nativeArr[22] = static_cast<int32_t>(dmaSample.captureSize);
|
||||
nativeArr[23] = static_cast<int32_t>(dmaSample.triggerChannels);
|
||||
nativeArr[24] = remaining;
|
||||
nativeArr[25] = readStatus;
|
||||
|
||||
return dmaSample.timeStamp;
|
||||
}
|
||||
|
||||
// TODO sync these up
|
||||
enum DMAOffsetConstants {
|
||||
kEnable_AI0_Low = 0,
|
||||
kEnable_AI0_High = 1,
|
||||
kEnable_AIAveraged0_Low = 2,
|
||||
kEnable_AIAveraged0_High = 3,
|
||||
kEnable_AI1_Low = 4,
|
||||
kEnable_AI1_High = 5,
|
||||
kEnable_AIAveraged1_Low = 6,
|
||||
kEnable_AIAveraged1_High = 7,
|
||||
kEnable_Accumulator0 = 8,
|
||||
kEnable_Accumulator1 = 9,
|
||||
kEnable_DI = 10,
|
||||
kEnable_AnalogTriggers = 11,
|
||||
kEnable_Counters_Low = 12,
|
||||
kEnable_Counters_High = 13,
|
||||
kEnable_CounterTimers_Low = 14,
|
||||
kEnable_CounterTimers_High = 15,
|
||||
kEnable_Encoders_Low = 16,
|
||||
kEnable_Encoders_High = 17,
|
||||
kEnable_EncoderTimers_Low = 18,
|
||||
kEnable_EncoderTimers_High = 19,
|
||||
kEnable_DutyCycle_Low = 20,
|
||||
kEnable_DutyCycle_High = 21,
|
||||
};
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_DMAJNI
|
||||
* Method: getSensorReadData
|
||||
* Signature: (I)Ljava/lang/Object;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_edu_wpi_first_hal_DMAJNI_getSensorReadData
|
||||
(JNIEnv* env, jclass, jint handle)
|
||||
{
|
||||
HAL_Handle halHandle = static_cast<HAL_Handle>(handle);
|
||||
|
||||
// Check for encoder/counter handle
|
||||
HAL_FPGAEncoderHandle fpgaEncoderHandle = 0;
|
||||
HAL_CounterHandle counterHandle = 0;
|
||||
bool validEncoderHandle =
|
||||
hal::GetEncoderBaseHandle(halHandle, &fpgaEncoderHandle, &counterHandle);
|
||||
|
||||
if (validEncoderHandle) {
|
||||
if (counterHandle != HAL_kInvalidHandle) {
|
||||
int32_t cindex = getHandleIndex(counterHandle);
|
||||
if (cindex < 4) {
|
||||
return CreateDMABaseStore(env, kEnable_Counters_Low, cindex);
|
||||
} else {
|
||||
return CreateDMABaseStore(env, kEnable_Counters_High, cindex - 4);
|
||||
}
|
||||
} else {
|
||||
int32_t cindex = getHandleIndex(fpgaEncoderHandle);
|
||||
if (cindex < 4) {
|
||||
return CreateDMABaseStore(env, kEnable_Encoders_Low, cindex);
|
||||
} else {
|
||||
return CreateDMABaseStore(env, kEnable_Encoders_High, cindex - 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HAL_HandleEnum handleType = getHandleType(halHandle);
|
||||
int32_t index = getHandleIndex(halHandle);
|
||||
if (handleType == HAL_HandleEnum::DIO) {
|
||||
return CreateDMABaseStore(env, kEnable_DI, index);
|
||||
} else if (handleType == HAL_HandleEnum::AnalogTrigger) {
|
||||
return CreateDMABaseStore(env, kEnable_AnalogTriggers, index);
|
||||
} else if (handleType == HAL_HandleEnum::AnalogInput) {
|
||||
if (index < 4) {
|
||||
return CreateDMABaseStore(env, kEnable_AI0_Low, index);
|
||||
} else {
|
||||
return CreateDMABaseStore(env, kEnable_AI0_High, index - 4);
|
||||
}
|
||||
} else if (handleType == HAL_HandleEnum::DutyCycle) {
|
||||
if (index < 4) {
|
||||
return CreateDMABaseStore(env, kEnable_DutyCycle_Low, index);
|
||||
} else {
|
||||
return CreateDMABaseStore(env, kEnable_DutyCycle_High, index - 4);
|
||||
}
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
@@ -54,7 +54,6 @@ static JClass matchInfoDataCls;
|
||||
static JClass canDataCls;
|
||||
static JClass canStreamMessageCls;
|
||||
static JClass halValueCls;
|
||||
static JClass baseStoreCls;
|
||||
static JClass revPHVersionCls;
|
||||
static JClass canStreamOverflowExCls;
|
||||
|
||||
@@ -67,7 +66,6 @@ static const JClassInit classes[] = {
|
||||
{"edu/wpi/first/hal/CANData", &canDataCls},
|
||||
{"edu/wpi/first/hal/CANStreamMessage", &canStreamMessageCls},
|
||||
{"edu/wpi/first/hal/HALValue", &halValueCls},
|
||||
{"edu/wpi/first/hal/DMAJNISample$BaseStore", &baseStoreCls},
|
||||
{"edu/wpi/first/hal/REVPHVersion", &revPHVersionCls},
|
||||
{"edu/wpi/first/hal/can/CANStreamOverflowException",
|
||||
&canStreamOverflowExCls}};
|
||||
@@ -353,11 +351,6 @@ jobject CreateHALValue(JNIEnv* env, const HAL_Value& value) {
|
||||
halValueCls, fromNative, static_cast<jint>(value.type), value1, value2);
|
||||
}
|
||||
|
||||
jobject CreateDMABaseStore(JNIEnv* env, jint valueType, jint index) {
|
||||
static jmethodID ctor = env->GetMethodID(baseStoreCls, "<init>", "(II)V");
|
||||
return env->NewObject(baseStoreCls, ctor, valueType, index);
|
||||
}
|
||||
|
||||
jobject CreatePowerDistributionVersion(JNIEnv* env, uint32_t firmwareMajor,
|
||||
uint32_t firmwareMinor,
|
||||
uint32_t firmwareFix,
|
||||
|
||||
@@ -84,8 +84,6 @@ jbyteArray SetCANStreamObject(JNIEnv* env, jobject canStreamData,
|
||||
|
||||
jobject CreateHALValue(JNIEnv* env, const HAL_Value& value);
|
||||
|
||||
jobject CreateDMABaseStore(JNIEnv* env, jint valueType, jint index);
|
||||
|
||||
jobject CreatePowerDistributionVersion(JNIEnv* env, uint32_t firmwareMajor,
|
||||
uint32_t firmwareMinor,
|
||||
uint32_t firmwareFix,
|
||||
|
||||
@@ -1,458 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hal/AnalogTrigger.h"
|
||||
#include "hal/Types.h"
|
||||
|
||||
/**
|
||||
* @defgroup hal_dma DMA Functions
|
||||
* @ingroup hal_capi
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The DMA Read Status.
|
||||
*/
|
||||
HAL_ENUM(HAL_DMAReadStatus) {
|
||||
HAL_DMA_OK = 1,
|
||||
HAL_DMA_TIMEOUT = 2,
|
||||
HAL_DMA_ERROR = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* Buffer for containing all DMA data for a specific sample.
|
||||
*/
|
||||
struct HAL_DMASample {
|
||||
uint32_t readBuffer[74];
|
||||
int32_t channelOffsets[22];
|
||||
uint64_t timeStamp;
|
||||
uint32_t captureSize;
|
||||
uint8_t triggerChannels;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes an object for performing DMA transfers.
|
||||
*
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the created dma handle
|
||||
*/
|
||||
HAL_DMAHandle HAL_InitializeDMA(int32_t* status);
|
||||
|
||||
/**
|
||||
* Frees a DMA object.
|
||||
*
|
||||
* @param handle the dma handle
|
||||
*/
|
||||
void HAL_FreeDMA(HAL_DMAHandle handle);
|
||||
|
||||
/**
|
||||
* Pauses or unpauses a DMA transfer.
|
||||
*
|
||||
* This can only be called while DMA is running.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] pause true to pause transfers, false to resume.
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_SetDMAPause(HAL_DMAHandle handle, HAL_Bool pause, int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets DMA transfers to occur at a specific timed interval.
|
||||
*
|
||||
* This will remove any external triggers. Only timed or external is supported.
|
||||
*
|
||||
* Only 1 timed period is supported.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] periodSeconds the period to trigger in seconds
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_SetDMATimedTrigger(HAL_DMAHandle handle, double periodSeconds,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets DMA transfers to occur at a specific timed interval in FPGA cycles.
|
||||
*
|
||||
* This will remove any external triggers. Only timed or external is supported.
|
||||
*
|
||||
* Only 1 timed period is supported
|
||||
*
|
||||
* The FPGA currently runs at 40 MHz, but this can change.
|
||||
* HAL_GetSystemClockTicksPerMicrosecond can be used to get a computable value
|
||||
* for this.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] cycles the period to trigger in FPGA cycles
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_SetDMATimedTriggerCycles(HAL_DMAHandle handle, uint32_t cycles,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds position data for an encoder to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] encoderHandle the encoder to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMAEncoder(HAL_DMAHandle handle, HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds timer data for an encoder to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] encoderHandle the encoder to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMAEncoderPeriod(HAL_DMAHandle handle,
|
||||
HAL_EncoderHandle encoderHandle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds position data for an counter to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] counterHandle the counter to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMACounter(HAL_DMAHandle handle, HAL_CounterHandle counterHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds timer data for an counter to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] counterHandle the counter to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMACounterPeriod(HAL_DMAHandle handle,
|
||||
HAL_CounterHandle counterHandle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds a digital source to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] digitalSourceHandle the digital source to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMADigitalSource(HAL_DMAHandle handle,
|
||||
HAL_Handle digitalSourceHandle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds an analog input to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] aInHandle the analog input to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMAAnalogInput(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds averaged data of an analog input to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] aInHandle the analog input to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMAAveragedAnalogInput(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds accumulator data of an analog input to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] aInHandle the analog input to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMAAnalogAccumulator(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Adds a duty cycle input to be collected by DMA.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] dutyCycleHandle the duty cycle input to add
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_AddDMADutyCycle(HAL_DMAHandle handle,
|
||||
HAL_DutyCycleHandle dutyCycleHandle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Sets DMA transfers to occur on an external trigger.
|
||||
*
|
||||
* This will remove any timed trigger set. Only timed or external is supported.
|
||||
*
|
||||
* Up to 8 external triggers are currently supported.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] digitalSourceHandle the digital source handle (either a
|
||||
* HAL_AnalogTriggerHandle or a
|
||||
* HAL_DigitalHandle)
|
||||
* @param[in] analogTriggerType the analog trigger type if the source is an
|
||||
* analog trigger
|
||||
* @param[in] rising true to trigger on rising edge
|
||||
* @param[in] falling true to trigger on falling edge
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the index of the trigger
|
||||
*/
|
||||
int32_t HAL_SetDMAExternalTrigger(HAL_DMAHandle handle,
|
||||
HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
HAL_Bool rising, HAL_Bool falling,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Clear all sensors from the DMA collection list.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_ClearDMASensors(HAL_DMAHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Clear all external triggers from the DMA trigger list.
|
||||
*
|
||||
* This can only be called if DMA is not started.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_ClearDMAExternalTriggers(HAL_DMAHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Starts DMA Collection.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] queueDepth the number of objects to be able to queue
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_StartDMA(HAL_DMAHandle handle, int32_t queueDepth, int32_t* status);
|
||||
|
||||
/**
|
||||
* Stops DMA Collection.
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_StopDMA(HAL_DMAHandle handle, int32_t* status);
|
||||
|
||||
/**
|
||||
* Gets the direct pointer to the DMA object.
|
||||
*
|
||||
* This is only to be used if absolute maximum performance is required. This
|
||||
* will only be valid until the handle is freed.
|
||||
*
|
||||
* @param handle the dma handle
|
||||
*/
|
||||
void* HAL_GetDMADirectPointer(HAL_DMAHandle handle);
|
||||
|
||||
/**
|
||||
* Reads a DMA sample using a direct DMA pointer.
|
||||
*
|
||||
* See HAL_ReadDMA for full documentation.
|
||||
*
|
||||
* @param[in] dmaPointer direct DMA pointer
|
||||
* @param[in] dmaSample the sample object to place data into
|
||||
* @param[in] timeoutSeconds the time to wait for data to be queued before
|
||||
* timing out
|
||||
* @param[in] remainingOut the number of samples remaining in the queue
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
enum HAL_DMAReadStatus HAL_ReadDMADirect(void* dmaPointer,
|
||||
HAL_DMASample* dmaSample,
|
||||
double timeoutSeconds,
|
||||
int32_t* remainingOut,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Reads a DMA sample from the queue.
|
||||
*
|
||||
*
|
||||
* @param[in] handle the dma handle
|
||||
* @param[in] dmaSample the sample object to place data into
|
||||
* @param[in] timeoutSeconds the time to wait for data to be queued before
|
||||
* timing out
|
||||
* @param[in] remainingOut the number of samples remaining in the queue
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return the success result of the sample read
|
||||
*/
|
||||
enum HAL_DMAReadStatus HAL_ReadDMA(HAL_DMAHandle handle,
|
||||
HAL_DMASample* dmaSample,
|
||||
double timeoutSeconds, int32_t* remainingOut,
|
||||
int32_t* status);
|
||||
|
||||
// The following are helper functions for reading data from samples
|
||||
|
||||
/**
|
||||
* Returns the timestamp of the sample.
|
||||
* This is in the same time domain as HAL_GetFPGATime().
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return timestamp in microseconds since FPGA Initialization
|
||||
*/
|
||||
uint64_t HAL_GetDMASampleTime(const HAL_DMASample* dmaSample, int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the raw distance data for an encoder from the sample.
|
||||
*
|
||||
* This can be scaled with DistancePerPulse and DecodingScaleFactor to match the
|
||||
* result of GetDistance()
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] encoderHandle the encoder handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return raw encoder ticks
|
||||
*/
|
||||
int32_t HAL_GetDMASampleEncoderRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the distance data for an counter from the sample.
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] counterHandle the counter handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return counter ticks
|
||||
*/
|
||||
int32_t HAL_GetDMASampleCounter(const HAL_DMASample* dmaSample,
|
||||
HAL_CounterHandle counterHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the raw period data for an encoder from the sample.
|
||||
*
|
||||
* This can be scaled with DistancePerPulse and DecodingScaleFactor to match the
|
||||
* result of GetRate()
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] encoderHandle the encoder handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return raw encoder period
|
||||
*/
|
||||
int32_t HAL_GetDMASampleEncoderPeriodRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the period data for an counter from the sample.
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] counterHandle the counter handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return counter period
|
||||
*/
|
||||
int32_t HAL_GetDMASampleCounterPeriod(const HAL_DMASample* dmaSample,
|
||||
HAL_CounterHandle counterHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the state of a digital source from the sample.
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] dSourceHandle the digital source handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return digital source state
|
||||
*/
|
||||
HAL_Bool HAL_GetDMASampleDigitalSource(const HAL_DMASample* dmaSample,
|
||||
HAL_Handle dSourceHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the raw analog data for an analog input from the sample.
|
||||
*
|
||||
* This can be scaled with HAL_GetAnalogValueToVolts to match GetVoltage().
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] aInHandle the analog input handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return raw analog data
|
||||
*/
|
||||
int32_t HAL_GetDMASampleAnalogInputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the raw averaged analog data for an analog input from the sample.
|
||||
*
|
||||
* This can be scaled with HAL_GetAnalogValueToVolts to match
|
||||
* GetAveragedVoltage().
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] aInHandle the analog input handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return raw averaged analog data
|
||||
*/
|
||||
int32_t HAL_GetDMASampleAveragedAnalogInputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the analog accumulator data for an analog input from the sample.
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] aInHandle the analog input handle
|
||||
* @param[in] count the accumulator count
|
||||
* @param[in] value the accumulator value
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
*/
|
||||
void HAL_GetDMASampleAnalogAccumulator(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int64_t* count, int64_t* value,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Returns the raw duty cycle input ratio data from the sample.
|
||||
*
|
||||
* Use HAL_GetDutyCycleOutputScaleFactor to scale this to a percentage.
|
||||
*
|
||||
* @param[in] dmaSample the sample to read from
|
||||
* @param[in] dutyCycleHandle the duty cycle handle
|
||||
* @param[out] status Error status variable. 0 on success.
|
||||
* @return raw duty cycle input data
|
||||
*/
|
||||
int32_t HAL_GetDMASampleDutyCycleOutputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_DutyCycleHandle dutyCycleHandle,
|
||||
int32_t* status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
/** @} */
|
||||
@@ -1,134 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "hal/DMA.h"
|
||||
|
||||
extern "C" {
|
||||
HAL_DMAHandle HAL_InitializeDMA(int32_t* status) {
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
void HAL_FreeDMA(HAL_DMAHandle handle) {}
|
||||
|
||||
void HAL_SetDMAPause(HAL_DMAHandle handle, HAL_Bool pause, int32_t* status) {}
|
||||
void HAL_SetDMATimedTrigger(HAL_DMAHandle handle, double periodSeconds,
|
||||
int32_t* status) {}
|
||||
void HAL_SetDMATimedTriggerCycles(HAL_DMAHandle handle, uint32_t cycles,
|
||||
int32_t* status) {}
|
||||
|
||||
void HAL_AddDMAEncoder(HAL_DMAHandle handle, HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status) {}
|
||||
void HAL_AddDMAEncoderPeriod(HAL_DMAHandle handle,
|
||||
HAL_EncoderHandle encoderHandle, int32_t* status) {
|
||||
}
|
||||
void HAL_AddDMACounter(HAL_DMAHandle handle, HAL_CounterHandle counterHandle,
|
||||
int32_t* status) {}
|
||||
void HAL_AddDMACounterPeriod(HAL_DMAHandle handle,
|
||||
HAL_CounterHandle counterHandle, int32_t* status) {
|
||||
}
|
||||
void HAL_AddDMADigitalSource(HAL_DMAHandle handle,
|
||||
HAL_Handle digitalSourceHandle, int32_t* status) {}
|
||||
void HAL_AddDMAAnalogInput(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle, int32_t* status) {}
|
||||
|
||||
void HAL_AddDMAAveragedAnalogInput(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {}
|
||||
|
||||
void HAL_AddDMAAnalogAccumulator(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {}
|
||||
|
||||
void HAL_AddDMADutyCycle(HAL_DMAHandle handle,
|
||||
HAL_DutyCycleHandle dutyCycleHandle, int32_t* status) {
|
||||
}
|
||||
|
||||
int32_t HAL_SetDMAExternalTrigger(HAL_DMAHandle handle,
|
||||
HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
HAL_Bool rising, HAL_Bool falling,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_ClearDMASensors(HAL_DMAHandle handle, int32_t* status) {}
|
||||
void HAL_ClearDMAExternalTriggers(HAL_DMAHandle handle, int32_t* status) {}
|
||||
|
||||
void HAL_StartDMA(HAL_DMAHandle handle, int32_t queueDepth, int32_t* status) {}
|
||||
void HAL_StopDMA(HAL_DMAHandle handle, int32_t* status) {}
|
||||
|
||||
void* HAL_GetDMADirectPointer(HAL_DMAHandle handle) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
enum HAL_DMAReadStatus HAL_ReadDMADirect(void* dmaPointer,
|
||||
HAL_DMASample* dmaSample,
|
||||
double timeoutSeconds,
|
||||
int32_t* remainingOut,
|
||||
int32_t* status) {
|
||||
return HAL_DMA_ERROR;
|
||||
}
|
||||
|
||||
enum HAL_DMAReadStatus HAL_ReadDMA(HAL_DMAHandle handle,
|
||||
HAL_DMASample* dmaSample,
|
||||
double timeoutSeconds, int32_t* remainingOut,
|
||||
int32_t* status) {
|
||||
return HAL_DMA_ERROR;
|
||||
}
|
||||
|
||||
// Sampling Code
|
||||
uint64_t HAL_GetDMASampleTime(const HAL_DMASample* dmaSample, int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleEncoderRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleCounter(const HAL_DMASample* dmaSample,
|
||||
HAL_CounterHandle counterHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleEncoderPeriodRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleCounterPeriod(const HAL_DMASample* dmaSample,
|
||||
HAL_CounterHandle counterHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
HAL_Bool HAL_GetDMASampleDigitalSource(const HAL_DMASample* dmaSample,
|
||||
HAL_Handle dSourceHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
int32_t HAL_GetDMASampleAnalogInputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleAveragedAnalogInputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_GetDMASampleAnalogAccumulator(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int64_t* count, int64_t* value,
|
||||
int32_t* status) {}
|
||||
|
||||
int32_t HAL_GetDMASampleDutyCycleOutputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_DutyCycleHandle dutyCycleHandle,
|
||||
int32_t* status) {
|
||||
return 0;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -1,230 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#include "hal/DMA.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
#include <wpi/print.h>
|
||||
|
||||
#include "PortsInternal.h"
|
||||
#include "hal/AnalogInput.h"
|
||||
#include "hal/Errors.h"
|
||||
#include "hal/HALBase.h"
|
||||
#include "hal/handles/HandlesInternal.h"
|
||||
#include "hal/handles/LimitedHandleResource.h"
|
||||
#include "hal/handles/UnlimitedHandleResource.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
static_assert(std::is_standard_layout_v<HAL_DMASample>,
|
||||
"HAL_DMASample must have standard layout");
|
||||
|
||||
namespace hal::init {
|
||||
void InitializeDMA() {}
|
||||
} // namespace hal::init
|
||||
|
||||
extern "C" {
|
||||
|
||||
HAL_DMAHandle HAL_InitializeDMA(int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
|
||||
void HAL_FreeDMA(HAL_DMAHandle handle) {}
|
||||
|
||||
void HAL_SetDMAPause(HAL_DMAHandle handle, HAL_Bool pause, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_SetDMATimedTrigger(HAL_DMAHandle handle, double seconds,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_SetDMATimedTriggerCycles(HAL_DMAHandle handle, uint32_t cycles,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMAEncoder(HAL_DMAHandle handle, HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMAEncoderPeriod(HAL_DMAHandle handle,
|
||||
HAL_EncoderHandle encoderHandle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMACounter(HAL_DMAHandle handle, HAL_CounterHandle counterHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMACounterPeriod(HAL_DMAHandle handle,
|
||||
HAL_CounterHandle counterHandle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMADigitalSource(HAL_DMAHandle handle,
|
||||
HAL_Handle digitalSourceHandle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMAAnalogInput(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMADutyCycle(HAL_DMAHandle handle,
|
||||
HAL_DutyCycleHandle dutyCycleHandle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMAAveragedAnalogInput(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_AddDMAAnalogAccumulator(HAL_DMAHandle handle,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t HAL_SetDMAExternalTrigger(HAL_DMAHandle handle,
|
||||
HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
HAL_Bool rising, HAL_Bool falling,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_ClearDMASensors(HAL_DMAHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_ClearDMAExternalTriggers(HAL_DMAHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_StartDMA(HAL_DMAHandle handle, int32_t queueDepth, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void HAL_StopDMA(HAL_DMAHandle handle, int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
void* HAL_GetDMADirectPointer(HAL_DMAHandle handle) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
enum HAL_DMAReadStatus HAL_ReadDMADirect(void* dmaPointer,
|
||||
HAL_DMASample* dmaSample,
|
||||
double timeoutSeconds,
|
||||
int32_t* remainingOut,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return HAL_DMAReadStatus::HAL_DMA_ERROR;
|
||||
}
|
||||
|
||||
enum HAL_DMAReadStatus HAL_ReadDMA(HAL_DMAHandle handle,
|
||||
HAL_DMASample* dmaSample,
|
||||
double timeoutSeconds, int32_t* remainingOut,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return HAL_DMAReadStatus::HAL_DMA_ERROR;
|
||||
}
|
||||
|
||||
uint64_t HAL_GetDMASampleTime(const HAL_DMASample* dmaSample, int32_t* status) {
|
||||
return dmaSample->timeStamp;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleEncoderRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleEncoderPeriodRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_EncoderHandle encoderHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleCounter(const HAL_DMASample* dmaSample,
|
||||
HAL_CounterHandle counterHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleCounterPeriod(const HAL_DMASample* dmaSample,
|
||||
HAL_CounterHandle counterHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetDMASampleDigitalSource(const HAL_DMASample* dmaSample,
|
||||
HAL_Handle dSourceHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return false;
|
||||
}
|
||||
int32_t HAL_GetDMASampleAnalogInputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleAveragedAnalogInputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAL_GetDMASampleAnalogAccumulator(const HAL_DMASample* dmaSample,
|
||||
HAL_AnalogInputHandle aInHandle,
|
||||
int64_t* count, int64_t* value,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t HAL_GetDMASampleDutyCycleOutputRaw(const HAL_DMASample* dmaSample,
|
||||
HAL_DutyCycleHandle dutyCycleHandle,
|
||||
int32_t* status) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
} // extern "C"
|
||||
@@ -57,7 +57,6 @@ void InitializeHAL() {
|
||||
InitializeConstants();
|
||||
InitializeCounter();
|
||||
InitializeDIO();
|
||||
InitializeDMA();
|
||||
InitializeDutyCycle();
|
||||
InitializeEncoder();
|
||||
InitializeFRCDriverStation();
|
||||
|
||||
@@ -29,7 +29,6 @@ extern void InitializeConstants();
|
||||
extern void InitializeCounter();
|
||||
extern void InitializeDigitalInternal();
|
||||
extern void InitializeDIO();
|
||||
extern void InitializeDMA();
|
||||
extern void InitializeDutyCycle();
|
||||
extern void InitializeEncoder();
|
||||
extern void InitializeFPGAEncoder();
|
||||
|
||||
Reference in New Issue
Block a user