From 25b502dec8b6205a96fc75d52689fd2ba9fd48bb Mon Sep 17 00:00:00 2001 From: Maciej Dudek Date: Tue, 24 Jan 2023 19:51:56 +0100 Subject: [PATCH] liblitedram: define SDRAM_WLC_DEBUG SDRAM_WLC_DEBUG is 0 or 1 based on SDRAM_WRITE_LATENCY_CALIBRATION_DEBUG. This reduces number of #ifdefs Signed-off-by: Maciej Dudek --- litex/soc/software/liblitedram/sdram.c | 29 +++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/litex/soc/software/liblitedram/sdram.c b/litex/soc/software/liblitedram/sdram.c index 688706996..6c14c6143 100644 --- a/litex/soc/software/liblitedram/sdram.c +++ b/litex/soc/software/liblitedram/sdram.c @@ -34,6 +34,12 @@ #ifdef CSR_SDRAM_BASE +#ifdef SDRAM_WRITE_LATENCY_CALIBRATION_DEBUG +#define SDRAM_WLC_DEBUG 1 +#else +#define SDRAM_WLC_DEBUG 0 +#endif + #if SDRAM_PHY_DELAYS > 32 #define MODULO (SDRAM_PHY_DELAYS/32) #else @@ -1085,9 +1091,9 @@ static void sdram_write_latency_calibration(void) { best_score = 0; best_bitslip = -1; for(bitslip=0; bitslip score ? subscore : score; /* Increment bitslip */ sdram_read_leveling_inc_bitslip(module); @@ -1130,9 +1135,9 @@ static void sdram_write_latency_calibration(void) { printf("m%d:- ", module); else printf("m%d:%d ", module, bitslip); -#ifdef SDRAM_WRITE_LATENCY_CALIBRATION_DEBUG - printf("\n"); -#endif + + if (SDRAM_WLC_DEBUG) + printf("\n"); /* Select best write window */ ddrphy_dly_sel_write(1 << module);