1
0
mirror of https://github.com/sendyne/cppreg.git synced 2025-05-09 23:24:05 +00:00

ADD PROPER DOCUMENTATION COMMENTS

This commit is contained in:
Nicolas Clauvelin 2018-03-12 17:20:32 -04:00
parent 4d575c176f
commit 327e230847

View File

@ -165,16 +165,38 @@ namespace cppreg {
); );
//! Packed register implementation.
/**
* @tparam RegisterPack Pack to which the register belongs.
* @tparam RegWidth Register total width in bits.
* @tparam OffsetInPack Register offset in the pack in bytes.
* @tparam reset Register reset value (0x0 if unknown).
* @tparam shadow Boolean flag to enable shadow value (enabled if `true`).
*
* This implementation is intended to be used when defining a register
* that belongs to a type.
*/
template < template <
typename RegisterPack, typename RegisterPack,
Width_t RegWidth, Width_t RegWidth,
std::uint32_t OffsetInPack std::uint32_t OffsetInPack,
typename RegisterType<RegWidth>::type ResetValue = 0x0,
bool UseShadow = false
> >
struct PackedRegister : struct PackedRegister :
Register<RegisterPack::pack_base + OffsetInPack * 8, RegWidth> { Register<
RegisterPack::pack_base + OffsetInPack * 8,
RegWidth,
ResetValue,
UseShadow
> {
//! Register type.
using base_reg = Register< using base_reg = Register<
RegisterPack::pack_base + OffsetInPack * 8, RegWidth RegisterPack::pack_base + OffsetInPack * 8,
RegWidth,
ResetValue,
UseShadow
>; >;
//! Memory modifier. //! Memory modifier.
@ -201,18 +223,22 @@ namespace cppreg {
}; };
template <typename... Regs> //! Pack indexing structure.
/**
* @tparam T List of types (registers or fields) to index.
*
* This can be used to conveniently map indices over packed registers.
* The order in the variadic parameter pack will define the indexing
* (starting at zero).
*/
template <typename... T>
struct PackIndexing { struct PackIndexing {
template <std::size_t N> template <std::size_t N>
using type = typename std::tuple_element<N, std::tuple<Regs...>>::type; using regs = typename std::tuple_element<N, std::tuple<T...>>::type;
template <std::size_t N>
using regs = typename std::tuple_element<N, std::tuple<Regs...>>::type;
}; };
} }
#endif // CPPREG_REGISTER_H #endif // CPPREG_REGISTER_H