diff options
Diffstat (limited to 'utils/regtools/qeditor/backend.h')
-rw-r--r-- | utils/regtools/qeditor/backend.h | 40 |
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: | |||
102 | virtual bool Commit() { return false; } | 102 | virtual bool Commit() { return false; } |
103 | }; | 103 | }; |
104 | 104 | ||
105 | /** The RAM backend doesn't have any backend storage and stores all values in | ||
106 | * an associative map */ | ||
107 | class RamIoBackend : public IoBackend | ||
108 | { | ||
109 | Q_OBJECT | ||
110 | public: | ||
111 | RamIoBackend(const QString& soc_name = ""); | ||
112 | |||
113 | virtual bool IsValid() { return m_soc != ""; } | ||
114 | virtual bool SupportAccess(AccessType type) { return type == ByName; } | ||
115 | virtual QString GetSocName() { return m_soc; } | ||
116 | virtual void SetSocName(const QString& soc_name) { m_soc = soc_name; } | ||
117 | virtual bool ReadRegister(const QString& name, soc_word_t& value); | ||
118 | virtual bool ReadRegister(soc_addr_t addr, soc_word_t& value) | ||
119 | { Q_UNUSED(addr); Q_UNUSED(value); return false; } | ||
120 | virtual bool Reload() { return false; } | ||
121 | virtual bool IsReadOnly() { return false; } | ||
122 | virtual bool WriteRegister(const QString& name, soc_word_t value, WriteMode mode); | ||
123 | virtual bool WriteRegister(soc_addr_t addr, soc_word_t value, WriteMode mode) | ||
124 | { Q_UNUSED(addr); Q_UNUSED(value); Q_UNUSED(mode); return false; } | ||
125 | virtual bool IsDirty() { return false; } | ||
126 | virtual bool Commit() { return false; } | ||
127 | /* clear all entries of the backend */ | ||
128 | virtual void DeleteAll(); | ||
129 | |||
130 | protected: | ||
131 | QString m_soc; | ||
132 | QMap< QString, soc_word_t > m_map; | ||
133 | }; | ||
134 | |||
105 | /** NOTE the File backend makes a difference between writes and commits: | 135 | /** NOTE the File backend makes a difference between writes and commits: |
106 | * a write will *never* touch the underlying file unless it was committed. */ | 136 | * a write will *never* touch the underlying file unless it was committed. */ |
107 | class FileIoBackend : public IoBackend | 137 | class FileIoBackend : public RamIoBackend |
108 | { | 138 | { |
109 | Q_OBJECT | 139 | Q_OBJECT |
110 | public: | 140 | public: |
@@ -112,26 +142,18 @@ public: | |||
112 | 142 | ||
113 | virtual bool IsValid() { return m_valid; } | 143 | virtual bool IsValid() { return m_valid; } |
114 | virtual bool SupportAccess(AccessType type) { return type == ByName; } | 144 | virtual bool SupportAccess(AccessType type) { return type == ByName; } |
115 | virtual QString GetSocName(); | ||
116 | virtual bool ReadRegister(const QString& name, soc_word_t& value); | ||
117 | virtual bool ReadRegister(soc_addr_t addr, soc_word_t& value) | ||
118 | { Q_UNUSED(addr); Q_UNUSED(value); return false; } | ||
119 | virtual bool Reload(); | 145 | virtual bool Reload(); |
120 | virtual bool IsReadOnly() { return m_readonly; } | 146 | virtual bool IsReadOnly() { return m_readonly; } |
121 | virtual bool WriteRegister(const QString& name, soc_word_t value, WriteMode mode); | 147 | virtual bool WriteRegister(const QString& name, soc_word_t value, WriteMode mode); |
122 | virtual bool WriteRegister(soc_addr_t addr, soc_word_t value, WriteMode mode) | ||
123 | { Q_UNUSED(addr); Q_UNUSED(value); Q_UNUSED(mode); return false; } | ||
124 | virtual bool IsDirty() { return m_dirty; } | 148 | virtual bool IsDirty() { return m_dirty; } |
125 | virtual bool Commit(); | 149 | virtual bool Commit(); |
126 | QString GetFileName() { return m_filename; } | 150 | QString GetFileName() { return m_filename; } |
127 | 151 | ||
128 | protected: | 152 | protected: |
129 | QString m_filename; | 153 | QString m_filename; |
130 | QString m_soc; | ||
131 | bool m_readonly; | 154 | bool m_readonly; |
132 | bool m_dirty; | 155 | bool m_dirty; |
133 | bool m_valid; | 156 | bool m_valid; |
134 | QMap< QString, soc_word_t > m_map; | ||
135 | }; | 157 | }; |
136 | 158 | ||
137 | #ifdef HAVE_HWSTUB | 159 | #ifdef HAVE_HWSTUB |