summaryrefslogtreecommitdiffstats
path: root/libs/NVRam
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2019-02-09 18:09:33 -0700
committerEvan Lojewski <github@meklort.com>2019-02-09 18:09:33 -0700
commit3cfa5c59e6a69106fefdbd35f39ab1179a49959f (patch)
tree12937af676b44775c03b95c56b637aebc06fa36a /libs/NVRam
parentc9ff2c0b1ca53e3c4a199da7e4804499c88bdbae (diff)
downloadbcm5719-ortega-3cfa5c59e6a69106fefdbd35f39ab1179a49959f.tar.gz
bcm5719-ortega-3cfa5c59e6a69106fefdbd35f39ab1179a49959f.zip
Do a manual clang-format run
Diffstat (limited to 'libs/NVRam')
-rw-r--r--libs/NVRam/crc.c10
-rw-r--r--libs/NVRam/include/NVRam.h17
-rw-r--r--libs/NVRam/nvm.c62
3 files changed, 44 insertions, 45 deletions
diff --git a/libs/NVRam/crc.c b/libs/NVRam/crc.c
index ec4d66e..b2d8f73 100644
--- a/libs/NVRam/crc.c
+++ b/libs/NVRam/crc.c
@@ -2,7 +2,7 @@
///
/// @file crc.c
///
-/// @project
+/// @project
///
/// @brief CRC Support Routines
///
@@ -46,10 +46,9 @@
#define CRC32_POLYNOMIAL 0xEDB88320
-uint32_t NVRam_crc (
- uint8_t *pcDatabuf, // Pointer to data buffer
- uint32_t ulDatalen, // Length of data buffer in bytes
- uint32_t crc) // Initial value
+uint32_t NVRam_crc(uint8_t *pcDatabuf, // Pointer to data buffer
+ uint32_t ulDatalen, // Length of data buffer in bytes
+ uint32_t crc) // Initial value
{
uint8_t data;
uint32_t idx, bit;
@@ -61,5 +60,6 @@ uint32_t NVRam_crc (
crc = (crc >> 1) ^ (((crc ^ data) & 1) ? CRC32_POLYNOMIAL : 0);
}
}
+
return crc;
}
diff --git a/libs/NVRam/include/NVRam.h b/libs/NVRam/include/NVRam.h
index 5f2fcfb..3d995ff 100644
--- a/libs/NVRam/include/NVRam.h
+++ b/libs/NVRam/include/NVRam.h
@@ -2,7 +2,7 @@
///
/// @file NVRam.h
///
-/// @project
+/// @project
///
/// @brief NVRam Support Routines
///
@@ -44,25 +44,24 @@
#ifndef NVRAM_H
#define NVRAM_H
-#include <stdint.h>
-#include <stddef.h>
#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
bool NVRam_acquireLock(void);
bool NVRam_releaseLock(void);
uint32_t NVRam_readWord(uint32_t address);
-void NVRam_read(uint32_t address, uint32_t* buffer, size_t words);
+void NVRam_read(uint32_t address, uint32_t *buffer, size_t words);
void NVRam_writeWord(uint32_t address, uint32_t data);
-void NVRam_write(uint32_t address, uint32_t* buffer, size_t words);
+void NVRam_write(uint32_t address, uint32_t *buffer, size_t words);
void NVRam_enable(void);
void NVRam_disable(void);
-uint32_t NVRam_crc(
- uint8_t *pcDatabuf, // Pointer to data buffer
- uint32_t ulDatalen, // Length of data buffer in bytes
- uint32_t crc); // Initial value
+uint32_t NVRam_crc(uint8_t *pcDatabuf, // Pointer to data buffer
+ uint32_t ulDatalen, // Length of data buffer in bytes
+ uint32_t crc); // Initial value
#endif /* NVRAM_H */
diff --git a/libs/NVRam/nvm.c b/libs/NVRam/nvm.c
index 2e3e965..bfd35f7 100644
--- a/libs/NVRam/nvm.c
+++ b/libs/NVRam/nvm.c
@@ -2,7 +2,7 @@
///
/// @file NVRam.c
///
-/// @project
+/// @project
///
/// @brief NVRam Support Routines
///
@@ -41,31 +41,31 @@
/// POSSIBILITY OF SUCH DAMAGE.
/// @endcond
////////////////////////////////////////////////////////////////////////////////
-#include <NVRam.h>
#include "bcm5719_NVM.h"
-#define ATMEL_AT45DB0X1B_PAGE_POS (9u)
-#define ATMEL_AT45DB0X1B_PAGE_SIZE (264u)
-#define ATMEL_AT45DB0X1B_ERASE (false)
+#include <NVRam.h>
+
+#define ATMEL_AT45DB0X1B_PAGE_POS (9u)
+#define ATMEL_AT45DB0X1B_PAGE_SIZE (264u)
+#define ATMEL_AT45DB0X1B_ERASE (false)
-#define PAGE_POS ATMEL_AT45DB0X1B_PAGE_POS
-#define PAGE_SIZE ATMEL_AT45DB0X1B_PAGE_SIZE
-#define NEEDS_ERASE ATMEL_AT45DB0X1B_ERASE
+#define PAGE_POS ATMEL_AT45DB0X1B_PAGE_POS
+#define PAGE_SIZE ATMEL_AT45DB0X1B_PAGE_SIZE
+#define NEEDS_ERASE ATMEL_AT45DB0X1B_ERASE
#ifdef CXX_SIMULATOR
#include <arpa/inet.h>
-#define REQ ReqSet2
-#define CLR ReqClr2
-#define WON ArbWon2
+#define REQ ReqSet2
+#define CLR ReqClr2
+#define WON ArbWon2
#else /* Firmware */
-#define ntohl(__x__) (__x__)
-#define htonl(__x__) (__x__)
-#define REQ ReqSet0
-#define CLR ReqClr0
-#define WON ArbWon0
+#define ntohl(__x__) (__x__)
+#define htonl(__x__) (__x__)
+#define REQ ReqSet0
+#define CLR ReqClr0
+#define WON ArbWon0
#endif
-
/**
* @fn uint32_t NVRam_translate(uint32_t address)
*
@@ -85,7 +85,7 @@ static inline uint32_t NVRam_translate(uint32_t address)
}
#else
return address;
-#endif
+#endif
}
void NVRam_enable(void)
@@ -102,9 +102,8 @@ void NVRam_disable(void)
static inline void NVRam_waitDone(void)
{
- while(!NVM.Command.bits.Done)
+ while (!NVM.Command.bits.Done)
{
-
}
}
@@ -113,7 +112,7 @@ bool NVRam_acquireLock(void)
// Grab lock
NVM.SoftwareArbitration.bits.REQ = 1;
- while(!NVM.SoftwareArbitration.bits.WON)
+ while (!NVM.SoftwareArbitration.bits.WON)
{
// Spin
}
@@ -144,7 +143,8 @@ static uint32_t NVRam_readWordInternal(uint32_t address, RegNVMCommand_t cmd)
return ntohl(NVM.Read.r32);
}
-static void NVRam_writeWordInternal(uint32_t address, uint32_t data, RegNVMCommand_t cmd)
+static void NVRam_writeWordInternal(uint32_t address, uint32_t data,
+ RegNVMCommand_t cmd)
{
address = NVRam_translate(address);
@@ -170,9 +170,9 @@ uint32_t NVRam_readWord(uint32_t address)
return NVRam_readWordInternal(address, cmd);
}
-void NVRam_read(uint32_t address, uint32_t* buffer, size_t words)
+void NVRam_read(uint32_t address, uint32_t *buffer, size_t words)
{
- if(!words)
+ if (!words)
{
// No data to read.
return;
@@ -183,9 +183,9 @@ void NVRam_read(uint32_t address, uint32_t* buffer, size_t words)
cmd.bits.Doit = 1;
cmd.bits.First = 1;
- while(words)
+ while (words)
{
- if(1 == words)
+ if (1 == words)
{
// Last word.
cmd.bits.Last = 1;
@@ -194,7 +194,7 @@ void NVRam_read(uint32_t address, uint32_t* buffer, size_t words)
*buffer = NVRam_readWordInternal(address, cmd);
buffer++;
words--;
- address +=4;
+ address += 4;
// If we have more than one word, clear the first bit.
cmd.bits.First = 0;
@@ -212,9 +212,9 @@ void NVRam_writeWord(uint32_t address, uint32_t data)
NVRam_writeWordInternal(address, data, cmd);
}
-void NVRam_write(uint32_t address, uint32_t* buffer, size_t words)
+void NVRam_write(uint32_t address, uint32_t *buffer, size_t words)
{
- if(!words)
+ if (!words)
{
// No bytes to read.
return;
@@ -226,9 +226,9 @@ void NVRam_write(uint32_t address, uint32_t* buffer, size_t words)
cmd.bits.First = 1;
cmd.bits.Wr = 1;
- while(words)
+ while (words)
{
- if(1 == words)
+ if (1 == words)
{
// Last word.
cmd.bits.Last = 1;
OpenPOWER on IntegriCloud