Update headers and .sos to v15 image + most API changes

Java still does not work

Change-Id: I172ac401a07b6703909068f82b7b6cc67e6075c0
This commit is contained in:
Thomas Clark
2014-10-05 17:17:59 -04:00
parent 6089722c4f
commit 7e9f183cf9
87 changed files with 2812 additions and 2667 deletions

View File

@@ -63,8 +63,6 @@ extern "C"
void setCounterPulseLengthMode(void* counter_pointer, double threshold, int32_t *status);
int32_t getCounterSamplesToAverage(void* counter_pointer, int32_t *status);
void setCounterSamplesToAverage(void* counter_pointer, int samplesToAverage, int32_t *status);
void startCounter(void* counter_pointer, int32_t *status);
void stopCounter(void* counter_pointer, int32_t *status);
void resetCounter(void* counter_pointer, int32_t *status);
int32_t getCounter(void* counter_pointer, int32_t *status);
double getCounterPeriod(void* counter_pointer, int32_t *status);
@@ -78,8 +76,6 @@ extern "C"
uint8_t port_b_module, uint32_t port_b_pin, bool port_b_analog_trigger,
bool reverseDirection, int32_t *index, int32_t *status); // TODO: fix routing
void freeEncoder(void* encoder_pointer, int32_t *status);
void startEncoder(void* encoder_pointer, int32_t *status);
void stopEncoder(void* encoder_pointer, int32_t *status);
void resetEncoder(void* encoder_pointer, int32_t *status);
int32_t getEncoder(void* encoder_pointer, int32_t *status); // Raw value
double getEncoderPeriod(void* encoder_pointer, int32_t *status);

View File

