STSW-STLKT01: Drivers/BSP/SensorTile/SensorTile_sd.h File Reference

STSW-STLKT01

STSW-STLKT01
SensorTile_sd.h File Reference

This file contains definitions for SensorTile_sd.c driver. More...

#include "SensorTile.h"

Go to the source code of this file.

Data Structures

struct  SD_CSD
 Card Specific Data: CSD Register. More...
 
struct  SD_CID
 Card Identification Data: CID Register. More...
 
struct  SD_CardInfo
 SD Card information. More...
 

Macros

#define MSD_OK   0x00
 SD status structure definition.
 
#define MSD_ERROR   0x01
 
#define STD_CAPACITY_SD_CARD_V1_1   ((uint32_t)0x00000000)
 Supported SD Memory Cards.
 
#define STD_CAPACITY_SD_CARD_V2_0   ((uint32_t)0x00000001)
 
#define HIGH_CAPACITY_SD_CARD   ((uint32_t)0x00000002)
 
#define SD_START_DATA_SINGLE_BLOCK_READ   0xFE /* Data token start byte, Start Single Block Read */
 Start Data tokens: Tokens (necessary because at nop/idle (and CS active) only 0xff is on the data/command line)
 
#define SD_START_DATA_MULTIPLE_BLOCK_READ   0xFE /* Data token start byte, Start Multiple Block Read */
 
#define SD_START_DATA_SINGLE_BLOCK_WRITE   0xFE /* Data token start byte, Start Single Block Write */
 
#define SD_START_DATA_MULTIPLE_BLOCK_WRITE   0xFD /* Data token start byte, Start Multiple Block Write */
 
#define SD_STOP_DATA_MULTIPLE_BLOCK_WRITE   0xFD /* Data toke stop byte, Stop Multiple Block Write */
 
#define SD_PRESENT   ((uint8_t)0x01)
 SD detection on its memory slot.
 
#define SD_NOT_PRESENT   ((uint8_t)0x00)
 
#define SD_CMD_GO_IDLE_STATE   ((uint8_t)0)
 SD Commands Index. More...
 
#define SD_CMD_SEND_OP_COND   ((uint8_t)1)
 
#define SD_CMD_ALL_SEND_CID   ((uint8_t)2)
 
#define SD_CMD_SET_REL_ADDR   ((uint8_t)3)
 
#define SD_CMD_SET_DSR   ((uint8_t)4)
 
#define SD_CMD_SDMMC_SEN_OP_COND   ((uint8_t)5)
 
#define SD_CMD_HS_SWITCH   ((uint8_t)6)
 
#define SD_CMD_SEL_DESEL_CARD   ((uint8_t)7)
 
#define SD_CMD_HS_SEND_EXT_CSD   ((uint8_t)8)
 
#define SD_CMD_SEND_CSD   ((uint8_t)9)
 
#define SD_CMD_SEND_CID   ((uint8_t)10)
 
#define SD_CMD_READ_DAT_UNTIL_STOP   ((uint8_t)11)
 
#define SD_CMD_STOP_TRANSMISSION   ((uint8_t)12)
 
#define SD_CMD_SEND_STATUS   ((uint8_t)13)
 
#define SD_CMD_HS_BUSTEST_READ   ((uint8_t)14)
 
#define SD_CMD_GO_INACTIVE_STATE   ((uint8_t)15)
 
#define SD_CMD_SET_BLOCKLEN   ((uint8_t)16)
 
#define SD_CMD_READ_SINGLE_BLOCK   ((uint8_t)17)
 
#define SD_CMD_READ_MULT_BLOCK   ((uint8_t)18)
 
#define SD_CMD_HS_BUSTEST_WRITE   ((uint8_t)19)
 
#define SD_CMD_WRITE_DAT_UNTIL_STOP   ((uint8_t)20)
 
#define SD_CMD_SET_BLOCK_COUNT   ((uint8_t)23)
 
#define SD_CMD_WRITE_SINGLE_BLOCK   ((uint8_t)24)
 
#define SD_CMD_WRITE_MULT_BLOCK   ((uint8_t)25)
 
#define SD_CMD_PROG_CID   ((uint8_t)26)
 
#define SD_CMD_PROG_CSD   ((uint8_t)27)
 
#define SD_CMD_SET_WRITE_PROT   ((uint8_t)28)
 
#define SD_CMD_CLR_WRITE_PROT   ((uint8_t)29)
 
#define SD_CMD_SEND_WRITE_PROT   ((uint8_t)30)
 
#define SD_CMD_SD_ERASE_GRP_START   ((uint8_t)32)
 
