Subversion Repositories LedShow

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 9
Line 4... Line 4...
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @brief   Header file of NOR HAL module.
5
  * @brief   Header file of NOR HAL module.
6
  ******************************************************************************
6
  ******************************************************************************
7
  * @attention
7
  * @attention
8
  *
8
  *
9
  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
9
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
-
 
10
  * All rights reserved.</center></h2>
10
  *
11
  *
11
  * Redistribution and use in source and binary forms, with or without modification,
12
  * This software component is licensed by ST under BSD 3-Clause license,
12
  * are permitted provided that the following conditions are met:
13
  * the "License"; You may not use this file except in compliance with the
13
  *   1. Redistributions of source code must retain the above copyright notice,
-
 
14
  *      this list of conditions and the following disclaimer.
14
  * License. You may obtain a copy of the License at:
15
  *   2. Redistributions in binary form must reproduce the above copyright notice,
-
 
16
  *      this list of conditions and the following disclaimer in the documentation
-
 
17
  *      and/or other materials provided with the distribution.
15
  *                       opensource.org/licenses/BSD-3-Clause
18
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-
 
19
  *      may be used to endorse or promote products derived from this software
-
 
20
  *      without specific prior written permission.
-
 
21
  *
-
 
22
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
23
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
24
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-
 
25
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-
 
26
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-
 
27
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-
 
28
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-
 
29
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-
 
30
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
 
31
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
32
  *
16
  *
33
  ******************************************************************************
17
  ******************************************************************************
34
  */
18
  */
35
 
19
 
36
/* Define to prevent recursive inclusion -------------------------------------*/
20
/* Define to prevent recursive inclusion -------------------------------------*/
37
#ifndef __STM32F1xx_HAL_NOR_H
21
#ifndef STM32F1xx_HAL_NOR_H
38
#define __STM32F1xx_HAL_NOR_H
22
#define STM32F1xx_HAL_NOR_H
39
 
23
 
40
#ifdef __cplusplus
24
#ifdef __cplusplus
41
 extern "C" {
25
extern "C" {
42
#endif
26
#endif
43
 
27
 
-
 
28
#if defined FSMC_BANK1
-
 
29
 
44
/* Includes ------------------------------------------------------------------*/
30
/* Includes ------------------------------------------------------------------*/
45
#include "stm32f1xx_ll_fsmc.h"
31
#include "stm32f1xx_ll_fsmc.h"
46
 
32
 
47
/** @addtogroup STM32F1xx_HAL_Driver
33
/** @addtogroup STM32F1xx_HAL_Driver
48
  * @{
34
  * @{
49
  */
35
  */
50
 
36
 
51
#if defined (STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG) || defined(STM32F100xE)
-
 
52
/** @addtogroup NOR
37
/** @addtogroup NOR
53
  * @{
38
  * @{
54
  */
-
 
55
 
-
 
56
/** @addtogroup NOR_Private_Constants
-
 
57
  * @{
-
 
58
  */
-
 
59
 
-
 
60
/* NOR device IDs addresses */
-
 
61
#define MC_ADDRESS               ((uint16_t)0x0000)
-
 
62
#define DEVICE_CODE1_ADDR        ((uint16_t)0x0001)
-
 
63
#define DEVICE_CODE2_ADDR        ((uint16_t)0x000E)
-
 
64
#define DEVICE_CODE3_ADDR        ((uint16_t)0x000F)
-
 
65
 
-
 
66
/* NOR CFI IDs addresses */
-
 
67
#define CFI1_ADDRESS             ((uint16_t)0x10)
-
 
68
#define CFI2_ADDRESS             ((uint16_t)0x11)
-
 
69
#define CFI3_ADDRESS             ((uint16_t)0x12)
-
 
70
#define CFI4_ADDRESS             ((uint16_t)0x13)
-
 
71
 
-
 
72
/* NOR operation wait timeout */
-
 
73
#define NOR_TMEOUT               ((uint16_t)0xFFFF)
-
 
74
   
-
 
75
/* NOR memory data width */
-
 
76
#define NOR_MEMORY_8B            ((uint8_t)0x0)
-
 
77
#define NOR_MEMORY_16B           ((uint8_t)0x1)
-
 
78
 
-
 
79
/* NOR memory device read/write start address */
-
 
80
#define NOR_MEMORY_ADRESS1       FSMC_BANK1_1
-
 
81
#define NOR_MEMORY_ADRESS2       FSMC_BANK1_2
-
 
82
#define NOR_MEMORY_ADRESS3       FSMC_BANK1_3
-
 
83
#define NOR_MEMORY_ADRESS4       FSMC_BANK1_4
-
 
84
 
-
 
85
/**
-
 
86
  * @}
-
 
87
  */
39
  */
88
 
40
 
-
 
41
/* Exported typedef ----------------------------------------------------------*/
89
/** @addtogroup NOR_Private_Macros
42
/** @defgroup NOR_Exported_Types NOR Exported Types
90
  * @{
43
  * @{
91
  */
44
  */
92
 
45
 
93
/**
46
/**
94
  * @brief  NOR memory address shifting.
47
  * @brief  HAL SRAM State structures definition
95
  * @param  __NOR_ADDRESS: NOR base address
-
 
96
  * @param  __NOR_MEMORY_WIDTH_: NOR memory width
-
 
97
  * @param  __ADDRESS__: NOR memory address
-
 
98
  * @retval NOR shifted address value
-
 
99
  */
-
 
100
#define NOR_ADDR_SHIFT(__NOR_ADDRESS, __NOR_MEMORY_WIDTH_, __ADDRESS__)       \
-
 
101
            ((uint32_t)(((__NOR_MEMORY_WIDTH_) == NOR_MEMORY_16B)?              \
-
 
102
              ((uint32_t)((__NOR_ADDRESS) + (2U * (__ADDRESS__)))):              \
-
 
103
              ((uint32_t)((__NOR_ADDRESS) + (__ADDRESS__)))))
-
 
104
 
-
 
105
/**
-
 
106
  * @brief  NOR memory write data to specified address.
-
 
107
  * @param  __ADDRESS__: NOR memory address
-
 
108
  * @param  __DATA__: Data to write
-
 
109
  * @retval None
-
 
110
  */
-
 
111
#define NOR_WRITE(__ADDRESS__, __DATA__)  (*(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__))
-
 
112
 
-
 
113
/**
-
 
114
  * @}
-
 
115
  */
48
  */
116
 
-
 
117
/* Exported typedef ----------------------------------------------------------*/
-
 
118
/** @defgroup NOR_Exported_Types NOR Exported Types
-
 
119
  * @{
-
 
120
  */
-
 
121
 
-
 
122
/**
-
 
123
  * @brief  HAL SRAM State structures definition  
-
 
124
  */
-
 
125
typedef enum
49
typedef enum
126
{  
50
{
127
  HAL_NOR_STATE_RESET             = 0x00U,  /*!< NOR not yet initialized or disabled  */
51
  HAL_NOR_STATE_RESET             = 0x00U,  /*!< NOR not yet initialized or disabled  */
128
  HAL_NOR_STATE_READY             = 0x01U,  /*!< NOR initialized and ready for use    */
52
  HAL_NOR_STATE_READY             = 0x01U,  /*!< NOR initialized and ready for use    */
129
  HAL_NOR_STATE_BUSY              = 0x02U,  /*!< NOR internal processing is ongoing   */
53
  HAL_NOR_STATE_BUSY              = 0x02U,  /*!< NOR internal processing is ongoing   */
130
  HAL_NOR_STATE_ERROR             = 0x03U,  /*!< NOR error state                      */
54
  HAL_NOR_STATE_ERROR             = 0x03U,  /*!< NOR error state                      */
131
  HAL_NOR_STATE_PROTECTED         = 0x04U   /*!< NOR NORSRAM device write protected  */
55
  HAL_NOR_STATE_PROTECTED         = 0x04U   /*!< NOR NORSRAM device write protected   */
132
}HAL_NOR_StateTypeDef;    
56
} HAL_NOR_StateTypeDef;
133
 
57
 
134
/**
58
/**
135
  * @brief  FSMC NOR Status typedef
59
  * @brief  FSMC NOR Status typedef
136
  */
60
  */
137
typedef enum
61
typedef enum
138
{
62
{
139
  HAL_NOR_STATUS_SUCCESS = 0U,
63
  HAL_NOR_STATUS_SUCCESS  = 0U,
140
  HAL_NOR_STATUS_ONGOING,
64
  HAL_NOR_STATUS_ONGOING,
141
  HAL_NOR_STATUS_ERROR,
65
  HAL_NOR_STATUS_ERROR,
142
  HAL_NOR_STATUS_TIMEOUT
66
  HAL_NOR_STATUS_TIMEOUT
143
}HAL_NOR_StatusTypeDef;
67
} HAL_NOR_StatusTypeDef;
144
 
68
 
145
/**
69
/**
146
  * @brief  FSMC NOR ID typedef
70
  * @brief  FSMC NOR ID typedef
147
  */
71
  */
148
typedef struct
72
typedef struct
149
{
73
{
150
  uint16_t Manufacturer_Code;  /*!< Defines the device's manufacturer code used to identify the memory       */
74
  uint16_t Manufacturer_Code;  /*!< Defines the device's manufacturer code used to identify the memory       */
151
 
75
 
152
  uint16_t Device_Code1;
76
  uint16_t Device_Code1;
153
 
77
 
154
  uint16_t Device_Code2;
78
  uint16_t Device_Code2;
155
       
79
 
156
  uint16_t Device_Code3;       /*!< Defines the device's codes used to identify the memory.
80
  uint16_t Device_Code3;       /*!< Defines the device's codes used to identify the memory.
157
                                    These codes can be accessed by performing read operations with specific
81
                                    These codes can be accessed by performing read operations with specific
158
                                    control signals and addresses set.They can also be accessed by issuing
82
                                    control signals and addresses set.They can also be accessed by issuing
159
                                    an Auto Select command                                                   */    
83
                                    an Auto Select command                                                   */
160
}NOR_IDTypeDef;
84
} NOR_IDTypeDef;
161
 
85
 
162
/**
86
/**
163
  * @brief  FSMC NOR CFI typedef
87
  * @brief  FSMC NOR CFI typedef
164
  */
88
  */
165
typedef struct
89
typedef struct
166
{
90
{
167
  /*!< Defines the information stored in the memory's Common flash interface
91
  /*!< Defines the information stored in the memory's Common flash interface
168
       which contains a description of various electrical and timing parameters,
92
       which contains a description of various electrical and timing parameters,
169
       density information and functions supported by the memory                   */
93
       density information and functions supported by the memory                   */
170
 
94
 
171
  uint16_t CFI_1;
95
  uint16_t CFI_1;
172
 
96
 
173
  uint16_t CFI_2;
97
  uint16_t CFI_2;
174
 
98
 
175
  uint16_t CFI_3;
99
  uint16_t CFI_3;
176
 
100
 
177
  uint16_t CFI_4;
101
  uint16_t CFI_4;
178
}NOR_CFITypeDef;
102
} NOR_CFITypeDef;
179
 
103
 
180
/**
104
/**
181
  * @brief  NOR handle Structure definition  
105
  * @brief  NOR handle Structure definition
182
  */
106
  */
-
 
107
#if (USE_HAL_NOR_REGISTER_CALLBACKS == 1)
-
 
108
typedef struct __NOR_HandleTypeDef
-
 
109
#else
183
typedef struct
110
typedef struct
-
 
111
#endif /* USE_HAL_NOR_REGISTER_CALLBACKS  */
-
 
112
 
184
{
113
{
185
  FSMC_NORSRAM_TypeDef          *Instance;    /*!< Register base address                        */
114
  FSMC_NORSRAM_TypeDef           *Instance;    /*!< Register base address                        */
186
 
115
 
187
  FSMC_NORSRAM_EXTENDED_TypeDef *Extended;    /*!< Extended mode register base address          */
116
  FSMC_NORSRAM_EXTENDED_TypeDef  *Extended;    /*!< Extended mode register base address          */
188
 
117
 
189
  FSMC_NORSRAM_InitTypeDef      Init;         /*!< NOR device control configuration parameters  */
118
  FSMC_NORSRAM_InitTypeDef       Init;         /*!< NOR device control configuration parameters  */
-
 
119
 
-
 
120
  HAL_LockTypeDef               Lock;         /*!< NOR locking object                           */
190
 
121
 
191
  HAL_LockTypeDef               Lock;         /*!< NOR locking object                           */
-
 
192
 
-
 
193
  __IO HAL_NOR_StateTypeDef     State;        /*!< NOR device access state                      */
122
  __IO HAL_NOR_StateTypeDef     State;        /*!< NOR device access state                      */
-
 
123
 
-
 
124
  uint32_t                      CommandSet;   /*!< NOR algorithm command set and control        */
-
 
125
 
-
 
126
#if (USE_HAL_NOR_REGISTER_CALLBACKS == 1)
-
 
127
  void (* MspInitCallback)(struct __NOR_HandleTypeDef *hnor);               /*!< NOR Msp Init callback              */
-
 
128
  void (* MspDeInitCallback)(struct __NOR_HandleTypeDef *hnor);             /*!< NOR Msp DeInit callback            */
-
 
129
#endif
-
 
130
} NOR_HandleTypeDef;
-
 
131
 
-
 
132
#if (USE_HAL_NOR_REGISTER_CALLBACKS == 1)
-
 
133
/**
-
 
134
  * @brief  HAL NOR Callback ID enumeration definition
194
   
135
  */
-
 
136
typedef enum
-
 
137
{
-
 
138
  HAL_NOR_MSP_INIT_CB_ID       = 0x00U,  /*!< NOR MspInit Callback ID          */
-
 
139
  HAL_NOR_MSP_DEINIT_CB_ID     = 0x01U   /*!< NOR MspDeInit Callback ID        */
195
}NOR_HandleTypeDef;
140
} HAL_NOR_CallbackIDTypeDef;
196
 
141
 
197
/**
142
/**
-
 
143
  * @brief  HAL NOR Callback pointer definition
-
 
144
  */
-
 
145
typedef void (*pNOR_CallbackTypeDef)(NOR_HandleTypeDef *hnor);
-
 
146
#endif
-
 
147
/**
198
  * @}
148
  * @}
199
  */
149
  */
200
 
150
 
201
/* Exported constants --------------------------------------------------------*/
151
/* Exported constants --------------------------------------------------------*/
202
/* Exported macro ------------------------------------------------------------*/
152
/* Exported macro ------------------------------------------------------------*/
203
 
-
 
204
/** @defgroup NOR_Exported_macro NOR Exported Macros
153
/** @defgroup NOR_Exported_Macros NOR Exported Macros
205
  * @{
154
  * @{
206
  */
155
  */
207
 
-
 
208
/** @brief Reset NOR handle state
156
/** @brief Reset NOR handle state
209
  * @param  __HANDLE__: NOR handle
157
  * @param  __HANDLE__ specifies the NOR handle.
210
  * @retval None
158
  * @retval None
211
  */
159
  */
-
 
160
#if (USE_HAL_NOR_REGISTER_CALLBACKS == 1)
-
 
161
#define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__)          do {                                             \
-
 
162
                                                               (__HANDLE__)->State = HAL_NOR_STATE_RESET;  \
-
 
163
                                                               (__HANDLE__)->MspInitCallback = NULL;       \
-
 
164
                                                               (__HANDLE__)->MspDeInitCallback = NULL;     \
-
 
165
                                                             } while(0)
-
 
166
#else
212
#define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NOR_STATE_RESET)
167
#define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NOR_STATE_RESET)
213
 
168
#endif
214
/**
169
/**
215
  * @}
170
  * @}
216
  */
171
  */
217
 
172
 
218
/* Exported functions --------------------------------------------------------*/
173
/* Exported functions --------------------------------------------------------*/
219
/** @addtogroup NOR_Exported_Functions NOR Exported Functions
174
/** @addtogroup NOR_Exported_Functions NOR Exported Functions
220
 *  @{
175
  * @{
221
 */
176
  */
222
 
177
 
223
/** @addtogroup NOR_Exported_Functions_Group1
178
/** @addtogroup NOR_Exported_Functions_Group1 Initialization and de-initialization functions
224
 *  @{
179
  * @{
225
 */
180
  */
226
 
181
 
227
/* Initialization/de-initialization functions  **********************************/  
182
/* Initialization/de-initialization functions  ********************************/
228
HAL_StatusTypeDef HAL_NOR_Init(NOR_HandleTypeDef *hnor, FSMC_NORSRAM_TimingTypeDef *Timing, FSMC_NORSRAM_TimingTypeDef *ExtTiming);
183
HAL_StatusTypeDef HAL_NOR_Init(NOR_HandleTypeDef *hnor, FSMC_NORSRAM_TimingTypeDef *Timing,
-
 
184
                               FSMC_NORSRAM_TimingTypeDef *ExtTiming);
229
HAL_StatusTypeDef HAL_NOR_DeInit(NOR_HandleTypeDef *hnor);
185
HAL_StatusTypeDef HAL_NOR_DeInit(NOR_HandleTypeDef *hnor);
230
void              HAL_NOR_MspInit(NOR_HandleTypeDef *hnor);
186
void HAL_NOR_MspInit(NOR_HandleTypeDef *hnor);
231
void              HAL_NOR_MspDeInit(NOR_HandleTypeDef *hnor);
187
void HAL_NOR_MspDeInit(NOR_HandleTypeDef *hnor);
232
void              HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout);
188
void HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout);
233
 
