aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2020-05-24 15:02:00 -0700
committerGitHub <noreply@github.com>2020-05-24 23:02:00 +0100
commit2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8 (patch)
tree69472e54f5e9302fb233f4086a20724349f6a1d6 /drivers
parentf66680d233d1abf61a38d3704a99941c62bfebbc (diff)
downloadfirmware-2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8.tar.gz
firmware-2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8.tar.bz2
firmware-2ac3a51d71a05fe46fc6967797b0d34d8fb3fcd8.zip
Fix SPI EEPROM compile issue when Console is enabled (#9193)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/eeprom/eeprom_spi.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/eeprom/eeprom_spi.c b/drivers/eeprom/eeprom_spi.c
index e10aaf14c..7b6416eaf 100644
--- a/drivers/eeprom/eeprom_spi.c
+++ b/drivers/eeprom/eeprom_spi.c
@@ -50,8 +50,9 @@
# define EXTERNAL_EEPROM_SPI_TIMEOUT 100
#endif
-#ifdef CONSOLE_ENABLE
-# include "print.h"
+#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
+# include "timer.h"
+# include "debug.h"
#endif // CONSOLE_ENABLE
static void init_spi_if_required(void) {
@@ -93,7 +94,7 @@ static void spi_eeprom_transmit_address(uintptr_t addr) {
void eeprom_driver_init(void) {}
void eeprom_driver_erase(void) {
-#ifdef CONSOLE_ENABLE
+#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
uint32_t start = timer_read32();
#endif
@@ -103,7 +104,7 @@ void eeprom_driver_erase(void) {
eeprom_write_block(buf, (void *)(uintptr_t)addr, EXTERNAL_EEPROM_PAGE_SIZE);
}
-#ifdef CONSOLE_ENABLE
+#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
dprintf("EEPROM erase took %ldms to complete\n", ((long)(timer_read32() - start)));
#endif
}
@@ -141,7 +142,7 @@ void eeprom_read_block(void *buf, const void *addr, size_t len) {
spi_eeprom_transmit_address((uintptr_t)addr);
spi_receive(buf, len);
-#ifdef DEBUG_EEPROM_OUTPUT
+#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
dprintf("[EEPROM R] 0x%08lX: ", ((uint32_t)(uintptr_t)addr));
for (size_t i = 0; i < len; ++i) {
dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
@@ -200,7 +201,7 @@ void eeprom_write_block(const void *buf, void *addr, size_t len) {
return;
}
-#ifdef DEBUG_EEPROM_OUTPUT
+#if defined(CONSOLE_ENABLE) && defined(DEBUG_EEPROM_OUTPUT)
dprintf("[EEPROM W] 0x%08lX: ", ((uint32_t)(uintptr_t)target_addr));
for (size_t i = 0; i < write_length; i++) {
dprintf(" %02X", (int)(uint8_t)(read_buf[i]));