mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Aug 06 08:15:07 2014 +0100
Revision:
274:6937b19af361
Parent:
226:b062af740e40
Child:
369:2e96f1b71984
Synchronized with git revision 5b145e4f6c509376173c3ea2aa35a6da879a2124

Full URL: https://github.com/mbedmicro/mbed/commit/5b145e4f6c509376173c3ea2aa35a6da879a2124/

[TARGET_LPC11UXX] PeripheralNames.h and PinMap definitions separation for LPC11UXX platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 87:085cde657901 1 /**
mbed_official 87:085cde657901 2 ******************************************************************************
mbed_official 87:085cde657901 3 * @file stm32f4xx_hal_nor.h
mbed_official 87:085cde657901 4 * @author MCD Application Team
mbed_official 226:b062af740e40 5 * @version V1.1.0RC2
mbed_official 226:b062af740e40 6 * @date 14-May-2014
mbed_official 87:085cde657901 7 * @brief Header file of NOR HAL module.
mbed_official 87:085cde657901 8 ******************************************************************************
mbed_official 87:085cde657901 9 * @attention
mbed_official 87:085cde657901 10 *
mbed_official 87:085cde657901 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 87:085cde657901 12 *
mbed_official 87:085cde657901 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 87:085cde657901 14 * are permitted provided that the following conditions are met:
mbed_official 87:085cde657901 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 87:085cde657901 16 * this list of conditions and the following disclaimer.
mbed_official 87:085cde657901 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 87:085cde657901 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 87:085cde657901 19 * and/or other materials provided with the distribution.
mbed_official 87:085cde657901 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 87:085cde657901 21 * may be used to endorse or promote products derived from this software
mbed_official 87:085cde657901 22 * without specific prior written permission.
mbed_official 87:085cde657901 23 *
mbed_official 87:085cde657901 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 87:085cde657901 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 87:085cde657901 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 87:085cde657901 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 87:085cde657901 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 87:085cde657901 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 87:085cde657901 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 87:085cde657901 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 87:085cde657901 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 87:085cde657901 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 87:085cde657901 34 *
mbed_official 87:085cde657901 35 ******************************************************************************
mbed_official 87:085cde657901 36 */
mbed_official 87:085cde657901 37
mbed_official 87:085cde657901 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 87:085cde657901 39 #ifndef __STM32F4xx_HAL_NOR_H
mbed_official 87:085cde657901 40 #define __STM32F4xx_HAL_NOR_H
mbed_official 87:085cde657901 41
mbed_official 87:085cde657901 42 #ifdef __cplusplus
mbed_official 87:085cde657901 43 extern "C" {
mbed_official 87:085cde657901 44 #endif
mbed_official 87:085cde657901 45
mbed_official 87:085cde657901 46 /* Includes ------------------------------------------------------------------*/
mbed_official 87:085cde657901 47 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
mbed_official 87:085cde657901 48 #include "stm32f4xx_ll_fsmc.h"
mbed_official 87:085cde657901 49 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
mbed_official 87:085cde657901 50
mbed_official 87:085cde657901 51 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
mbed_official 87:085cde657901 52 #include "stm32f4xx_ll_fmc.h"
mbed_official 87:085cde657901 53 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 87:085cde657901 54
mbed_official 87:085cde657901 55 /** @addtogroup STM32F4xx_HAL_Driver
mbed_official 87:085cde657901 56 * @{
mbed_official 87:085cde657901 57 */
mbed_official 87:085cde657901 58
mbed_official 87:085cde657901 59 /** @addtogroup NOR
mbed_official 87:085cde657901 60 * @{
mbed_official 87:085cde657901 61 */
mbed_official 87:085cde657901 62
mbed_official 87:085cde657901 63 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
mbed_official 87:085cde657901 64
mbed_official 226:b062af740e40 65 /* Exported typedef ----------------------------------------------------------*/
mbed_official 87:085cde657901 66 /**
mbed_official 87:085cde657901 67 * @brief HAL SRAM State structures definition
mbed_official 87:085cde657901 68 */
mbed_official 87:085cde657901 69 typedef enum
mbed_official 87:085cde657901 70 {
mbed_official 87:085cde657901 71 HAL_NOR_STATE_RESET = 0x00, /*!< NOR not yet initialized or disabled */
mbed_official 87:085cde657901 72 HAL_NOR_STATE_READY = 0x01, /*!< NOR initialized and ready for use */
mbed_official 87:085cde657901 73 HAL_NOR_STATE_BUSY = 0x02, /*!< NOR internal processing is ongoing */
mbed_official 226:b062af740e40 74 HAL_NOR_STATE_ERROR = 0x03, /*!< NOR error state */
mbed_official 226:b062af740e40 75 HAL_NOR_STATE_PROTECTED = 0x04 /*!< NOR NORSRAM device write protected */
mbed_official 226:b062af740e40 76 }HAL_NOR_StateTypeDef;
mbed_official 87:085cde657901 77
mbed_official 87:085cde657901 78 /**
mbed_official 87:085cde657901 79 * @brief FMC NOR Status typedef
mbed_official 87:085cde657901 80 */
mbed_official 87:085cde657901 81 typedef enum
mbed_official 87:085cde657901 82 {
mbed_official 87:085cde657901 83 NOR_SUCCESS = 0,
mbed_official 87:085cde657901 84 NOR_ONGOING,
mbed_official 87:085cde657901 85 NOR_ERROR,
mbed_official 87:085cde657901 86 NOR_TIMEOUT
mbed_official 226:b062af740e40 87 }NOR_StatusTypedef;
mbed_official 87:085cde657901 88
mbed_official 87:085cde657901 89 /**
mbed_official 87:085cde657901 90 * @brief FMC NOR ID typedef
mbed_official 87:085cde657901 91 */
mbed_official 87:085cde657901 92 typedef struct
mbed_official 87:085cde657901 93 {
mbed_official 87:085cde657901 94 uint16_t Manufacturer_Code; /*!< Defines the device's manufacturer code used to identify the memory */
mbed_official 226:b062af740e40 95
mbed_official 226:b062af740e40 96 uint16_t Device_Code1;
mbed_official 226:b062af740e40 97
mbed_official 226:b062af740e40 98 uint16_t Device_Code2;
mbed_official 226:b062af740e40 99
mbed_official 226:b062af740e40 100 uint16_t Device_Code3; /*!< Defines the devices' codes used to identify the memory.
mbed_official 87:085cde657901 101 These codes can be accessed by performing read operations with specific
mbed_official 87:085cde657901 102 control signals and addresses set.They can also be accessed by issuing
mbed_official 226:b062af740e40 103 an Auto Select command */
mbed_official 87:085cde657901 104 }NOR_IDTypeDef;
mbed_official 87:085cde657901 105
mbed_official 87:085cde657901 106 /**
mbed_official 87:085cde657901 107 * @brief FMC NOR CFI typedef
mbed_official 87:085cde657901 108 */
mbed_official 87:085cde657901 109 typedef struct
mbed_official 87:085cde657901 110 {
mbed_official 87:085cde657901 111 /*!< Defines the information stored in the memory's Common flash interface
mbed_official 87:085cde657901 112 which contains a description of various electrical and timing parameters,
mbed_official 87:085cde657901 113 density information and functions supported by the memory */
mbed_official 226:b062af740e40 114
mbed_official 226:b062af740e40 115 uint16_t CFI_1;
mbed_official 226:b062af740e40 116
mbed_official 226:b062af740e40 117 uint16_t CFI_2;
mbed_official 226:b062af740e40 118
mbed_official 226:b062af740e40 119 uint16_t CFI_3;
mbed_official 226:b062af740e40 120
mbed_official 226:b062af740e40 121 uint16_t CFI_4;
mbed_official 87:085cde657901 122 }NOR_CFITypeDef;
mbed_official 87:085cde657901 123
mbed_official 87:085cde657901 124 /**
mbed_official 226:b062af740e40 125 * @brief NOR handle Structure definition
mbed_official 87:085cde657901 126 */
mbed_official 87:085cde657901 127 typedef struct
mbed_official 87:085cde657901 128 {
mbed_official 226:b062af740e40 129 FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */
mbed_official 226:b062af740e40 130
mbed_official 87:085cde657901 131 FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */
mbed_official 226:b062af740e40 132
mbed_official 87:085cde657901 133 FMC_NORSRAM_InitTypeDef Init; /*!< NOR device control configuration parameters */
mbed_official 87:085cde657901 134
mbed_official 226:b062af740e40 135 HAL_LockTypeDef Lock; /*!< NOR locking object */
mbed_official 226:b062af740e40 136
mbed_official 87:085cde657901 137 __IO HAL_NOR_StateTypeDef State; /*!< NOR device access state */
mbed_official 226:b062af740e40 138
mbed_official 87:085cde657901 139 }NOR_HandleTypeDef;
mbed_official 87:085cde657901 140
mbed_official 87:085cde657901 141 /* Exported constants --------------------------------------------------------*/
mbed_official 87:085cde657901 142 /** @defgroup NOR_Exported_Constants
mbed_official 87:085cde657901 143 * @{
mbed_official 87:085cde657901 144 */
mbed_official 87:085cde657901 145 /* NOR device IDs addresses */
mbed_official 87:085cde657901 146 #define MC_ADDRESS ((uint16_t)0x0000)
mbed_official 87:085cde657901 147 #define DEVICE_CODE1_ADDR ((uint16_t)0x0001)
mbed_official 87:085cde657901 148 #define DEVICE_CODE2_ADDR ((uint16_t)0x000E)
mbed_official 87:085cde657901 149 #define DEVICE_CODE3_ADDR ((uint16_t)0x000F)
mbed_official 87:085cde657901 150
mbed_official 87:085cde657901 151 /* NOR CFI IDs addresses */
mbed_official 87:085cde657901 152 #define CFI1_ADDRESS ((uint16_t)0x61)
mbed_official 87:085cde657901 153 #define CFI2_ADDRESS ((uint16_t)0x62)
mbed_official 87:085cde657901 154 #define CFI3_ADDRESS ((uint16_t)0x63)
mbed_official 87:085cde657901 155 #define CFI4_ADDRESS ((uint16_t)0x64)
mbed_official 87:085cde657901 156
mbed_official 87:085cde657901 157 /* NOR operation wait timeout */
mbed_official 87:085cde657901 158 #define NOR_TMEOUT ((uint16_t)0xFFFF)
mbed_official 87:085cde657901 159
mbed_official 87:085cde657901 160 /* #define NOR_MEMORY_16B */
mbed_official 87:085cde657901 161 #define NOR_MEMORY_8B
mbed_official 87:085cde657901 162
mbed_official 87:085cde657901 163 /* NOR memory device read/write start address */
mbed_official 87:085cde657901 164 #define NOR_MEMORY_ADRESS ((uint32_t)0x60000000)
mbed_official 87:085cde657901 165
mbed_official 87:085cde657901 166 /**
mbed_official 87:085cde657901 167 * @}
mbed_official 87:085cde657901 168 */
mbed_official 87:085cde657901 169
mbed_official 87:085cde657901 170 /* Exported macro ------------------------------------------------------------*/
mbed_official 226:b062af740e40 171
mbed_official 226:b062af740e40 172 /** @brief Reset NOR handle state
mbed_official 226:b062af740e40 173 * @param __HANDLE__: specifies the NOR handle.
mbed_official 226:b062af740e40 174 * @retval None
mbed_official 226:b062af740e40 175 */
mbed_official 226:b062af740e40 176 #define __HAL_NOR_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_NOR_STATE_RESET)
mbed_official 226:b062af740e40 177
mbed_official 87:085cde657901 178 /**
mbed_official 87:085cde657901 179 * @brief NOR memory address shifting.
mbed_official 87:085cde657901 180 * @param __ADDRESS__: NOR memory address
mbed_official 87:085cde657901 181 * @retval NOR shifted address value
mbed_official 87:085cde657901 182 */
mbed_official 87:085cde657901 183 #ifdef NOR_MEMORY_8B
mbed_official 87:085cde657901 184 #define __NOR_ADDR_SHIFT(__ADDRESS__) (uint32_t)(NOR_MEMORY_ADRESS + (2 * (__ADDRESS__)))
mbed_official 87:085cde657901 185 #else /* NOR_MEMORY_16B */
mbed_official 87:085cde657901 186 #define __NOR_ADDR_SHIFT(__ADDRESS__) (uint32_t)(NOR_MEMORY_ADRESS + (__ADDRESS__))
mbed_official 87:085cde657901 187 #endif /* NOR_MEMORY_8B */
mbed_official 87:085cde657901 188
mbed_official 87:085cde657901 189 /**
mbed_official 87:085cde657901 190 * @brief NOR memory write data to specified address.
mbed_official 87:085cde657901 191 * @param __ADDRESS__: NOR memory address
mbed_official 87:085cde657901 192 * @param __DATA__: Data to write
mbed_official 87:085cde657901 193 * @retval None
mbed_official 87:085cde657901 194 */
mbed_official 106:ced8cbb51063 195 #define __NOR_WRITE(__ADDRESS__, __DATA__) (*(__IO uint16_t *)((uint32_t)(__ADDRESS__)) = (__DATA__))
mbed_official 87:085cde657901 196
mbed_official 87:085cde657901 197 /* Exported functions --------------------------------------------------------*/
mbed_official 87:085cde657901 198
mbed_official 226:b062af740e40 199 /* Initialization/de-initialization functions ********************************/
mbed_official 87:085cde657901 200 HAL_StatusTypeDef HAL_NOR_Init(NOR_HandleTypeDef *hnor, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming);
mbed_official 87:085cde657901 201 HAL_StatusTypeDef HAL_NOR_DeInit(NOR_HandleTypeDef *hnor);
mbed_official 106:ced8cbb51063 202 void HAL_NOR_MspInit(NOR_HandleTypeDef *hnor);
mbed_official 106:ced8cbb51063 203 void HAL_NOR_MspDeInit(NOR_HandleTypeDef *hnor);
mbed_official 106:ced8cbb51063 204 void HAL_NOR_MspWait(NOR_HandleTypeDef *hnor, uint32_t Timeout);
mbed_official 87:085cde657901 205
mbed_official 226:b062af740e40 206 /* I/O operation functions ***************************************************/
mbed_official 87:085cde657901 207 HAL_StatusTypeDef HAL_NOR_Read_ID(NOR_HandleTypeDef *hnor, NOR_IDTypeDef *pNOR_ID);
mbed_official 87:085cde657901 208 HAL_StatusTypeDef HAL_NOR_ReturnToReadMode(NOR_HandleTypeDef *hnor);
mbed_official 87:085cde657901 209 HAL_StatusTypeDef HAL_NOR_Read(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData);
mbed_official 87:085cde657901 210 HAL_StatusTypeDef HAL_NOR_Program(NOR_HandleTypeDef *hnor, uint32_t *pAddress, uint16_t *pData);
mbed_official 87:085cde657901 211
mbed_official 87:085cde657901 212 HAL_StatusTypeDef HAL_NOR_ReadBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize);
mbed_official 87:085cde657901 213 HAL_StatusTypeDef HAL_NOR_ProgramBuffer(NOR_HandleTypeDef *hnor, uint32_t uwAddress, uint16_t *pData, uint32_t uwBufferSize);
mbed_official 87:085cde657901 214
mbed_official 87:085cde657901 215 HAL_StatusTypeDef HAL_NOR_Erase_Block(NOR_HandleTypeDef *hnor, uint32_t BlockAddress, uint32_t Address);
mbed_official 87:085cde657901 216 HAL_StatusTypeDef HAL_NOR_Erase_Chip(NOR_HandleTypeDef *hnor, uint32_t Address);
mbed_official 87:085cde657901 217 HAL_StatusTypeDef HAL_NOR_Read_CFI(NOR_HandleTypeDef *hnor, NOR_CFITypeDef *pNOR_CFI);
mbed_official 87:085cde657901 218
mbed_official 226:b062af740e40 219 /* NOR Control functions *****************************************************/
mbed_official 87:085cde657901 220 HAL_StatusTypeDef HAL_NOR_WriteOperation_Enable(NOR_HandleTypeDef *hnor);
mbed_official 87:085cde657901 221 HAL_StatusTypeDef HAL_NOR_WriteOperation_Disable(NOR_HandleTypeDef *hnor);
mbed_official 87:085cde657901 222
mbed_official 226:b062af740e40 223 /* NOR State functions ********************************************************/
mbed_official 87:085cde657901 224 HAL_NOR_StateTypeDef HAL_NOR_GetState(NOR_HandleTypeDef *hnor);
mbed_official 87:085cde657901 225 NOR_StatusTypedef HAL_NOR_GetStatus(NOR_HandleTypeDef *hnor, uint32_t Address, uint32_t Timeout);
mbed_official 87:085cde657901 226
mbed_official 87:085cde657901 227 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
mbed_official 87:085cde657901 228 /**
mbed_official 87:085cde657901 229 * @}
mbed_official 87:085cde657901 230 */
mbed_official 87:085cde657901 231
mbed_official 87:085cde657901 232 /**
mbed_official 87:085cde657901 233 * @}
mbed_official 87:085cde657901 234 */
mbed_official 87:085cde657901 235
mbed_official 87:085cde657901 236 #ifdef __cplusplus
mbed_official 87:085cde657901 237 }
mbed_official 87:085cde657901 238 #endif
mbed_official 87:085cde657901 239
mbed_official 87:085cde657901 240 #endif /* __STM32F4xx_HAL_NOR_H */
mbed_official 87:085cde657901 241
mbed_official 87:085cde657901 242 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/