1919#include " HALf4/stm32f4xx_ll_fmc.h"
2020#include " HALf4/stm32f4xx_hal_sdram.h"
2121
22+ #include " core/io/FMC.hpp"
23+
2224#define SDRAM_TIMEOUT (0x0000FFFFUL )
2325
2426typedef struct {
@@ -127,7 +129,7 @@ namespace core::io {
127129 * configures SDRAM timing parameters, and provides simple 32-bit
128130 * memory read/write access methods.
129131 */
130- class FMCf4xx {
132+ class FMCf4xx : public FMC {
131133public:
132134 /* *
133135 * Structure to simplify SDRAM initialization, pre-filled with default values
@@ -236,20 +238,9 @@ class FMCf4xx {
236238 */
237239 FMCf4xx (FMCPinConfig pinConfig, SdramInitConfig sdramInitConfig, SdramTimingConfig sdramTimingConfig);
238240
239- /* *
240- * Write a value to SDRAM at the specified byte offset.
241- *
242- * @param[in] offset Byte offset from the SDRAM base address
243- * @param[in] value Value to write to memory
244- */
245241 void write32 (uint32_t offset, uint32_t value) const ;
246242
247- /* *
248- * Read a value SDRAM at the specified byte offset.
249- *
250- * @param[in] offset Byte offset from the SDRAM base address
251- */
252- [[nodiscard]] uint32_t read32 (uint32_t offset) const ;
243+ uint32_t read32 (uint32_t offset) const ;
253244
254245private:
255246 /* *
@@ -267,14 +258,17 @@ class FMCf4xx {
267258 */
268259 void InitPinGroup (const FMC_GPIO * pins, uint8_t count);
269260
261+ /* *
262+ * @return the base address depending on the bank number
263+ */
264+ uint32_t getSdramBaseAddress ();
265+
270266 SdramInitConfig sdramInitConfig;
271267 SdramTimingConfig sdramTimingConfig;
272268 FMCPinConfig fmcPinConfig;
273269
274270 SDRAM_HandleTypeDef sdram;
275271 FMC_SDRAM_TimingTypeDef sdramTiming;
276-
277- uint32_t sdramMemoryAddress; // address to read and write to
278272};
279273
280274}
0 commit comments