exti: add support for specifying a max latency requirement for interrupts
A non-zero maxLatency specified for an enabled interrupt will prevent the
system from going into sleep modes that take longer than the specified
latency to wake up.
Set vsync maxLatencyNs to MAX_VSYNC_INT_LATENCY to prevent the cpu from
going into any stop modes while vsync is enabled.
Bug: 29886751
Change-Id: I4b578b7598d8e4d6989b4ea0dafeb9c8900f8553
Signed-off-by: Ben Fennema <[email protected]>
diff --git a/firmware/src/drivers/vsync/vsync.c b/firmware/src/drivers/vsync/vsync.c
index c6d55aa..75716ae 100644
--- a/firmware/src/drivers/vsync/vsync.c
+++ b/firmware/src/drivers/vsync/vsync.c
@@ -38,7 +38,8 @@
// This defines how many vsync events we could handle being backed up in the
// queue. Use this to size our slab
-#define MAX_VSYNC_EVENTS 4
+#define MAX_VSYNC_EVENTS 4
+#define MAX_VSYNC_INT_LATENCY 1000 /* in ns */
#ifndef VSYNC_PIN
#error "VSYNC_PIN is not defined; please define in variant.h"
@@ -198,6 +199,7 @@
mTask.sensorHandle = sensorRegister(&mSensorInfo, &mSensorOps, NULL, true);
mTask.pin = gpioRequest(VSYNC_PIN);
mTask.isr.func = vsyncIsr;
+ mTask.isr.maxLatencyNs = MAX_VSYNC_INT_LATENCY;
mTask.evtSlab = slabAllocatorNew(sizeof(struct SingleAxisDataEvent) + sizeof(struct SingleAxisDataPoint), 4, MAX_VSYNC_EVENTS);
if (!mTask.evtSlab) {