diff options
author | Fredrik Thulin <fredrik@thulin.net> | 2016-05-23 21:59:17 +0200 |
---|---|---|
committer | Fredrik Thulin <fredrik@thulin.net> | 2016-05-23 21:59:17 +0200 |
commit | 6265025f7cd7f606b6da62c7add13a6008500cf7 (patch) | |
tree | 7761c2a2136ed59fab776c6e2c78427a3082fd10 /stm-fmc.h | |
parent | 50f9d40503e5f9cb24241c4c584db3cb94af07aa (diff) |
SDRAM initialization and test code from Pavel.
Integrated into the cli-test program as such:
cryptech> test sdram
Initializing SDRAM
Starting SDRAM test (n = 0)
Run sequential write-then-read test for the first chip
Run random write-then-read test for the first chip
Run sequential write-then-read test for the second chip
Run random write-then-read test for the second chip
Run interleaved write-then-read test for both chips at once
SDRAM test (n = 0) completed
SDRAM test completed successfully
cryptech>
Diffstat (limited to 'stm-fmc.h')
-rw-r--r-- | stm-fmc.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -44,8 +44,18 @@ #define FMC_NWAIT_IDLE GPIO_PIN_SET - -extern void fmc_init(void); +#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); |