mbed(SerialHalfDuplex入り)

Fork of mbed by mbed official

Committer:
yusuke_kyo
Date:
Wed Apr 08 08:04:18 2015 +0000
Revision:
98:01a414ca7d6d
Parent:
96:487b796308b0
remove SerialHalfDuplex.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 96:487b796308b0 1 /**
Kojto 96:487b796308b0 2 ******************************************************************************
Kojto 96:487b796308b0 3 * @file stm32f1xx_hal_flash.h
Kojto 96:487b796308b0 4 * @author MCD Application Team
Kojto 96:487b796308b0 5 * @version V1.0.0
Kojto 96:487b796308b0 6 * @date 15-December-2014
Kojto 96:487b796308b0 7 * @brief Header file of Flash HAL module.
Kojto 96:487b796308b0 8 ******************************************************************************
Kojto 96:487b796308b0 9 * @attention
Kojto 96:487b796308b0 10 *
Kojto 96:487b796308b0 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 96:487b796308b0 12 *
Kojto 96:487b796308b0 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 96:487b796308b0 14 * are permitted provided that the following conditions are met:
Kojto 96:487b796308b0 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 96:487b796308b0 16 * this list of conditions and the following disclaimer.
Kojto 96:487b796308b0 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 96:487b796308b0 18 * this list of conditions and the following disclaimer in the documentation
Kojto 96:487b796308b0 19 * and/or other materials provided with the distribution.
Kojto 96:487b796308b0 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 96:487b796308b0 21 * may be used to endorse or promote products derived from this software
Kojto 96:487b796308b0 22 * without specific prior written permission.
Kojto 96:487b796308b0 23 *
Kojto 96:487b796308b0 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 96:487b796308b0 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 96:487b796308b0 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 96:487b796308b0 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 96:487b796308b0 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 96:487b796308b0 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 96:487b796308b0 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 96:487b796308b0 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 96:487b796308b0 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 96:487b796308b0 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 96:487b796308b0 34 *
Kojto 96:487b796308b0 35 ******************************************************************************
Kojto 96:487b796308b0 36 */
Kojto 96:487b796308b0 37
Kojto 96:487b796308b0 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 96:487b796308b0 39 #ifndef __STM32F1xx_HAL_FLASH_H
Kojto 96:487b796308b0 40 #define __STM32F1xx_HAL_FLASH_H
Kojto 96:487b796308b0 41
Kojto 96:487b796308b0 42 #ifdef __cplusplus
Kojto 96:487b796308b0 43 extern "C" {
Kojto 96:487b796308b0 44 #endif
Kojto 96:487b796308b0 45
Kojto 96:487b796308b0 46 /* Includes ------------------------------------------------------------------*/
Kojto 96:487b796308b0 47 #include "stm32f1xx_hal_def.h"
Kojto 96:487b796308b0 48
Kojto 96:487b796308b0 49 /** @addtogroup STM32F1xx_HAL_Driver
Kojto 96:487b796308b0 50 * @{
Kojto 96:487b796308b0 51 */
Kojto 96:487b796308b0 52
Kojto 96:487b796308b0 53 /** @addtogroup FLASH
Kojto 96:487b796308b0 54 * @{
Kojto 96:487b796308b0 55 */
Kojto 96:487b796308b0 56
Kojto 96:487b796308b0 57 /** @addtogroup FLASH_Private_Constants
Kojto 96:487b796308b0 58 * @{
Kojto 96:487b796308b0 59 */
Kojto 96:487b796308b0 60 #define FLASH_TIMEOUT_VALUE ((uint32_t)50000)/* 50 s */
Kojto 96:487b796308b0 61 /**
Kojto 96:487b796308b0 62 * @}
Kojto 96:487b796308b0 63 */
Kojto 96:487b796308b0 64
Kojto 96:487b796308b0 65 /** @addtogroup FLASH_Private_Macros
Kojto 96:487b796308b0 66 * @{
Kojto 96:487b796308b0 67 */
Kojto 96:487b796308b0 68
Kojto 96:487b796308b0 69 #define IS_FLASH_TYPEPROGRAM(VALUE) (((VALUE) == FLASH_TYPEPROGRAM_HALFWORD) || \
Kojto 96:487b796308b0 70 ((VALUE) == FLASH_TYPEPROGRAM_WORD) || \
Kojto 96:487b796308b0 71 ((VALUE) == FLASH_TYPEPROGRAM_DOUBLEWORD))
Kojto 96:487b796308b0 72
Kojto 96:487b796308b0 73 /**
Kojto 96:487b796308b0 74 * @}
Kojto 96:487b796308b0 75 */
Kojto 96:487b796308b0 76
Kojto 96:487b796308b0 77 /* Exported types ------------------------------------------------------------*/
Kojto 96:487b796308b0 78 /** @defgroup FLASH_Exported_Types FLASH Exported Types
Kojto 96:487b796308b0 79 * @{
Kojto 96:487b796308b0 80 */
Kojto 96:487b796308b0 81
Kojto 96:487b796308b0 82
Kojto 96:487b796308b0 83 /**
Kojto 96:487b796308b0 84 * @brief FLASH Procedure structure definition
Kojto 96:487b796308b0 85 */
Kojto 96:487b796308b0 86 typedef enum
Kojto 96:487b796308b0 87 {
Kojto 96:487b796308b0 88 FLASH_PROC_NONE = 0,
Kojto 96:487b796308b0 89 FLASH_PROC_PAGEERASE = 1,
Kojto 96:487b796308b0 90 FLASH_PROC_MASSERASE = 2,
Kojto 96:487b796308b0 91 FLASH_PROC_PROGRAMHALFWORD = 3,
Kojto 96:487b796308b0 92 FLASH_PROC_PROGRAMWORD = 4,
Kojto 96:487b796308b0 93 FLASH_PROC_PROGRAMDOUBLEWORD = 5
Kojto 96:487b796308b0 94 } FLASH_ProcedureTypeDef;
Kojto 96:487b796308b0 95
Kojto 96:487b796308b0 96 /**
Kojto 96:487b796308b0 97 * @brief FLASH handle Structure definition
Kojto 96:487b796308b0 98 */
Kojto 96:487b796308b0 99 typedef struct
Kojto 96:487b796308b0 100 {
Kojto 96:487b796308b0 101 __IO FLASH_ProcedureTypeDef ProcedureOnGoing; /* Internal variable to indicate which procedure is ongoing or not in IT context */
Kojto 96:487b796308b0 102
Kojto 96:487b796308b0 103 __IO uint32_t DataRemaining; /* Internal variable to save the remaining pages to erase or half-word to program in IT context */
Kojto 96:487b796308b0 104
Kojto 96:487b796308b0 105 __IO uint32_t Address; /* Internal variable to save address selected for program or erase */
Kojto 96:487b796308b0 106
Kojto 96:487b796308b0 107 __IO uint64_t Data; /* Internal variable to save data to be programmed */
Kojto 96:487b796308b0 108
Kojto 96:487b796308b0 109 HAL_LockTypeDef Lock; /* FLASH locking object */
Kojto 96:487b796308b0 110
Kojto 96:487b796308b0 111 __IO uint32_t ErrorCode; /* FLASH error code */
Kojto 96:487b796308b0 112
Kojto 96:487b796308b0 113 } FLASH_ProcessTypeDef;
Kojto 96:487b796308b0 114
Kojto 96:487b796308b0 115 /**
Kojto 96:487b796308b0 116 * @}
Kojto 96:487b796308b0 117 */
Kojto 96:487b796308b0 118
Kojto 96:487b796308b0 119 /* Exported constants --------------------------------------------------------*/
Kojto 96:487b796308b0 120 /** @defgroup FLASH_Exported_Constants FLASH Exported Constants
Kojto 96:487b796308b0 121 * @{
Kojto 96:487b796308b0 122 */
Kojto 96:487b796308b0 123
Kojto 96:487b796308b0 124 /** @defgroup FLASH_Error_Codes FLASH Error Codes
Kojto 96:487b796308b0 125 * @{
Kojto 96:487b796308b0 126 */
Kojto 96:487b796308b0 127
Kojto 96:487b796308b0 128 #define HAL_FLASH_ERROR_NONE ((uint32_t)0x00)
Kojto 96:487b796308b0 129 #define HAL_FLASH_ERROR_PROG ((uint32_t)0x01)
Kojto 96:487b796308b0 130 #define HAL_FLASH_ERROR_WRP ((uint32_t)0x02)
Kojto 96:487b796308b0 131 #define HAL_FLASH_ERROR_OPTV ((uint32_t)0x04)
Kojto 96:487b796308b0 132
Kojto 96:487b796308b0 133 /**
Kojto 96:487b796308b0 134 * @}
Kojto 96:487b796308b0 135 */
Kojto 96:487b796308b0 136
Kojto 96:487b796308b0 137
Kojto 96:487b796308b0 138 /** @defgroup FLASH_Type_Program Type Program
Kojto 96:487b796308b0 139 * @{
Kojto 96:487b796308b0 140 */
Kojto 96:487b796308b0 141 #define FLASH_TYPEPROGRAM_HALFWORD ((uint32_t)0x01) /*!<Program a half-word (16-bit) at a specified address.*/
Kojto 96:487b796308b0 142 #define FLASH_TYPEPROGRAM_WORD ((uint32_t)0x02) /*!<Program a word (32-bit) at a specified address.*/
Kojto 96:487b796308b0 143 #define FLASH_TYPEPROGRAM_DOUBLEWORD ((uint32_t)0x03) /*!<Program a double word (64-bit) at a specified address*/
Kojto 96:487b796308b0 144
Kojto 96:487b796308b0 145 /**
Kojto 96:487b796308b0 146 * @}
Kojto 96:487b796308b0 147 */
Kojto 96:487b796308b0 148
Kojto 96:487b796308b0 149 /**
Kojto 96:487b796308b0 150 * @}
Kojto 96:487b796308b0 151 */
Kojto 96:487b796308b0 152
Kojto 96:487b796308b0 153 /* Exported macro ------------------------------------------------------------*/
Kojto 96:487b796308b0 154
Kojto 96:487b796308b0 155 /** @defgroup FLASH_Exported_Macros FLASH Exported Macros
Kojto 96:487b796308b0 156 * @brief macros to control FLASH features
Kojto 96:487b796308b0 157 * @{
Kojto 96:487b796308b0 158 */
Kojto 96:487b796308b0 159
Kojto 96:487b796308b0 160 /**
Kojto 96:487b796308b0 161 * @brief Enable the FLASH half cycle access.
Kojto 96:487b796308b0 162 * @note halfcycle access can only be used with a low-frequency clock of less than
Kojto 96:487b796308b0 163 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
Kojto 96:487b796308b0 164 * @retval None
Kojto 96:487b796308b0 165 */
Kojto 96:487b796308b0 166 #define __HAL_FLASH_HALF_CYCLE_ACCESS_ENABLE() (FLASH->ACR |= FLASH_ACR_HLFCYA)
Kojto 96:487b796308b0 167
Kojto 96:487b796308b0 168 /**
Kojto 96:487b796308b0 169 * @brief Disable the FLASH half cycle access.
Kojto 96:487b796308b0 170 * @note halfcycle access can only be used with a low-frequency clock of less than
Kojto 96:487b796308b0 171 8 MHz that can be obtained with the use of HSI or HSE but not of PLL.
Kojto 96:487b796308b0 172 * @retval None
Kojto 96:487b796308b0 173 */
Kojto 96:487b796308b0 174 #define __HAL_FLASH_HALF_CYCLE_ACCESS_DISABLE() (FLASH->ACR &= (~FLASH_ACR_HLFCYA))
Kojto 96:487b796308b0 175
Kojto 96:487b796308b0 176 /**
Kojto 96:487b796308b0 177 * @}
Kojto 96:487b796308b0 178 */
Kojto 96:487b796308b0 179
Kojto 96:487b796308b0 180 /* Include FLASH HAL Extended module */
Kojto 96:487b796308b0 181 #include "stm32f1xx_hal_flash_ex.h"
Kojto 96:487b796308b0 182
Kojto 96:487b796308b0 183 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 184 /** @addtogroup FLASH_Exported_Functions
Kojto 96:487b796308b0 185 * @{
Kojto 96:487b796308b0 186 */
Kojto 96:487b796308b0 187
Kojto 96:487b796308b0 188 /** @addtogroup FLASH_Exported_Functions_Group1
Kojto 96:487b796308b0 189 * @{
Kojto 96:487b796308b0 190 */
Kojto 96:487b796308b0 191 /* IO operation functions *****************************************************/
Kojto 96:487b796308b0 192 HAL_StatusTypeDef HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
Kojto 96:487b796308b0 193 HAL_StatusTypeDef HAL_FLASH_Program_IT(uint32_t TypeProgram, uint32_t Address, uint64_t Data);
Kojto 96:487b796308b0 194
Kojto 96:487b796308b0 195 /* FLASH IRQ handler method */
Kojto 96:487b796308b0 196 void HAL_FLASH_IRQHandler(void);
Kojto 96:487b796308b0 197 /* Callbacks in non blocking modes */
Kojto 96:487b796308b0 198 void HAL_FLASH_EndOfOperationCallback(uint32_t ReturnValue);
Kojto 96:487b796308b0 199 void HAL_FLASH_OperationErrorCallback(uint32_t ReturnValue);
Kojto 96:487b796308b0 200
Kojto 96:487b796308b0 201 /**
Kojto 96:487b796308b0 202 * @}
Kojto 96:487b796308b0 203 */
Kojto 96:487b796308b0 204
Kojto 96:487b796308b0 205 /** @addtogroup FLASH_Exported_Functions_Group2
Kojto 96:487b796308b0 206 * @{
Kojto 96:487b796308b0 207 */
Kojto 96:487b796308b0 208 /* Peripheral Control functions ***********************************************/
Kojto 96:487b796308b0 209 HAL_StatusTypeDef HAL_FLASH_Unlock(void);
Kojto 96:487b796308b0 210 HAL_StatusTypeDef HAL_FLASH_Lock(void);
Kojto 96:487b796308b0 211 HAL_StatusTypeDef HAL_FLASH_OB_Unlock(void);
Kojto 96:487b796308b0 212 HAL_StatusTypeDef HAL_FLASH_OB_Lock(void);
Kojto 96:487b796308b0 213 HAL_StatusTypeDef HAL_FLASH_OB_Launch(void);
Kojto 96:487b796308b0 214
Kojto 96:487b796308b0 215 /**
Kojto 96:487b796308b0 216 * @}
Kojto 96:487b796308b0 217 */
Kojto 96:487b796308b0 218
Kojto 96:487b796308b0 219 /** @addtogroup FLASH_Exported_Functions_Group3
Kojto 96:487b796308b0 220 * @{
Kojto 96:487b796308b0 221 */
Kojto 96:487b796308b0 222 /* Peripheral State and Error functions ***************************************/
Kojto 96:487b796308b0 223 uint32_t HAL_FLASH_GetError(void);
Kojto 96:487b796308b0 224
Kojto 96:487b796308b0 225 /**
Kojto 96:487b796308b0 226 * @}
Kojto 96:487b796308b0 227 */
Kojto 96:487b796308b0 228
Kojto 96:487b796308b0 229 /**
Kojto 96:487b796308b0 230 * @}
Kojto 96:487b796308b0 231 */
Kojto 96:487b796308b0 232
Kojto 96:487b796308b0 233 /* Private function -------------------------------------------------*/
Kojto 96:487b796308b0 234 /** @addtogroup FLASH_Private_Functions
Kojto 96:487b796308b0 235 * @{
Kojto 96:487b796308b0 236 */
Kojto 96:487b796308b0 237 void FLASH_PageErase(uint32_t PageAddress);
Kojto 96:487b796308b0 238 HAL_StatusTypeDef FLASH_WaitForLastOperation(uint32_t Timeout);
Kojto 96:487b796308b0 239 void FLASH_SetErrorCode(void);
Kojto 96:487b796308b0 240 void FLASH_Program_HalfWord(uint32_t Address, uint16_t Data);
Kojto 96:487b796308b0 241
Kojto 96:487b796308b0 242 /**
Kojto 96:487b796308b0 243 * @}
Kojto 96:487b796308b0 244 */
Kojto 96:487b796308b0 245
Kojto 96:487b796308b0 246 /**
Kojto 96:487b796308b0 247 * @}
Kojto 96:487b796308b0 248 */
Kojto 96:487b796308b0 249
Kojto 96:487b796308b0 250 /**
Kojto 96:487b796308b0 251 * @}
Kojto 96:487b796308b0 252 */
Kojto 96:487b796308b0 253
Kojto 96:487b796308b0 254 #ifdef __cplusplus
Kojto 96:487b796308b0 255 }
Kojto 96:487b796308b0 256 #endif
Kojto 96:487b796308b0 257
Kojto 96:487b796308b0 258 #endif /* __STM32F1xx_HAL_FLASH_H */
Kojto 96:487b796308b0 259
Kojto 96:487b796308b0 260 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Kojto 96:487b796308b0 261