-
-
Save cleverca22/6729ffbf85d053d4bc274b65ad4e411a to your computer and use it in GitHub Desktop.
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
void FUN_600005b8(void) | |
{ | |
uint uVar1; | |
uint fraction; | |
uint divisor; | |
divisor = 52; | |
uVar1 = crystal_is_fast(); | |
fraction = 87381; | |
if (uVar1 != 0) { | |
divisor = 37; | |
fraction = 38836; | |
} | |
write_volatile_4(A2W_XOSC_CTRL,0x5a0000ff); | |
write_volatile_4(A2W_PLLC_FRACR,fraction | 0x5a000000); | |
write_volatile_4(A2W_PLLC_CTRLR,divisor | 0x5a001000); | |
write_volatile_4(A2W_PLLC_MULTI,0x5a000000); | |
write_volatile_4(CM_PLLC,0x5a0000aa); | |
do { | |
uVar1 = read_volatile_4(CM_LOCK); | |
} while ((uVar1 & 0x400) == 0); | |
write_volatile_4(A2W_PLLC_CORE0R,0x5a000005); | |
write_volatile_4(A2W_PLLC_CORE1R,0x5a000005); | |
write_volatile_4(A2W_PLLC_CORE2R,0x5a000005); | |
write_volatile_4(A2W_PLLC_PERR,0x5a000004); | |
write_volatile_4(A2W_PLLC_MULTI,0x5a000000); | |
write_volatile_4(A2W_PLLC_CTRL,divisor | 0x5a021000); | |
write_volatile_4(A2W_PLLC_CORE1R,0x5a000100); | |
write_volatile_4(A2W_PLLC_CORE2R,0x5a000100); | |
write_volatile_4(A2W_PLLC_PERR,0x5a000000); | |
write_volatile_4(A2W_PLLC_MULTI,0x5a000000); | |
write_volatile_4(CM_PLLC,0x5a000000); | |
write_volatile_4(CM_VPUDIV,0x5a002000); | |
do { | |
uVar1 = read_volatile_4(CM_VPUCTL); | |
} while ((uVar1 & 0x80) != 0); | |
write_volatile_4(CM_VPUCTL,0x5a000045); | |
return; | |
} | |
uint crystal_is_fast(void) | |
{ | |
gp_area *gp; | |
return (uint)((gp->bootmode >> 1 & 1) == 0); | |
} | |
void handle_gpio_bootmode(void) | |
{ | |
uint uVar1; | |
int iVar2; | |
gp_area *gp; | |
otp_read_bootmode(&gp->bootmode); | |
otp_read66(&gp->otp66); | |
uVar1 = is_nandboot_enabled(); | |
if (uVar1 != 0) { | |
otp_something_67(&gp->otp67_thing); | |
} | |
iVar2 = bootmode_gpio_enabled(); | |
if (iVar2 != 0) { | |
iVar2 = bootmode_gpio_bank(); | |
if (iVar2 == 0) { | |
uVar1 = read_volatile_4(GP_LEV0); | |
uVar1 = uVar1 >> 22; | |
} | |
else { | |
uVar1 = read_volatile_4(GP_LEV1); | |
uVar1 = uVar1 >> 7; | |
} | |
gp->field_0x30 = uVar1 & 0x1f; | |
if ((uVar1 & 1) == 0) { | |
gp->bootmode = gp->bootmode & 0xffdfffff; | |
} | |
if ((uVar1 & 2) == 0) { | |
gp->bootmode = gp->bootmode & 0xf87fffff; | |
} | |
if ((uVar1 & 4) == 0) { | |
gp->bootmode = gp->bootmode & 0xffffffdf; | |
} | |
if ((uVar1 & 8) == 0) { | |
gp->bootmode = gp->bootmode & 0xbfffffff; | |
} | |
if ((uVar1 & 0x10) == 0) { | |
gp->bootmode = gp->bootmode & 0xcfffffff; | |
} | |
} | |
return; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment