summaryrefslogtreecommitdiff
path: root/src/core/hw/lcd.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hw/lcd.h')
-rw-r--r--src/core/hw/lcd.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h
index 57029c5e8..191fd44af 100644
--- a/src/core/hw/lcd.h
+++ b/src/core/hw/lcd.h
@@ -6,7 +6,6 @@
6 6
7#include <cstddef> 7#include <cstddef>
8#include <type_traits> 8#include <type_traits>
9
10#include "common/bit_field.h" 9#include "common/bit_field.h"
11#include "common/common_funcs.h" 10#include "common/common_funcs.h"
12#include "common/common_types.h" 11#include "common/common_types.h"
@@ -42,16 +41,15 @@ struct Regs {
42 return sizeof(Regs) / sizeof(u32); 41 return sizeof(Regs) / sizeof(u32);
43 } 42 }
44 43
45 const u32& operator [] (int index) const { 44 const u32& operator[](int index) const {
46 const u32* content = reinterpret_cast<const u32*>(this); 45 const u32* content = reinterpret_cast<const u32*>(this);
47 return content[index]; 46 return content[index];
48 } 47 }
49 48
50 u32& operator [] (int index) { 49 u32& operator[](int index) {
51 u32* content = reinterpret_cast<u32*>(this); 50 u32* content = reinterpret_cast<u32*>(this);
52 return content[index]; 51 return content[index];
53 } 52 }
54
55}; 53};
56static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout"); 54static_assert(std::is_standard_layout<Regs>::value, "Structure does not use standard layout");
57 55
@@ -59,14 +57,14 @@ static_assert(std::is_standard_layout<Regs>::value, "Structure does not use stan
59// is technically allowed since C++11. This macro should be enabled once MSVC adds 57// is technically allowed since C++11. This macro should be enabled once MSVC adds
60// support for that. 58// support for that.
61#ifndef _MSC_VER 59#ifndef _MSC_VER
62#define ASSERT_REG_POSITION(field_name, position) \ 60#define ASSERT_REG_POSITION(field_name, position) \
63 static_assert(offsetof(Regs, field_name) == position * 4, \ 61 static_assert(offsetof(Regs, field_name) == position * 4, \
64 "Field "#field_name" has invalid position") 62 "Field " #field_name " has invalid position")
65 63
66ASSERT_REG_POSITION(color_fill_top, 0x81); 64ASSERT_REG_POSITION(color_fill_top, 0x81);
67ASSERT_REG_POSITION(backlight_top, 0x90); 65ASSERT_REG_POSITION(backlight_top, 0x90);
68ASSERT_REG_POSITION(color_fill_bottom, 0x281); 66ASSERT_REG_POSITION(color_fill_bottom, 0x281);
69ASSERT_REG_POSITION(backlight_bottom, 0x290); 67ASSERT_REG_POSITION(backlight_bottom, 0x290);
70 68
71#undef ASSERT_REG_POSITION 69#undef ASSERT_REG_POSITION
72#endif // !defined(_MSC_VER) 70#endif // !defined(_MSC_VER)
@@ -74,7 +72,7 @@ ASSERT_REG_POSITION(backlight_bottom, 0x290);
74extern Regs g_regs; 72extern Regs g_regs;
75 73
76template <typename T> 74template <typename T>
77void Read(T &var, const u32 addr); 75void Read(T& var, const u32 addr);
78 76
79template <typename T> 77template <typename T>
80void Write(u32 addr, const T data); 78void Write(u32 addr, const T data);