diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2014-09-27 21:23:38 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2014-12-15 22:52:54 +0100 |
commit | 99ed6d2bea6b8bc76b9775aea4735b68c19f175f (patch) | |
tree | 06bb113b620181cba1dba7009201981a0fcf2ad3 /utils/regtools | |
parent | b08620dd304f54943c057405da49d44102ebcc77 (diff) |
qeditor: backends can now report validity status
Change-Id: Iefedc9cee10a8c7457d972e5a60d151a6cb38aa8
Reviewed-on: http://gerrit.rockbox.org/995
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Diffstat (limited to 'utils/regtools')
-rw-r--r-- | utils/regtools/qeditor/backend.cpp | 3 | ||||
-rw-r--r-- | utils/regtools/qeditor/backend.h | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/utils/regtools/qeditor/backend.cpp b/utils/regtools/qeditor/backend.cpp index 9c94ac5642..e47df8e3a4 100644 --- a/utils/regtools/qeditor/backend.cpp +++ b/utils/regtools/qeditor/backend.cpp @@ -114,6 +114,7 @@ FileIoBackend::FileIoBackend(const QString& filename, const QString& soc_name) { m_filename = filename; m_soc = soc_name; + m_valid = false; Reload(); } @@ -132,6 +133,7 @@ bool FileIoBackend::ReadRegister(const QString& name, soc_word_t& value) bool FileIoBackend::Reload() { + m_valid = false; QFile file(m_filename); if(!file.open(QIODevice::ReadOnly | QIODevice::Text)) return false; @@ -155,6 +157,7 @@ bool FileIoBackend::Reload() m_readonly = !QFileInfo(file).isWritable(); m_dirty = false; + m_valid = true; return true; } diff --git a/utils/regtools/qeditor/backend.h b/utils/regtools/qeditor/backend.h index 64ba4c4922..2dba4e2b08 100644 --- a/utils/regtools/qeditor/backend.h +++ b/utils/regtools/qeditor/backend.h @@ -53,6 +53,8 @@ public: * HW.dev.reg * where <dev> is the device name (including index like APPUART1) * and <reg> is the register name (including index like PRIORITY29) */ + /* report whether backend is valid */ + virtual bool IsValid() = 0; /* report whether backend supports register access type */ virtual bool SupportAccess(AccessType type) = 0; /* get SoC name */ @@ -83,6 +85,7 @@ class DummyIoBackend : public IoBackend public: DummyIoBackend() {} + virtual bool IsValid() { return false; } virtual bool SupportAccess(AccessType type) { Q_UNUSED(type); return false; } virtual QString GetSocName() { return ""; } virtual bool ReadRegister(const QString& name, soc_word_t& value) @@ -107,6 +110,7 @@ class FileIoBackend : public IoBackend public: FileIoBackend(const QString& filename, const QString& soc_name = ""); + virtual bool IsValid() { return m_valid; } virtual bool SupportAccess(AccessType type) { return type == ByName; } virtual QString GetSocName(); virtual bool ReadRegister(const QString& name, soc_word_t& value); @@ -126,6 +130,7 @@ protected: QString m_soc; bool m_readonly; bool m_dirty; + bool m_valid; QMap< QString, soc_word_t > m_map; }; @@ -173,6 +178,7 @@ public: HWStubIoBackend(HWStubDevice *dev); virtual ~HWStubIoBackend(); + virtual bool IsValid() { return m_dev->IsValid(); } virtual bool SupportAccess(AccessType type) { return type == ByAddress; } virtual QString GetSocName(); virtual bool ReadRegister(const QString& name, soc_word_t& value) |