summaryrefslogtreecommitdiffstats
path: root/utils/regtools/qeditor/backend.h
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-09-30 15:51:02 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-12-15 22:53:15 +0100
commit1bcc4fc67bb0aa7b7fab9f9a098f3b473ea1637f (patch)
tree39182d98d25016db3b98fac7c5c1817f19ff4aef /utils/regtools/qeditor/backend.h
parent4a711fee423b00698313ac9c9a8df4f25696f8dd (diff)
downloadrockbox-1bcc4fc67bb0aa7b7fab9f9a098f3b473ea1637f.tar.gz
rockbox-1bcc4fc67bb0aa7b7fab9f9a098f3b473ea1637f.tar.bz2
rockbox-1bcc4fc67bb0aa7b7fab9f9a098f3b473ea1637f.zip
qeditor: introduce a new "RAM" backend, and refactor file backend
Change-Id: Icfbbc01b83d3592041803387e35f5aa6fb0fa813 Reviewed-on: http://gerrit.rockbox.org/997 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Diffstat (limited to 'utils/regtools/qeditor/backend.h')
-rw-r--r--utils/regtools/qeditor/backend.h40
1 files changed, 31 insertions, 9 deletions
diff --git a/utils/regtools/qeditor/backend.h b/utils/regtools/qeditor/backend.h
index 2dba4e2b08..c8adbc474f 100644
--- a/utils/regtools/qeditor/backend.h
+++ b/utils/regtools/qeditor/backend.h
@@ -102,9 +102,39 @@ public:
virtual bool Commit() { return false; }
};
+/** The RAM backend doesn't have any backend storage and stores all values in
+ * an associative map */
+class RamIoBackend : public IoBackend
+{
+ Q_OBJECT
+public:
+ RamIoBackend(const QString& soc_name = "");
+
+ virtual bool IsValid() { return m_soc != ""; }
+ virtual bool SupportAccess(AccessType type) { return type == ByName; }
+ virtual QString GetSocName() { return m_soc; }
+ virtual void SetSocName(const QString& soc_name) { m_soc = soc_name; }
+ virtual bool ReadRegister(const QString& name, soc_word_t& value);
+ virtual bool ReadRegister(soc_addr_t addr, soc_word_t& value)
+ { Q_UNUSED(addr); Q_UNUSED(value); return false; }
+ virtual bool Reload() { return false; }
+ virtual bool IsReadOnly() { return false; }
+ virtual bool WriteRegister(const QString& name, soc_word_t value, WriteMode mode);
+ virtual bool WriteRegister(soc_addr_t addr, soc_word_t value, WriteMode mode)
+ { Q_UNUSED(addr); Q_UNUSED(value); Q_UNUSED(mode); return false; }
+ virtual bool IsDirty() { return false; }
+ virtual bool Commit() { return false; }
+ /* clear all entries of the backend */
+ virtual void DeleteAll();
+
+protected:
+ QString m_soc;
+ QMap< QString, soc_word_t > m_map;
+};
+
/** NOTE the File backend makes a difference between writes and commits:
* a write will *never* touch the underlying file unless it was committed. */
-class FileIoBackend : public IoBackend
+class FileIoBackend : public RamIoBackend
{
Q_OBJECT
public:
@@ -112,26 +142,18 @@ public:
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);
- virtual bool ReadRegister(soc_addr_t addr, soc_word_t& value)
- { Q_UNUSED(addr); Q_UNUSED(value); return false; }
virtual bool Reload();
virtual bool IsReadOnly() { return m_readonly; }
virtual bool WriteRegister(const QString& name, soc_word_t value, WriteMode mode);
- virtual bool WriteRegister(soc_addr_t addr, soc_word_t value, WriteMode mode)
- { Q_UNUSED(addr); Q_UNUSED(value); Q_UNUSED(mode); return false; }
virtual bool IsDirty() { return m_dirty; }
virtual bool Commit();
QString GetFileName() { return m_filename; }
protected:
QString m_filename;
- QString m_soc;
bool m_readonly;
bool m_dirty;
bool m_valid;
- QMap< QString, soc_word_t > m_map;
};
#ifdef HAVE_HWSTUB