diff options
| author | Tony Wasserka <NeoBrainX@gmail.com> | 2014-07-16 11:27:58 +0200 | 
|---|---|---|
| committer | Tony Wasserka <NeoBrainX@gmail.com> | 2014-07-23 00:33:08 +0200 | 
| commit | 246cb75584af281596b938f898e8a3aedbcdb62a (patch) | |
| tree | e87322b8dbcf7e7d2975bc6874f0fd3487a46eb7 /src/common | |
| parent | 75775e9ef41248592cb2c27ae69737e46499e705 (diff) | |
RegisterSet: Simplify code by using structs for register definition instead of unions.
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/register_set.h | 14 | 
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 @@  /*   * Standardized way to define a group of registers and corresponding data structures. To define   * a new register set, first define struct containing an enumeration called "Id" containing - * all register IDs and a template union called "Struct". Specialize the Struct union for any + * all register IDs and a template struct called "Struct". Specialize the Struct struct for any   * register ID which needs to be accessed in a specialized way. You can then declare the object   * containing all register values using the RegisterSet<BaseType, DefiningStruct> type, where   * BaseType is the underlying type of each register (e.g. u32). @@ -54,7 +54,7 @@   *   *         // declare register definition structures   *         template<Id id> - *         union Struct; + *         struct Struct;   *     };   *   *     // Define register set object @@ -62,9 +62,11 @@   *   *     // define register definition structures   *     template<> - *     union Regs::Struct<Regs::Value1> { - *         BitField<0, 4, u32> some_field; - *         BitField<4, 3, u32> some_other_field; + *     struct Regs::Struct<Regs::Value1> { + *         union { + *             BitField<0, 4, u32> some_field; + *             BitField<4, 3, u32> some_other_field; + *         };   *     };   *   * Usage in external code (within SomeNamespace scope): @@ -77,7 +79,7 @@   *   *   * @tparam BaseType Base type used for storing individual registers, e.g. u32 - * @tparam RegDefinition Class defining an enumeration called "Id" and a template<Id id> union, as described above. + * @tparam RegDefinition Class defining an enumeration called "Id" and a template<Id id> struct, as described above.   * @note RegDefinition::Id needs to have an enum value called NumIds defining the number of registers to be allocated.   */  template<typename BaseType, typename RegDefinition> | 
