meh

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Mar 19 18:28:32 2014 +0000
Revision:
81:7d30d6019079
Parent:
77:869cf507173a
Child:
85:024bf7f99721
Release 81 of the mbed library

Main changes:

- Updates and fixes for many targets
- LPC1768: serial interface code fixes
- nRF51822 targets now output a .hex file
- More exporters
- More flexible GPIO API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32f4xx_hal_pccard.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
bogdanm 81:7d30d6019079 5 * @version V1.0.0
bogdanm 81:7d30d6019079 6 * @date 18-February-2014
emilmont 77:869cf507173a 7 * @brief Header file of PCCARD HAL module.
emilmont 77:869cf507173a 8 ******************************************************************************
emilmont 77:869cf507173a 9 * @attention
emilmont 77:869cf507173a 10 *
emilmont 77:869cf507173a 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 12 *
emilmont 77:869cf507173a 13 * Redistribution and use in source and binary forms, with or without modification,
emilmont 77:869cf507173a 14 * are permitted provided that the following conditions are met:
emilmont 77:869cf507173a 15 * 1. Redistributions of source code must retain the above copyright notice,
emilmont 77:869cf507173a 16 * this list of conditions and the following disclaimer.
emilmont 77:869cf507173a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
emilmont 77:869cf507173a 18 * this list of conditions and the following disclaimer in the documentation
emilmont 77:869cf507173a 19 * and/or other materials provided with the distribution.
emilmont 77:869cf507173a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
emilmont 77:869cf507173a 21 * may be used to endorse or promote products derived from this software
emilmont 77:869cf507173a 22 * without specific prior written permission.
emilmont 77:869cf507173a 23 *
emilmont 77:869cf507173a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
emilmont 77:869cf507173a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 77:869cf507173a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
emilmont 77:869cf507173a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
emilmont 77:869cf507173a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
emilmont 77:869cf507173a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
emilmont 77:869cf507173a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emilmont 77:869cf507173a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
emilmont 77:869cf507173a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
emilmont 77:869cf507173a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
emilmont 77:869cf507173a 34 *
emilmont 77:869cf507173a 35 ******************************************************************************
emilmont 77:869cf507173a 36 */
emilmont 77:869cf507173a 37
emilmont 77:869cf507173a 38 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 39 #ifndef __STM32F4xx_HAL_PCCARD_H
emilmont 77:869cf507173a 40 #define __STM32F4xx_HAL_PCCARD_H
emilmont 77:869cf507173a 41
emilmont 77:869cf507173a 42 #ifdef __cplusplus
emilmont 77:869cf507173a 43 extern "C" {
emilmont 77:869cf507173a 44 #endif
emilmont 77:869cf507173a 45
emilmont 77:869cf507173a 46 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 47 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx)
emilmont 77:869cf507173a 48 #include "stm32f4xx_ll_fsmc.h"
emilmont 77:869cf507173a 49 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */
emilmont 77:869cf507173a 50
emilmont 77:869cf507173a 51 #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx)
emilmont 77:869cf507173a 52 #include "stm32f4xx_ll_fmc.h"
emilmont 77:869cf507173a 53 #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
emilmont 77:869cf507173a 54
emilmont 77:869cf507173a 55 /** @addtogroup STM32F4xx_HAL_Driver
emilmont 77:869cf507173a 56 * @{
emilmont 77:869cf507173a 57 */
emilmont 77:869cf507173a 58
emilmont 77:869cf507173a 59 /** @addtogroup PCCARD
emilmont 77:869cf507173a 60 * @{
emilmont 77:869cf507173a 61 */
emilmont 77:869cf507173a 62
emilmont 77:869cf507173a 63 #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx)
emilmont 77:869cf507173a 64
emilmont 77:869cf507173a 65 /* Exported typedef ----------------------------------------------------------*/
emilmont 77:869cf507173a 66
emilmont 77:869cf507173a 67 /**
emilmont 77:869cf507173a 68 * @brief HAL SRAM State structures definition
emilmont 77:869cf507173a 69 */
emilmont 77:869cf507173a 70 typedef enum
emilmont 77:869cf507173a 71 {
emilmont 77:869cf507173a 72 HAL_PCCARD_STATE_RESET = 0x00, /*!< PCCARD peripheral not yet initialized or disabled */
emilmont 77:869cf507173a 73 HAL_PCCARD_STATE_READY = 0x01, /*!< PCCARD peripheral ready */
emilmont 77:869cf507173a 74 HAL_PCCARD_STATE_BUSY = 0x02, /*!< PCCARD peripheral busy */
emilmont 77:869cf507173a 75 HAL_PCCARD_STATE_ERROR = 0x04 /*!< PCCARD peripheral error */
emilmont 77:869cf507173a 76 }HAL_PCCARD_StateTypeDef;
emilmont 77:869cf507173a 77
emilmont 77:869cf507173a 78 typedef enum
emilmont 77:869cf507173a 79 {
emilmont 77:869cf507173a 80 CF_SUCCESS = 0,
emilmont 77:869cf507173a 81 CF_ONGOING,
emilmont 77:869cf507173a 82 CF_ERROR,
emilmont 77:869cf507173a 83 CF_TIMEOUT
emilmont 77:869cf507173a 84 }CF_StatusTypedef;
emilmont 77:869cf507173a 85
emilmont 77:869cf507173a 86 /**
emilmont 77:869cf507173a 87 * @brief FMC_PCCARD handle Structure definition
emilmont 77:869cf507173a 88 */
emilmont 77:869cf507173a 89 typedef struct
emilmont 77:869cf507173a 90 {
emilmont 77:869cf507173a 91 FMC_PCCARD_TypeDef *Instance; /*!< Register base address for PCCARD device */
emilmont 77:869cf507173a 92
emilmont 77:869cf507173a 93 FMC_PCCARD_InitTypeDef Init; /*!< PCCARD device control configuration parameters */
emilmont 77:869cf507173a 94
emilmont 77:869cf507173a 95 __IO HAL_PCCARD_StateTypeDef State; /*!< PCCARD device access state */
emilmont 77:869cf507173a 96
emilmont 77:869cf507173a 97 HAL_LockTypeDef Lock; /*!< PCCARD Lock */
emilmont 77:869cf507173a 98
emilmont 77:869cf507173a 99 }PCCARD_HandleTypeDef;
emilmont 77:869cf507173a 100
emilmont 77:869cf507173a 101
emilmont 77:869cf507173a 102 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 103 /** @defgroup PCCARD_Exported_Constants
emilmont 77:869cf507173a 104 * @{
emilmont 77:869cf507173a 105 */
emilmont 77:869cf507173a 106
emilmont 77:869cf507173a 107 #define CF_DEVICE_ADDRESS ((uint32_t)0x90000000)
emilmont 77:869cf507173a 108 #define CF_ATTRIBUTE_SPACE_ADDRESS ((uint32_t)0x98000000) /* Attribute space size to @0x9BFF FFFF */
emilmont 77:869cf507173a 109 #define CF_COMMON_SPACE_ADDRESS CF_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */
emilmont 77:869cf507173a 110 #define CF_IO_SPACE_ADDRESS ((uint32_t)0x9C000000) /* IO space size to @0x9FFF FFFF */
emilmont 77:869cf507173a 111 #define CF_IO_SPACE_PRIMARY_ADDR ((uint32_t)0x9C0001F0) /* IO space size to @0x9FFF FFFF */
emilmont 77:869cf507173a 112
emilmont 77:869cf507173a 113 /* Compact Flash-ATA registers description */
emilmont 77:869cf507173a 114 #define CF_DATA ((uint8_t)0x00) /* Data register */
emilmont 77:869cf507173a 115 #define CF_SECTOR_COUNT ((uint8_t)0x02) /* Sector Count register */
emilmont 77:869cf507173a 116 #define CF_SECTOR_NUMBER ((uint8_t)0x03) /* Sector Number register */
emilmont 77:869cf507173a 117 #define CF_CYLINDER_LOW ((uint8_t)0x04) /* Cylinder low register */
emilmont 77:869cf507173a 118 #define CF_CYLINDER_HIGH ((uint8_t)0x05) /* Cylinder high register */
emilmont 77:869cf507173a 119 #define CF_CARD_HEAD ((uint8_t)0x06) /* Card/Head register */
emilmont 77:869cf507173a 120 #define CF_STATUS_CMD ((uint8_t)0x07) /* Status(read)/Command(write) register */
emilmont 77:869cf507173a 121 #define CF_STATUS_CMD_ALTERNATE ((uint8_t)0x0E) /* Alternate Status(read)/Command(write) register */
emilmont 77:869cf507173a 122 #define CF_COMMON_DATA_AREA ((uint16_t)0x0400) /* Start of data area (for Common access only!) */
emilmont 77:869cf507173a 123
emilmont 77:869cf507173a 124 /* Compact Flash-ATA commands */
emilmont 77:869cf507173a 125 #define CF_READ_SECTOR_CMD ((uint8_t)0x20)
emilmont 77:869cf507173a 126 #define CF_WRITE_SECTOR_CMD ((uint8_t)0x30)
emilmont 77:869cf507173a 127 #define CF_ERASE_SECTOR_CMD ((uint8_t)0xC0)
emilmont 77:869cf507173a 128 #define CF_IDENTIFY_CMD ((uint8_t)0xEC)
emilmont 77:869cf507173a 129
emilmont 77:869cf507173a 130 /* Compact Flash status */
emilmont 77:869cf507173a 131 #define CF_TIMEOUT_ERROR ((uint8_t)0x60)
emilmont 77:869cf507173a 132 #define CF_BUSY ((uint8_t)0x80)
emilmont 77:869cf507173a 133 #define CF_PROGR ((uint8_t)0x01)
emilmont 77:869cf507173a 134 #define CF_READY ((uint8_t)0x40)
emilmont 77:869cf507173a 135
emilmont 77:869cf507173a 136 #define CF_SECTOR_SIZE ((uint32_t)255) /* In half words */
emilmont 77:869cf507173a 137
emilmont 77:869cf507173a 138 /**
emilmont 77:869cf507173a 139 * @}
emilmont 77:869cf507173a 140 */
emilmont 77:869cf507173a 141
emilmont 77:869cf507173a 142 /* Exported functions --------------------------------------------------------*/
emilmont 77:869cf507173a 143 /* Initialization/de-initialization functions **********************************/
emilmont 77:869cf507173a 144 HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming);
emilmont 77:869cf507173a 145 HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard);
bogdanm 81:7d30d6019079 146 void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard);
bogdanm 81:7d30d6019079 147 void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard);
emilmont 77:869cf507173a 148
emilmont 77:869cf507173a 149 /* IO operation functions *****************************************************/
emilmont 77:869cf507173a 150 HAL_StatusTypeDef HAL_CF_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus);
emilmont 77:869cf507173a 151 HAL_StatusTypeDef HAL_CF_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
emilmont 77:869cf507173a 152 HAL_StatusTypeDef HAL_CF_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus);
emilmont 77:869cf507173a 153 HAL_StatusTypeDef HAL_CF_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus);
emilmont 77:869cf507173a 154 HAL_StatusTypeDef HAL_CF_Reset(PCCARD_HandleTypeDef *hpccard);
emilmont 77:869cf507173a 155 void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard);
bogdanm 81:7d30d6019079 156 void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard);
emilmont 77:869cf507173a 157
emilmont 77:869cf507173a 158 /* PCCARD State functions *******************************************************/
emilmont 77:869cf507173a 159 HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard);
emilmont 77:869cf507173a 160 CF_StatusTypedef HAL_CF_GetStatus(PCCARD_HandleTypeDef *hpccard);
emilmont 77:869cf507173a 161 CF_StatusTypedef HAL_CF_ReadStatus(PCCARD_HandleTypeDef *hpccard);
emilmont 77:869cf507173a 162
emilmont 77:869cf507173a 163 #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */
emilmont 77:869cf507173a 164 /**
emilmont 77:869cf507173a 165 * @}
emilmont 77:869cf507173a 166 */
emilmont 77:869cf507173a 167
emilmont 77:869cf507173a 168 /**
emilmont 77:869cf507173a 169 * @}
emilmont 77:869cf507173a 170 */
emilmont 77:869cf507173a 171
emilmont 77:869cf507173a 172 #ifdef __cplusplus
emilmont 77:869cf507173a 173 }
emilmont 77:869cf507173a 174 #endif
emilmont 77:869cf507173a 175
emilmont 77:869cf507173a 176 #endif /* __STM32F4xx_HAL_PCCARD_H */
emilmont 77:869cf507173a 177
emilmont 77:869cf507173a 178 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/