BSP files for STM32H747I-Discovery Copy from ST Cube delivery
Dependents: DISCO_H747I_LCD_demo DISCO_H747I_AUDIO_demo
STM32H747I-Discovery/stm32h747i_discovery_sdram.h@3:bc403474b366, 2019-11-06 (annotated)
- Committer:
- Jerome Coutant
- Date:
- Wed Nov 06 11:32:01 2019 +0100
- Revision:
- 3:bc403474b366
- Parent:
- 0:146cf26a9bbb
Add PDM lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jerome Coutant
0:146cf26a9bbb
|
1
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
2
|
******************************************************************************
|
|
Jerome Coutant
0:146cf26a9bbb
|
3
|
* @file stm32h747i_discovery_sdram.h
|
|
Jerome Coutant
0:146cf26a9bbb
|
4
|
* @author MCD Application Team
|
|
Jerome Coutant
0:146cf26a9bbb
|
5
|
* @brief This file contains the common defines and functions prototypes for
|
|
Jerome Coutant
0:146cf26a9bbb
|
6
|
* the stm32h747i_discovery_sdram.c driver.
|
|
Jerome Coutant
0:146cf26a9bbb
|
7
|
******************************************************************************
|
|
Jerome Coutant
0:146cf26a9bbb
|
8
|
* @attention
|
|
Jerome Coutant
0:146cf26a9bbb
|
9
|
*
|
|
Jerome Coutant
0:146cf26a9bbb
|
10
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
|
Jerome Coutant
0:146cf26a9bbb
|
11
|
* All rights reserved.</center></h2>
|
|
Jerome Coutant
0:146cf26a9bbb
|
12
|
*
|
|
Jerome Coutant
0:146cf26a9bbb
|
13
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
Jerome Coutant
0:146cf26a9bbb
|
14
|
* the "License"; You may not use this file except in compliance with the
|
|
Jerome Coutant
0:146cf26a9bbb
|
15
|
* License. You may obtain a copy of the License at:
|
|
Jerome Coutant
0:146cf26a9bbb
|
16
|
* opensource.org/licenses/BSD-3-Clause
|
|
Jerome Coutant
0:146cf26a9bbb
|
17
|
*
|
|
Jerome Coutant
0:146cf26a9bbb
|
18
|
******************************************************************************
|
|
Jerome Coutant
0:146cf26a9bbb
|
19
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
20
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
21
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
22
|
#ifndef __STM32H747I_DISCOVERY_SDRAM_H
|
|
Jerome Coutant
0:146cf26a9bbb
|
23
|
#define __STM32H747I_DISCOVERY_SDRAM_H
|
|
Jerome Coutant
0:146cf26a9bbb
|
24
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
25
|
#ifdef __cplusplus
|
|
Jerome Coutant
0:146cf26a9bbb
|
26
|
extern "C" {
|
|
Jerome Coutant
0:146cf26a9bbb
|
27
|
#endif
|
|
Jerome Coutant
0:146cf26a9bbb
|
28
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
29
|
/* Includes ------------------------------------------------------------------*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
30
|
#include "stm32h7xx_hal.h"
|
|
Jerome Coutant
0:146cf26a9bbb
|
31
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
32
|
/** @addtogroup BSP
|
|
Jerome Coutant
0:146cf26a9bbb
|
33
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
34
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
35
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
36
|
/** @addtogroup STM32H747I_DISCOVERY
|
|
Jerome Coutant
0:146cf26a9bbb
|
37
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
38
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
39
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
40
|
/** @addtogroup STM32H747I_DISCOVERY_SDRAM
|
|
Jerome Coutant
0:146cf26a9bbb
|
41
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
42
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
43
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
44
|
/** @defgroup STM32H747I_DISCOVERY_SDRAM_Exported_Constants Exported Constants
|
|
Jerome Coutant
0:146cf26a9bbb
|
45
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
46
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
47
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
48
|
* @brief SDRAM status structure definition
|
|
Jerome Coutant
0:146cf26a9bbb
|
49
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
50
|
#define SDRAM_OK ((uint8_t)0x00)
|
|
Jerome Coutant
0:146cf26a9bbb
|
51
|
#define SDRAM_ERROR ((uint8_t)0x01)
|
|
Jerome Coutant
0:146cf26a9bbb
|
52
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
53
|
#define SDRAM_DEVICE_ADDR ((uint32_t)0xD0000000)
|
|
Jerome Coutant
0:146cf26a9bbb
|
54
|
#define SDRAM_DEVICE_SIZE ((uint32_t)0x2000000) /* SDRAM device size in MBytes */
|
|
Jerome Coutant
0:146cf26a9bbb
|
55
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
56
|
/* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_8 */
|
|
Jerome Coutant
0:146cf26a9bbb
|
57
|
/* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_16 */
|
|
Jerome Coutant
0:146cf26a9bbb
|
58
|
#define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_32
|
|
Jerome Coutant
0:146cf26a9bbb
|
59
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
60
|
#define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_2
|
|
Jerome Coutant
0:146cf26a9bbb
|
61
|
/* #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_3 */
|
|
Jerome Coutant
0:146cf26a9bbb
|
62
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
63
|
#define REFRESH_COUNT ((uint32_t)0x0603) /* SDRAM refresh counter (100Mhz SD clock) */
|
|
Jerome Coutant
0:146cf26a9bbb
|
64
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
65
|
#define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
|
|
Jerome Coutant
0:146cf26a9bbb
|
66
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
67
|
/* DMA definitions for SDRAM DMA transfer */
|
|
Jerome Coutant
0:146cf26a9bbb
|
68
|
#define __MDMAx_CLK_ENABLE __HAL_RCC_MDMA_CLK_ENABLE
|
|
Jerome Coutant
0:146cf26a9bbb
|
69
|
#define __MDMAx_CLK_DISABLE __HAL_RCC_MDMA_CLK_DISABLE
|
|
Jerome Coutant
0:146cf26a9bbb
|
70
|
#define SDRAM_MDMAx_CHANNEL MDMA_Channel0
|
|
Jerome Coutant
0:146cf26a9bbb
|
71
|
#define SDRAM_MDMAx_IRQn MDMA_IRQn
|
|
Jerome Coutant
0:146cf26a9bbb
|
72
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
73
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
74
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
75
|
* @brief FMC SDRAM Mode definition register defines
|
|
Jerome Coutant
0:146cf26a9bbb
|
76
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
77
|
#define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
|
|
Jerome Coutant
0:146cf26a9bbb
|
78
|
#define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
|
|
Jerome Coutant
0:146cf26a9bbb
|
79
|
#define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
|
|
Jerome Coutant
0:146cf26a9bbb
|
80
|
#define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
|
|
Jerome Coutant
0:146cf26a9bbb
|
81
|
#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
|
|
Jerome Coutant
0:146cf26a9bbb
|
82
|
#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
|
|
Jerome Coutant
0:146cf26a9bbb
|
83
|
#define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
|
|
Jerome Coutant
0:146cf26a9bbb
|
84
|
#define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
|
|
Jerome Coutant
0:146cf26a9bbb
|
85
|
#define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
|
|
Jerome Coutant
0:146cf26a9bbb
|
86
|
#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
|
|
Jerome Coutant
0:146cf26a9bbb
|
87
|
#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
|
|
Jerome Coutant
0:146cf26a9bbb
|
88
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
89
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
90
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
91
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
92
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
93
|
/** @addtogroup STM32H747I_DISCOVERY_SDRAM_Exported_Functions
|
|
Jerome Coutant
0:146cf26a9bbb
|
94
|
* @{
|
|
Jerome Coutant
0:146cf26a9bbb
|
95
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
96
|
uint8_t BSP_SDRAM_Init(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
97
|
uint8_t BSP_SDRAM_DeInit(void);
|
|
Jerome Coutant
0:146cf26a9bbb
|
98
|
void BSP_SDRAM_Initialization_sequence(uint32_t RefreshCount);
|
|
Jerome Coutant
0:146cf26a9bbb
|
99
|
uint8_t BSP_SDRAM_ReadData(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
|
Jerome Coutant
0:146cf26a9bbb
|
100
|
uint8_t BSP_SDRAM_ReadData_DMA(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
|
Jerome Coutant
0:146cf26a9bbb
|
101
|
uint8_t BSP_SDRAM_WriteData(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
|
Jerome Coutant
0:146cf26a9bbb
|
102
|
uint8_t BSP_SDRAM_WriteData_DMA(uint32_t uwStartAddress, uint32_t *pData, uint32_t uwDataSize);
|
|
Jerome Coutant
0:146cf26a9bbb
|
103
|
uint8_t BSP_SDRAM_Sendcmd(FMC_SDRAM_CommandTypeDef *SdramCmd);
|
|
Jerome Coutant
0:146cf26a9bbb
|
104
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
105
|
/* These functions can be modified in case the current settings (e.g. DMA stream)
|
|
Jerome Coutant
0:146cf26a9bbb
|
106
|
need to be changed for specific application needs */
|
|
Jerome Coutant
0:146cf26a9bbb
|
107
|
void BSP_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram, void *Params);
|
|
Jerome Coutant
0:146cf26a9bbb
|
108
|
void BSP_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram, void *Params);
|
|
Jerome Coutant
0:146cf26a9bbb
|
109
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
110
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
111
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
112
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
113
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
114
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
115
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
116
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
117
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
118
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
119
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
120
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
121
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
122
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
123
|
/**
|
|
Jerome Coutant
0:146cf26a9bbb
|
124
|
* @}
|
|
Jerome Coutant
0:146cf26a9bbb
|
125
|
*/
|
|
Jerome Coutant
0:146cf26a9bbb
|
126
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
127
|
#ifdef __cplusplus
|
|
Jerome Coutant
0:146cf26a9bbb
|
128
|
}
|
|
Jerome Coutant
0:146cf26a9bbb
|
129
|
#endif
|
|
Jerome Coutant
0:146cf26a9bbb
|
130
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
131
|
#endif /* __STM32H747I_DISCOVERY_SDRAM_H */
|
|
Jerome Coutant
0:146cf26a9bbb
|
132
|
|
|
Jerome Coutant
0:146cf26a9bbb
|
133
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
|