aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Duggan <andrew.duggan@gmail.com>2014-11-11 07:58:09 -0800
committerAndrew Duggan <aduggan@synaptics.com>2015-02-23 13:23:27 -0800
commitdc8385559de574637738ab6d120e12e27e569a55 (patch)
treec8465436b4785b6d5e9140f7a041b88e912c857f
parent849fea35a5aa27e84f041ea74d427945018c97e6 (diff)
downloadrmi4utils-dc8385559de574637738ab6d120e12e27e569a55.tar.gz
Disable all interrupts not related to the update process before entering flash programming
-rw-r--r--rmi4update/rmi4update.cpp16
-rw-r--r--rmi4update/rmi4update.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/rmi4update/rmi4update.cpp b/rmi4update/rmi4update.cpp
index 8474b5a..6502a9e 100644
--- a/rmi4update/rmi4update.cpp
+++ b/rmi4update/rmi4update.cpp
@@ -103,6 +103,10 @@ int RMI4Update::UpdateFirmware(bool force, bool performLockdown)
fprintf(stdout, "Device Properties:\n");
m_device.PrintProperties();
+ rc = DisableNonessentialInterupts();
+ if (rc != UPDATE_SUCCESS)
+ return rc;
+
rc = ReadF34Queries();
if (rc != UPDATE_SUCCESS)
return rc;
@@ -204,6 +208,18 @@ int RMI4Update::UpdateFirmware(bool force, bool performLockdown)
}
+int RMI4Update::DisableNonessentialInterupts()
+{
+ int rc;
+ unsigned char interruptEnabeMask = m_f34.GetInterruptMask() | m_f01.GetInterruptMask();
+
+ rc = m_device.Write(m_f01.GetControlBase() + 1, &interruptEnabeMask, 1);
+ if (rc < 0)
+ return rc;
+
+ return UPDATE_SUCCESS;
+}
+
int RMI4Update::FindUpdateFunctions()
{
if (0 > m_device.ScanPDT())
diff --git a/rmi4update/rmi4update.h b/rmi4update/rmi4update.h
index ff69ae2..7dff0f5 100644
--- a/rmi4update/rmi4update.h
+++ b/rmi4update/rmi4update.h
@@ -32,6 +32,7 @@ public:
int UpdateFirmware(bool force = false, bool performLockdown = false);
private:
+ int DisableNonessentialInterupts();
int FindUpdateFunctions();
int ReadF34Queries();
int ReadF34Controls();