@@ -16,10 +16,11 @@ extern "C"
void* initializeInterrupts(uint32_t interruptIndex, bool watcher, int32_t *status);
void cleanInterrupts(void* interrupt_pointer, int32_t *status);
void waitForInterrupt(void* interrupt_pointer, double timeout, int32_t *status);
uint32_t waitForInterrupt(void* interrupt_pointer, double timeout, bool ignorePrevious, int32_t *status);
void enableInterrupts(void* interrupt_pointer, int32_t *status);
void disableInterrupts(void* interrupt_pointer, int32_t *status);
double readInterruptTimestamp(void* interrupt_pointer, int32_t *status);
double readRisingTimestamp(void* interrupt_pointer, int32_t *status);
double readFallingTimestamp(void* interrupt_pointer, int32_t *status);
void requestInterrupts(void* interrupt_pointer, uint8_t routing_module, uint32_t routing_pin,
bool routing_analog_trigger, int32_t *status);
void attachInterruptHandler(void* interrupt_pointer, InterruptHandlerFunction handler,

View File

@@ -11,6 +11,7 @@
#include <stdint.h>
#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h"
#include "FRC_FPGA_ChipObject/tDMAManager.h"
#include "FRC_FPGA_ChipObject/tInterruptManager.h"
#include "FRC_FPGA_ChipObject/tSystem.h"

View File

@@ -683,14 +683,11 @@ void setCounterUpSourceEdge(void* counter_pointer, bool risingEdge, bool falling
*/
void clearCounterUpSource(void* counter_pointer, int32_t *status) {
Counter* counter = (Counter*) counter_pointer;
bool state = counter->counter->readConfig_Enable(status);
counter->counter->writeConfig_Enable(false, status);
counter->counter->writeConfig_UpFallingEdge(false, status);
counter->counter->writeConfig_UpRisingEdge(false, status);
// Index 0 of digital is always 0.
counter->counter->writeConfig_UpSource_Channel(0, status);
counter->counter->writeConfig_UpSource_AnalogTrigger(false, status);
counter->counter->writeConfig_Enable(state, status);
}
/**
@@ -738,14 +735,11 @@ void setCounterDownSourceEdge(void* counter_pointer, bool risingEdge, bool falli
*/
void clearCounterDownSource(void* counter_pointer, int32_t *status) {
Counter* counter = (Counter*) counter_pointer;
bool state = counter->counter->readConfig_Enable(status);
counter->counter->writeConfig_Enable(false, status);
counter->counter->writeConfig_DownFallingEdge(false, status);
counter->counter->writeConfig_DownRisingEdge(false, status);
// Index 0 of digital is always 0.
counter->counter->writeConfig_DownSource_Channel(0, status);
counter->counter->writeConfig_DownSource_AnalogTrigger(false, status);
counter->counter->writeConfig_Enable(state, status);
}
/**
@@ -814,25 +808,6 @@ void setCounterSamplesToAverage(void* counter_pointer, int samplesToAverage, int
counter->counter->writeTimerConfig_AverageSize(samplesToAverage, status);
}
/**
* Start the Counter counting.
* This enables the counter and it starts accumulating counts from the associated
* input channel. The counter value is not reset on starting, and still has the previous value.
*/
void startCounter(void* counter_pointer, int32_t *status) {
Counter* counter = (Counter*) counter_pointer;
counter->counter->writeConfig_Enable(1, status);
}
/**
* Stop the Counter.
* Stops the counting but doesn't effect the current value.
*/
void stopCounter(void* counter_pointer, int32_t *status) {
Counter* counter = (Counter*) counter_pointer;
counter->counter->writeConfig_Enable(0, status);
}
/**
* Reset the Counter to zero.
* Set the counter value to zero. This doesn't effect the running state of the counter, just sets
@@ -993,23 +968,6 @@ void freeEncoder(void* encoder_pointer, int32_t *status) {
delete encoder->encoder;
}
/**
* Start the Encoder.
* Starts counting pulses on the Encoder device.
*/
void startEncoder(void* encoder_pointer, int32_t *status) {
Encoder* encoder = (Encoder*) encoder_pointer;
encoder->encoder->writeConfig_Enable(1, status);
}
/**
* Stops counting pulses on the Encoder device. The value is not changed.
*/
void stopEncoder(void* encoder_pointer, int32_t *status) {
Encoder* encoder = (Encoder*) encoder_pointer;
encoder->encoder->writeConfig_Enable(0, status);
}
/**
* Reset the Encoder distance to zero.
* Resets the current count to zero on the encoder.

View File

@@ -4,7 +4,7 @@
#ifndef __FRC_FPGA_ChipObject_Aliases_h__
#define __FRC_FPGA_ChipObject_Aliases_h__
#define nInvariantFPGANamespace nFRC_C0EF_1_1_0
#define nRuntimeFPGANamespace nFRC_2012_1_6_4
#define nInvariantFPGANamespace nFRC_C0EF_1_1_0
#endif // __FRC_FPGA_ChipObject_Aliases_h__

View File

@@ -4,6 +4,6 @@
#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__
#define __RoboRIO_FRC_ChipObject_Aliases_h__
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_8
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_9
#endif // __RoboRIO_FRC_ChipObject_Aliases_h__

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_nInterfaceGlobals_h__
#define __nFRC_2015_1_0_8_nInterfaceGlobals_h__
#ifndef __nFRC_2015_1_0_9_nInterfaceGlobals_h__
#define __nFRC_2015_1_0_9_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2015_1_0_8_nInterfaceGlobals_h__
#endif // __nFRC_2015_1_0_9_nInterfaceGlobals_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_AI_h__
#define __nFRC_2015_1_0_8_AI_h__
#ifndef __nFRC_2015_1_0_9_AI_h__
#define __nFRC_2015_1_0_9_AI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tAI
@@ -140,4 +140,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_AI_h__
#endif // __nFRC_2015_1_0_9_AI_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_AO_h__
#define __nFRC_2015_1_0_8_AO_h__
#ifndef __nFRC_2015_1_0_9_AO_h__
#define __nFRC_2015_1_0_9_AO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tAO
@@ -47,4 +47,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_AO_h__
#endif // __nFRC_2015_1_0_9_AO_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Accel_h__
#define __nFRC_2015_1_0_8_Accel_h__
#ifndef __nFRC_2015_1_0_9_Accel_h__
#define __nFRC_2015_1_0_9_Accel_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tAccel
@@ -99,4 +99,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Accel_h__
#endif // __nFRC_2015_1_0_9_Accel_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Accumulator_h__
#define __nFRC_2015_1_0_8_Accumulator_h__
#ifndef __nFRC_2015_1_0_9_Accumulator_h__
#define __nFRC_2015_1_0_9_Accumulator_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tAccumulator
@@ -84,4 +84,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Accumulator_h__
#endif // __nFRC_2015_1_0_9_Accumulator_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Alarm_h__
#define __nFRC_2015_1_0_8_Alarm_h__
#ifndef __nFRC_2015_1_0_9_Alarm_h__
#define __nFRC_2015_1_0_9_Alarm_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tAlarm
@@ -54,4 +54,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Alarm_h__
#endif // __nFRC_2015_1_0_9_Alarm_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_AnalogTrigger_h__
#define __nFRC_2015_1_0_8_AnalogTrigger_h__
#ifndef __nFRC_2015_1_0_9_AnalogTrigger_h__
#define __nFRC_2015_1_0_9_AnalogTrigger_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tAnalogTrigger
@@ -126,4 +126,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_AnalogTrigger_h__
#endif // __nFRC_2015_1_0_9_AnalogTrigger_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_BIST_h__
#define __nFRC_2015_1_0_8_BIST_h__
#ifndef __nFRC_2015_1_0_9_BIST_h__
#define __nFRC_2015_1_0_9_BIST_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tBIST
@@ -87,4 +87,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_BIST_h__
#endif // __nFRC_2015_1_0_9_BIST_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Counter_h__
#define __nFRC_2015_1_0_8_Counter_h__
#ifndef __nFRC_2015_1_0_9_Counter_h__
#define __nFRC_2015_1_0_9_Counter_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tCounter
@@ -56,21 +56,21 @@ public:
unsigned IndexSource_Module : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexEdgeSensitive : 1;
unsigned UpRisingEdge : 1;
unsigned UpFallingEdge : 1;
unsigned DownRisingEdge : 1;
unsigned DownFallingEdge : 1;
unsigned Mode : 2;
unsigned PulseLengthThreshold : 6;
unsigned Enable : 1;
#else
unsigned Enable : 1;
unsigned PulseLengthThreshold : 6;
unsigned Mode : 2;
unsigned DownFallingEdge : 1;
unsigned DownRisingEdge : 1;
unsigned UpFallingEdge : 1;
unsigned UpRisingEdge : 1;
unsigned IndexEdgeSensitive : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexSource_Module : 1;
@@ -147,13 +147,13 @@ public:
virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0;
@@ -165,13 +165,13 @@ public:
virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0;
virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0;
virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0;
virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable(tRioStatusCode *status) = 0;
typedef enum
@@ -216,4 +216,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Counter_h__
#endif // __nFRC_2015_1_0_9_Counter_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_DIO_h__
#define __nFRC_2015_1_0_8_DIO_h__
#ifndef __nFRC_2015_1_0_9_DIO_h__
#define __nFRC_2015_1_0_9_DIO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tDIO
@@ -245,4 +245,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_DIO_h__
#endif // __nFRC_2015_1_0_9_DIO_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_DMA_h__
#define __nFRC_2015_1_0_8_DMA_h__
#ifndef __nFRC_2015_1_0_9_DMA_h__
#define __nFRC_2015_1_0_9_DMA_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tDMA
@@ -185,4 +185,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_DMA_h__
#endif // __nFRC_2015_1_0_9_DMA_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Encoder_h__
#define __nFRC_2015_1_0_8_Encoder_h__
#ifndef __nFRC_2015_1_0_9_Encoder_h__
#define __nFRC_2015_1_0_9_Encoder_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tEncoder
@@ -56,11 +56,11 @@ public:
unsigned IndexSource_Module : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexEdgeSensitive : 1;
unsigned Reverse : 1;
unsigned Enable : 1;
#else
unsigned Enable : 1;
unsigned Reverse : 1;
unsigned IndexEdgeSensitive : 1;
unsigned IndexActiveHigh : 1;
unsigned IndexSource_AnalogTrigger : 1;
unsigned IndexSource_Module : 1;
@@ -137,8 +137,8 @@ public:
virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0;
virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0;
virtual tConfig readConfig(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0;
virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0;
@@ -150,8 +150,8 @@ public:
virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0;
virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0;
virtual bool readConfig_Reverse(tRioStatusCode *status) = 0;
virtual bool readConfig_Enable(tRioStatusCode *status) = 0;
typedef enum
@@ -196,4 +196,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Encoder_h__
#endif // __nFRC_2015_1_0_9_Encoder_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Global_h__
#define __nFRC_2015_1_0_8_Global_h__
#ifndef __nFRC_2015_1_0_9_Global_h__
#define __nFRC_2015_1_0_9_Global_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tGlobal
@@ -101,4 +101,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Global_h__
#endif // __nFRC_2015_1_0_9_Global_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Interrupt_h__
#define __nFRC_2015_1_0_8_Interrupt_h__
#ifndef __nFRC_2015_1_0_9_Interrupt_h__
#define __nFRC_2015_1_0_9_Interrupt_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tInterrupt
@@ -54,9 +54,9 @@ public:
typedef enum
{
} tTimeStamp_IfaceConstants;
} tFallingTimeStamp_IfaceConstants;
virtual unsigned int readTimeStamp(tRioStatusCode *status) = 0;
virtual unsigned int readFallingTimeStamp(tRioStatusCode *status) = 0;
typedef enum
@@ -79,6 +79,13 @@ public:
virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0;
typedef enum
{
} tRisingTimeStamp_IfaceConstants;
virtual unsigned int readRisingTimeStamp(tRioStatusCode *status) = 0;
@@ -90,4 +97,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Interrupt_h__
#endif // __nFRC_2015_1_0_9_Interrupt_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_PWM_h__
#define __nFRC_2015_1_0_8_PWM_h__
#ifndef __nFRC_2015_1_0_9_PWM_h__
#define __nFRC_2015_1_0_9_PWM_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tPWM
@@ -117,4 +117,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_PWM_h__
#endif // __nFRC_2015_1_0_9_PWM_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Power_h__
#define __nFRC_2015_1_0_8_Power_h__
#ifndef __nFRC_2015_1_0_9_Power_h__
#define __nFRC_2015_1_0_9_Power_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tPower
@@ -214,4 +214,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Power_h__
#endif // __nFRC_2015_1_0_9_Power_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_Relay_h__
#define __nFRC_2015_1_0_8_Relay_h__
#ifndef __nFRC_2015_1_0_9_Relay_h__
#define __nFRC_2015_1_0_9_Relay_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tRelay
@@ -65,4 +65,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_Relay_h__
#endif // __nFRC_2015_1_0_9_Relay_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_SPI_h__
#define __nFRC_2015_1_0_8_SPI_h__
#ifndef __nFRC_2015_1_0_9_SPI_h__
#define __nFRC_2015_1_0_9_SPI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tSPI
@@ -65,4 +65,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_SPI_h__
#endif // __nFRC_2015_1_0_9_SPI_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_8_SysWatchdog_h__
#define __nFRC_2015_1_0_8_SysWatchdog_h__
#ifndef __nFRC_2015_1_0_9_SysWatchdog_h__
#define __nFRC_2015_1_0_9_SysWatchdog_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_8
namespace nFRC_2015_1_0_9
{
class tSysWatchdog
@@ -88,6 +88,13 @@ public:
virtual unsigned int readTimer(tRioStatusCode *status) = 0;
typedef enum
{
} tForcedKills_IfaceConstants;
virtual unsigned short readForcedKills(tRioStatusCode *status) = 0;
private:
@@ -98,4 +105,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_8_SysWatchdog_h__
#endif // __nFRC_2015_1_0_9_SysWatchdog_h__

View File

@@ -0,0 +1,17 @@
// Describes the information needed to configure a DMA channel.
// Copyright (c) National Instruments 2008. All Rights Reserved.
#include <stdint.h>
#ifndef __tDMAChannelDescriptor_h__
#define __tDMAChannelDescriptor_h__
struct tDMAChannelDescriptor
{
uint32_t channel;
uint32_t baseAddress;
uint32_t depth;
bool targetToHost;
};
#endif // __tDMAChannelDescriptor_h__

View File

@@ -1,46 +1,41 @@
// Class for handling DMA transters.
// Class for handling DMA transfers.
// Copyright (c) National Instruments 2008. All Rights Reserved.
#ifndef __tDMAManager_h__
#define __tDMAManager_h__
#include "tSystem.h"
#include <stdint.h>
namespace nFPGA
{
// TODO: Implement DMA Manager
/*
class tDMAManager : public tSystem
{
public:
tDMAManager(tNIRIO_u32 dmaChannel, tNIRIO_u32 hostBufferSize, tRioStatusCode *status);
tDMAManager(uint32_t dmaChannel, uint32_t hostBufferSize, tRioStatusCode *status);
~tDMAManager();
void start(tRioStatusCode *status);
void stop(tRioStatusCode *status);
bool isStarted() {return _started;}
void read(
tNIRIO_u32* buf,
tNIRIO_u32 num,
tNIRIO_u32 timeout,
tNIRIO_u32* read,
tNIRIO_u32* remaining,
uint32_t* buf,
size_t num,
uint32_t timeout,
size_t* remaining,
tRioStatusCode *status);
void write(
tNIRIO_u32* buf,
tNIRIO_u32 num,
tNIRIO_u32 timeout,
tNIRIO_u32* remaining,
uint32_t* buf,
size_t num,
uint32_t timeout,
size_t* remaining,
tRioStatusCode *status);
private:
bool _started;
tNIRIO_u32 _dmaChannel;
tNIRIO_u32 _hostBufferSize;
tDMAChannelDescriptor const *_dmaChannelDescriptor;
uint32_t _dmaChannel;
uint32_t _hostBufferSize;
};
*/
}
#endif // __tDMAManager_h__

View File

@@ -28,11 +28,11 @@ public:
tInterruptManager(uint32_t interruptMask, bool watcher, tRioStatusCode *status);
~tInterruptManager();
void registerHandler(tInterruptHandler handler, void *param, tRioStatusCode *status);
uint32_t watch(int32_t timeoutInMs, tRioStatusCode *status);
uint32_t watch(int32_t timeoutInMs, bool ignorePrevious, tRioStatusCode *status);
void enable(tRioStatusCode *status);
void disable(tRioStatusCode *status);
bool isEnabled(tRioStatusCode *status);
private:
public:
class tInterruptThread;
friend class tInterruptThread;
void handler();
@@ -58,4 +58,3 @@ private:
#endif // __tInterruptManager_h__

View File

@@ -20,6 +20,7 @@ public:
tSystem(tRioStatusCode *status);
~tSystem();
void getFpgaGuid(uint32_t *guid_ptr, tRioStatusCode *status);
void reset(tRioStatusCode *status);
protected:
static NiFpga_Session _DeviceHandle;

View File

@@ -18,8 +18,10 @@ public:
virtual void getHardwareFpgaSignature(uint32_t *guid_ptr, tRioStatusCode *status)=0;
virtual uint32_t getLVHandle(tRioStatusCode *status)=0;
virtual uint32_t getHandle()=0;
virtual void reset(tRioStatusCode *status)=0;
};
}
#endif // __tSystemInterface_h__

