11#ifndef EVT_FMC_HPP
22#define EVT_FMC_HPP
33
4+ /* *
5+ * FMC SDRAM driver for STM32F4 series.
6+ *
7+ * Provides a C++ abstraction for configuring and accessing external SDRAM
8+ * using the Flexible Memory Controller (FMC) peripheral.
9+ *
10+ * This driver wraps STM32 HAL functionality and simplifies:
11+ * - GPIO configuration for FMC pins
12+ * - SDRAM timing configuration
13+ * - SDRAM read/write operations
14+ *
15+ * @note Requires STM32 HAL libraries.
16+ */
17+
418#include " HALf4/stm32f4xx_hal.h"
519#include " HALf4/stm32f4xx_ll_fmc.h"
620#include " HALf4/stm32f4xx_hal_sdram.h"
@@ -106,12 +120,20 @@ typedef FMC_GPIO FMC_CMD;
106120
107121namespace core ::io {
108122
123+ /* *
124+ * Driver for configuring and accessing external SDRAM via FMC.
125+ *
126+ * Class initializes the FMC peripheral and associated GPIO pins,
127+ * configures SDRAM timing parameters, and provides simple 32-bit
128+ * memory read/write access methods.
129+ */
109130class FMCf4xx {
110131public:
111132 /* *
112133 * Structure to simplify SDRAM initialization, pre-filled with default values
113134 *
114- * Holds all the parameters needed to configure the SDRAM
135+ * Holds all SDRAM controller settings that map directly to
136+ * the HAL_SDRAM_Init configuration structure.
115137 */
116138 struct SdramInitConfig {
117139 FMC_SDRAM_TypeDef* sdramDevice = FMC_SDRAM_DEVICE ;
@@ -130,7 +152,7 @@ class FMCf4xx {
130152 /* *
131153 * Structure to simplify SDRAM timing initialization, pre-filled with default values
132154 *
133- * Holds all the parameters needed to configure the SDRAM timing
155+ * Contains all required SDRAM timing delays in clock cycles.
134156 */
135157 struct SdramTimingConfig {
136158 uint32_t loadToActiveDelay = LOAD_MODE_REGISTER_TO_ACTIVE ;
@@ -183,7 +205,14 @@ class FMCf4xx {
183205 };
184206
185207 /* *
186- * Structure to hold all FMC GPIO pins
208+ * Groups all FMC GPIO pin configurations.
209+ *
210+ * Contains arrays of:
211+ * - Address pins
212+ * - Data pins
213+ * - Bank select pins
214+ * - Command pins
215+ * - Byte enable pins
187216 */
188217 struct FMCPinConfig {
189218 FMCAddressPins address;
@@ -196,11 +225,16 @@ class FMCf4xx {
196225 /* *
197226 * Initializes an FMC device
198227 *
199- * @param[in] pin_config a struct containing all FMC GPIO pin group arrays
200- * @param[in] sdramInitConfig a struct containing all FMC SDRAM configuration
201- * @param[in] sdramTimingConfig a struct containing all FMC SDRAM timing configuration variables
228+ * @param[in] pinConfig All FMC GPIO pin configurations.
229+ * @param[in] sdramInitConfig SDRAM controller configuration parameters.
230+ * @param[in] sdramTimingConfig SDRAM timing configuration parameters.
231+ *
232+ * - Enables FMC peripheral clock
233+ * - Initializes GPIO pins
234+ * - Configures SDRAM controller
235+ * - Calls HAL_SDRAM_Init()
202236 */
203- FMCf4xx (FMCPinConfig pin_config , SdramInitConfig sdramInitConfig, SdramTimingConfig sdramTimingConfig);
237+ FMCf4xx (FMCPinConfig pinConfig , SdramInitConfig sdramInitConfig, SdramTimingConfig sdramTimingConfig);
204238
205239 /* *
206240 * Write a value to SDRAM at the specified byte offset.
0 commit comments