Merge branch 'master' into developer
This commit is contained in:
commit
7df9917a00
@ -19,8 +19,6 @@
|
||||
#define COLOR_RED 0x0000FF
|
||||
#define COLOR_BLACK 0x000000
|
||||
|
||||
extern volatile struct fb *const fb;
|
||||
|
||||
bool loadSplash(void);
|
||||
void drawCharacter(char character, int posX, int posY, u32 color);
|
||||
int drawString(const char *string, int posX, int posY, u32 color);
|
@ -12,8 +12,9 @@
|
||||
#include "draw.h"
|
||||
#include "i2c.h"
|
||||
|
||||
#define ARM11_STUB_ADDRESS (0x25000000 - 0x40) //It's currently only 0x28 bytes large. We're putting 0x40 just to be sure here
|
||||
#define WAIT_FOR_ARM9() *arm11Entry = 0; while(!*arm11Entry); ((void (*)())*arm11Entry)();
|
||||
vu32 *arm11Entry = (vu32 *)0x1FFFFFF8;
|
||||
volatile struct fb *const fb = (volatile struct fb *)0x23FFFE00;
|
||||
|
||||
void __attribute__((naked)) arm11Stub(void)
|
||||
{
|
||||
@ -30,7 +31,6 @@ void __attribute__((naked)) arm11Stub(void)
|
||||
static inline void invokeArm11Function(void (*func)())
|
||||
{
|
||||
static bool hasCopiedStub = false;
|
||||
|
||||
if(!hasCopiedStub)
|
||||
{
|
||||
memcpy((void *)ARM11_STUB_ADDRESS, arm11Stub, 0x40);
|
||||
@ -63,9 +63,11 @@ void deinitScreens(void)
|
||||
if(PDN_GPU_CNT != 1) invokeArm11Function(ARM11);
|
||||
}
|
||||
|
||||
void updateBrightness(u32 brightnessIndex)
|
||||
void updateBrightness(u32 brightnessLevel)
|
||||
{
|
||||
u32 brightnessLevel = brightness[brightnessIndex];
|
||||
static int brightnessValue;
|
||||
|
||||
brightnessValue = brightness[brightnessLevel];
|
||||
|
||||
void __attribute__((naked)) ARM11(void)
|
||||
{
|
||||
@ -73,13 +75,13 @@ void updateBrightness(u32 brightnessIndex)
|
||||
__asm(".word 0xF10C01C0");
|
||||
|
||||
//Change brightness
|
||||
*(vu32 *)0x10202240 = brightnessLevel;
|
||||
*(vu32 *)0x10202A40 = brightnessLevel;
|
||||
*(vu32 *)0x10202240 = brightnessValue;
|
||||
*(vu32 *)0x10202A40 = brightnessValue;
|
||||
|
||||
WAIT_FOR_ARM9();
|
||||
}
|
||||
|
||||
flushDCacheRange(&brightnessLevel, 4);
|
||||
flushDCacheRange(&brightnessValue, 4);
|
||||
invokeArm11Function(ARM11);
|
||||
}
|
||||
|
||||
@ -91,6 +93,7 @@ void clearScreens(void)
|
||||
__asm(".word 0xF10C01C0");
|
||||
|
||||
//Setting up two simultaneous memory fills using the GPU
|
||||
|
||||
vu32 *REGs_PSC0 = (vu32 *)0x10400010;
|
||||
REGs_PSC0[0] = (u32)fb->top_left >> 3; //Start address
|
||||
REGs_PSC0[1] = (u32)(fb->top_left + 0x46500) >> 3; //End address
|
||||
@ -122,22 +125,22 @@ void clearScreens(void)
|
||||
invokeArm11Function(ARM11);
|
||||
}
|
||||
|
||||
bool initScreens(void)
|
||||
u32 initScreens(void)
|
||||
{
|
||||
bool needToInit = PDN_GPU_CNT == 1;
|
||||
u32 needToInit = PDN_GPU_CNT == 1;
|
||||
|
||||
void __attribute__((naked)) ARM11(void)
|
||||
{
|
||||
//Disable interrupts
|
||||
__asm(".word 0xF10C01C0");
|
||||
|
||||
u32 brightnessLevel = brightness[MULTICONFIG(0)];
|
||||
u32 brightnessLevel = MULTICONFIG(0);
|
||||
|
||||
*(vu32 *)0x10141200 = 0x1007F;
|
||||
*(vu32 *)0x10202014 = 0x00000001;
|
||||
*(vu32 *)0x1020200C &= 0xFFFEFFFE;
|
||||
*(vu32 *)0x10202240 = brightnessLevel;
|
||||
*(vu32 *)0x10202A40 = brightnessLevel;
|
||||
*(vu32 *)0x10202240 = brightness[brightnessLevel];
|
||||
*(vu32 *)0x10202A40 = brightness[brightnessLevel];
|
||||
*(vu32 *)0x10202244 = 0x1023E;
|
||||
*(vu32 *)0x10202A44 = 0x1023E;
|
||||
|
||||
@ -233,7 +236,8 @@ bool initScreens(void)
|
||||
//Turn on backlight
|
||||
i2cWriteRegister(I2C_DEV_MCU, 0x22, 0x2A);
|
||||
}
|
||||
else updateBrightness(MULTICONFIG(0));
|
||||
else
|
||||
updateBrightness(MULTICONFIG(0));
|
||||
|
||||
clearScreens();
|
||||
|
||||
|
@ -10,16 +10,14 @@
|
||||
#include "types.h"
|
||||
|
||||
#define PDN_GPU_CNT (*(vu8 *)0x10141200)
|
||||
#define ARM11_STUB_ADDRESS (0x25000000 - 0x40) //It's currently only 0x28 bytes large. We're putting 0x40 just to be sure here
|
||||
#define WAIT_FOR_ARM9() *arm11Entry = 0; while(!*arm11Entry); ((void (*)())*arm11Entry)();
|
||||
|
||||
struct fb {
|
||||
static volatile struct fb {
|
||||
u8 *top_left;
|
||||
u8 *top_right;
|
||||
u8 *bottom;
|
||||
};
|
||||
} *const fb = (volatile struct fb *)0x23FFFE00;
|
||||
|
||||
void deinitScreens(void);
|
||||
void updateBrightness(u32 brightnessIndex);
|
||||
void updateBrightness(u32 brightnessLevel);
|
||||
void clearScreens(void);
|
||||
bool initScreens(void);
|
||||
u32 initScreens(void);
|
Reference in New Issue
Block a user