View File

@@ -13,7 +13,8 @@ void* initializeInterrupts(uint32_t interruptIndex, bool watcher, int32_t *statu
// Expects the calling leaf class to allocate an interrupt index.
anInterrupt->anInterrupt = tInterrupt::create(interruptIndex, status);
anInterrupt->anInterrupt->writeConfig_WaitForAck(false, status);
anInterrupt->manager = new tInterruptManager(1 << interruptIndex, watcher, status);
anInterrupt->manager = new tInterruptManager(
(1 << interruptIndex) | (1 << (interruptIndex + 8)), watcher, status);
return anInterrupt;
}
@@ -29,16 +30,29 @@ void cleanInterrupts(void* interrupt_pointer, int32_t *status)
/**
* In synchronous mode, wait for the defined interrupt to occur.
* @param timeout Timeout in seconds
* @param ignorePrevious If true, ignore interrupts that happened before
* waitForInterrupt was called.
* @return The mask of interrupts that fired.
*/
void waitForInterrupt(void* interrupt_pointer, double timeout, int32_t *status)
uint32_t waitForInterrupt(void* interrupt_pointer, double timeout, bool ignorePrevious, int32_t *status)
{
uint32_t result;
Interrupt* anInterrupt = (Interrupt*)interrupt_pointer;
anInterrupt->manager->watch((int32_t)(timeout * 1e3), status);
result = anInterrupt->manager->watch((int32_t)(timeout * 1e3), ignorePrevious, status);
// Don't report a timeout as an error - the return code is enough to tell
// that a timeout happened.
if(*status == -NiFpga_Status_IrqTimeout) {
*status = NiFpga_Status_Success;
}
return result;
}
/**
* Enable interrupts to occur on this input.
* oInterrupts are disabled when the RequestInterrupt call is made. This gives time to do the
* Interrupts are disabled when the RequestInterrupt call is made. This gives time to do the
* setup of the other options before starting to field interrupts.
*/
void enableInterrupts(void* interrupt_pointer, int32_t *status)
@@ -52,21 +66,31 @@ void enableInterrupts(void* interrupt_pointer, int32_t *status)
*/
void disableInterrupts(void* interrupt_pointer, int32_t *status)
{
Interrupt* anInterrupt = (Interrupt*)interrupt_pointer;
anInterrupt->manager->disable(status);
}
/**
* Return the timestamp for the interrupt that occurred most recently.
* Return the timestamp for the rising interrupt that occurred most recently.
* This is in the same time domain as GetClock().
* @return Timestamp in seconds since boot.
*/
double readInterruptTimestamp(void* interrupt_pointer, int32_t *status)
double readRisingTimestamp(void* interrupt_pointer, int32_t *status)
{
Interrupt* anInterrupt = (Interrupt*)interrupt_pointer;
uint32_t timestamp = anInterrupt->anInterrupt->readTimeStamp(status);
uint32_t timestamp = anInterrupt->anInterrupt->readRisingTimeStamp(status);
return timestamp * 1e-6;
}
/**
* Return the timestamp for the falling interrupt that occurred most recently.
* This is in the same time domain as GetClock().
* @return Timestamp in seconds since boot.
*/
double readFallingTimestamp(void* interrupt_pointer, int32_t *status)
{
Interrupt* anInterrupt = (Interrupt*)interrupt_pointer;
uint32_t timestamp = anInterrupt->anInterrupt->readFallingTimeStamp(status);
return timestamp * 1e-6;
}

