1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
39
42
43
44
45
48
51
52
60
61
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
87
88
89
90
91
92
93
94
95
101
102
105
106
107
108
111
112
113
114
115
118
119
123
124
130
131
132
133
136
137
138
141
142
145
146
147
148
149
150
151
152
153
156
157
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
189
190
191
194
195
198
199
200
201
202
203
206
207
210
211
212
213
214
217
218
221
222
225
226
229
230
231
232
233
234
235
236
/* ... */
#ifndef STM32F4xx_HAL_SRAM_H
#define STM32F4xx_HAL_SRAM_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(FMC_Bank1) || defined(FSMC_Bank1)
#if defined(FSMC_Bank1)
#include "stm32f4xx_ll_fsmc.h"
#else
#include "stm32f4xx_ll_fmc.h"
#endif
/* ... */
/* ... */
Includes
/* ... */
/* ... */
typedef enum
{
HAL_SRAM_STATE_RESET = 0x00U,
HAL_SRAM_STATE_READY = 0x01U,
HAL_SRAM_STATE_BUSY = 0x02U,
HAL_SRAM_STATE_ERROR = 0x03U,
HAL_SRAM_STATE_PROTECTED = 0x04U
...} HAL_SRAM_StateTypeDef;
/* ... */
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
typedef struct __SRAM_HandleTypeDef
#else
typedef struct
#endif
{
FMC_NORSRAM_TypeDef *Instance;
FMC_NORSRAM_EXTENDED_TypeDef *Extended;
FMC_NORSRAM_InitTypeDef Init;
HAL_LockTypeDef Lock;
__IO HAL_SRAM_StateTypeDef State;
DMA_HandleTypeDef *hdma;
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
void (* MspInitCallback)(struct __SRAM_HandleTypeDef *hsram);
void (* MspDeInitCallback)(struct __SRAM_HandleTypeDef *hsram);
void (* DmaXferCpltCallback)(DMA_HandleTypeDef *hdma);
void (* DmaXferErrorCallback)(DMA_HandleTypeDef *hdma); /* ... */
#endif
...} SRAM_HandleTypeDef;
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
/* ... */
typedef enum
{
HAL_SRAM_MSP_INIT_CB_ID = 0x00U,
HAL_SRAM_MSP_DEINIT_CB_ID = 0x01U,
HAL_SRAM_DMA_XFER_CPLT_CB_ID = 0x02U,
HAL_SRAM_DMA_XFER_ERR_CB_ID = 0x03U
...} HAL_SRAM_CallbackIDTypeDef;
/* ... */
typedef void (*pSRAM_CallbackTypeDef)(SRAM_HandleTypeDef *hsram);
typedef void (*pSRAM_DmaCallbackTypeDef)(DMA_HandleTypeDef *hdma);/* ... */
#endif
/* ... */
Exported typedef
/* ... */
/* ... */
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
#define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) do { \
(__HANDLE__)->State = HAL_SRAM_STATE_RESET; \
(__HANDLE__)->MspInitCallback = NULL; \
(__HANDLE__)->MspDeInitCallback = NULL; \
...} while(0)...
/* ... */#else
#define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET)
#endif
/* ... */
Exported macro
/* ... */
/* ... */
HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing,
FMC_NORSRAM_TimingTypeDef *ExtTiming);
HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram);
void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram);
void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram);
/* ... */
/* ... */
HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer,
uint32_t BufferSize);
HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer,
uint32_t BufferSize);
void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma);
void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma);
#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
HAL_StatusTypeDef HAL_SRAM_RegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId,
pSRAM_CallbackTypeDef pCallback);
HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId);
HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId,
pSRAM_DmaCallbackTypeDef pCallback);/* ... */
#endif
/* ... */
/* ... */
HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram);
HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram);
/* ... */
/* ... */
HAL_SRAM_StateTypeDef HAL_SRAM_GetState(const SRAM_HandleTypeDef *hsram);
/* ... */
/* ... */
/* ... */
/* ... */
/* ... */
#endif
#ifdef __cplusplus
}extern "C" { ... }
#endif
/* ... */
#endif