L4 HAL Drivers
Embed:
(wiki syntax)
Show/hide line numbers
stm32l4xx_hal_sd.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_sd.h 00004 * @author MCD Application Team 00005 * @version V1.1.0 00006 * @date 16-September-2015 00007 * @brief Header file of SD HAL module. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 /* Define to prevent recursive inclusion -------------------------------------*/ 00039 #ifndef __STM32L4xx_HAL_SD_H 00040 #define __STM32L4xx_HAL_SD_H 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /* Includes ------------------------------------------------------------------*/ 00047 #include "stm32l4xx_ll_sdmmc.h" 00048 00049 /** @addtogroup STM32L4xx_HAL_Driver 00050 * @{ 00051 */ 00052 00053 /** @defgroup SD SD 00054 * @brief SD HAL module driver 00055 * @{ 00056 */ 00057 00058 /* Exported types ------------------------------------------------------------*/ 00059 /** @defgroup SD_Exported_Types SD Exported Types 00060 * @{ 00061 */ 00062 00063 /** @defgroup SD_Exported_Types_Group1 SD Handle Structure definition 00064 * @{ 00065 */ 00066 #define SD_InitTypeDef SDMMC_InitTypeDef 00067 #define SD_TypeDef SDMMC_TypeDef 00068 00069 typedef struct 00070 { 00071 SD_TypeDef *Instance; /*!< SDMMC register base address */ 00072 00073 SD_InitTypeDef Init; /*!< SD required parameters */ 00074 00075 HAL_LockTypeDef Lock; /*!< SD locking object */ 00076 00077 uint32_t CardType; /*!< SD card type */ 00078 00079 uint32_t RCA; /*!< SD relative card address */ 00080 00081 uint32_t CSD[4]; /*!< SD card specific data table */ 00082 00083 uint32_t CID[4]; /*!< SD card identification number table */ 00084 00085 __IO uint32_t SdTransferCplt; /*!< SD transfer complete flag in non blocking mode */ 00086 00087 __IO uint32_t SdTransferErr; /*!< SD transfer error flag in non blocking mode */ 00088 00089 __IO uint32_t DmaTransferCplt; /*!< SD DMA transfer complete flag */ 00090 00091 __IO uint32_t SdOperation; /*!< SD transfer operation (read/write) */ 00092 00093 DMA_HandleTypeDef *hdmarx; /*!< SD Rx DMA handle parameters */ 00094 00095 DMA_HandleTypeDef *hdmatx; /*!< SD Tx DMA handle parameters */ 00096 00097 }SD_HandleTypeDef; 00098 /** 00099 * @} 00100 */ 00101 00102 /** @defgroup SD_Exported_Types_Group2 Card Specific Data: CSD Register 00103 * @{ 00104 */ 00105 typedef struct 00106 { 00107 __IO uint8_t CSDStruct; /*!< CSD structure */ 00108 __IO uint8_t SysSpecVersion; /*!< System specification version */ 00109 __IO uint8_t Reserved1; /*!< Reserved */ 00110 __IO uint8_t TAAC; /*!< Data read access time 1 */ 00111 __IO uint8_t NSAC; /*!< Data read access time 2 in CLK cycles */ 00112 __IO uint8_t MaxBusClkFrec; /*!< Max. bus clock frequency */ 00113 __IO uint16_t CardComdClasses; /*!< Card command classes */ 00114 __IO uint8_t RdBlockLen; /*!< Max. read data block length */ 00115 __IO uint8_t PartBlockRead; /*!< Partial blocks for read allowed */ 00116 __IO uint8_t WrBlockMisalign; /*!< Write block misalignment */ 00117 __IO uint8_t RdBlockMisalign; /*!< Read block misalignment */ 00118 __IO uint8_t DSRImpl; /*!< DSR implemented */ 00119 __IO uint8_t Reserved2; /*!< Reserved */ 00120 __IO uint32_t DeviceSize; /*!< Device Size */ 00121 __IO uint8_t MaxRdCurrentVDDMin; /*!< Max. read current @ VDD min */ 00122 __IO uint8_t MaxRdCurrentVDDMax; /*!< Max. read current @ VDD max */ 00123 __IO uint8_t MaxWrCurrentVDDMin; /*!< Max. write current @ VDD min */ 00124 __IO uint8_t MaxWrCurrentVDDMax; /*!< Max. write current @ VDD max */ 00125 __IO uint8_t DeviceSizeMul; /*!< Device size multiplier */ 00126 __IO uint8_t EraseGrSize; /*!< Erase group size */ 00127 __IO uint8_t EraseGrMul; /*!< Erase group size multiplier */ 00128 __IO uint8_t WrProtectGrSize; /*!< Write protect group size */ 00129 __IO uint8_t WrProtectGrEnable; /*!< Write protect group enable */ 00130 __IO uint8_t ManDeflECC; /*!< Manufacturer default ECC */ 00131 __IO uint8_t WrSpeedFact; /*!< Write speed factor */ 00132 __IO uint8_t MaxWrBlockLen; /*!< Max. write data block length */ 00133 __IO uint8_t WriteBlockPaPartial; /*!< Partial blocks for write allowed */ 00134 __IO uint8_t Reserved3; /*!< Reserved */ 00135 __IO uint8_t ContentProtectAppli; /*!< Content protection application */ 00136 __IO uint8_t FileFormatGrouop; /*!< File format group */ 00137 __IO uint8_t CopyFlag; /*!< Copy flag (OTP) */ 00138 __IO uint8_t PermWrProtect; /*!< Permanent write protection */ 00139 __IO uint8_t TempWrProtect; /*!< Temporary write protection */ 00140 __IO uint8_t FileFormat; /*!< File format */ 00141 __IO uint8_t ECC; /*!< ECC code */ 00142 __IO uint8_t CSD_CRC; /*!< CSD CRC */ 00143 __IO uint8_t Reserved4; /*!< Always 1 */ 00144 00145 }HAL_SD_CSDTypedef; 00146 /** 00147 * @} 00148 */ 00149 00150 /** @defgroup SD_Exported_Types_Group3 Card Identification Data: CID Register 00151 * @{ 00152 */ 00153 typedef struct 00154 { 00155 __IO uint8_t ManufacturerID; /*!< Manufacturer ID */ 00156 __IO uint16_t OEM_AppliID; /*!< OEM/Application ID */ 00157 __IO uint32_t ProdName1; /*!< Product Name part1 */ 00158 __IO uint8_t ProdName2; /*!< Product Name part2 */ 00159 __IO uint8_t ProdRev; /*!< Product Revision */ 00160 __IO uint32_t ProdSN; /*!< Product Serial Number */ 00161 __IO uint8_t Reserved1; /*!< Reserved1 */ 00162 __IO uint16_t ManufactDate; /*!< Manufacturing Date */ 00163 __IO uint8_t CID_CRC; /*!< CID CRC */ 00164 __IO uint8_t Reserved2; /*!< Always 1 */ 00165 00166 }HAL_SD_CIDTypedef; 00167 /** 00168 * @} 00169 */ 00170 00171 /** @defgroup SD_Exported_Types_Group4 SD Card Status returned by ACMD13 00172 * @{ 00173 */ 00174 typedef struct 00175 { 00176 __IO uint8_t DAT_BUS_WIDTH; /*!< Shows the currently defined data bus width */ 00177 __IO uint8_t SECURED_MODE; /*!< Card is in secured mode of operation */ 00178 __IO uint16_t SD_CARD_TYPE; /*!< Carries information about card type */ 00179 __IO uint32_t SIZE_OF_PROTECTED_AREA; /*!< Carries information about the capacity of protected area */ 00180 __IO uint8_t SPEED_CLASS; /*!< Carries information about the speed class of the card */ 00181 __IO uint8_t PERFORMANCE_MOVE; /*!< Carries information about the card's performance move */ 00182 __IO uint8_t AU_SIZE; /*!< Carries information about the card's allocation unit size */ 00183 __IO uint16_t ERASE_SIZE; /*!< Determines the number of AUs to be erased in one operation */ 00184 __IO uint8_t ERASE_TIMEOUT; /*!< Determines the timeout for any number of AU erase */ 00185 __IO uint8_t ERASE_OFFSET; /*!< Carries information about the erase offset */ 00186 00187 }HAL_SD_CardStatusTypedef; 00188 /** 00189 * @} 00190 */ 00191 00192 /** @defgroup SD_Exported_Types_Group5 SD Card information structure 00193 * @{ 00194 */ 00195 typedef struct 00196 { 00197 HAL_SD_CSDTypedef SD_csd; /*!< SD card specific data register */ 00198 HAL_SD_CIDTypedef SD_cid; /*!< SD card identification number register */ 00199 uint64_t CardCapacity; /*!< Card capacity */ 00200 uint32_t CardBlockSize; /*!< Card block size */ 00201 uint16_t RCA; /*!< SD relative card address */ 00202 uint8_t CardType; /*!< SD card type */ 00203 00204 }HAL_SD_CardInfoTypedef; 00205 /** 00206 * @} 00207 */ 00208 00209 /** @defgroup SD_Exported_Types_Group6 SD Error status enumeration Structure definition 00210 * @{ 00211 */ 00212 typedef enum 00213 { 00214 /** 00215 * @brief SD specific error defines 00216 */ 00217 SD_CMD_CRC_FAIL = (1), /*!< Command response received (but CRC check failed) */ 00218 SD_DATA_CRC_FAIL = (2), /*!< Data block sent/received (CRC check failed) */ 00219 SD_CMD_RSP_TIMEOUT = (3), /*!< Command response timeout */ 00220 SD_DATA_TIMEOUT = (4), /*!< Data timeout */ 00221 SD_TX_UNDERRUN = (5), /*!< Transmit FIFO underrun */ 00222 SD_RX_OVERRUN = (6), /*!< Receive FIFO overrun */ 00223 SD_START_BIT_ERR = (7), /*!< Start bit not detected on all data signals in wide bus mode */ 00224 SD_CMD_OUT_OF_RANGE = (8), /*!< Command's argument was out of range. */ 00225 SD_ADDR_MISALIGNED = (9), /*!< Misaligned address */ 00226 SD_BLOCK_LEN_ERR = (10), /*!< Transferred block length is not allowed for the card or the number of transferred bytes does not match the block length */ 00227 SD_ERASE_SEQ_ERR = (11), /*!< An error in the sequence of erase command occurs. */ 00228 SD_BAD_ERASE_PARAM = (12), /*!< An invalid selection for erase groups */ 00229 SD_WRITE_PROT_VIOLATION = (13), /*!< Attempt to program a write protect block */ 00230 SD_LOCK_UNLOCK_FAILED = (14), /*!< Sequence or password error has been detected in unlock command or if there was an attempt to access a locked card */ 00231 SD_COM_CRC_FAILED = (15), /*!< CRC check of the previous command failed */ 00232 SD_ILLEGAL_CMD = (16), /*!< Command is not legal for the card state */ 00233 SD_CARD_ECC_FAILED = (17), /*!< Card internal ECC was applied but failed to correct the data */ 00234 SD_CC_ERROR = (18), /*!< Internal card controller error */ 00235 SD_GENERAL_UNKNOWN_ERROR = (19), /*!< General or unknown error */ 00236 SD_STREAM_READ_UNDERRUN = (20), /*!< The card could not sustain data transfer in stream read operation. */ 00237 SD_STREAM_WRITE_OVERRUN = (21), /*!< The card could not sustain data programming in stream mode */ 00238 SD_CID_CSD_OVERWRITE = (22), /*!< CID/CSD overwrite error */ 00239 SD_WP_ERASE_SKIP = (23), /*!< Only partial address space was erased */ 00240 SD_CARD_ECC_DISABLED = (24), /*!< Command has been executed without using internal ECC */ 00241 SD_ERASE_RESET = (25), /*!< Erase sequence was cleared before executing because an out of erase sequence command was received */ 00242 SD_AKE_SEQ_ERROR = (26), /*!< Error in sequence of authentication. */ 00243 SD_INVALID_VOLTRANGE = (27), 00244 SD_ADDR_OUT_OF_RANGE = (28), 00245 SD_SWITCH_ERROR = (29), 00246 SD_SDMMC_DISABLED = (30), 00247 SD_SDMMC_FUNCTION_BUSY = (31), 00248 SD_SDMMC_FUNCTION_FAILED = (32), 00249 SD_SDMMC_UNKNOWN_FUNCTION = (33), 00250 00251 /** 00252 * @brief Standard error defines 00253 */ 00254 SD_INTERNAL_ERROR = (34), 00255 SD_NOT_CONFIGURED = (35), 00256 SD_REQUEST_PENDING = (36), 00257 SD_REQUEST_NOT_APPLICABLE = (37), 00258 SD_INVALID_PARAMETER = (38), 00259 SD_UNSUPPORTED_FEATURE = (39), 00260 SD_UNSUPPORTED_HW = (40), 00261 SD_ERROR = (41), 00262 SD_OK = (0) 00263 00264 }HAL_SD_ErrorTypedef; 00265 /** 00266 * @} 00267 */ 00268 00269 /** @defgroup SD_Exported_Types_Group7 SD Transfer state enumeration structure 00270 * @{ 00271 */ 00272 typedef enum 00273 { 00274 SD_TRANSFER_OK = 0, /*!< Transfer success */ 00275 SD_TRANSFER_BUSY = 1, /*!< Transfer is occurring */ 00276 SD_TRANSFER_ERROR = 2 /*!< Transfer failed */ 00277 00278 }HAL_SD_TransferStateTypedef; 00279 /** 00280 * @} 00281 */ 00282 00283 /** @defgroup SD_Exported_Types_Group8 SD Card State enumeration structure 00284 * @{ 00285 */ 00286 typedef enum 00287 { 00288 SD_CARD_READY = ((uint32_t)0x00000001), /*!< Card state is ready */ 00289 SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002), /*!< Card is in identification state */ 00290 SD_CARD_STANDBY = ((uint32_t)0x00000003), /*!< Card is in standby state */ 00291 SD_CARD_TRANSFER = ((uint32_t)0x00000004), /*!< Card is in transfer state */ 00292 SD_CARD_SENDING = ((uint32_t)0x00000005), /*!< Card is sending an operation */ 00293 SD_CARD_RECEIVING = ((uint32_t)0x00000006), /*!< Card is receiving operation information */ 00294 SD_CARD_PROGRAMMING = ((uint32_t)0x00000007), /*!< Card is in programming state */ 00295 SD_CARD_DISCONNECTED = ((uint32_t)0x00000008), /*!< Card is disconnected */ 00296 SD_CARD_ERROR = ((uint32_t)0x000000FF) /*!< Card is in error state */ 00297 00298 }HAL_SD_CardStateTypedef; 00299 /** 00300 * @} 00301 */ 00302 00303 /** @defgroup SD_Exported_Types_Group9 SD Operation enumeration structure 00304 * @{ 00305 */ 00306 typedef enum 00307 { 00308 SD_READ_SINGLE_BLOCK = 0, /*!< Read single block operation */ 00309 SD_READ_MULTIPLE_BLOCK = 1, /*!< Read multiple blocks operation */ 00310 SD_WRITE_SINGLE_BLOCK = 2, /*!< Write single block operation */ 00311 SD_WRITE_MULTIPLE_BLOCK = 3 /*!< Write multiple blocks operation */ 00312 00313 }HAL_SD_OperationTypedef; 00314 /** 00315 * @} 00316 */ 00317 00318 /** 00319 * @} 00320 */ 00321 00322 /* Exported constants --------------------------------------------------------*/ 00323 /** @defgroup SD_Exported_Constants SD Exported Constants 00324 * @{ 00325 */ 00326 00327 /** 00328 * @brief SD Commands Index 00329 */ 00330 #define SD_CMD_GO_IDLE_STATE ((uint8_t)0) /*!< Resets the SD memory card. */ 00331 #define SD_CMD_SEND_OP_COND ((uint8_t)1) /*!< Sends host capacity support information and activates the card's initialization process. */ 00332 #define SD_CMD_ALL_SEND_CID ((uint8_t)2) /*!< Asks any card connected to the host to send the CID numbers on the CMD line. */ 00333 #define SD_CMD_SET_REL_ADDR ((uint8_t)3) /*!< Asks the card to publish a new relative address (RCA). */ 00334 #define SD_CMD_SET_DSR ((uint8_t)4) /*!< Programs the DSR of all cards. */ 00335 #define SD_CMD_SDMMC_SEN_OP_COND ((uint8_t)5) /*!< Sends host capacity support information (HCS) and asks the accessed card to send its 00336 operating condition register (OCR) content in the response on the CMD line. */ 00337 #define SD_CMD_HS_SWITCH ((uint8_t)6) /*!< Checks switchable function (mode 0) and switch card function (mode 1). */ 00338 #define SD_CMD_SEL_DESEL_CARD ((uint8_t)7) /*!< Selects the card by its own relative address and gets deselected by any other address */ 00339 #define SD_CMD_HS_SEND_EXT_CSD ((uint8_t)8) /*!< Sends SD Memory Card interface condition, which includes host supply voltage information 00340 and asks the card whether card supports voltage. */ 00341 #define SD_CMD_SEND_CSD ((uint8_t)9) /*!< Addressed card sends its card specific data (CSD) on the CMD line. */ 00342 #define SD_CMD_SEND_CID ((uint8_t)10) /*!< Addressed card sends its card identification (CID) on the CMD line. */ 00343 #define SD_CMD_READ_DAT_UNTIL_STOP ((uint8_t)11) /*!< SD card doesn't support it. */ 00344 #define SD_CMD_STOP_TRANSMISSION ((uint8_t)12) /*!< Forces the card to stop transmission. */ 00345 #define SD_CMD_SEND_STATUS ((uint8_t)13) /*!< Addressed card sends its status register. */ 00346 #define SD_CMD_HS_BUSTEST_READ ((uint8_t)14) 00347 #define SD_CMD_GO_INACTIVE_STATE ((uint8_t)15) /*!< Sends an addressed card into the inactive state. */ 00348 #define SD_CMD_SET_BLOCKLEN ((uint8_t)16) /*!< Sets the block length (in bytes for SDSC) for all following block commands 00349 (read, write, lock). Default block length is fixed to 512 Bytes. Not effective 00350 for SDHS and SDXC. */ 00351 #define SD_CMD_READ_SINGLE_BLOCK ((uint8_t)17) /*!< Reads single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of 00352 fixed 512 bytes in case of SDHC and SDXC. */ 00353 #define SD_CMD_READ_MULT_BLOCK ((uint8_t)18) /*!< Continuously transfers data blocks from card to host until interrupted by 00354 STOP_TRANSMISSION command. */ 00355 #define SD_CMD_HS_BUSTEST_WRITE ((uint8_t)19) /*!< 64 bytes tuning pattern is sent for SDR50 and SDR104. */ 00356 #define SD_CMD_WRITE_DAT_UNTIL_STOP ((uint8_t)20) /*!< Speed class control command. */ 00357 #define SD_CMD_SET_BLOCK_COUNT ((uint8_t)23) /*!< Specify block count for CMD18 and CMD25. */ 00358 #define SD_CMD_WRITE_SINGLE_BLOCK ((uint8_t)24) /*!< Writes single block of size selected by SET_BLOCKLEN in case of SDSC, and a block of 00359 fixed 512 bytes in case of SDHC and SDXC. */ 00360 #define SD_CMD_WRITE_MULT_BLOCK ((uint8_t)25) /*!< Continuously writes blocks of data until a STOP_TRANSMISSION follows. */ 00361 #define SD_CMD_PROG_CID ((uint8_t)26) /*!< Reserved for manufacturers. */ 00362 #define SD_CMD_PROG_CSD ((uint8_t)27) /*!< Programming of the programmable bits of the CSD. */ 00363 #define SD_CMD_SET_WRITE_PROT ((uint8_t)28) /*!< Sets the write protection bit of the addressed group. */ 00364 #define SD_CMD_CLR_WRITE_PROT ((uint8_t)29) /*!< Clears the write protection bit of the addressed group. */ 00365 #define SD_CMD_SEND_WRITE_PROT ((uint8_t)30) /*!< Asks the card to send the status of the write protection bits. */ 00366 #define SD_CMD_SD_ERASE_GRP_START ((uint8_t)32) /*!< Sets the address of the first write block to be erased. (For SD card only). */ 00367 #define SD_CMD_SD_ERASE_GRP_END ((uint8_t)33) /*!< Sets the address of the last write block of the continuous range to be erased. */ 00368 #define SD_CMD_ERASE_GRP_START ((uint8_t)35) /*!< Sets the address of the first write block to be erased. Reserved for each command 00369 system set by switch function command (CMD6). */ 00370 #define SD_CMD_ERASE_GRP_END ((uint8_t)36) /*!< Sets the address of the last write block of the continuous range to be erased. 00371 Reserved for each command system set by switch function command (CMD6). */ 00372 #define SD_CMD_ERASE ((uint8_t)38) /*!< Reserved for SD security applications. */ 00373 #define SD_CMD_FAST_IO ((uint8_t)39) /*!< SD card doesn't support it (Reserved). */ 00374 #define SD_CMD_GO_IRQ_STATE ((uint8_t)40) /*!< SD card doesn't support it (Reserved). */ 00375 #define SD_CMD_LOCK_UNLOCK ((uint8_t)42) /*!< Sets/resets the password or lock/unlock the card. The size of the data block is set by 00376 the SET_BLOCK_LEN command. */ 00377 #define SD_CMD_APP_CMD ((uint8_t)55) /*!< Indicates to the card that the next command is an application specific command rather 00378 than a standard command. */ 00379 #define SD_CMD_GEN_CMD ((uint8_t)56) /*!< Used either to transfer a data block to the card or to get a data block from the card 00380 for general purpose/application specific commands. */ 00381 #define SD_CMD_NO_CMD ((uint8_t)64) 00382 00383 /** 00384 * @brief Following commands are SD Card Specific commands. 00385 * SDMMC_APP_CMD should be sent before sending these commands. 00386 */ 00387 #define SD_CMD_APP_SD_SET_BUSWIDTH ((uint8_t)6) /*!< (ACMD6) Defines the data bus width to be used for data transfer. The allowed data bus 00388 widths are given in SCR register. */ 00389 #define SD_CMD_SD_APP_STATUS ((uint8_t)13) /*!< (ACMD13) Sends the SD status. */ 00390 #define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS ((uint8_t)22) /*!< (ACMD22) Sends the number of the written (without errors) write blocks. Responds with 00391 32bit+CRC data block. */ 00392 #define SD_CMD_SD_APP_OP_COND ((uint8_t)41) /*!< (ACMD41) Sends host capacity support information (HCS) and asks the accessed card to 00393 send its operating condition register (OCR) content in the response on the CMD line. */ 00394 #define SD_CMD_SD_APP_SET_CLR_CARD_DETECT ((uint8_t)42) /*!< (ACMD42) Connects/Disconnects the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card. */ 00395 #define SD_CMD_SD_APP_SEND_SCR ((uint8_t)51) /*!< Reads the SD Configuration Register (SCR). */ 00396 #define SD_CMD_SDMMC_RW_DIRECT ((uint8_t)52) /*!< For SD I/O card only, reserved for security specification. */ 00397 #define SD_CMD_SDMMC_RW_EXTENDED ((uint8_t)53) /*!< For SD I/O card only, reserved for security specification. */ 00398 00399 /** 00400 * @brief Following commands are SD Card Specific security commands. 00401 * SD_CMD_APP_CMD should be sent before sending these commands. 00402 */ 00403 #define SD_CMD_SD_APP_GET_MKB ((uint8_t)43) /*!< For SD card only */ 00404 #define SD_CMD_SD_APP_GET_MID ((uint8_t)44) /*!< For SD card only */ 00405 #define SD_CMD_SD_APP_SET_CER_RN1 ((uint8_t)45) /*!< For SD card only */ 00406 #define SD_CMD_SD_APP_GET_CER_RN2 ((uint8_t)46) /*!< For SD card only */ 00407 #define SD_CMD_SD_APP_SET_CER_RES2 ((uint8_t)47) /*!< For SD card only */ 00408 #define SD_CMD_SD_APP_GET_CER_RES1 ((uint8_t)48) /*!< For SD card only */ 00409 #define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK ((uint8_t)18) /*!< For SD card only */ 00410 #define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK ((uint8_t)25) /*!< For SD card only */ 00411 #define SD_CMD_SD_APP_SECURE_ERASE ((uint8_t)38) /*!< For SD card only */ 00412 #define SD_CMD_SD_APP_CHANGE_SECURE_AREA ((uint8_t)49) /*!< For SD card only */ 00413 #define SD_CMD_SD_APP_SECURE_WRITE_MKB ((uint8_t)48) /*!< For SD card only */ 00414 00415 /** 00416 * @brief Supported SD Memory Cards 00417 */ 00418 #define STD_CAPACITY_SD_CARD_V1_1 ((uint32_t)0x00000000) 00419 #define STD_CAPACITY_SD_CARD_V2_0 ((uint32_t)0x00000001) 00420 #define HIGH_CAPACITY_SD_CARD ((uint32_t)0x00000002) 00421 #define MULTIMEDIA_CARD ((uint32_t)0x00000003) 00422 #define SECURE_DIGITAL_IO_CARD ((uint32_t)0x00000004) 00423 #define HIGH_SPEED_MULTIMEDIA_CARD ((uint32_t)0x00000005) 00424 #define SECURE_DIGITAL_IO_COMBO_CARD ((uint32_t)0x00000006) 00425 #define HIGH_CAPACITY_MMC_CARD ((uint32_t)0x00000007) 00426 /** 00427 * @} 00428 */ 00429 00430 /* Exported macro ------------------------------------------------------------*/ 00431 /** @defgroup SD_Exported_macros SD Exported Macros 00432 * @brief macros to handle interrupts and specific clock configurations 00433 * @{ 00434 */ 00435 00436 /** 00437 * @brief Enable the SD device. 00438 * @retval None 00439 */ 00440 #define __HAL_SD_SDMMC_ENABLE(__HANDLE__) __SDMMC_ENABLE((__HANDLE__)->Instance) 00441 00442 /** 00443 * @brief Disable the SD device. 00444 * @retval None 00445 */ 00446 #define __HAL_SD_SDMMC_DISABLE(__HANDLE__) __SDMMC_DISABLE((__HANDLE__)->Instance) 00447 00448 /** 00449 * @brief Enable the SDMMC DMA transfer. 00450 * @retval None 00451 */ 00452 #define __HAL_SD_SDMMC_DMA_ENABLE(__HANDLE__) __SDMMC_DMA_ENABLE((__HANDLE__)->Instance) 00453 00454 /** 00455 * @brief Disable the SDMMC DMA transfer. 00456 * @retval None 00457 */ 00458 #define __HAL_SD_SDMMC_DMA_DISABLE(__HANDLE__) __SDMMC_DMA_DISABLE((__HANDLE__)->Instance) 00459 00460 /** 00461 * @brief Enable the SD device interrupt. 00462 * @param __HANDLE__: SD Handle 00463 * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be enabled. 00464 * This parameter can be one or a combination of the following values: 00465 * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt 00466 * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt 00467 * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt 00468 * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt 00469 * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt 00470 * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt 00471 * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt 00472 * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt 00473 * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt 00474 * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt 00475 * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt 00476 * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt 00477 * @arg SDMMC_IT_RXACT: Data receive in progress interrupt 00478 * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt 00479 * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt 00480 * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt 00481 * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt 00482 * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt 00483 * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt 00484 * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt 00485 * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt 00486 * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt 00487 * @retval None 00488 */ 00489 #define __HAL_SD_SDMMC_ENABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_ENABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__)) 00490 00491 /** 00492 * @brief Disable the SD device interrupt. 00493 * @param __HANDLE__: SD Handle 00494 * @param __INTERRUPT__: specifies the SDMMC interrupt sources to be disabled. 00495 * This parameter can be one or a combination of the following values: 00496 * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt 00497 * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt 00498 * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt 00499 * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt 00500 * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt 00501 * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt 00502 * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt 00503 * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt 00504 * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt 00505 * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt 00506 * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt 00507 * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt 00508 * @arg SDMMC_IT_RXACT: Data receive in progress interrupt 00509 * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt 00510 * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt 00511 * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt 00512 * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt 00513 * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt 00514 * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt 00515 * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt 00516 * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt 00517 * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt 00518 * @retval None 00519 */ 00520 #define __HAL_SD_SDMMC_DISABLE_IT(__HANDLE__, __INTERRUPT__) __SDMMC_DISABLE_IT((__HANDLE__)->Instance, (__INTERRUPT__)) 00521 00522 /** 00523 * @brief Check whether the specified SD flag is set or not. 00524 * @param __HANDLE__: SD Handle 00525 * @param __FLAG__: specifies the flag to check. 00526 * This parameter can be one of the following values: 00527 * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed) 00528 * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) 00529 * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout 00530 * @arg SDMMC_FLAG_DTIMEOUT: Data timeout 00531 * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error 00532 * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error 00533 * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed) 00534 * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required) 00535 * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) 00536 * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed) 00537 * @arg SDMMC_FLAG_CMDACT: Command transfer in progress 00538 * @arg SDMMC_FLAG_TXACT: Data transmit in progress 00539 * @arg SDMMC_FLAG_RXACT: Data receive in progress 00540 * @arg SDMMC_FLAG_TXFIFOHE: Transmit FIFO Half Empty 00541 * @arg SDMMC_FLAG_RXFIFOHF: Receive FIFO Half Full 00542 * @arg SDMMC_FLAG_TXFIFOF: Transmit FIFO full 00543 * @arg SDMMC_FLAG_RXFIFOF: Receive FIFO full 00544 * @arg SDMMC_FLAG_TXFIFOE: Transmit FIFO empty 00545 * @arg SDMMC_FLAG_RXFIFOE: Receive FIFO empty 00546 * @arg SDMMC_FLAG_TXDAVL: Data available in transmit FIFO 00547 * @arg SDMMC_FLAG_RXDAVL: Data available in receive FIFO 00548 * @arg SDMMC_FLAG_SDIOIT: SD I/O interrupt received 00549 * @retval The new state of SD FLAG (SET or RESET). 00550 */ 00551 #define __HAL_SD_SDMMC_GET_FLAG(__HANDLE__, __FLAG__) __SDMMC_GET_FLAG((__HANDLE__)->Instance, (__FLAG__)) 00552 00553 /** 00554 * @brief Clear the SD's pending flags. 00555 * @param __HANDLE__: SD Handle 00556 * @param __FLAG__: specifies the flag to clear. 00557 * This parameter can be one or a combination of the following values: 00558 * @arg SDMMC_FLAG_CCRCFAIL: Command response received (CRC check failed) 00559 * @arg SDMMC_FLAG_DCRCFAIL: Data block sent/received (CRC check failed) 00560 * @arg SDMMC_FLAG_CTIMEOUT: Command response timeout 00561 * @arg SDMMC_FLAG_DTIMEOUT: Data timeout 00562 * @arg SDMMC_FLAG_TXUNDERR: Transmit FIFO underrun error 00563 * @arg SDMMC_FLAG_RXOVERR: Received FIFO overrun error 00564 * @arg SDMMC_FLAG_CMDREND: Command response received (CRC check passed) 00565 * @arg SDMMC_FLAG_CMDSENT: Command sent (no response required) 00566 * @arg SDMMC_FLAG_DATAEND: Data end (data counter, SDIDCOUNT, is zero) 00567 * @arg SDMMC_FLAG_DBCKEND: Data block sent/received (CRC check passed) 00568 * @arg SDMMC_FLAG_SDIOIT: SD I/O interrupt received 00569 * @retval None 00570 */ 00571 #define __HAL_SD_SDMMC_CLEAR_FLAG(__HANDLE__, __FLAG__) __SDMMC_CLEAR_FLAG((__HANDLE__)->Instance, (__FLAG__)) 00572 00573 /** 00574 * @brief Check whether the specified SD interrupt has occurred or not. 00575 * @param __HANDLE__: SD Handle 00576 * @param __INTERRUPT__: specifies the SDMMC interrupt source to check. 00577 * This parameter can be one of the following values: 00578 * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt 00579 * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt 00580 * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt 00581 * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt 00582 * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt 00583 * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt 00584 * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt 00585 * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt 00586 * @arg SDMMC_IT_DATAEND: Data end (data counter, SDIDCOUNT, is zero) interrupt 00587 * @arg SDMMC_IT_DBCKEND: Data block sent/received (CRC check passed) interrupt 00588 * @arg SDMMC_IT_CMDACT: Command transfer in progress interrupt 00589 * @arg SDMMC_IT_TXACT: Data transmit in progress interrupt 00590 * @arg SDMMC_IT_RXACT: Data receive in progress interrupt 00591 * @arg SDMMC_IT_TXFIFOHE: Transmit FIFO Half Empty interrupt 00592 * @arg SDMMC_IT_RXFIFOHF: Receive FIFO Half Full interrupt 00593 * @arg SDMMC_IT_TXFIFOF: Transmit FIFO full interrupt 00594 * @arg SDMMC_IT_RXFIFOF: Receive FIFO full interrupt 00595 * @arg SDMMC_IT_TXFIFOE: Transmit FIFO empty interrupt 00596 * @arg SDMMC_IT_RXFIFOE: Receive FIFO empty interrupt 00597 * @arg SDMMC_IT_TXDAVL: Data available in transmit FIFO interrupt 00598 * @arg SDMMC_IT_RXDAVL: Data available in receive FIFO interrupt 00599 * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt 00600 * @retval The new state of SD IT (SET or RESET). 00601 */ 00602 #define __HAL_SD_SDMMC_GET_IT(__HANDLE__, __INTERRUPT__) __SDMMC_GET_IT((__HANDLE__)->Instance, (__INTERRUPT__)) 00603 00604 /** 00605 * @brief Clear the SD's interrupt pending bits. 00606 * @param __HANDLE__: SD Handle 00607 * @param __INTERRUPT__: specifies the interrupt pending bit to clear. 00608 * This parameter can be one or a combination of the following values: 00609 * @arg SDMMC_IT_CCRCFAIL: Command response received (CRC check failed) interrupt 00610 * @arg SDMMC_IT_DCRCFAIL: Data block sent/received (CRC check failed) interrupt 00611 * @arg SDMMC_IT_CTIMEOUT: Command response timeout interrupt 00612 * @arg SDMMC_IT_DTIMEOUT: Data timeout interrupt 00613 * @arg SDMMC_IT_TXUNDERR: Transmit FIFO underrun error interrupt 00614 * @arg SDMMC_IT_RXOVERR: Received FIFO overrun error interrupt 00615 * @arg SDMMC_IT_CMDREND: Command response received (CRC check passed) interrupt 00616 * @arg SDMMC_IT_CMDSENT: Command sent (no response required) interrupt 00617 * @arg SDMMC_IT_DATAEND: Data end (data counter, SDMMC_DCOUNT, is zero) interrupt 00618 * @arg SDMMC_IT_SDIOIT: SD I/O interrupt received interrupt 00619 * @retval None 00620 */ 00621 #define __HAL_SD_SDMMC_CLEAR_IT(__HANDLE__, __INTERRUPT__) __SDMMC_CLEAR_IT((__HANDLE__)->Instance, (__INTERRUPT__)) 00622 /** 00623 * @} 00624 */ 00625 00626 /* Exported functions --------------------------------------------------------*/ 00627 /** @defgroup SD_Exported_Functions SD Exported Functions 00628 * @{ 00629 */ 00630 00631 /** @defgroup SD_Exported_Functions_Group1 Initialization and de-initialization functions 00632 * @{ 00633 */ 00634 HAL_SD_ErrorTypedef HAL_SD_Init(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypedef *SDCardInfo); 00635 HAL_StatusTypeDef HAL_SD_DeInit (SD_HandleTypeDef *hsd); 00636 void HAL_SD_MspInit(SD_HandleTypeDef *hsd); 00637 void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd); 00638 /** 00639 * @} 00640 */ 00641 00642 /** @defgroup SD_Exported_Functions_Group2 Input and Output operation functions 00643 * @{ 00644 */ 00645 /* Blocking mode: Polling */ 00646 HAL_SD_ErrorTypedef HAL_SD_ReadBlocks(SD_HandleTypeDef *hsd, uint32_t *pReadBuffer, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); 00647 HAL_SD_ErrorTypedef HAL_SD_WriteBlocks(SD_HandleTypeDef *hsd, uint32_t *pWriteBuffer, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); 00648 HAL_SD_ErrorTypedef HAL_SD_Erase(SD_HandleTypeDef *hsd, uint64_t startaddr, uint64_t endaddr); 00649 00650 /* Non-Blocking mode: Interrupt */ 00651 void HAL_SD_IRQHandler(SD_HandleTypeDef *hsd); 00652 00653 /* Callback in non blocking modes (DMA) */ 00654 void HAL_SD_DMA_RxCpltCallback(DMA_HandleTypeDef *hdma); 00655 void HAL_SD_DMA_RxErrorCallback(DMA_HandleTypeDef *hdma); 00656 void HAL_SD_DMA_TxCpltCallback(DMA_HandleTypeDef *hdma); 00657 void HAL_SD_DMA_TxErrorCallback(DMA_HandleTypeDef *hdma); 00658 void HAL_SD_XferCpltCallback(SD_HandleTypeDef *hsd); 00659 void HAL_SD_XferErrorCallback(SD_HandleTypeDef *hsd); 00660 00661 /* Non-Blocking mode: DMA */ 00662 HAL_SD_ErrorTypedef HAL_SD_ReadBlocks_DMA(SD_HandleTypeDef *hsd, uint32_t *pReadBuffer, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); 00663 HAL_SD_ErrorTypedef HAL_SD_WriteBlocks_DMA(SD_HandleTypeDef *hsd, uint32_t *pWriteBuffer, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumberOfBlocks); 00664 HAL_SD_ErrorTypedef HAL_SD_CheckWriteOperation(SD_HandleTypeDef *hsd, uint32_t Timeout); 00665 HAL_SD_ErrorTypedef HAL_SD_CheckReadOperation(SD_HandleTypeDef *hsd, uint32_t Timeout); 00666 /** 00667 * @} 00668 */ 00669 00670 /** @defgroup SD_Exported_Functions_Group3 Peripheral Control functions 00671 * @{ 00672 */ 00673 HAL_SD_ErrorTypedef HAL_SD_Get_CardInfo(SD_HandleTypeDef *hsd, HAL_SD_CardInfoTypedef *pCardInfo); 00674 HAL_SD_ErrorTypedef HAL_SD_WideBusOperation_Config(SD_HandleTypeDef *hsd, uint32_t WideMode); 00675 HAL_SD_ErrorTypedef HAL_SD_StopTransfer(SD_HandleTypeDef *hsd); 00676 HAL_SD_ErrorTypedef HAL_SD_HighSpeed (SD_HandleTypeDef *hsd); 00677 /** 00678 * @} 00679 */ 00680 00681 /* Peripheral State functions ************************************************/ 00682 /** @defgroup SD_Exported_Functions_Group4 Peripheral State functions 00683 * @{ 00684 */ 00685 HAL_SD_ErrorTypedef HAL_SD_SendSDStatus(SD_HandleTypeDef *hsd, uint32_t *pSDstatus); 00686 HAL_SD_ErrorTypedef HAL_SD_GetCardStatus(SD_HandleTypeDef *hsd, HAL_SD_CardStatusTypedef *pCardStatus); 00687 HAL_SD_TransferStateTypedef HAL_SD_GetStatus(SD_HandleTypeDef *hsd); 00688 /** 00689 * @} 00690 */ 00691 00692 /** 00693 * @} 00694 */ 00695 00696 /* Private types -------------------------------------------------------------*/ 00697 /** @defgroup SD_Private_Types SD Private Types 00698 * @{ 00699 */ 00700 00701 /** 00702 * @} 00703 */ 00704 00705 /* Private defines -----------------------------------------------------------*/ 00706 /** @defgroup SD_Private_Defines SD Private Defines 00707 * @{ 00708 */ 00709 00710 /** 00711 * @} 00712 */ 00713 00714 /* Private variables ---------------------------------------------------------*/ 00715 /** @defgroup SD_Private_Variables SD Private Variables 00716 * @{ 00717 */ 00718 00719 /** 00720 * @} 00721 */ 00722 00723 /* Private constants ---------------------------------------------------------*/ 00724 /** @defgroup SD_Private_Constants SD Private Constants 00725 * @{ 00726 */ 00727 00728 /** 00729 * @} 00730 */ 00731 00732 /* Private macros ------------------------------------------------------------*/ 00733 /** @defgroup SD_Private_Macros SD Private Macros 00734 * @{ 00735 */ 00736 00737 /** 00738 * @} 00739 */ 00740 00741 /* Private functions prototypes ----------------------------------------------*/ 00742 /** @defgroup SD_Private_Functions_Prototypes SD Private Functions Prototypes 00743 * @{ 00744 */ 00745 00746 /** 00747 * @} 00748 */ 00749 00750 /* Private functions ---------------------------------------------------------*/ 00751 /** @defgroup SD_Private_Functions SD Private Functions 00752 * @{ 00753 */ 00754 00755 /** 00756 * @} 00757 */ 00758 00759 /** 00760 * @} 00761 */ 00762 00763 /** 00764 * @} 00765 */ 00766 00767 #ifdef __cplusplus 00768 } 00769 #endif 00770 00771 00772 #endif /* __STM32L4xx_HAL_SD_H */ 00773 00774 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 00775
Generated on Tue Jul 12 2022 10:58:10 by 1.7.2