View File

@@ -32,6 +32,8 @@
#endif
#endif
#define ERR_FRCSystem_NetCommNotResponding -44049
enum AllianceStationID_t {
kAllianceStationID_red1,
kAllianceStationID_red2,
@@ -68,7 +70,7 @@ struct JoystickAxes_t {
struct JoystickPOV_t {
uint16_t count;
uint16_t povs[1];
int16_t povs[1];
};
#ifdef __cplusplus
@@ -81,9 +83,6 @@ extern "C" {
int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength,
const char *userDataLow, int userDataLowLength, int wait_ms);
int EXPORT_FUNC setStatusDataFloatAsInt(int battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength,
const char *userDataLow, int userDataLowLength, int wait_ms);
int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
#ifdef SIMULATION
@@ -101,9 +100,13 @@ extern "C" {
int EXPORT_FUNC FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord);
int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(enum AllianceStationID_t *allianceStation);
int EXPORT_FUNC FRC_NetworkCommunication_getMatchTime(float *matchTime);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, struct JoystickAxes_t *axes, uint8_t maxAxes);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, uint32_t *buttons, uint8_t *count);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, struct JoystickPOV_t *povs, uint8_t maxPOVs);
int EXPORT_FUNC FRC_NetworkCommunication_setJoystickOutputs(uint8_t joystickNum, uint32_t hidOutputs, uint16_t leftRumble, uint16_t rightRumble);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickDesc(uint8_t joystickNum, uint8_t *isXBox, uint8_t *type, char *name,
uint8_t *axisCount, uint8_t *axisTypes, uint8_t *buttonCount, uint8_t *povCount);
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);

BIN
ni-libraries/libFRC_NetworkCommunication.so.1.5.0 Normal file → Executable file

Binary file not shown.

BIN
ni-libraries/libFRC_NetworkCommunicationLV.so.1.5.0 Normal file → Executable file

Binary file not shown.

View File

@@ -1,2 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libNiFpga.so.13 )
GROUP ( libNiFpga.so.14 )

Binary file not shown.

View File

@@ -1,2 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libfrccansae.so.1 )
GROUP ( libNiFpga.so.14.0 )

View File

@@ -1,2 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_emb.so.6 )
GROUP ( libNiFpga.so.14.0.0 )

BIN
ni-libraries/libNiFpga.so.14.0.0 Executable file

Binary file not shown.

View File

@@ -1,2 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libNiFpgaLv.so.13 )
GROUP ( libNiFpgaLv.so.14 )

Binary file not shown.

View File

@@ -1,2 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libni_rtlog.so.2 )
GROUP ( libNiFpgaLv.so.14.0 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libNiFpgaLv.so.14.0.0 )

Binary file not shown.

View File

@@ -1,2 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libNiRioSrv.so.13 )
GROUP ( libNiRioSrv.so.14 )

Binary file not shown.

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libNiRioSrv.so.14.0 )

View File

@@ -0,0 +1,2 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libNiRioSrv.so.14.0.0 )

Binary file not shown.

BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so.1.2.0 Normal file → Executable file

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libfrccansae.so.1.0.0 )

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
ni-libraries/libi2c.so.1.0.0 Normal file → Executable file
View File

Binary file not shown.

Binary file not shown.

View File

@@ -1,2 +0,0 @@
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( libnirio_emb_can.so.14 )

