diff --git a/litex/soc/software/liblitedram/accessors.c b/litex/soc/software/liblitedram/accessors.c index 47c3b733f..75f03cdde 100644 --- a/litex/soc/software/liblitedram/accessors.c +++ b/litex/soc/software/liblitedram/accessors.c @@ -4,6 +4,10 @@ #if defined(CSR_SDRAM_BASE) && defined(CSR_DDRPHY_BASE) +/*----------------------------------------------------------------------------*/ +/* Read DQ Delays Reset/Increment Functions */ +/*----------------------------------------------------------------------------*/ + #if defined(SDRAM_PHY_READ_LEVELING_CAPABLE) int read_dq_delay[SDRAM_PHY_MODULES]; @@ -21,6 +25,10 @@ void read_rst_dq_delay(int module) { #endif // defined(SDRAM_PHY_READ_LEVELING_CAPABLE) +/*----------------------------------------------------------------------------*/ +/* Write DQ/DQS/Clk Delays Reset/Increment Functions */ +/*----------------------------------------------------------------------------*/ + #if defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) int sdram_clock_delay; @@ -94,6 +102,10 @@ void write_rst_delay(int module) { #endif // defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) +/*----------------------------------------------------------------------------*/ +/* Bitslip Delays Reset/Increment Functions */ +/*----------------------------------------------------------------------------*/ + #if defined(SDRAM_PHY_BITSLIPS) int read_dq_bitslip[SDRAM_PHY_MODULES]; @@ -124,6 +136,10 @@ void write_rst_dq_bitslip(int module) { #endif // defined(SDRAM_PHY_BITSLIPS) +/*----------------------------------------------------------------------------*/ +/* SDRAM Module Selection Functions */ +/*----------------------------------------------------------------------------*/ + void sdram_select(int module, int dq_line) { ddrphy_dly_sel_write(1 << module); @@ -148,6 +164,10 @@ void sdram_deselect(int module, int dq_line) { #endif } +/*----------------------------------------------------------------------------*/ +/* SDRAM Actions */ +/*----------------------------------------------------------------------------*/ + void sdram_leveling_action(int module, int dq_line, action_callback action) { /* Select module */ sdram_select(module, dq_line); diff --git a/litex/soc/software/liblitedram/accessors.h b/litex/soc/software/liblitedram/accessors.h index b411493a5..c3525195c 100644 --- a/litex/soc/software/liblitedram/accessors.h +++ b/litex/soc/software/liblitedram/accessors.h @@ -11,6 +11,10 @@ extern "C" { typedef void (*action_callback)(int module); +/*----------------------------------------------------------------------------*/ +/* Read DQ Delays Reset/Increment Functions */ +/*----------------------------------------------------------------------------*/ + #if defined(SDRAM_PHY_READ_LEVELING_CAPABLE) extern int read_dq_delay[SDRAM_PHY_MODULES]; @@ -19,6 +23,11 @@ void read_rst_dq_delay(int module); #endif // defined(SDRAM_PHY_READ_LEVELING_CAPABLE) + +/*----------------------------------------------------------------------------*/ +/* Write DQ/DQS/Clk Delays Reset/Increment Functions */ +/*----------------------------------------------------------------------------*/ + #if defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) extern int sdram_clock_delay; @@ -37,6 +46,10 @@ void write_rst_delay(int module); #endif // defined(SDRAM_PHY_WRITE_LEVELING_CAPABLE) +/*----------------------------------------------------------------------------*/ +/* Bitslip Delays Reset/Increment Functions */ +/*----------------------------------------------------------------------------*/ + #if defined(SDRAM_PHY_BITSLIPS) extern int read_dq_bitslip[SDRAM_PHY_MODULES]; @@ -49,8 +62,17 @@ void write_rst_dq_bitslip(int module); #endif // defined(SDRAM_PHY_BITSLIPS) +/*----------------------------------------------------------------------------*/ +/* SDRAM Module Selection Functions */ +/*----------------------------------------------------------------------------*/ + void sdram_select(int module, int dq_line); void sdram_deselect(int module, int dq_line); + +/*----------------------------------------------------------------------------*/ +/* SDRAM Actions */ +/*----------------------------------------------------------------------------*/ + void sdram_leveling_action(int module, int dq_line, action_callback action); #ifdef SDRAM_PHY_WRITE_LEVELING_CAPABLE