summaryrefslogtreecommitdiff
path: root/utils/regtools/include
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2016-03-19 21:18:35 +0000
committerAmaury Pouly <amaury.pouly@gmail.com>2016-04-08 19:38:36 +0200
commitcc4c9b70bcac048fc388d0f553b7621f52449526 (patch)
tree68e7757577855c81e2b0a3f4f3d2b0762d4dcc31 /utils/regtools/include
parentf6c61eb11a13f7a5141a980f56b9a14b3309c449 (diff)
downloadrockbox-cc4c9b70bcac048fc388d0f553b7621f52449526.zip
rockbox-cc4c9b70bcac048fc388d0f553b7621f52449526.tar.gz
rockbox-cc4c9b70bcac048fc388d0f553b7621f52449526.tar.bz2
rockbox-cc4c9b70bcac048fc388d0f553b7621f52449526.tar.xz
regtools: add register access to soc desc
Registers (and variants) can now specify the type of access supported: - unspecified: for variant means same as register, for register defaults R/W - read/write - read only - write only Backward compatibility is preserved by setting access to unspecified by default. Change-Id: I3e84ae18f962a45db62f996a542d08405d05b895
Diffstat (limited to 'utils/regtools/include')
-rw-r--r--utils/regtools/include/soc_desc.hpp27
1 files changed, 23 insertions, 4 deletions
diff --git a/utils/regtools/include/soc_desc.hpp b/utils/regtools/include/soc_desc.hpp
index 66562f8..99f8706 100644
--- a/utils/regtools/include/soc_desc.hpp
+++ b/utils/regtools/include/soc_desc.hpp
@@ -77,6 +77,21 @@ protected:
* Bare representation of the format
*/
+/** Register access type and rules
+ *
+ * Access can be specified on registers and register variants. When left
+ * unspecified (aka DEFAULT), a register variant inherit the access from
+ * the register, and a register defaults to read-write if unspecified.
+ * When specified, the register variant access takes precedence over the register
+ * access. */
+enum access_t
+{
+ UNSPECIFIED = 0, /** Register: read-write, fields: inherit from register */
+ READ_ONLY, /** Read-only */
+ READ_WRITE, /** Read-write */
+ WRITE_ONLY, /** Write-only */
+};
+
/** Enumerated value (aka named value), represents a special value for a field */
struct enum_t
{
@@ -137,33 +152,37 @@ struct field_t
/** Register variant information
*
* A register variant provides an alternative access to the register, potentially
- * we special semantics. Although there are no constraints on the type string,
+ * with special semantics. Although there are no constraints on the type string,
* the following types have well-defined semantics:
* - alias: the same register at another address
* - set: writing to this register will set the 1s bits and ignore the 0s
* - clr: writing to this register will clear the 1s bits and ignore the 0s
* - tog: writing to this register will toggle the 1s bits and ignore the 0s
+ * Note that by default, variants inherit the access type of the register but
+ * can override it.
*/
struct variant_t
{
soc_id_t id; /** ID (must be unique among register variants) */
std::string type; /** type of the variant */
soc_addr_t offset; /** offset of the variant */
+ access_t access; /** Access type */
- /** Default constructor: default ID, offset is 0 */
- variant_t():id(DEFAULT_ID), offset(0) {}
+ /** Default constructor: default ID, offset is 0, access is unspecified */
+ variant_t():id(DEFAULT_ID), offset(0), access(UNSPECIFIED) {}
};
/** Register information */
struct register_t
{
size_t width; /** Size in bits */
+ access_t access; /** Access type */
std::string desc; /** Optional description of the register */
std::vector< field_t > field; /** List of fields */
std::vector< variant_t > variant; /** List of variants */
/** Default constructor: width is 32 */
- register_t():width(32) {}
+ register_t():width(32), access(UNSPECIFIED) {}
};
/** Node address range information */