Binary file not shown.

Binary file not shown.

Binary file not shown.

0
ni-libraries/libspi.so.1.0.0 Normal file → Executable file
View File

Binary file not shown.

View File

@@ -12,15 +12,23 @@
class InterruptableSensorBase : public SensorBase
{
public:
enum WaitResult {
kTimeout = 0x0,
kRisingEdge = 0x1,
kFallingEdge = 0x100,
kBoth = 0x101,
};
InterruptableSensorBase();
virtual ~InterruptableSensorBase();
virtual void RequestInterrupts(InterruptHandlerFunction handler, void *param) = 0; ///< Asynchronus handler version.
virtual void RequestInterrupts() = 0; ///< Synchronus Wait version.
virtual void CancelInterrupts(); ///< Free up the underlying chipobject functions.
virtual void WaitForInterrupt(float timeout); ///< Synchronus version.
virtual WaitResult WaitForInterrupt(float timeout, bool ignorePrevious = true); ///< Synchronus version.
virtual void EnableInterrupts(); ///< Enable interrupts - after finishing setup.
virtual void DisableInterrupts(); ///< Disable, but don't deallocate.
virtual double ReadInterruptTimestamp();///< Return the timestamp for the interrupt that occurred.
virtual double ReadRisingTimestamp();///< Return the timestamp for the rising interrupt that occurred.
virtual double ReadFallingTimestamp();///< Return the timestamp for the falling interrupt that occurred.
protected:
void* m_interrupt;
uint32_t m_interruptIndex;

View File

@@ -32,6 +32,8 @@
#endif
#endif
#define ERR_FRCSystem_NetCommNotResponding -44049
enum AllianceStationID_t {
kAllianceStationID_red1,
kAllianceStationID_red2,
@@ -68,7 +70,7 @@ struct JoystickAxes_t {
struct JoystickPOV_t {
uint16_t count;
uint16_t povs[1];
int16_t povs[1];
};
#ifdef __cplusplus
@@ -81,9 +83,6 @@ extern "C" {
int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength,
const char *userDataLow, int userDataLowLength, int wait_ms);
int EXPORT_FUNC setStatusDataFloatAsInt(int battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength,
const char *userDataLow, int userDataLowLength, int wait_ms);
int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
#ifdef SIMULATION
@@ -101,9 +100,13 @@ extern "C" {
int EXPORT_FUNC FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord);
int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(enum AllianceStationID_t *allianceStation);
int EXPORT_FUNC FRC_NetworkCommunication_getMatchTime(float *matchTime);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, struct JoystickAxes_t *axes, uint8_t maxAxes);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, uint32_t *buttons, uint8_t *count);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, struct JoystickPOV_t *povs, uint8_t maxPOVs);
int EXPORT_FUNC FRC_NetworkCommunication_setJoystickOutputs(uint8_t joystickNum, uint32_t hidOutputs, uint16_t leftRumble, uint16_t rightRumble);
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickDesc(uint8_t joystickNum, uint8_t *isXBox, uint8_t *type, char *name,
uint8_t *axisCount, uint8_t *axisTypes, uint8_t *buttonCount, uint8_t *povCount);
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);

View File

