Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraWright committed Apr 26, 2016
1 parent 5202ba8 commit a736e46
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 30 deletions.
4 changes: 2 additions & 2 deletions source/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
#define MULTICONFIG(a) ((config >> (a * 2 + 6)) & 3)
#define BOOTCONFIG(a, b) ((config >> a) & b)

extern u32 config;
extern u32 config;

void configureCFW(const char *configPath);
void configureCFW(const char *configPath);
4 changes: 2 additions & 2 deletions source/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "fatfs/sdmmc/sdmmc.h"

/****************************************************************
* Crypto Libs
* Crypto libs
****************************************************************/

/* original version by megazig */
Expand Down Expand Up @@ -271,7 +271,7 @@ static void sha(void *res, const void *src, u32 size, u32 mode)
}

/****************************************************************
* Nand/FIRM Crypto stuff
* NAND/FIRM crypto
****************************************************************/

static u8 nandCTR[0x10],
Expand Down
3 changes: 2 additions & 1 deletion source/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static const struct fb {
static inline int strlen(const char *string)
{
char *stringEnd = (char *)string;

while(*stringEnd) stringEnd++;

return stringEnd - string;
Expand All @@ -43,7 +44,7 @@ void loadSplash(void)
fileRead(fb->bottom, "/luma/splashbottom.bin", 0x38400))
{
u64 i = 0x1400000;
while(--i) __asm("mov r0, r0"); //Less Ghetto sleep func
while(i--) __asm("mov r0, r0"); //Less Ghetto sleep func
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/emunand.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "types.h"

#define NCSD_MAGIC (0x4453434E)
#define NCSD_MAGIC 0x4453434E

void getEmunandSect(u32 *off, u32 *head, u32 *emuNAND);
u32 getSDMMC(u8 *pos, u32 size);
Expand Down
4 changes: 1 addition & 3 deletions source/firm.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ void main(void)
//If screens are inited or the corresponding option is set, load splash screen
if(PDN_GPU_CNT != 1 || CONFIG(8)) loadSplash();

//Determine if we need to autoboot sysNAND
u32 autoBootSys = CONFIG(0);

//Determine if we need to boot an emuNAND or sysNAND
Expand Down Expand Up @@ -187,7 +186,6 @@ void main(void)
launchFirm(bootType);
}

//Load FIRM into FCRAM
static inline void loadFirm(u32 firmType, u32 externalFirm)
{
section = firm->section;
Expand Down Expand Up @@ -390,7 +388,7 @@ static inline void patchTwlAgbFirm(u32 firmType)

static inline void launchFirm(u32 bootType)
{
//Copy firm partitions to respective memory locations
//Copy FIRM sections to respective memory locations
for(u32 i = 0; i < 4 && section[i].size; i++)
memcpy(section[i].address, (u8 *)firm + section[i].offset, section[i].size);

Expand Down
26 changes: 13 additions & 13 deletions source/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,26 @@ static inline u8 i2cGetDeviceRegAddr(u8 device_id)

//-----------------------------------------------------------------------------

static vu8* reg_data_addrs[] = {
(vu8*)(I2C1_REG_OFF + I2C_REG_DATA),
(vu8*)(I2C2_REG_OFF + I2C_REG_DATA),
(vu8*)(I2C3_REG_OFF + I2C_REG_DATA),
static vu8 *reg_data_addrs[] = {
(vu8 *)(I2C1_REG_OFF + I2C_REG_DATA),
(vu8 *)(I2C2_REG_OFF + I2C_REG_DATA),
(vu8 *)(I2C3_REG_OFF + I2C_REG_DATA),
};

static inline vu8* i2cGetDataReg(u8 bus_id)
static inline vu8 *i2cGetDataReg(u8 bus_id)
{
return reg_data_addrs[bus_id];
}

//-----------------------------------------------------------------------------

static vu8* reg_cnt_addrs[] = {
(vu8*)(I2C1_REG_OFF + I2C_REG_CNT),
(vu8*)(I2C2_REG_OFF + I2C_REG_CNT),
(vu8*)(I2C3_REG_OFF + I2C_REG_CNT),
static vu8 *reg_cnt_addrs[] = {
(vu8 *)(I2C1_REG_OFF + I2C_REG_CNT),
(vu8 *)(I2C2_REG_OFF + I2C_REG_CNT),
(vu8 *)(I2C3_REG_OFF + I2C_REG_CNT),
};

static inline vu8* i2cGetCntReg(u8 bus_id)
static inline vu8 *i2cGetCntReg(u8 bus_id)
{
return reg_cnt_addrs[bus_id];
}
Expand Down Expand Up @@ -94,16 +94,16 @@ u32 i2cWriteRegister(u8 dev_id, u8 reg, u8 data)
u8 bus_id = i2cGetDeviceBusId(dev_id);
u8 dev_addr = i2cGetDeviceRegAddr(dev_id);

for (u32 i = 0; i < 8; i++)
for(u32 i = 0; i < 8; i++)
{
if (i2cSelectDevice(bus_id, dev_addr) && i2cSelectRegister(bus_id, reg))
if(i2cSelectDevice(bus_id, dev_addr) && i2cSelectRegister(bus_id, reg))
{
i2cWaitBusy(bus_id);
*i2cGetDataReg(bus_id) = data;
*i2cGetCntReg(bus_id) = 0xC1;
i2cStop(bus_id, 0);

if (i2cGetResult(bus_id))
if(i2cGetResult(bus_id))
return 1;
}
*i2cGetCntReg(bus_id) = 0xC5;
Expand Down
8 changes: 3 additions & 5 deletions source/patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

const u32 mpuPatch[3] = {0x00360003, 0x00200603, 0x001C0603};

const u16 nandRedir[2] = {0x4C00, 0x47A0};

const u16 sigPatch[2] = {0x2000, 0x4770};

const u16 writeBlock[2] = {0x2000, 0x46C0};
const u16 nandRedir[2] = {0x4C00, 0x47A0},
sigPatch[2] = {0x2000, 0x4770},
writeBlock[2] = {0x2000, 0x46C0};

const u8 unitInfoPatch = 0xE3;

Expand Down
6 changes: 3 additions & 3 deletions source/patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
* Patches
**************************************************/
const u32 mpuPatch[3];
const u16 nandRedir[2];
const u16 sigPatch[2];
const u16 writeBlock[2];
const u16 nandRedir[2],
sigPatch[2],
writeBlock[2];
const u8 unitInfoPatch;

/**************************************************
Expand Down

0 comments on commit a736e46

Please sign in to comment.