-
 
234
/**
189
/**
235
  * @}
190
  * @}
236
  */
191
  */
237
 
192
 
238
/** @addtogroup NOR_Exported_Functions_Group2
193
/** @addtogroup NOR_Exported_Functions_Group2 Input and Output functions
239
 *  @{
194
  * @{
240
 */
195
  */
241
 
196
 
242
/* I/O operation functions  ***************************************************/
197
/* I/O operation functions  ***************************************************/
243
HAL_StatusTypeDef HAL_NOR_Read_ID(NOR_HandleTypeDef *hnor, NOR_IDTypeDef *pNOR_ID);
198
HAL_StatusTypeDef HAL_NOR_Read_ID(NOR_HandleTypeDef *hnor, NOR_IDTypeDef *pNOR_ID);
244
HAL_StatusTypeDef HAL_NOR_ReturnToReadMode(NOR_HandleTypeDef *hnor);
199
HAL_StatusTypeDef HAL_NOR_ReturnToReadMode(NOR_HandleTypeDef *hnor);
245
HAL_StatusTypeDef HAL_NOR_Read(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData);
200
HAL_StatusTypeDef HAL_NOR_Read(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData);
246
HAL_StatusTypeDef HAL_NOR_Program(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData);
201
HAL_StatusTypeDef HAL_NOR_Program(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData);
247
 
202
 
248
HAL_StatusTypeDef HAL_NOR_ReadBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize);
203
HAL_StatusTypeDef HAL_NOR_ReadBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData,
-
 
204
                                     uint32_t uwBufferSize);
249
HAL_StatusTypeDef HAL_NOR_ProgramBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize);
205
HAL_StatusTypeDef HAL_NOR_ProgramBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData,
-
 
206
                                        uint32_t uwBufferSize);
250
 
207
 
251
HAL_StatusTypeDef HAL_NOR_Erase_Block(NOR_HandleTypeDef *hnor, uint32_t BlockAddress, uint32_t Address);
208
HAL_StatusTypeDef HAL_NOR_Erase_Block(NOR_HandleTypeDef *hnor, uint32_t BlockAddress, uint32_t Address);
252
HAL_StatusTypeDef HAL_NOR_Erase_Chip(NOR_HandleTypeDef *hnor, uint32_t Address);
209
HAL_StatusTypeDef HAL_NOR_Erase_Chip(NOR_HandleTypeDef *hnor, uint32_t Address);
253
HAL_StatusTypeDef HAL_NOR_Read_CFI(NOR_HandleTypeDef *hnor, NOR_CFITypeDef *pNOR_CFI);
210
HAL_StatusTypeDef HAL_NOR_Read_CFI(NOR_HandleTypeDef *hnor, NOR_CFITypeDef *pNOR_CFI);
254
 
