SD card use for DISCO_F469NI basic example

Dependents:   DISCO-F469NI_SD_demo StoreBitmaps IntegrationPotentiometer IntegrationCAN ... more

Files at this revision

API Documentation at this revision

Comitter:
Jerome Coutant
Date:
Wed May 17 12:56:35 2017 +0200
Parent:
0:173c7f7ccc35
Commit message:
DISCO-F769NI BSP update with F4 Cube V1.16.0

Changed in this revision

SD_DISCO_F469NI.cpp Show annotated file Show diff for this revision Revisions of this file
SD_DISCO_F469NI.h Show annotated file Show diff for this revision Revisions of this file
diff -r 173c7f7ccc35 -r c532df66d66a SD_DISCO_F469NI.cpp
--- a/SD_DISCO_F469NI.cpp	Fri Mar 18 15:19:45 2016 +0000
+++ b/SD_DISCO_F469NI.cpp	Wed May 17 12:56:35 2017 +0200
@@ -56,38 +56,37 @@
   return BSP_SD_IsDetected();
 }
 
-uint8_t SD_DISCO_F469NI::ReadBlocks(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+uint8_t SD_DISCO_F469NI::ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout)
 {
-  return BSP_SD_ReadBlocks(pData, ReadAddr, BlockSize, NumOfBlocks);
+  return BSP_SD_ReadBlocks(pData, ReadAddr, NumOfBlocks, Timeout);
 }
 
-uint8_t SD_DISCO_F469NI::WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+uint8_t SD_DISCO_F469NI::WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout)
 {
-  return BSP_SD_WriteBlocks(pData, WriteAddr, BlockSize, NumOfBlocks);
+  return BSP_SD_WriteBlocks(pData, WriteAddr, NumOfBlocks, Timeout);
 }
 
-uint8_t SD_DISCO_F469NI::ReadBlocks_DMA(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+uint8_t SD_DISCO_F469NI::ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks)
 {
-  return BSP_SD_ReadBlocks_DMA(pData, ReadAddr, BlockSize, NumOfBlocks);
+  return BSP_SD_ReadBlocks_DMA(pData, ReadAddr, NumOfBlocks);
 }
 
-uint8_t SD_DISCO_F469NI::WriteBlocks_DMA(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks)
+uint8_t SD_DISCO_F469NI::WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks)
 {
-  return BSP_SD_WriteBlocks_DMA(pData, WriteAddr, BlockSize, NumOfBlocks);
+  return BSP_SD_WriteBlocks_DMA(pData, WriteAddr, NumOfBlocks);
 }
 
-uint8_t SD_DISCO_F469NI::Erase(uint64_t StartAddr, uint64_t EndAddr)
+uint8_t SD_DISCO_F469NI::Erase(uint32_t StartAddr, uint32_t EndAddr)
 {
   return BSP_SD_Erase(StartAddr, EndAddr);
 }
 
-HAL_SD_TransferStateTypedef SD_DISCO_F469NI::GetStatus(void)
+uint8_t SD_DISCO_F469NI::GetCardState(void)
 {
-  return BSP_SD_GetStatus();
+  return BSP_SD_GetCardState();
 }
 
-void SD_DISCO_F469NI::GetCardInfo(HAL_SD_CardInfoTypedef *CardInfo)
+void SD_DISCO_F469NI::GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo)
 {
   BSP_SD_GetCardInfo(CardInfo);
 }
-
diff -r 173c7f7ccc35 -r c532df66d66a SD_DISCO_F469NI.h
--- a/SD_DISCO_F469NI.h	Fri Mar 18 15:19:45 2016 +0000
+++ b/SD_DISCO_F469NI.h	Wed May 17 12:56:35 2017 +0200
@@ -80,41 +80,39 @@
     * @brief  Reads block(s); from a specified address in an SD card, in polling mode.
     * @param  pData: Pointer to the buffer that will contain the data to transmit
     * @param  ReadAddr: Address from where data is to be read
-    * @param  BlockSize: SD card data block size, that should be 512
-    * @param  NumOfBlocks: Number of SD blocks to read
+    * @param  NumOfBlocks: Number of SD blocks to write
+    * @param  Timeout: Timeout for write operation
     * @retval SD status
     */
-  uint8_t ReadBlocks(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+  uint8_t ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
 
   /**
     * @brief  Writes block(s); to a specified address in an SD card, in polling mode.
     * @param  pData: Pointer to the buffer that will contain the data to transmit
     * @param  WriteAddr: Address from where data is to be written
-    * @param  BlockSize: SD card data block size, that should be 512
     * @param  NumOfBlocks: Number of SD blocks to write
+    * @param  Timeout: Timeout for write operation
     * @retval SD status
     */
-  uint8_t WriteBlocks(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+  uint8_t WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
 
   /**
     * @brief  Reads block(s); from a specified address in an SD card, in DMA mode.
     * @param  pData: Pointer to the buffer that will contain the data to transmit
     * @param  ReadAddr: Address from where data is to be read
-    * @param  BlockSize: SD card data block size, that should be 512
-    * @param  NumOfBlocks: Number of SD blocks to read
+    * @param  NumOfBlocks: Number of SD blocks to write
     * @retval SD status
     */
-  uint8_t ReadBlocks_DMA(uint32_t *pData, uint64_t ReadAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+  uint8_t ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
 
   /**
     * @brief  Writes block(s); to a specified address in an SD card, in DMA mode.
     * @param  pData: Pointer to the buffer that will contain the data to transmit
     * @param  WriteAddr: Address from where data is to be written
-    * @param  BlockSize: SD card data block size, that should be 512
     * @param  NumOfBlocks: Number of SD blocks to write
     * @retval SD status
     */
-  uint8_t WriteBlocks_DMA(uint32_t *pData, uint64_t WriteAddr, uint32_t BlockSize, uint32_t NumOfBlocks);
+  uint8_t WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
 
   /**
     * @brief  Erases the specified memory area of the given SD card.
@@ -122,22 +120,21 @@
     * @param  EndAddr: End byte address
     * @retval SD status
     */
-  uint8_t Erase(uint64_t StartAddr, uint64_t EndAddr);
+  uint8_t Erase(uint32_t StartAddr, uint32_t EndAddr);
   /**
     * @brief  Gets the current SD card data status.
     * @retval Data transfer state.
     *          This value can be one of the following values:
     *            @arg  SD_TRANSFER_OK: No data transfer is acting
     *            @arg  SD_TRANSFER_BUSY: Data transfer is acting
-    *            @arg  SD_TRANSFER_ERROR: Data transfer error
     */
-  HAL_SD_TransferStateTypedef GetStatus(void);
+  uint8_t GetCardState(void);
 
   /**
     * @brief  Get SD information about specific SD card.
     * @param  CardInfo: Pointer to HAL_SD_CardInfoTypedef structure
     */
-  void GetCardInfo(HAL_SD_CardInfoTypedef *CardInfo);
+  void GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
 
 private: