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_pccard.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 PCCARD 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_PCCARD_H
Kojto 96:487b796308b0 40 #define __STM32F1xx_HAL_PCCARD_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_ll_fsmc.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 #if defined (STM32F101xE) || defined(STM32F103xE) || defined(STM32F101xG) || defined(STM32F103xG)
Kojto 96:487b796308b0 54 /** @addtogroup PCCARD
Kojto 96:487b796308b0 55 * @{
Kojto 96:487b796308b0 56 */
Kojto 96:487b796308b0 57
Kojto 96:487b796308b0 58 /** @addtogroup PCCARD_Private_Constants
Kojto 96:487b796308b0 59 * @{
Kojto 96:487b796308b0 60 */
Kojto 96:487b796308b0 61
Kojto 96:487b796308b0 62 #define PCCARD_DEVICE_ADDRESS FSMC_BANK4
Kojto 96:487b796308b0 63 #define PCCARD_ATTRIBUTE_SPACE_ADDRESS ((uint32_t)(FSMC_BANK4 + 0x08000000)) /* Attribute space size to @0x9BFF FFFF */
Kojto 96:487b796308b0 64 #define PCCARD_COMMON_SPACE_ADDRESS PCCARD_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */
Kojto 96:487b796308b0 65 #define PCCARD_IO_SPACE_ADDRESS ((uint32_t)(FSMC_BANK4 + 0x0C000000)) /* IO space size to @0x9FFF FFFF */
Kojto 96:487b796308b0 66 #define PCCARD_IO_SPACE_PRIMARY_ADDR ((uint32_t)(FSMC_BANK4 + 0x0C0001F0)) /* IO space size to @0x9FFF FFFF */
Kojto 96:487b796308b0 67
Kojto 96:487b796308b0 68 /* Compact Flash-ATA registers description */
Kojto 96:487b796308b0 69 #define ATA_DATA ((uint8_t)0x00) /* Data register */
Kojto 96:487b796308b0 70 #define ATA_SECTOR_COUNT ((uint8_t)0x02) /* Sector Count register */
Kojto 96:487b796308b0 71 #define ATA_SECTOR_NUMBER ((uint8_t)0x03) /* Sector Number register */
Kojto 96:487b796308b0 72 #define ATA_CYLINDER_LOW ((uint8_t)0x04) /* Cylinder low register */
Kojto 96:487b796308b0 73 #define ATA_CYLINDER_HIGH ((uint8_t)0x05) /* Cylinder high register */
Kojto 96:487b796308b0 74 #define ATA_CARD_HEAD ((uint8_t)0x06) /* Card/Head register */
Kojto 96:487b796308b0 75 #define ATA_STATUS_CMD ((uint8_t)0x07) /* Status(read)/Command(write) register */
Kojto 96:487b796308b0 76 #define ATA_STATUS_CMD_ALTERNATE ((uint8_t)0x0E) /* Alternate Status(read)/Command(write) register */
Kojto 96:487b796308b0 77 #define ATA_COMMON_DATA_AREA ((uint16_t)0x0400) /* Start of data area (for Common access only!) */
Kojto 96:487b796308b0 78 #define ATA_CARD_CONFIGURATION ((uint16_t)0x0202) /* Card Configuration and Status Register */
Kojto 96:487b796308b0 79
Kojto 96:487b796308b0 80 /* Compact Flash-ATA commands */
Kojto 96:487b796308b0 81 #define ATA_READ_SECTOR_CMD ((uint8_t)0x20)
Kojto 96:487b796308b0 82 #define ATA_WRITE_SECTOR_CMD ((uint8_t)0x30)
Kojto 96:487b796308b0 83 #define ATA_ERASE_SECTOR_CMD ((uint8_t)0xC0)
Kojto 96:487b796308b0 84 #define ATA_IDENTIFY_CMD ((uint8_t)0xEC)
Kojto 96:487b796308b0 85
Kojto 96:487b796308b0 86 /* Compact Flash status */
Kojto 96:487b796308b0 87 #define PCCARD_TIMEOUT_ERROR ((uint8_t)0x60)
Kojto 96:487b796308b0 88 #define PCCARD_BUSY ((uint8_t)0x80)
Kojto 96:487b796308b0 89 #define PCCARD_PROGR ((uint8_t)0x01)
Kojto 96:487b796308b0 90 #define PCCARD_READY ((uint8_t)0x40)
Kojto 96:487b796308b0 91
Kojto 96:487b796308b0 92 #define PCCARD_SECTOR_SIZE ((uint32_t)255) /* In half words */
Kojto 96:487b796308b0 93
Kojto 96:487b796308b0 94
Kojto 96:487b796308b0 95 /* Compact Flash redefinition */
Kojto 96:487b796308b0 96 #define HAL_CF_Read_ID HAL_PCCARD_Read_ID
Kojto 96:487b796308b0 97 #define HAL_CF_Write_Sector HAL_PCCARD_Write_Sector
Kojto 96:487b796308b0 98 #define HAL_CF_Read_Sector HAL_PCCARD_Read_Sector
Kojto 96:487b796308b0 99 #define HAL_CF_Erase_Sector HAL_PCCARD_Erase_Sector
Kojto 96:487b796308b0 100 #define HAL_CF_Reset HAL_PCCARD_Reset
Kojto 96:487b796308b0 101
Kojto 96:487b796308b0 102 #define HAL_CF_GetStatus HAL_PCCARD_GetStatus
Kojto 96:487b796308b0 103 #define HAL_CF_ReadStatus HAL_PCCARD_ReadStatus
Kojto 96:487b796308b0 104
Kojto 96:487b796308b0 105 #define CF_SUCCESS HAL_PCCARD_STATUS_SUCCESS
Kojto 96:487b796308b0 106 #define CF_ONGOING HAL_PCCARD_STATUS_ONGOING
Kojto 96:487b796308b0 107 #define CF_ERROR HAL_PCCARD_STATUS_ERROR
Kojto 96:487b796308b0 108 #define CF_TIMEOUT HAL_PCCARD_STATUS_TIMEOUT
Kojto 96:487b796308b0 109 #define CF_StatusTypedef HAL_PCCARD_StatusTypeDef
Kojto 96:487b796308b0 110
Kojto 96:487b796308b0 111
Kojto 96:487b796308b0 112 #define CF_DEVICE_ADDRESS PCCARD_DEVICE_ADDRESS
Kojto 96:487b796308b0 113 #define CF_ATTRIBUTE_SPACE_ADDRESS PCCARD_ATTRIBUTE_SPACE_ADDRESS
Kojto 96:487b796308b0 114 #define CF_COMMON_SPACE_ADDRESS PCCARD_COMMON_SPACE_ADDRESS
Kojto 96:487b796308b0 115 #define CF_IO_SPACE_ADDRESS PCCARD_IO_SPACE_ADDRESS
Kojto 96:487b796308b0 116 #define CF_IO_SPACE_PRIMARY_ADDR PCCARD_IO_SPACE_PRIMARY_ADDR
Kojto 96:487b796308b0 117
Kojto 96:487b796308b0 118 #define CF_TIMEOUT_ERROR PCCARD_TIMEOUT_ERROR
Kojto 96:487b796308b0 119 #define CF_BUSY PCCARD_BUSY
Kojto 96:487b796308b0 120 #define CF_PROGR PCCARD_PROGR
Kojto 96:487b796308b0 121 #define CF_READY PCCARD_READY
Kojto 96:487b796308b0 122
Kojto 96:487b796308b0 123 #define CF_SECTOR_SIZE PCCARD_SECTOR_SIZE
Kojto 96:487b796308b0 124
Kojto 96:487b796308b0 125 /**
Kojto 96:487b796308b0 126 * @}
Kojto 96:487b796308b0 127 */
Kojto 96:487b796308b0 128
Kojto 96:487b796308b0 129 /* Exported typedef ----------------------------------------------------------*/
Kojto 96:487b796308b0 130 /** @defgroup PCCARD_Exported_Types PCCARD Exported Types
Kojto 96:487b796308b0 131 * @{
Kojto 96:487b796308b0 132 */
Kojto 96:487b796308b0 133
Kojto 96:487b796308b0 134 /**
Kojto 96:487b796308b0 135 * @brief HAL PCCARD State structures definition
Kojto 96:487b796308b0 136 */
Kojto 96:487b796308b0 137 typedef enum
Kojto 96:487b796308b0 138 {
Kojto 96:487b796308b0 139 HAL_PCCARD_STATE_RESET = 0x00, /*!< PCCARD peripheral not yet initialized or disabled */
Kojto 96:487b796308b0 140 HAL_PCCARD_STATE_READY = 0x01, /*!< PCCARD peripheral ready */
Kojto 96:487b796308b0 141 HAL_PCCARD_STATE_BUSY = 0x02, /*!< PCCARD peripheral busy */
Kojto 96:487b796308b0 142 HAL_PCCARD_STATE_ERROR = 0x04 /*!< PCCARD peripheral error */
Kojto 96:487b796308b0 143 }HAL_PCCARD_StateTypeDef;
Kojto 96:487b796308b0 144
Kojto 96:487b796308b0 145 typedef enum
Kojto 96:487b796308b0 146 {
Kojto 96:487b796308b0 147 HAL_PCCARD_STATUS_SUCCESS = 0,
Kojto 96:487b796308b0 148 HAL_PCCARD_STATUS_ONGOING,
Kojto 96:487b796308b0 149 HAL_PCCARD_STATUS_ERROR,
Kojto 96:487b796308b0 150 HAL_PCCARD_STATUS_TIMEOUT
Kojto 96:487b796308b0 151 }HAL_PCCARD_StatusTypeDef;
Kojto 96:487b796308b0 152
Kojto 96:487b796308b0 153 /**
Kojto 96:487b796308b0 154 * @brief FSMC_PCCARD handle Structure definition
Kojto 96:487b796308b0 155 */
Kojto 96:487b796308b0 156 typedef struct
Kojto 96:487b796308b0 157 {
Kojto 96:487b796308b0 158 FSMC_PCCARD_TypeDef *Instance; /*!< Register base address for PCCARD device */
Kojto 96:487b796308b0 159
Kojto 96:487b796308b0 160 FSMC_PCCARD_InitTypeDef Init; /*!< PCCARD device control configuration parameters */
Kojto 96:487b796308b0 161
Kojto 96:487b796308b0 162 __IO HAL_PCCARD_StateTypeDef State; /*!< PCCARD device access state */
Kojto 96:487b796308b0 163
Kojto 96:487b796308b0 164 HAL_LockTypeDef Lock; /*!< PCCARD Lock */
Kojto 96:487b796308b0 165
Kojto 96:487b796308b0 166 }PCCARD_HandleTypeDef;
Kojto 96:487b796308b0 167 /**
Kojto 96:487b796308b0 168 * @}
Kojto 96:487b796308b0 169 */
Kojto 96:487b796308b0 170
Kojto 96:487b796308b0 171 /* Exported constants --------------------------------------------------------*/
Kojto 96:487b796308b0 172 /* Exported macro ------------------------------------------------------------*/
Kojto 96:487b796308b0 173 /** @defgroup PCCARD_Exported_Macros PCCARD Exported Macros
Kojto 96:487b796308b0 174 * @{
Kojto 96:487b796308b0 175 */
Kojto 96:487b796308b0 176
Kojto 96:487b796308b0 177 /** @brief Reset PCCARD handle state
Kojto 96:487b796308b0 178 * @param __HANDLE__: specifies the PCCARD handle.
Kojto 96:487b796308b0 179 * @retval None
Kojto 96:487b796308b0 180 */
Kojto 96:487b796308b0 181 #define __HAL_PCCARD_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_PCCARD_STATE_RESET)
Kojto 96:487b796308b0 182 /**
Kojto 96:487b796308b0 183 * @}
Kojto 96:487b796308b0 184 */
Kojto 96:487b796308b0 185
Kojto 96:487b796308b0 186 /* Exported functions --------------------------------------------------------*/
Kojto 96:487b796308b0 187 /** @addtogroup PCCARD_Exported_Functions PCCARD Exported Functions
Kojto 96:487b796308b0 188 * @{
Kojto 96:487b796308b0 189 */
Kojto 96:487b796308b0 190
Kojto 96:487b796308b0 191 /** @addtogroup PCCARD_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 96:487b796308b0 192 * @{
Kojto 96:487b796308b0 193 */
Kojto 96:487b796308b0 194 /* Initialization/de-initialization functions **********************************/
Kojto 96:487b796308b0 195 HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FSMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FSMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FSMC_NAND_PCC_TimingTypeDef *IOSpaceTiming);
Kojto 96:487b796308b0 196 HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 197 void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 198 void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 199 /**
Kojto 96:487b796308b0 200 * @}
Kojto 96:487b796308b0 201 */
Kojto 96:487b796308b0 202
Kojto 96:487b796308b0 203 /** @addtogroup PCCARD_Exported_Functions_Group2 Input Output and memory functions
Kojto 96:487b796308b0 204 * @{
Kojto 96:487b796308b0 205 */
Kojto 96:487b796308b0 206 /* IO operation functions *****************************************************/
Kojto 96:487b796308b0 207 HAL_StatusTypeDef HAL_PCCARD_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus);
Kojto 96:487b796308b0 208 HAL_StatusTypeDef HAL_PCCARD_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
Kojto 96:487b796308b0 209 HAL_StatusTypeDef HAL_PCCARD_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
Kojto 96:487b796308b0 210 HAL_StatusTypeDef HAL_PCCARD_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus);
Kojto 96:487b796308b0 211 HAL_StatusTypeDef HAL_PCCARD_Reset(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 212 void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 213 void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 214
Kojto 96:487b796308b0 215 /**
Kojto 96:487b796308b0 216 * @}
Kojto 96:487b796308b0 217 */
Kojto 96:487b796308b0 218
Kojto 96:487b796308b0 219 /** @defgroup PCCARD_Exported_Functions_Group3 Peripheral State functions
Kojto 96:487b796308b0 220 * @{
Kojto 96:487b796308b0 221 */
Kojto 96:487b796308b0 222 /* PCCARD State functions *******************************************************/
Kojto 96:487b796308b0 223 HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 224 HAL_PCCARD_StatusTypeDef HAL_PCCARD_GetStatus(PCCARD_HandleTypeDef *hpccard);
Kojto 96:487b796308b0 225 HAL_PCCARD_StatusTypeDef HAL_PCCARD_ReadStatus(PCCARD_HandleTypeDef *hpccard);
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
Kojto 96:487b796308b0 234 /**
Kojto 96:487b796308b0 235 * @}
Kojto 96:487b796308b0 236 */
Kojto 96:487b796308b0 237
Kojto 96:487b796308b0 238 #endif /* STM32F101xE || STM32F103xE || STM32F101xG || STM32F103xG */
Kojto 96:487b796308b0 239 /**
Kojto 96:487b796308b0 240 * @}
Kojto 96:487b796308b0 241 */
Kojto 96:487b796308b0 242
Kojto 96:487b796308b0 243 #ifdef __cplusplus
Kojto 96:487b796308b0 244 }
Kojto 96:487b796308b0 245 #endif
Kojto 96:487b796308b0 246
Kojto 96:487b796308b0 247 #endif /* __STM32F1xx_HAL_PCCARD_H */
Kojto 96:487b796308b0 248
Kojto 96:487b796308b0 249 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/