#define SD_CMD_SD_ERASE_GRP_END   ((uint8_t)33)
 
#define SD_CMD_ERASE_GRP_START   ((uint8_t)35)
 
#define SD_CMD_ERASE_GRP_END   ((uint8_t)36)
 
#define SD_CMD_ERASE   ((uint8_t)38)
 
#define SD_CMD_FAST_IO   ((uint8_t)39)
 
#define SD_CMD_GO_IRQ_STATE   ((uint8_t)40)
 
#define SD_CMD_LOCK_UNLOCK   ((uint8_t)42)
 
#define SD_CMD_APP_CMD   ((uint8_t)55)
 
#define SD_CMD_GEN_CMD   ((uint8_t)56)
 
#define SD_CMD_SDMMC_READ_OCR   ((uint8_t)58)
 
#define SD_CMD_NO_CMD   ((uint8_t)64)
 
#define SD_CMD_APP_SD_SET_BUSWIDTH   ((uint8_t)6)
 Following commands are SD Card Specific commands. SDMMC_APP_CMD should be sent before sending these commands. More...
 
#define SD_CMD_SD_APP_STATUS   ((uint8_t)13)
 
#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS   ((uint8_t)22)
 
#define SD_CMD_SD_APP_OP_COND   ((uint8_t)41)
 
#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT   ((uint8_t)42)
 
#define SD_CMD_SD_APP_SEND_SCR   ((uint8_t)51)
 
#define SD_CMD_SDMMC_RW_DIRECT   ((uint8_t)52)
 
#define SD_CMD_SDMMC_RW_EXTENDED   ((uint8_t)53)
 

Enumerations

enum  SD_Info {
  SD_RESPONSE_NO_ERROR = (0x00), SD_IN_IDLE_STATE = (0x01), SD_ERASE_RESET = (0x02), SD_ILLEGAL_COMMAND = (0x04),
  SD_COM_CRC_ERROR = (0x08), SD_ERASE_SEQUENCE_ERROR = (0x10), SD_ADDRESS_ERROR = (0x20), SD_PARAMETER_ERROR = (0x40),
  SD_RESPONSE_FAILURE = (0xFF), SD_DATA_OK = (0x05), SD_DATA_CRC_ERROR = (0x0B), SD_DATA_WRITE_ERROR = (0x0D),
  SD_DATA_OTHER_ERROR = (0xFF)
}
 

Functions

uint8_t BSP_SD_Init (void)
 Initialize the SD card. More...
 
uint8_t BSP_SD_IsDetected (void)
 
uint8_t BSP_SD_ReadBlocks (uint32_t *p32Data, uint64_t Sector, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in an SD card, in polling mode. More...
 
uint8_t BSP_SD_WriteBlocks (uint32_t *p32Data, uint64_t Sector, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in an SD card, in polling mode. More...
 
uint8_t BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr)
 Erases the specified memory area of the given SD card. More...
 
uint8_t BSP_SD_GetStatus (void)
 Returns the SD status. More...
 
uint8_t BSP_SD_GetCardInfo (SD_CardInfo *pCardInfo)
 Returns information about specific card. More...
 
void SD_IO_Init (void)
 Initializes the SD Card and put it into StandBy State (Ready for data transfer). More...
 
void SD_IO_Init_LS (void)
 Initializes the SD Card and put it into StandBy State (Ready for data transfer). Low baundrate. More...
 
void SD_IO_WriteByte (uint8_t Data)
 Writes a byte on the SD. More...
 
uint8_t SD_IO_ReadByte (void)
 Reads a byte from the SD. More...
 
HAL_StatusTypeDef SD_IO_WriteCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response)
 Sends 5 bytes command to the SD card and get response. More...
 
uint8_t SD_IO_WriteCmd_wResp (uint8_t Cmd, uint32_t Arg, uint8_t Crc)
 Sends 5 bytes command to the SD card and get response. More...
 
HAL_StatusTypeDef SD_IO_WaitResponse (uint8_t Response)
 Waits response from the SD card. More...
 
void SD_IO_WriteDummy (void)
 Sends dummy byte with CS High. More...
 
void SD_IO_WriteDMA (uint8_t *pData, uint16_t Size)
 Writes a block by DMA on the SD. More...
 

Detailed Description

This file contains definitions for SensorTile_sd.c driver.

Author
Central Labs
Version
V1.3.1
Date
27-Apr-2017
Attention

© COPYRIGHT(c) 2014 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file SensorTile_sd.h.

Generated by   doxygen 1.8.13