diff options
author | Evan Lojewski <github@meklort.com> | 2019-05-05 17:30:34 -0600 |
---|---|---|
committer | Evan Lojewski <github@meklort.com> | 2019-05-05 17:30:34 -0600 |
commit | 32dd1f9c10c90bd381375654da99e5883487d0b3 (patch) | |
tree | 1269d53d63b88a539172a547fdc8191930a3b8b1 | |
parent | 00e58e0d58463e93a4bb7c0b9606caf81a7c85cb (diff) | |
download | bcm5719-ortega-32dd1f9c10c90bd381375654da99e5883487d0b3.tar.gz bcm5719-ortega-32dd1f9c10c90bd381375654da99e5883487d0b3.zip |
First pass through clang-format.
-rw-r--r-- | ape/main.c | 42 | ||||
-rw-r--r-- | ape/rmu.c | 24 | ||||
-rw-r--r-- | libs/APE/ape.c | 29 | ||||
-rw-r--r-- | libs/MII/mii.c | 54 | ||||
-rw-r--r-- | libs/NCSI/tests/valid_commands.c | 161 | ||||
-rw-r--r-- | libs/NVRam/crc.c | 4 | ||||
-rw-r--r-- | libs/NVRam/nvm.c | 3 | ||||
-rw-r--r-- | libs/elfio/elf_examples/hello.c | 2 | ||||
-rw-r--r-- | stage1/main.c | 41 | ||||
-rw-r--r-- | utils/bcmregtool/apeloader/main.c | 16 |
10 files changed, 209 insertions, 167 deletions
@@ -44,26 +44,27 @@ #include "ape.h" -#include <Network.h> -#include <Ethernet.h> -#include <NCSI.h> -#include <types.h> - -#include <APE_SHM.h> #include <APE_APE.h> #include <APE_APE_PERI.h> - #include <APE_RX_PORT.h> +#include <APE_SHM.h> +#include <Ethernet.h> +#include <NCSI.h> +#include <Network.h> +#include <types.h> void handleCommand(void) { uint32_t command = SHM.LoaderCommand.bits.Command; - if(!command) return; + if (!command) + { + return; + } uint32_t arg0 = SHM.LoaderArg0.r32; uint32_t arg1 = SHM.LoaderArg1.r32; - switch(command) + switch (command) { default: break; @@ -71,21 +72,21 @@ void handleCommand(void) case SHM_LOADER_COMMAND_COMMAND_READ_MEM: { // Read word address specified in arg0 - uint32_t* addr = ((void*)arg0); + uint32_t *addr = ((void *)arg0); SHM.LoaderArg0.r32 = *addr; break; } case SHM_LOADER_COMMAND_COMMAND_WRITE_MEM: { // Write word address specified in arg0 with arg1 - uint32_t* addr = ((void*)arg0); + uint32_t *addr = ((void *)arg0); *addr = arg1; break; } case SHM_LOADER_COMMAND_COMMAND_CALL: { // call address specified in arg0. - void (*function)(uint32_t) = ((void*)arg0); + void (*function)(uint32_t) = ((void *)arg0); function(arg1); break; } @@ -102,30 +103,33 @@ void handleBMCPacket(void) RegAPE_PERIBmcToNcRxStatus_t stat; stat.r32 = APE_PERI.BmcToNcRxStatus.r32; - if(stat.bits.New) + if (stat.bits.New) { - if(stat.bits.Bad) + if (stat.bits.Bad) { // TODO: ACK bad packet. APE_PERI.BmcToNcRxControl.bits.ResetBad = 1; - while(APE_PERI.BmcToNcRxControl.bits.ResetBad); + while (APE_PERI.BmcToNcRxControl.bits.ResetBad) + { + // Wait + } } else { int32_t bytes = stat.bits.PacketLength; - if(!stat.bits.Passthru) + if (!stat.bits.Passthru) { // stat.print(); int32_t words = DIVIDE_RND_UP(bytes, sizeof(uint32_t)); int i = 0; - while(words--) + while (words--) { uint32_t word = (APE_PERI.BmcToNcReadBuffer.r32); buffer[i] = word; i++; } - NetworkFrame_t *frame = ((NetworkFrame_t*)buffer); + NetworkFrame_t *frame = ((NetworkFrame_t *)buffer); handleNCSIFrame(frame); } @@ -144,7 +148,7 @@ void __attribute__((noreturn)) loaderLoop(void) SHM.SegSig.bits.Sig = SHM_SEG_SIG_SIG_LOADER; SHM.FwStatus.bits.Ready = 1; - for(;;) + for (;;) { handleBMCPacket(); Network_PassthroughRxPatcket(); @@ -47,7 +47,6 @@ #include <APE_APE.h> #include <APE_APE_PERI.h> #include <APE_DEVICE.h> - #include <Network.h> void initRMU(void) @@ -60,14 +59,17 @@ void initRMU(void) mode.bits.ICodePIPRdDisable = 1; APE.Mode = mode; - // Optionally, set REG_APE__RMU_CONTROL to RST_RX|RST_TX. This can help unwedge the state machines if you wedged them previously due to a bug in your code. + // Optionally, set REG_APE__RMU_CONTROL to RST_RX|RST_TX. This can help + // unwedge the state machines if you wedged them previously due to a bug in + // your code. RegAPE_PERIRmuControl_t rmuControl; rmuControl.r32 = 0; rmuControl.bits.ResetTX = 1; rmuControl.bits.ResetRX = 1; APE_PERI.RmuControl = rmuControl; - // Now set REG_APE__RMU_CONTROL to AUTO_DRV|RX|TX. Also set bits 19 and 20 (meaning unknown). + // Now set REG_APE__RMU_CONTROL to AUTO_DRV|RX|TX. Also set bits 19 and 20 + // (meaning unknown). rmuControl.r32 = 0; rmuControl.bits.AutoDrv = 1; rmuControl.bits.RX = 1; @@ -75,13 +77,16 @@ void initRMU(void) rmuControl.r32 |= (1 << 19) | (1 << 20); APE_PERI.RmuControl = rmuControl; - // Set REG_APE__BMC_NC_RX_CONTROL to FLOW_CONTROL=0 or 1, HWM=0x240, XON_THRESHOLD=0x201F. - // Note: FLOW_CONTROL=1 enables the hardware to automatically send PAUSE frames to the BMC. tcpdump can detect these, so keeping flow control on gives you a way to detect when the RX state machine has gotten wedged. + // Set REG_APE__BMC_NC_RX_CONTROL to FLOW_CONTROL=0 or 1, HWM=0x240, + // XON_THRESHOLD=0x201F. Note: FLOW_CONTROL=1 enables the hardware to + // automatically send PAUSE frames to the BMC. tcpdump can detect these, so + // keeping flow control on gives you a way to detect when the RX state + // machine has gotten wedged. RegAPE_PERIBmcToNcRxControl_t rxControl; rxControl.r32 = 0; rxControl.bits.FlowControl = 1; rxControl.bits.HWM = 0x240; - rxControl.r32 |= (0x201F << 11) ; /* XON_THRESHOLD */ + rxControl.r32 |= (0x201F << 11); /* XON_THRESHOLD */ APE_PERI.BmcToNcRxControl = rxControl; // Set REG_APE__NC_BMC_TX_CONTROL to 0. @@ -92,11 +97,12 @@ void initRMU(void) // Set all eight REG_APE__BMC_NC_RX_SRC_MAC_MATCHN_{HIGH,LOW} to zero. Network_SetMACAddr(0, 0, 1, true); - - // Set REG_APE__ARB_CONTROL as desired. Suggest PACKAGE_ID=0, TKNREL=0x14, START, and setting unknown bit 26 to 1. + // Set REG_APE__ARB_CONTROL as desired. Suggest PACKAGE_ID=0, TKNREL=0x14, + // START, and setting unknown bit 26 to 1. RegAPE_PERIArbControl_t arbControl; arbControl.r32 = (1 << 26); - arbControl.bits.PackageID = 0; /* TODO: allow to be configured as per NC-SI spec. */ + arbControl.bits.PackageID = + 0; /* TODO: allow to be configured as per NC-SI spec. */ arbControl.bits.Start = 1; arbControl.bits.TKNREL = 0x14; APE_PERI.ArbControl = arbControl; diff --git a/libs/APE/ape.c b/libs/APE/ape.c index 2f3d6ee..0dd2acb 100644 --- a/libs/APE/ape.c +++ b/libs/APE/ape.c @@ -51,7 +51,7 @@ void APE_aquireLock(void) lock_req.bits.Bootcode = 1; uint8_t function = DEVICE.Status.bits.FunctionNumber; - switch(function) + switch (function) { default: case 0: @@ -59,7 +59,7 @@ void APE_aquireLock(void) do { // spin - } while(lock_req.r32 != APE_PERI.PerLockGrantPhy0.r32); + } while (lock_req.r32 != APE_PERI.PerLockGrantPhy0.r32); return; case 1: @@ -67,7 +67,7 @@ void APE_aquireLock(void) do { // spin - } while(lock_req.r32 != APE_PERI.PerLockGrantPhy1.r32); + } while (lock_req.r32 != APE_PERI.PerLockGrantPhy1.r32); return; case 2: @@ -75,7 +75,7 @@ void APE_aquireLock(void) do { // spin - } while(lock_req.r32 != APE_PERI.PerLockGrantPhy2.r32); + } while (lock_req.r32 != APE_PERI.PerLockGrantPhy2.r32); return; case 3: @@ -83,10 +83,9 @@ void APE_aquireLock(void) do { // spin - } while(lock_req.r32 != APE_PERI.PerLockGrantPhy3.r32); + } while (lock_req.r32 != APE_PERI.PerLockGrantPhy3.r32); return; } - } void APE_releaseLock(void) @@ -96,7 +95,7 @@ void APE_releaseLock(void) lock_release.bits.Bootcode = 1; uint8_t function = DEVICE.Status.bits.FunctionNumber; - switch(function) + switch (function) { default: case 0: @@ -119,12 +118,12 @@ void APE_releaseAllLocks(void) lock_release.r32 = 0; lock_release.bits.Bootcode = 1; - APE_PERI.PerLockGrantPhy0.r32 = lock_release.r32; - APE_PERI.PerLockGrantGrc.r32 = lock_release.r32; - APE_PERI.PerLockGrantPhy1.r32 = lock_release.r32; - APE_PERI.PerLockGrantPhy2.r32 = lock_release.r32; - APE_PERI.PerLockGrantMem.r32 = lock_release.r32; - APE_PERI.PerLockGrantPhy3.r32 = lock_release.r32; - APE_PERI.PerLockGrantPort6.r32 = lock_release.r32; - APE_PERI.PerLockGrantGpio.r32 = lock_release.r32; + APE_PERI.PerLockGrantPhy0.r32 = lock_release.r32; + APE_PERI.PerLockGrantGrc.r32 = lock_release.r32; + APE_PERI.PerLockGrantPhy1.r32 = lock_release.r32; + APE_PERI.PerLockGrantPhy2.r32 = lock_release.r32; + APE_PERI.PerLockGrantMem.r32 = lock_release.r32; + APE_PERI.PerLockGrantPhy3.r32 = lock_release.r32; + APE_PERI.PerLockGrantPort6.r32 = lock_release.r32; + APE_PERI.PerLockGrantGpio.r32 = lock_release.r32; } diff --git a/libs/MII/mii.c b/libs/MII/mii.c index 51042d2..ad8e2ef 100644 --- a/libs/MII/mii.c +++ b/libs/MII/mii.c @@ -55,15 +55,17 @@ static void __attribute__((noinline)) MII_wait(void) uint8_t MII_getPhy(void) { - if(DEVICE.SgmiiStatus.bits.MediaSelectionMode) + if (DEVICE.SgmiiStatus.bits.MediaSelectionMode) { // SERDES platform - return DEVICE.Status.bits.FunctionNumber + DEVICE_MII_COMMUNICATION_PHY_ADDRESS_SGMII_0; + return DEVICE.Status.bits.FunctionNumber + + DEVICE_MII_COMMUNICATION_PHY_ADDRESS_SGMII_0; } else { // GPHY platform - return DEVICE.Status.bits.FunctionNumber + DEVICE_MII_COMMUNICATION_PHY_ADDRESS_PHY_0; + return DEVICE.Status.bits.FunctionNumber + + DEVICE_MII_COMMUNICATION_PHY_ADDRESS_PHY_0; } } @@ -114,16 +116,16 @@ static void MII_writeRegisterInternal(uint8_t phy, mii_reg_t reg, uint16_t data) MII_wait(); } - static uint16_t MII_readShadowRegister18(uint8_t phy, mii_reg_t reg) { - // Write register 18h, bits [2:0] = 111 This selects the Miscellaneous Control register, shadow 7h. - // All reads must be performed through the Miscellaneous Control register. - // Bit 15 = 0 This allows only bits [14:12] and bits [2:0] to be written. - // Bits [14:12] = zzz This selects shadow register zzz to be read. - // Bits [11: 3] = <don't care> When bit 15 = 0, these bits are ignored. - // Bits [2:0] = 111 This sets the Shadow Register Select to 111 (Miscellaneous Control register). - // Read register 18h Data read back is the value from shadow register zzz. + // Write register 18h, bits [2:0] = 111 This selects the Miscellaneous + // Control register, shadow 7h. All reads must be performed through the + // Miscellaneous Control register. Bit 15 = 0 This allows only bits [14:12] + // and bits [2:0] to be written. Bits [14:12] = zzz This selects shadow + // register zzz to be read. Bits [11: 3] = <don't care> When bit 15 = 0, + // these bits are ignored. Bits [2:0] = 111 This sets the Shadow Register + // Select to 111 (Miscellaneous Control register). Read register 18h Data + // read back is the value from shadow register zzz. // -------------------------------------------- // PHY 0x18 Shadow 0x1 register read Procedure @@ -163,11 +165,11 @@ static uint16_t MII_readShadowRegister1C(uint8_t phy, mii_reg_t reg) uint16_t MII_readRegister(uint8_t phy, mii_reg_t reg) { - if((reg & 0xFF) == 0x1C) + if ((reg & 0xFF) == 0x1C) { return MII_readShadowRegister1C(phy, reg); } - else if((reg & 0xFF) == 0x18) + else if ((reg & 0xFF) == 0x18) { return MII_readShadowRegister18(phy, reg); } @@ -179,9 +181,9 @@ uint16_t MII_readRegister(uint8_t phy, mii_reg_t reg) static void MII_writeShadowRegister18(uint8_t phy, mii_reg_t reg, uint16_t data) { - // Set Bits [15:3] = Preferred write values Bits [15:3] contain the desired bits to be written to. - // Set Bits [2:0] = yyy This enables shadow register yyy to be written. - // For shadow 7h, bit 15 must also be written. + // Set Bits [15:3] = Preferred write values Bits [15:3] contain the desired + // bits to be written to. Set Bits [2:0] = yyy This enables shadow register + // yyy to be written. For shadow 7h, bit 15 must also be written. // -------------------------------------------- // PHY 0x18 Shadow 0x2 register write Procedure @@ -195,13 +197,14 @@ static void MII_writeShadowRegister18(uint8_t phy, mii_reg_t reg, uint16_t data) shadow_select.r16 = 0; shadow_select.bits.ShadowRegisterReadSelector = shadow_reg; shadow_select.bits.ShadowRegisterSelector = 7; - MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_AUXILIARY_CONTROL, shadow_select.r16); + MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_AUXILIARY_CONTROL, + shadow_select.r16); RegMIIMiscellaneousControl_t write_data; write_data.r16 = data; write_data.bits.ShadowRegisterSelector = shadow_reg; - MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_AUXILIARY_CONTROL, write_data.r16); - + MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_AUXILIARY_CONTROL, + write_data.r16); } static void MII_writeShadowRegister1C(uint8_t phy, mii_reg_t reg, uint16_t data) @@ -217,23 +220,25 @@ static void MII_writeShadowRegister1C(uint8_t phy, mii_reg_t reg, uint16_t data) RegMIICabletronLed_t shadow_select; shadow_select.r16 = 0; shadow_select.bits.ShadowRegisterSelector = shadow_reg; - MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_CABLETRON_LED, shadow_select.r16); + MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_CABLETRON_LED, + shadow_select.r16); RegMIICabletronLed_t write_data; write_data.r16 = data; write_data.bits.ShadowRegisterSelector = shadow_reg; write_data.bits.WriteEnable = 1; - MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_CABLETRON_LED, write_data.r16); + MII_writeRegisterInternal(phy, (mii_reg_t)REG_MII_CABLETRON_LED, + write_data.r16); } void MII_writeRegister(uint8_t phy, mii_reg_t reg, uint16_t data) { - if((reg & 0xFF) == 0x1C) + if ((reg & 0xFF) == 0x1C) { MII_writeShadowRegister1C(phy, reg, data); } - else if((reg & 0xFF) == 0x18) + else if ((reg & 0xFF) == 0x18) { MII_writeShadowRegister18(phy, reg, data); } @@ -263,5 +268,6 @@ void MII_reset(uint8_t phy) do { // Spin - } while((MII_readRegister(phy, (mii_reg_t)REG_MII_CONTROL) & MII_CONTROL_RESET_MASK) == MII_CONTROL_RESET_MASK); + } while ((MII_readRegister(phy, (mii_reg_t)REG_MII_CONTROL) & + MII_CONTROL_RESET_MASK) == MII_CONTROL_RESET_MASK); } diff --git a/libs/NCSI/tests/valid_commands.c b/libs/NCSI/tests/valid_commands.c index 1667f0f..5288f4f 100644 --- a/libs/NCSI/tests/valid_commands.c +++ b/libs/NCSI/tests/valid_commands.c @@ -1,146 +1,177 @@ #include <stdint.h> - // Select Packate uint8_t select_package1[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xed, 0x01, 0x1f, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0xff, 0xff, 0xfd, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xed, 0x01, 0x1f, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0xff, 0xff, 0xfd, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t select_package1_len = sizeof(select_package1); // Clear Initial State uint8_t clear_initial_state[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xff, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t clear_initial_state_len = sizeof(clear_initial_state); // Disable VLAN uint8_t disable_vlan[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xef, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf2, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xef, 0x0d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf2, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t disable_vlan_len = sizeof(disable_vlan); // Set MAC Address uint8_t set_mac_addr[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x09, - 0x4d, 0x00, 0x01, 0x4a, 0x01, 0x01, 0xff, 0xff, 0x75, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x09, 0x4d, + 0x00, 0x01, 0x4a, 0x01, 0x01, 0xff, 0xff, 0x75, 0xb3, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t set_mac_addr_len = sizeof(set_mac_addr); // Enable Broadcast Filter uint8_t enable_bcast_filter[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf1, 0x10, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0xff, 0xff, 0xee, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf1, 0x10, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0f, 0xff, 0xff, 0xee, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t enable_bcast_filter_len = sizeof(enable_bcast_filter); // Enable Network TX uint8_t enable_network_tx[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf2, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf9, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf2, 0x06, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, + 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t enable_network_tx_len = sizeof(enable_network_tx); // Enable Channel uint8_t enable_channel[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xfc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf3, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfc, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t enable_channel_len = sizeof(enable_channel); // AEN Enable uint8_t aen_enable[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf4, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xf6, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf4, 0x08, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xf6, 0xfc, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t aen_enable_len = sizeof(aen_enable); // Get Link Status Ch0 uint8_t get_link_status_ch0[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf5, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf5, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf5, 0x0a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t get_link_status_ch0_len = sizeof(get_link_status_ch0); // Select Package uint8_t select_package2[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xf8, 0x01, 0x1f, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0xff, 0xff, 0xfd, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xf8, 0x01, 0x1f, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0xff, 0xff, 0xfd, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t select_package2_len = sizeof(select_package2); // Get Link Status Ch1 uint8_t get_link_status_ch1[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xfa, 0x0a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf5, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xfa, 0x0a, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, + 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t get_link_status_ch1_len = sizeof(get_link_status_ch1); // Get Link Status Ch2 uint8_t get_link_status_ch2[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xfb, 0x0a, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf5, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xfb, 0x0a, 0x02, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t get_link_status_ch2_len = sizeof(get_link_status_ch2); // Get Link Status Ch3 uint8_t get_link_status_ch3[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xfc, 0x0a, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xfc, 0x0a, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf5, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t get_link_status_ch3_len = sizeof(get_link_status_ch3); // Disable Network Tx uint8_t disable_network_tx[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xfd, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xfd, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t disable_network_tx_len = sizeof(disable_network_tx); // Disable Channel uint8_t disable_channel[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xfe, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0xff, 0xff, 0xfa, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xfe, 0x04, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0xff, 0xff, 0xfa, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t disable_channel_len = sizeof(disable_channel); // Deselect Package uint8_t deselect_package[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88, 0xf8, 0x00, 0x01, - 0x00, 0xff, 0x02, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xfc, 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x88, 0xf8, 0x00, 0x01, 0x00, 0xff, 0x02, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfc, + 0xe1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; uint32_t deselect_package_len = sizeof(deselect_package); diff --git a/libs/NVRam/crc.c b/libs/NVRam/crc.c index dc1d560..d3dd384 100644 --- a/libs/NVRam/crc.c +++ b/libs/NVRam/crc.c @@ -47,8 +47,8 @@ #define CRC32_POLYNOMIAL 0xEDB88320 uint32_t NVRam_crc(const uint8_t *pcDatabuf, // Pointer to data buffer - uint32_t ulDatalen, // Length of data buffer in bytes - uint32_t crc) // Initial value + uint32_t ulDatalen, // Length of data buffer in bytes + uint32_t crc) // Initial value { uint8_t data; uint32_t idx, bit; diff --git a/libs/NVRam/nvm.c b/libs/NVRam/nvm.c index dbbad58..bf494f6 100644 --- a/libs/NVRam/nvm.c +++ b/libs/NVRam/nvm.c @@ -108,7 +108,6 @@ void NVRam_disableWrites(void) NVM.Access.bits.WriteEnable = 0; } - static inline void NVRam_waitDone(void) { while (!NVM.Command.bits.Done) @@ -223,7 +222,7 @@ void NVRam_read(uint32_t address, uint32_t *buffer, size_t words) void NVRam_writeWord(uint32_t address, uint32_t data) { - if(data != NVRam_readWord(address)) + if (data != NVRam_readWord(address)) { // Only write if different. diff --git a/libs/elfio/elf_examples/hello.c b/libs/elfio/elf_examples/hello.c index 65f198c..07dcbd7 100644 --- a/libs/elfio/elf_examples/hello.c +++ b/libs/elfio/elf_examples/hello.c @@ -2,7 +2,7 @@ int main() { - printf( "Hello\n" ); + printf("Hello\n"); return 0; } diff --git a/stage1/main.c b/stage1/main.c index 5469fbd..5a8a1fa 100644 --- a/stage1/main.c +++ b/stage1/main.c @@ -47,22 +47,20 @@ #if CXX_SIMULATOR #include <HAL.hpp> #include <endian.h> -#define crc_swap(__x__) (__x__) /* No swapping needed on the host */ +#define crc_swap(__x__) (__x__) /* No swapping needed on the host */ #else #define be32toh(__x__) (__x__) -#define crc_swap(__x__) ((((__x__) & 0x000000FF) << 24) | \ - (((__x__) & 0x0000FF00) << 8 ) | \ - (((__x__) & 0x00FF0000) >> 8 ) | \ - (((__x__) & 0xFF000000) >> 24)) +#define crc_swap(__x__) \ + ((((__x__)&0x000000FF) << 24) | (((__x__)&0x0000FF00) << 8) | \ + (((__x__)&0x00FF0000) >> 8) | (((__x__)&0xFF000000) >> 24)) #endif +#include <APE.h> #include <NVRam.h> +#include <bcm5719_APE.h> #include <bcm5719_BOOTCODE.h> -#include <bcm5719_GEN.h> #include <bcm5719_DEVICE.h> -#include <bcm5719_APE.h> +#include <bcm5719_GEN.h> #include <bcm5719_SHM.h> -#include <APE.h> - #include <string.h> NVRAMContents_t gNVMContents; @@ -70,12 +68,12 @@ NVRAMContents_t gNVMContents; int main() { reportStatus(STATUS_MAIN, 0); - uint32_t* bootcode_dest; + uint32_t *bootcode_dest; #if CXX_SIMULATOR initHAL(NULL); - bootcode_dest = (uint32_t*)malloc(REG_BOOTCODE_SIZE); + bootcode_dest = (uint32_t *)malloc(REG_BOOTCODE_SIZE); #else - bootcode_dest = (uint32_t*)&BOOTCODE; + bootcode_dest = (uint32_t *)&BOOTCODE; #endif #if !CXX_SIMULATOR @@ -110,7 +108,7 @@ int main() SHM.RcpuCpmuStatus.bits.Status = (DEVICE.Status.r32 & 0xFFFF0000) >> 16; SHM.RcpuCpmuStatus.bits.Address = SHM_RCPU_CPMU_STATUS_ADDRESS_ADDRESS; - if(SHM_RCPU_SEG_SIG_SIG_RCPU_MAGIC != SHM.RcpuSegSig.bits.Sig) + if (SHM_RCPU_SEG_SIG_SIG_RCPU_MAGIC != SHM.RcpuSegSig.bits.Sig) { SHM.RcpuInitCount.r32 = 1; } @@ -125,8 +123,7 @@ int main() // Mark it as valid. SHM.RcpuSegLength.r32 = 0x34; - SHM.RcpuSegSig.bits.Sig = SHM_RCPU_SEG_SIG_SIG_RCPU_MAGIC; - + SHM.RcpuSegSig.bits.Sig = SHM_RCPU_SEG_SIG_SIG_RCPU_MAGIC; // Set GEN_FIRMWARE_MBOX to BOOTCODE_READY_MAGIC. reportStatus(GEN_GEN_DATA_SIG_SIG_DRIVER_READY, 0); @@ -138,7 +135,7 @@ int main() APE_releaseAllLocks(); DEVICE.RxCpuEventEnable.bits.VPDAttention = 1; - for(;;) + for (;;) { // APE heartbeat. // APE.RcpuApeResetCount.r32 = APE.RcpuApeResetCount.r32 + 1; @@ -146,21 +143,19 @@ int main() // APE.RcpuLastApeFwStatus.r32 = APE.FwStatus.r32; // Spin - if(DEVICE.RxCpuEvent.bits.VPDAttention) + if (DEVICE.RxCpuEvent.bits.VPDAttention) { uint32_t vpd_offset = DEVICE.PciVpdRequest.bits.RequestedVPDOffset; - union - { + union { uint8_t r8[4]; uint32_t r32; } vpd_data; vpd_data.r8[0] = gNVMContents.vpd.bytes[vpd_offset]; - vpd_data.r8[1] = gNVMContents.vpd.bytes[vpd_offset+1]; - vpd_data.r8[2] = gNVMContents.vpd.bytes[vpd_offset+2]; - vpd_data.r8[3] = gNVMContents.vpd.bytes[vpd_offset+3]; + vpd_data.r8[1] = gNVMContents.vpd.bytes[vpd_offset + 1]; + vpd_data.r8[2] = gNVMContents.vpd.bytes[vpd_offset + 2]; + vpd_data.r8[3] = gNVMContents.vpd.bytes[vpd_offset + 3]; DEVICE.PciVpdResponse.r32 = vpd_data.r32; } } - } diff --git a/utils/bcmregtool/apeloader/main.c b/utils/bcmregtool/apeloader/main.c index 71e25c5..0aa4c2e 100644 --- a/utils/bcmregtool/apeloader/main.c +++ b/utils/bcmregtool/apeloader/main.c @@ -52,15 +52,18 @@ int __start() SHM.SegSig.bits.Sig = SHM_SEG_SIG_SIG_LOADER; SHM.FwStatus.bits.Ready = 1; - for(;;) + for (;;) { uint32_t command = SHM.LoaderCommand.bits.Command; - if(!command) continue; + if (!command) + { + continue; + } uint32_t arg0 = SHM.LoaderArg0.r32; uint32_t arg1 = SHM.LoaderArg1.r32; - switch(command) + switch (command) { default: break; @@ -68,21 +71,21 @@ int __start() case SHM_LOADER_COMMAND_COMMAND_READ_MEM: { // Read word address specified in arg0 - uint32_t* addr = ((void*)arg0); + uint32_t *addr = ((void *)arg0); SHM.LoaderArg0.r32 = *addr; break; } case SHM_LOADER_COMMAND_COMMAND_WRITE_MEM: { // Write word address specified in arg0 with arg1 - uint32_t* addr = ((void*)arg0); + uint32_t *addr = ((void *)arg0); *addr = arg1; break; } case SHM_LOADER_COMMAND_COMMAND_CALL: { // call address specified in arg0. - void (*function)(uint32_t) = ((void*)arg0); + void (*function)(uint32_t) = ((void *)arg0); function(arg1); break; } @@ -91,5 +94,4 @@ int __start() // Mark command as handled. SHM.LoaderCommand.bits.Command = 0; } - }
\ No newline at end of file |