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