Tune IRQs on the new roboRIO for lower latency
This pulls peak wakeup latency down from 800 uS or more to 150 uS. Most
of this is changing ktimersoftd/* to be high priority.
While we are here, most of the IRQs, including MMC are running at RT
priority 15. Anything we want to run needs to be higher than 15. Move
the networking stack and message_bridge up above that so we get low
latency communications.
Change-Id: I14ede0fdeb2a008f482feae75fa04cabc3f5abeb
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/wpilib/sensor_reader.cc b/frc971/wpilib/sensor_reader.cc
index 2a40128..f476e71 100644
--- a/frc971/wpilib/sensor_reader.cc
+++ b/frc971/wpilib/sensor_reader.cc
@@ -6,6 +6,7 @@
#include "aos/init.h"
#include "aos/logging/logging.h"
+#include "aos/realtime.h"
#include "aos/util/compiler_memory_barrier.h"
#include "frc971/wpilib/ahal/DigitalInput.h"
#include "frc971/wpilib/ahal/DriverStation.h"
@@ -27,6 +28,10 @@
ds_ = &::frc::DriverStation::GetInstance();
event_loop->SetRuntimeRealtimePriority(40);
+ // The timer interrupt fires on CPU1. Since nothing else is pinned, it will
+ // be cheapest to pin this there so it transitions directly and doesn't
+ // need to ever migrate.
+ event_loop->SetRuntimeAffinity(aos::MakeCpusetFromCpus({1}));
// Fill in the no pwm trigger defaults.
timer_handler_ = event_loop_->AddTimer([this]() { Loop(); });