@@ -32,11 +32,6 @@ void Counter::InitCounter(Mode mode)
m_allocatedDownSource = false;
HALReport(HALUsageReporting::kResourceType_Counter, index, mode);
if (StatusIsFatal()) return;
status = 0;
startCounter(m_counter, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
/**

View File

@@ -67,13 +67,6 @@ void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType)
HALReport(HALUsageReporting::kResourceType_Encoder, index, encodingType);
LiveWindow::GetInstance()->AddSensor("Encoder", m_aSource->GetChannelForRouting(), this);
if (StatusIsFatal()) return;
if (!m_counter) {
int32_t status = 0;
startEncoder(m_encoder, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
}
}
/**

View File

@@ -46,13 +46,20 @@ void InterruptableSensorBase::CancelInterrupts()
/**
* In synchronous mode, wait for the defined interrupt to occur.
* @param timeout Timeout in seconds
* @param ignorePrevious If true, ignore interrupts that happened before
* WaitForInterrupt was called.
* @return What interrupts fired
*/
void InterruptableSensorBase::WaitForInterrupt(float timeout)
InterruptableSensorBase::WaitResult InterruptableSensorBase::WaitForInterrupt(float timeout, bool ignorePrevious)
{
wpi_assert(m_interrupt != NULL);
int32_t status = 0;
waitForInterrupt(m_interrupt, timeout, &status);
uint32_t result;
result = waitForInterrupt(m_interrupt, timeout, ignorePrevious, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
return static_cast<WaitResult>(result);
}
/**
@@ -80,15 +87,33 @@ void InterruptableSensorBase::DisableInterrupts()
}
/**
* Return the timestamp for the interrupt that occurred most recently.
* Return the timestamp for the rising interrupt that occurred most recently.
* This is in the same time domain as GetClock().
* The rising-edge interrupt should be enabled with
* {@link #DigitalInput.SetUpSourceEdge}
* @return Timestamp in seconds since boot.
*/
double InterruptableSensorBase::ReadInterruptTimestamp()
double InterruptableSensorBase::ReadRisingTimestamp()
{
wpi_assert(m_interrupt != NULL);
int32_t status = 0;
double timestamp = readInterruptTimestamp(m_interrupt, &status);
double timestamp = readRisingTimestamp(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
return timestamp;
}
/**
* Return the timestamp for the falling interrupt that occurred most recently.
* This is in the same time domain as GetClock().
* The falling-edge interrupt should be enabled with
* {@link #DigitalInput.SetUpSourceEdge}
* @return Timestamp in seconds since boot.
*/
double InterruptableSensorBase::ReadFallingTimestamp()
{
wpi_assert(m_interrupt != NULL);
int32_t status = 0;
double timestamp = readFallingTimestamp(m_interrupt, &status);
wpi_setErrorWithContext(status, getHALErrorMessage(status));
return timestamp;
}

View File

@@ -88,11 +88,6 @@ public class Counter extends SensorBase implements CounterBase,
UsageReporting.report(tResourceType.kResourceType_Counter, m_index,
mode.value);
status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
CounterJNI.startCounter(m_counter, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
}
/**
@@ -325,7 +320,7 @@ public class Counter extends SensorBase implements CounterBase,
if(source == null){
throw new NullPointerException("The Digital Source given was null");
}
if (m_downSource != null && m_allocatedDownSource) {
m_downSource.free();
m_allocatedDownSource = false;
@@ -358,7 +353,7 @@ public class Counter extends SensorBase implements CounterBase,
if (triggerType == null){
throw new NullPointerException("Analog Trigger Type given was null");
}
setDownSource(analogTrigger.createOutput(triggerType));
m_allocatedDownSource = true;
}

View File

@@ -107,14 +107,6 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW
UsageReporting.report(tResourceType.kResourceType_Encoder,
m_index, m_encodingType.value);
LiveWindow.addSensor("Encoder", m_aSource.getChannelForRouting(), this);
if (m_counter == null) {
ByteBuffer status = ByteBuffer.allocateDirect(4);
// set the byte order
status.order(ByteOrder.LITTLE_ENDIAN);
EncoderJNI.startEncoder(m_encoder, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
}
}
/**

View File

@@ -19,7 +19,7 @@ import edu.wpi.first.wpilibj.util.CheckedAllocationException;
* Base for sensors to be used with interrupts
*/
public abstract class InterruptableSensorBase extends SensorBase {
/**
/**
* This is done to store the JVM variable in the InterruptJNI
* This is done because the HAL must have access to the JVM variable
* in order to attach the newly spawned thread when an interrupt is fired.
@@ -35,12 +35,12 @@ public abstract class InterruptableSensorBase extends SensorBase {
* The interrupt resource
*/
protected ByteBuffer m_interrupt = null;
/**
* Flags if the interrupt being allocated is synchronous
*/
protected boolean m_isSynchronousInterrupt = false;
/**
* The index of the interrupt
*/
@@ -56,7 +56,7 @@ public abstract class InterruptableSensorBase extends SensorBase {
public InterruptableSensorBase() {
m_interrupt = null;
}
/**
* @return
*/
@@ -71,7 +71,7 @@ public abstract class InterruptableSensorBase extends SensorBase {
* @return
*/
abstract byte getModuleForRouting();
/**
* Request interrupts asynchronously on this digital input.
*
@@ -80,16 +80,16 @@ public abstract class InterruptableSensorBase extends SensorBase {
* {@link InterruptHandlerFunction#interruptFired(int, Object)} that
* will be called whenever there is an interrupt on this device.
* Request interrupts in synchronus mode where the user program
* interrupt handler will be called when an interrupt occurs. The
* interrupt handler will be called when an interrupt occurs. The
* default is interrupt on rising edges only.
*/
public void requestInterrupts(InterruptHandlerFunction<?> handler) {
if(m_interrupt != null){
throw new AllocationException("The interrupt has already been allocated");
}
allocateInterrupts(false);
assert (m_interrupt != null);
ByteBuffer status = ByteBuffer.allocateDirect(4);
@@ -114,7 +114,7 @@ public abstract class InterruptableSensorBase extends SensorBase {
if(m_interrupt != null){
throw new AllocationException("The interrupt has already been allocated");
}
allocateInterrupts(true);
assert (m_interrupt != null);
@@ -132,7 +132,7 @@ public abstract class InterruptableSensorBase extends SensorBase {
/**
* Allocate the interrupt
*
*
* @param watcher true if the interrupt should be in synchronous mode where the user
* program will have to explicitly wait for the interrupt to occur.
*/
@@ -170,20 +170,33 @@ public abstract class InterruptableSensorBase extends SensorBase {
/**
* In synchronous mode, wait for the defined interrupt to occur.
*
*
* @param timeout
* Timeout in seconds
* @param ignorePrevious
* If true, ignore interrupts that happened before
* waitForInterrupt was called.
*/
public void waitForInterrupt(double timeout) {
public void waitForInterrupt(double timeout, boolean ignorePrevious) {
if (m_interrupt == null) {
throw new IllegalStateException("The interrupt is not allocated.");
}
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
InterruptJNI.waitForInterrupt(m_interrupt, (float) timeout, status.asIntBuffer());
InterruptJNI.waitForInterrupt(m_interrupt, (float) timeout, ignorePrevious, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
}
/**
* In synchronous mode, wait for the defined interrupt to occur.
*
* @param timeout
* Timeout in seconds
*/
public void waitForInterrupt(double timeout) {
waitForInterrupt(timeout, true);
}
/**
* Enable interrupts to occur on this input. Interrupts are disabled when
* the RequestInterrupt call is made. This gives time to do the setup of the
@@ -219,22 +232,41 @@ public abstract class InterruptableSensorBase extends SensorBase {
}
/**
* Return the timestamp for the interrupt that occurred most recently. This
* is in the same time domain as getClock().
*
* Return the timestamp for the rising interrupt that occurred most
* recently. This is in the same time domain as getClock().
* The rising-edge interrupt should be enabled with
* {@link #setUpSourceEdge}
* @return Timestamp in seconds since boot.
*/
public double readInterruptTimestamp() {
public double readRisingTimestamp() {
if (m_interrupt == null) {
throw new IllegalStateException("The interrupt is not allocated.");
}
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
double timestamp = InterruptJNI.readInterruptTimestamp(m_interrupt, status.asIntBuffer());
double timestamp = InterruptJNI.readRisingTimestamp(m_interrupt, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return timestamp;
}
/**
* Return the timestamp for the falling interrupt that occurred most
* recently. This is in the same time domain as getClock().
* The falling-edge interrupt should be enabled with
* {@link #setUpSourceEdge}
* @return Timestamp in seconds since boot.
*/
public double readFallingTimestamp() {
if (m_interrupt == null) {
throw new IllegalStateException("The interrupt is not allocated.");
}
ByteBuffer status = ByteBuffer.allocateDirect(4);
status.order(ByteOrder.LITTLE_ENDIAN);
double timestamp = InterruptJNI.readFallingTimestamp(m_interrupt, status.asIntBuffer());
HALUtil.checkStatus(status.asIntBuffer());
return timestamp;
}
/**
* Set which edge to trigger interrupts on
*

View File

@@ -19,8 +19,6 @@ public class CounterJNI extends JNIWrapper {
public static native void setCounterPulseLengthMode(ByteBuffer counter_pointer, double threshold, IntBuffer status);
public static native int getCounterSamplesToAverage(ByteBuffer counter_pointer, IntBuffer status);
public static native void setCounterSamplesToAverage(ByteBuffer counter_pointer, int samplesToAverage, IntBuffer status);
public static native void startCounter(ByteBuffer counter_pointer, IntBuffer status);
public static native void stopCounter(ByteBuffer counter_pointer, IntBuffer status);
public static native void resetCounter(ByteBuffer counter_pointer, IntBuffer status);
public static native int getCounter(ByteBuffer counter_pointer, IntBuffer status);
public static native double getCounterPeriod(ByteBuffer counter_pointer, IntBuffer status);

View File

@@ -6,8 +6,6 @@ import java.nio.ByteBuffer;
public class EncoderJNI extends JNIWrapper {
public static native ByteBuffer initializeEncoder(byte port_a_module, int port_a_pin, byte port_a_analog_trigger, byte port_b_module, int port_b_pin, byte port_b_analog_trigger, byte reverseDirection, IntBuffer index, IntBuffer status);
public static native void freeEncoder(ByteBuffer encoder_pointer, IntBuffer status);
public static native void startEncoder(ByteBuffer encoder_pointer, IntBuffer status);
public static native void stopEncoder(ByteBuffer encoder_pointer, IntBuffer status);
public static native void resetEncoder(ByteBuffer encoder_pointer, IntBuffer status);
public static native int getEncoder(ByteBuffer encoder_pointer, IntBuffer status);
public static native double getEncoderPeriod(ByteBuffer encoder_pointer, IntBuffer status);

View File

@@ -10,10 +10,11 @@ public class InterruptJNI extends JNIWrapper {
public static native void initializeInterruptJVM(IntBuffer status);
public static native ByteBuffer initializeInterrupts(int interruptIndex, byte watcher, IntBuffer status);
public static native void cleanInterrupts(ByteBuffer interrupt_pointer, IntBuffer status);
public static native void waitForInterrupt(ByteBuffer interrupt_pointer, double timeout, IntBuffer status);
public static native int waitForInterrupt(ByteBuffer interrupt_pointer, double timeout, boolean ignorePrevious, IntBuffer status);
public static native void enableInterrupts(ByteBuffer interrupt_pointer, IntBuffer status);
public static native void disableInterrupts(ByteBuffer interrupt_pointer, IntBuffer status);
public static native double readInterruptTimestamp(ByteBuffer interrupt_pointer, IntBuffer status);
public static native double readRisingTimestamp(ByteBuffer interrupt_pointer, IntBuffer status);
public static native double readFallingTimestamp(ByteBuffer interrupt_pointer, IntBuffer status);
public static native void requestInterrupts(ByteBuffer interrupt_pointer, byte routing_module, int routing_pin, byte routing_analog_trigger, IntBuffer status);
public static native void attachInterruptHandler(ByteBuffer interrupt_pointer, InterruptJNIHandlerFunction handler, Object param, IntBuffer status);
public static native void setInterruptUpSourceEdge(ByteBuffer interrupt_pointer, byte risingEdge, byte fallingEdge, IntBuffer status);

View File

@@ -24,13 +24,13 @@ import edu.wpi.first.wpilibj.test.AbstractComsSetup;
/**
* This class should not be run as a test explicitly. Instead it should be extended by tests that use the InterruptableSensorBase
*
*
* @author jonathanleitschuh
*
*/
public abstract class AbstractInterruptTest extends AbstractComsSetup {
private InterruptableSensorBase interruptable = null;
private InterruptableSensorBase getInterruptable(){
if(interruptable == null){
interruptable = giveInterruptableSensorBase();
@@ -46,7 +46,7 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
interruptable = null;
}
}
/**
* Give the interruptible sensor base that interrupts can be attached to.
* @return
@@ -64,19 +64,19 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
* Perform whatever action is required to set the interrupt low.
*/
abstract void setInterruptLow();
private class InterruptCounter{
private final AtomicInteger count = new AtomicInteger();
void increment(){
count.addAndGet(1);
}
int getCount(){
return count.get();
}
};
private class TestInterruptHandlerFunction extends InterruptHandlerFunction<InterruptCounter>{
protected final AtomicBoolean exceptionThrown = new AtomicBoolean(false);
/** Stores the time that the interrupt fires */
@@ -85,11 +85,11 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
final AtomicBoolean interruptComplete = new AtomicBoolean(false);
protected Exception ex;
final InterruptCounter counter;
TestInterruptHandlerFunction(InterruptCounter counter){
this.counter = counter;
}
@Override
void interruptFired(int interruptAssertedMask, InterruptCounter param) {
interruptFireTime.set(Utility.getFPGATime());
@@ -104,60 +104,60 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
}
interruptComplete.set(true);
};
@Override
public InterruptCounter overridableParamater(){
return counter;
}
};
@Test(timeout = 1000)
public void testSingleInterruptsTriggering() throws Exception{
//Given
final InterruptCounter counter = new InterruptCounter();
TestInterruptHandlerFunction function = new TestInterruptHandlerFunction(counter);
//When
getInterruptable().requestInterrupts(function);
getInterruptable().enableInterrupts();
setInterruptLow();
Timer.delay(0.01);
//Note: Utility.getFPGATime() is used because double values can turn over after the robot has been running for a long time
final long interruptTriggerTime = Utility.getFPGATime();
setInterruptHigh();
//Delay until the interrupt is complete
while(!function.interruptComplete.get()){
Timer.delay(.005);
}
//Then
assertEquals("The interrupt did not fire the expected number of times", 1, counter.getCount());
//If the test within the interrupt failed
if(function.exceptionThrown.get()){
throw function.ex;
}
final long range = 10000; //in microseconds
final long range = 10000; //in microseconds
assertThat("The interrupt did not fire within the expected time period (values in milliseconds)",
function.interruptFireTime.get(), both(greaterThan(interruptTriggerTime - range))
.and(lessThan(interruptTriggerTime + range)));
assertThat("The readInterruptTimestamp() did not return the correct value (values in seconds)",
getInterruptable().readInterruptTimestamp(), both(greaterThan((interruptTriggerTime - range)/1e6))
assertThat("The readRisingTimestamp() did not return the correct value (values in seconds)",
getInterruptable().readRisingTimestamp(), both(greaterThan((interruptTriggerTime - range)/1e6))
.and(lessThan((interruptTriggerTime + range)/1e6)));
}
@Test(timeout = 1000)
public void testMultipleInterruptsTriggering() throws Exception{
//Given
final InterruptCounter counter = new InterruptCounter();
TestInterruptHandlerFunction function = new TestInterruptHandlerFunction(counter);
//When
getInterruptable().requestInterrupts(function);
getInterruptable().enableInterrupts();
final int fireCount = 50;
for(int i = 0; i < fireCount; i ++){
setInterruptLow();
@@ -170,14 +170,14 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
//Then
assertEquals("The interrupt did not fire the expected number of times", fireCount, counter.getCount());
}
/** The timeout length for this test in seconds */
private static final int synchronousTimeout = 5;
@Test(timeout = (long)(synchronousTimeout*1e3))
public void testSynchronousInterruptsTriggering(){
//Given
getInterruptable().requestInterrupts();
final double synchronousDelay = synchronousTimeout/2.;
Runnable r = new Runnable(){
@Override
@@ -187,32 +187,32 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
setInterruptHigh();
}
};
//When
//Note: the long time value is used because doubles can flip if the robot is left running for long enough
final long startTimeStamp = Utility.getFPGATime();
new Thread(r).start();
//Delay for twice as long as the timeout so the test should fail first
getInterruptable().waitForInterrupt(synchronousTimeout * 2);
final long stopTimeStamp = Utility.getFPGATime();
//Then
//The test will not have timed out and:
final double interruptRunTime = (stopTimeStamp - startTimeStamp)*1e-6;
assertEquals("The interrupt did not run for the expected amount of time (units in seconds)", synchronousDelay, interruptRunTime, .1);
}
@Test(timeout = 2000)
public void testDisableStopsInterruptFiring(){
final InterruptCounter counter = new InterruptCounter();
TestInterruptHandlerFunction function = new TestInterruptHandlerFunction(counter);
//When
getInterruptable().requestInterrupts(function);
getInterruptable().enableInterrupts();
final int fireCount = 50;
for(int i = 0; i < fireCount; i ++){
setInterruptLow();
@@ -224,16 +224,16 @@ public abstract class AbstractInterruptTest extends AbstractComsSetup {
}
getInterruptable().disableInterrupts();
//TestBench.out().println("Finished disabling the robot");
for(int i = 0; i < fireCount; i ++){
setInterruptLow();
setInterruptHigh();
//Just wait because the interrupt should not fire
Timer.delay(.005);
}
//Then
assertEquals("The interrupt did not fire the expected number of times", fireCount, counter.getCount());
}
}

View File

@@ -287,40 +287,6 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_setCounterSampl
COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CounterJNI
* Method: startCounter
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_startCounter
(JNIEnv * env, jclass, jobject id, jobject status)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI startCounter";
void ** javaId = (void**)env->GetDirectBufferAddress(id);
COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId;
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
startCounter(*javaId, statusPtr);
COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CounterJNI
* Method: stopCounter
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_CounterJNI_stopCounter
(JNIEnv * env, jclass, jobject id, jobject status)
{
COUNTERJNI_LOG(logDEBUG) << "Calling COUNTERJNI stopCounter";
void ** javaId = (void**)env->GetDirectBufferAddress(id);
COUNTERJNI_LOG(logDEBUG) << "Counter Ptr = " << *javaId;
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
COUNTERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
stopCounter(*javaId, statusPtr);
COUNTERJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
}
/*
* Class: edu_wpi_first_wpilibj_hal_CounterJNI
* Method: resetCounter

View File

@@ -61,40 +61,6 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_freeEncoder
ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
}
/*
* Class: edu_wpi_first_wpilibj_hal_EncoderJNI
* Method: startEncoder
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_startEncoder
(JNIEnv * env, jclass, jobject id, jobject status)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI startEncoder";
void ** javaId = (void**)env->GetDirectBufferAddress(id);
ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId;
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
startEncoder(*javaId, statusPtr);
ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
}
/*
* Class: edu_wpi_first_wpilibj_hal_EncoderJNI
* Method: stopEncoder
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_EncoderJNI_stopEncoder
(JNIEnv * env, jclass, jobject id, jobject status)
{
ENCODERJNI_LOG(logDEBUG) << "Calling ENCODERJNI stopEncoder";
void ** javaId = (void**)env->GetDirectBufferAddress(id);
ENCODERJNI_LOG(logDEBUG) << "Encoder Ptr = " << *javaId;
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
ENCODERJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
stopEncoder(*javaId, statusPtr);
ENCODERJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
}
/*
* Class: edu_wpi_first_wpilibj_hal_EncoderJNI
* Method: resetEncoder

View File

@@ -8,8 +8,8 @@
TLogLevel interruptJNILogLevel = logERROR;
#define INTERRUPTJNI_LOG(level) \
if (level > interruptJNILogLevel) ; \
else Log().Get(level)
if (level > interruptJNILogLevel) ; \
else Log().Get(level)
//Used for callback when an interrupt is fired.
static JavaVM *jvm;
@@ -79,8 +79,8 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_cleanInterrup
* Method: waitForInterrupt
* Signature: (Ljava/nio/ByteBuffer;DLjava/nio/IntBuffer;)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt
(JNIEnv * env, jclass, jobject interrupt_pointer, jdouble timeout, jobject status)
JNIEXPORT int JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterrupt
(JNIEnv * env, jclass, jobject interrupt_pointer, jdouble timeout, jboolean ignorePrevious, jobject status)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI waitForInterrupt";
void ** javaId = (void**)env->GetDirectBufferAddress(interrupt_pointer);
@@ -88,9 +88,11 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_waitForInterr
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
INTERRUPTJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
waitForInterrupt(*javaId, timeout, statusPtr);
int result = waitForInterrupt(*javaId, timeout, ignorePrevious, statusPtr);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
return result;
}
/*
@@ -133,19 +135,39 @@ JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_disableInterr
/*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: readInterruptTimestamp
* Method: readRisingTimestamp
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D
*/
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readInterruptTimestamp
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readRisingTimestamp
(JNIEnv * env, jclass, jobject interrupt_pointer, jobject status)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readInterruptTimestamp";
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readRisingTimestamp";
void ** javaId = (void**)env->GetDirectBufferAddress(interrupt_pointer);
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << *javaId;
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
INTERRUPTJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
jdouble timeStamp = readInterruptTimestamp(*javaId, statusPtr);
jdouble timeStamp = readRisingTimestamp(*javaId, statusPtr);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
return timeStamp;
}
/*
* Class: edu_wpi_first_wpilibj_hal_InterruptJNI
* Method: readFallingTimestamp
* Signature: (Ljava/nio/ByteBuffer;Ljava/nio/IntBuffer;)D
*/
JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_hal_InterruptJNI_readFallingTimestamp
(JNIEnv * env, jclass, jobject interrupt_pointer, jobject status)
{
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI readFallingTimestamp";
void ** javaId = (void**)env->GetDirectBufferAddress(interrupt_pointer);
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Ptr = " << *javaId;
jint * statusPtr = (jint*)env->GetDirectBufferAddress(status);
INTERRUPTJNI_LOG(logDEBUG) << "Status Ptr = " << statusPtr;
jdouble timeStamp = readFallingTimestamp(*javaId, statusPtr);
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << *statusPtr;
return timeStamp;