-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
62 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
#include <coreinit/debug.h> | ||
#include <coreinit/screen.h> | ||
|
||
extern "C" uint32_t __OSPhysicalToEffectiveUncached(uint32_t); | ||
|
||
static inline uint32_t DCReadReg32(OSScreenID screen, uint32_t index) { | ||
if (OSIsECOMode()) { | ||
return 0; | ||
} | ||
auto regs = (uint32_t *) __OSPhysicalToEffectiveUncached(0xc200000); | ||
return regs[index + (screen * 0x200)]; | ||
} | ||
|
||
|
||
static inline void DCWriteReg32(OSScreenID screen, uint32_t index, uint32_t val) { | ||
if (OSIsECOMode()) { | ||
return; | ||
} | ||
auto regs = (uint32_t *) __OSPhysicalToEffectiveUncached(0xc200000); | ||
regs[index + (screen * 0x200)] = val; | ||
} | ||
|
||
// https://www.x.org/docs/AMD/old/42589_rv630_rrg_1.01o.pdf (reg id in document / 4) | ||
#define D1GRPH_ENABLE_REG 0x1840 | ||
#define D1GRPH_CONTROL_REG 0x1841 | ||
#define D1GRPH_PITCH_REG 0x1848 | ||
#define D1OVL_PITCH_REG 0x1866 | ||
#define D1GRPH_X_END_REG 0x184d | ||
#define D1GRPH_Y_END_REG 0x184e | ||
|
||
static inline void SetDCPitchReg(OSScreenID screen, uint16_t pitch) { | ||
DCWriteReg32(screen, D1GRPH_PITCH_REG, pitch); | ||
DCWriteReg32(screen, D1OVL_PITCH_REG, pitch); | ||
} |