summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/register_set.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/register_set.h b/src/common/register_set.h
index 0418551b3..ba19a2614 100644
--- a/src/common/register_set.h
+++ b/src/common/register_set.h
@@ -34,7 +34,7 @@
34/* 34/*
35 * Standardized way to define a group of registers and corresponding data structures. To define 35 * Standardized way to define a group of registers and corresponding data structures. To define
36 * a new register set, first define struct containing an enumeration called "Id" containing 36 * a new register set, first define struct containing an enumeration called "Id" containing
37 * all register IDs and a template union called "Struct". Specialize the Struct union for any 37 * all register IDs and a template struct called "Struct". Specialize the Struct struct for any
38 * register ID which needs to be accessed in a specialized way. You can then declare the object 38 * register ID which needs to be accessed in a specialized way. You can then declare the object
39 * containing all register values using the RegisterSet<BaseType, DefiningStruct> type, where 39 * containing all register values using the RegisterSet<BaseType, DefiningStruct> type, where
40 * BaseType is the underlying type of each register (e.g. u32). 40 * BaseType is the underlying type of each register (e.g. u32).
@@ -54,7 +54,7 @@
54 * 54 *
55 * // declare register definition structures 55 * // declare register definition structures
56 * template<Id id> 56 * template<Id id>
57 * union Struct; 57 * struct Struct;
58 * }; 58 * };
59 * 59 *
60 * // Define register set object 60 * // Define register set object
@@ -62,9 +62,11 @@
62 * 62 *
63 * // define register definition structures 63 * // define register definition structures
64 * template<> 64 * template<>
65 * union Regs::Struct<Regs::Value1> { 65 * struct Regs::Struct<Regs::Value1> {
66 * BitField<0, 4, u32> some_field; 66 * union {
67 * BitField<4, 3, u32> some_other_field; 67 * BitField<0, 4, u32> some_field;
68 * BitField<4, 3, u32> some_other_field;
69 * };
68 * }; 70 * };
69 * 71 *
70 * Usage in external code (within SomeNamespace scope): 72 * Usage in external code (within SomeNamespace scope):
@@ -77,7 +79,7 @@
77 * 79 *
78 * 80 *
79 * @tparam BaseType Base type used for storing individual registers, e.g. u32 81 * @tparam BaseType Base type used for storing individual registers, e.g. u32
80 * @tparam RegDefinition Class defining an enumeration called "Id" and a template<Id id> union, as described above. 82 * @tparam RegDefinition Class defining an enumeration called "Id" and a template<Id id> struct, as described above.
81 * @note RegDefinition::Id needs to have an enum value called NumIds defining the number of registers to be allocated. 83 * @note RegDefinition::Id needs to have an enum value called NumIds defining the number of registers to be allocated.
82 */ 84 */
83template<typename BaseType, typename RegDefinition> 85template<typename BaseType, typename RegDefinition>