aboutsummaryrefslogtreecommitdiff
path: root/stm-fmc.h
diff options
context:
space:
mode:
Diffstat (limited to 'stm-fmc.h')
-rw-r--r--stm-fmc.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/stm-fmc.h b/stm-fmc.h
index 9e34d32..1e6a670 100644
--- a/stm-fmc.h
+++ b/stm-fmc.h
@@ -35,9 +35,27 @@
#ifndef __STM_FMC_H
#define __STM_FMC_H
-#include <stdint.h>
+#define FMC_FPGA_BASE_ADDR 0x60000000
+#define FMC_FPGA_ADDR_MASK 0x03FFFFFC // there are 26 physical lines, but "only" 24 usable for now
+#define FMC_FPGA_NWAIT_MAX_POLL_TICKS 10
-extern void fmc_init(void);
+#define FMC_GPIO_PORT_NWAIT GPIOD
+#define FMC_GPIO_PIN_NWAIT GPIO_PIN_6
+
+#define FMC_NWAIT_IDLE GPIO_PIN_SET
+
+#define fmc_af_gpio(port, pins) \
+ GPIO_InitStruct.Pin = pins; \
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; \
+ GPIO_InitStruct.Pull = GPIO_NOPULL; \
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; \
+ GPIO_InitStruct.Alternate = GPIO_AF12_FMC; \
+ __HAL_RCC_##port##_CLK_ENABLE(); \
+ HAL_GPIO_Init(port, &GPIO_InitStruct)
+
+
+extern HAL_StatusTypeDef fmc_init(void);
+extern void fmc_init_gpio(void);
extern int fmc_write_32(uint32_t addr, uint32_t *data);
extern int fmc_read_32(uint32_t addr, uint32_t *data);