211
 
-
 
212
#if (USE_HAL_NOR_REGISTER_CALLBACKS == 1)
-
 
213
/* NOR callback registering/unregistering */
-
 
214
HAL_StatusTypeDef HAL_NOR_RegisterCallback(NOR_HandleTypeDef *hnor, HAL_NOR_CallbackIDTypeDef CallbackId,
-
 
215
                                           pNOR_CallbackTypeDef pCallback);
-
 
216
HAL_StatusTypeDef HAL_NOR_UnRegisterCallback(NOR_HandleTypeDef *hnor, HAL_NOR_CallbackIDTypeDef CallbackId);
-
 
217
#endif
255
/**
218
/**
256
  * @}
219
  * @}
257
  */
220
  */
258
 
221
 
259
/** @addtogroup NOR_Exported_Functions_Group3
222
/** @addtogroup NOR_Exported_Functions_Group3 NOR Control functions
260
 *  @{
223
  * @{
261
 */
224
  */
262
 
225
 
263
/* NOR Control functions  *****************************************************/
226
/* NOR Control functions  *****************************************************/
264
HAL_StatusTypeDef HAL_NOR_WriteOperation_Enable(NOR_HandleTypeDef *hnor);
227
HAL_StatusTypeDef HAL_NOR_WriteOperation_Enable(NOR_HandleTypeDef *hnor);
265
HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable(NOR_HandleTypeDef *hnor);
228
HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable(NOR_HandleTypeDef *hnor);
266
 
