Keep track of FPGA time rollovers with 64-bit time.

This allows both greater than 72 minute (2^32 * 1 us) timeouts and also
gracefully handles notifiers across the FPGA time counter rollover.

Change-Id: Ibde0b903155f60b618b0ca4d5f8f6dd49f90b020
This commit is contained in:
Peter Johnson
2015-12-30 19:06:47 -08:00
committed by Brad Miller (WPI)
parent 063925e737
commit e2ec34090a
13 changed files with 71 additions and 43 deletions

View File

@@ -48,7 +48,7 @@ public class Notifier {
* Update the alarm hardware to reflect the next alarm.
*/
private void updateAlarm() {
NotifierJNI.updateNotifierAlarm(m_notifier, (int) (m_expirationTime * 1e6));
NotifierJNI.updateNotifierAlarm(m_notifier, (long) (m_expirationTime * 1e6));
}
/**
@@ -56,7 +56,7 @@ public class Notifier {
* calling of the user handler.
*/
@Override
public void apply(int time) {
public void apply(long time) {
m_processLock.lock();
if (m_periodic) {
m_expirationTime += m_period;

View File

@@ -14,7 +14,7 @@ public class NotifierJNI extends JNIWrapper {
* Callback function
*/
public interface NotifierJNIHandlerFunction {
void apply(int curTime);
void apply(long curTime);
}
/**
@@ -30,7 +30,7 @@ public class NotifierJNI extends JNIWrapper {
/**
* Sets the notifier to call the callback in another triggerTime microseconds.
*/
public static native void updateNotifierAlarm(long notifierPtr, int triggerTime);
public static native void updateNotifierAlarm(long notifierPtr, long triggerTime);
/**
* Tells the notifier to stop calling the callback.