diff --git a/source/config.h b/source/config.h index deadb9546..a3ec0382a 100644 --- a/source/config.h +++ b/source/config.h @@ -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); \ No newline at end of file diff --git a/source/crypto.c b/source/crypto.c index 9b1fd4611..9819af86d 100755 --- a/source/crypto.c +++ b/source/crypto.c @@ -9,7 +9,7 @@ #include "fatfs/sdmmc/sdmmc.h" /**************************************************************** -* Crypto Libs +* Crypto libs ****************************************************************/ /* original version by megazig */ @@ -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], diff --git a/source/draw.c b/source/draw.c index 546a3ad78..5cf04ca2c 100644 --- a/source/draw.c +++ b/source/draw.c @@ -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; @@ -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 } } diff --git a/source/emunand.h b/source/emunand.h index 1cf075160..2d5e98a20 100644 --- a/source/emunand.h +++ b/source/emunand.h @@ -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); diff --git a/source/firm.c b/source/firm.c index ef6ca70fc..12d8bfacb 100755 --- a/source/firm.c +++ b/source/firm.c @@ -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 @@ -187,7 +186,6 @@ void main(void) launchFirm(bootType); } -//Load FIRM into FCRAM static inline void loadFirm(u32 firmType, u32 externalFirm) { section = firm->section; @@ -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); diff --git a/source/i2c.c b/source/i2c.c index cdbb9a8b2..5f89d0a44 100644 --- a/source/i2c.c +++ b/source/i2c.c @@ -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]; } @@ -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; diff --git a/source/patches.c b/source/patches.c index 60ac20aa0..109e03b7c 100644 --- a/source/patches.c +++ b/source/patches.c @@ -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; diff --git a/source/patches.h b/source/patches.h index 78879c260..1e2f52581 100644 --- a/source/patches.h +++ b/source/patches.h @@ -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; /**************************************************