-
 
267
/**
229
/**
268
  * @}
230
  * @}
269
  */
231
  */
270
 
232
 
271
/** @addtogroup NOR_Exported_Functions_Group4
233
/** @addtogroup NOR_Exported_Functions_Group4 NOR State functions
272
 *  @{
234
  * @{
273
 */
235
  */
274
 
236
 
275
/* NOR State functions ********************************************************/
237
/* NOR State functions ********************************************************/
276
HAL_NOR_StateTypeDef  HAL_NOR_GetState(NOR_HandleTypeDef *hnor);
238
HAL_NOR_StateTypeDef  HAL_NOR_GetState(NOR_HandleTypeDef *hnor);
277
HAL_NOR_StatusTypeDef HAL_NOR_GetStatus(NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout);
239
HAL_NOR_StatusTypeDef HAL_NOR_GetStatus(NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout);
-
 
240
/**
-
 
241
  * @}
-
 
242
  */
278
 
243
 
279
/**
244
/**
280
  * @}
245
  * @}
281
  */
246
  */
-
 
247
 
-
 
248
/* Private types -------------------------------------------------------------*/
-
 
249
/* Private variables ---------------------------------------------------------*/
-
 
250
/* Private constants ---------------------------------------------------------*/
-
 
251
/** @defgroup NOR_Private_Constants NOR Private Constants
-
 
252
  * @{
282
 
253
  */
-
 
254
/* NOR device IDs addresses */
-
 
255
#define MC_ADDRESS               ((uint16_t)0x0000)
-
 
