source: S-port/trunk/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_sram.h

Last change on this file was 1, checked in by AlexLir, 3 years ago
File size: 9.9 KB
Line 
1/**
2 ******************************************************************************
3 * @file stm32f4xx_hal_sram.h
4 * @author MCD Application Team
5 * @brief Header file of SRAM HAL module.
6 ******************************************************************************
7 * @attention
8 *
9 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
10 * All rights reserved.</center></h2>
11 *
12 * This software component is licensed by ST under BSD 3-Clause license,
13 * the "License"; You may not use this file except in compliance with the
14 * License. You may obtain a copy of the License at:
15 * opensource.org/licenses/BSD-3-Clause
16 *
17 ******************************************************************************
18 */
19
20/* Define to prevent recursive inclusion -------------------------------------*/
21#ifndef __STM32F4xx_HAL_SRAM_H
22#define __STM32F4xx_HAL_SRAM_H
23
24#ifdef __cplusplus
25 extern "C" {
26#endif
27
28/* Includes ------------------------------------------------------------------*/
29#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F412Zx) ||\
30 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
31 #include "stm32f4xx_ll_fsmc.h"
32#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
33
34#if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) ||\
35 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx)
36 #include "stm32f4xx_ll_fmc.h"
37#endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */
38
39
40/** @addtogroup STM32F4xx_HAL_Driver
41 * @{
42 */
43
44#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\
45 defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\
46 defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) ||\
47 defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F413xx) || defined(STM32F423xx)
48
49/** @addtogroup SRAM
50 * @{
51 */
52
53/* Exported typedef ----------------------------------------------------------*/
54
55/** @defgroup SRAM_Exported_Types SRAM Exported Types
56 * @{
57 */
58/**
59 * @brief HAL SRAM State structures definition
60 */
61typedef enum
62{
63 HAL_SRAM_STATE_RESET = 0x00U, /*!< SRAM not yet initialized or disabled */
64 HAL_SRAM_STATE_READY = 0x01U, /*!< SRAM initialized and ready for use */
65 HAL_SRAM_STATE_BUSY = 0x02U, /*!< SRAM internal process is ongoing */
66 HAL_SRAM_STATE_ERROR = 0x03U, /*!< SRAM error state */
67 HAL_SRAM_STATE_PROTECTED = 0x04U /*!< SRAM peripheral NORSRAM device write protected */
68
69} HAL_SRAM_StateTypeDef;
70
71/**
72 * @brief SRAM handle Structure definition
73 */
74#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
75typedef struct __SRAM_HandleTypeDef
76#else
77typedef struct
78#endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */
79{
80 FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */
81
82 FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */
83
84 FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */
85
86 HAL_LockTypeDef Lock; /*!< SRAM locking object */
87
88 __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */
89
90 DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */
91
92#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
93 void (* MspInitCallback) ( struct __SRAM_HandleTypeDef * hsram); /*!< SRAM Msp Init callback */
94 void (* MspDeInitCallback) ( struct __SRAM_HandleTypeDef * hsram); /*!< SRAM Msp DeInit callback */
95 void (* DmaXferCpltCallback) ( DMA_HandleTypeDef * hdma); /*!< SRAM DMA Xfer Complete callback */
96 void (* DmaXferErrorCallback) ( DMA_HandleTypeDef * hdma); /*!< SRAM DMA Xfer Error callback */
97#endif
98} SRAM_HandleTypeDef;
99
100#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
101/**
102 * @brief HAL SRAM Callback ID enumeration definition
103 */
104typedef enum
105{
106 HAL_SRAM_MSP_INIT_CB_ID = 0x00U, /*!< SRAM MspInit Callback ID */
107 HAL_SRAM_MSP_DEINIT_CB_ID = 0x01U, /*!< SRAM MspDeInit Callback ID */
108 HAL_SRAM_DMA_XFER_CPLT_CB_ID = 0x02U, /*!< SRAM DMA Xfer Complete Callback ID */
109 HAL_SRAM_DMA_XFER_ERR_CB_ID = 0x03U /*!< SRAM DMA Xfer Complete Callback ID */
110}HAL_SRAM_CallbackIDTypeDef;
111
112/**
113 * @brief HAL SRAM Callback pointer definition
114 */
115typedef void (*pSRAM_CallbackTypeDef)(SRAM_HandleTypeDef *hsram);
116typedef void (*pSRAM_DmaCallbackTypeDef)(DMA_HandleTypeDef *hdma);
117#endif
118/**
119 * @}
120 */
121
122/* Exported constants --------------------------------------------------------*/
123/* Exported macro ------------------------------------------------------------*/
124
125/** @defgroup SRAM_Exported_Macros SRAM Exported Macros
126 * @{
127 */
128/** @brief Reset SRAM handle state
129 * @param __HANDLE__ SRAM handle
130 * @retval None
131 */
132#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
133#define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) do { \
134 (__HANDLE__)->State = HAL_SRAM_STATE_RESET; \
135 (__HANDLE__)->MspInitCallback = NULL; \
136 (__HANDLE__)->MspDeInitCallback = NULL; \
137 } while(0)
138#else
139#define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET)
140#endif
141
142/**
143 * @}
144 */
145/* Exported functions --------------------------------------------------------*/
146
147/** @addtogroup SRAM_Exported_Functions
148 * @{
149 */
150
151/** @addtogroup SRAM_Exported_Functions_Group1
152 * @{
153 */
154/* Initialization/de-initialization functions **********************************/
155HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming);
156HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram);
157void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram);
158void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram);
159
160void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma);
161void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma);
162/**
163 * @}
164 */
165
166/** @addtogroup SRAM_Exported_Functions_Group2
167 * @{
168 */
169/* I/O operation functions *****************************************************/
170HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize);
171HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize);
172HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize);
173HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize);
174HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize);
175HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize);
176HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize);
177HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize);
178#if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1)
179/* SRAM callback registering/unregistering */
180HAL_StatusTypeDef HAL_SRAM_RegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_CallbackTypeDef pCallback);
181HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId);
182HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, pSRAM_DmaCallbackTypeDef pCallback);
183#endif
184/**
185 * @}
186 */
187
188/** @addtogroup SRAM_Exported_Functions_Group3
189 * @{
190 */
191/* SRAM Control functions ******************************************************/
192HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram);
193HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram);
194/**
195 * @}
196 */
197
198/** @addtogroup SRAM_Exported_Functions_Group4
199 * @{
200 */
201/* SRAM State functions *********************************************************/
202HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram);
203/**
204 * @}
205 */
206
207/**
208 * @}
209 */
210
211/* Private types -------------------------------------------------------------*/
212/* Private variables ---------------------------------------------------------*/
213/* Private constants ---------------------------------------------------------*/
214/* Private macros ------------------------------------------------------------*/
215/* Private functions ---------------------------------------------------------*/
216/**
217 * @}
218 */
219
220#endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx ||\
221 STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx ||\
222 STM32F412Vx || STM32F412Rx || STM32F413xx || STM32F423xx */
223/**
224 * @}
225 */
226#ifdef __cplusplus
227}
228#endif
229
230#endif /* __STM32F4xx_HAL_SRAM_H */
231
232/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Note: See TracBrowser for help on using the repository browser.