256
#define DEVICE_CODE1_ADDR        ((uint16_t)0x0001)
-
 
257
#define DEVICE_CODE2_ADDR        ((uint16_t)0x000E)
-
 
258
#define DEVICE_CODE3_ADDR        ((uint16_t)0x000F)
-
 
259
 
-
 
260
/* NOR CFI IDs addresses */
-
 
261
#define CFI1_ADDRESS             ((uint16_t)0x61)
-
 
262
#define CFI2_ADDRESS             ((uint16_t)0x62)
-
 
263
#define CFI3_ADDRESS             ((uint16_t)0x63)
-
 
264
#define CFI4_ADDRESS             ((uint16_t)0x64)
-
 
265
 
-
 
266
/* NOR operation wait timeout */
-
 
267
#define NOR_TMEOUT               ((uint16_t)0xFFFF)
-
 
268
 
-
 
269
/* NOR memory data width */
-
 
270
#define NOR_MEMORY_8B            ((uint8_t)0x0)
-
 
271
#define NOR_MEMORY_16B           ((uint8_t)0x1)
-
 
272
 
-
 
273
/* NOR memory device read/write start address */
-
 
274
#define NOR_MEMORY_ADRESS1       (0x60000000U)
-
 
275
#define NOR_MEMORY_ADRESS2       (0x64000000U)
-
 
276
#define NOR_MEMORY_ADRESS3       (0x68000000U)
-
 
277
#define NOR_MEMORY_ADRESS4       (0x6C000000U)
283
/**
278
/**
284
  * @}
279
  * @}
285
  */
280
  */
-
 
281
 
-
 
282
/* Private macros ------------------------------------------------------------*/
-
 
283
/** @defgroup NOR_Private_Macros NOR Private Macros
-
 
284
  * @{
286
 
285
  */
-
 
286
/**
-
 
287
  * @brief  NOR memory address shifting.
-
 
288
  * @param  __NOR_ADDRESS NOR base address
-
 
289
  * @param  __NOR_MEMORY_WIDTH_ NOR memory width
-
 
290
  * @param  __ADDRESS__ NOR memory address
-
 
291
  * @retval NOR shifted address value
-
 
292
  */
-
 
293
#define NOR_ADDR_SHIFT(__NOR_ADDRESS, __NOR_MEMORY_WIDTH_, __ADDRESS__)         \
-
 
294
  ((uint32_t)(((__NOR_MEMORY_WIDTH_) == NOR_MEMORY_16B)?            \
-
 
295
              ((uint32_t)((__NOR_ADDRESS) + (2U * (__ADDRESS__)))):              \
-
 
296
              ((uint32_t)((__NOR_ADDRESS) + (__ADDRESS__)))))
-
 
297
 
-
 
298
/**
-
 
299
  * @brief  NOR memory write data to specified address.
-
 
300
  * @param  __ADDRESS__ NOR memory address
-
 
301
  * @param  __DATA__ Data to write
-
 
302
  * @retval None
-
 
303
  */
-
 
304
#define NOR_WRITE(__ADDRESS__, __DATA__)   do{                                                             \
-
 
305
                                               (*(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__)); \
-
 
306
                                               __DSB();                                                    \
-
 
307
                                             } while(0)
287
 
308
 
288
/**
309
/**
289
  * @}
310
  * @}
290
  */
311
  */
291
 
312
 
292
#endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG || STM32F100xE */
-
 
-
 
313
/**
-
 
314
  * @}
-
 
315
  */
293
 
316
 
294
/**
317
/**
295
  * @}
318
  * @}
296
  */
319
  */
297
 
320
 
-
 
321
#endif /* FSMC_BANK1 */
-
 
322
 
298
#ifdef __cplusplus
323
#ifdef __cplusplus
299
}
324
}
300
#endif
325
#endif
301
 
326
 
302
#endif /* __STM32F1xx_HAL_NOR_H */
327
#endif /* STM32F1xx_HAL_NOR_H */
303
 
328
 
304
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
329
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/