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

STSW-STLKT01

STSW-STLKT01
SensorTile_sd.c File Reference

This file provides the SD card driver for the SensorTile board. More...

#include "SensorTile_sd.h"

Go to the source code of this file.

Macros

#define SD_DUMMY_BYTE   0xFF
 
#define SD_NO_RESPONSE_EXPECTED   0x80
 

Enumerations

enum  { TRANSFER_WAIT, TRANSFER_COMPLETE, TRANSFER_ERROR }
 

Functions

static uint8_t SD_GetCIDRegister (SD_CID *Cid)
 Read the CID card register. Reading the contents of the CID register in SPI mode is a simple read-block transaction. More...
 
static uint8_t SD_GetCSDRegister (SD_CSD *Csd)
 Read the CSD card register. Reading the contents of the CSD register in SPI mode is a simple read-block transaction. More...
 
static SD_Info SD_GetDataResponse (void)
 Get SD card data response. More...
 
static uint8_t SD_GoIdleState (void)
 Put SD in Idle state. More...
 
static uint8_t SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response)
 Send 5 bytes command to the SD card and get response. More...
 
static uint8_t SD_SendCmd_wResp (uint8_t Cmd, uint32_t Arg, uint8_t Crc)
 Send 5 bytes command to the SD card and get response. More...
 
uint8_t BSP_SD_Init (void)
 Initialize the SD card. More...
 
uint8_t BSP_SD_GetCardInfo (SD_CardInfo *pCardInfo)
 Returns information about specific card. More...
 
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...
 
void HAL_SPI_TxCpltCallback (SPI_HandleTypeDef *hspi)
 TxRx Transfer completed callback. More...
 
uint8_t BSP_SD_GetStatus (void)
 Returns the SD status. More...
 
uint8_t BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr)
 Erases the specified memory area of the given SD card. More...
 

Variables

__IO uint8_t SdStatus = SD_PRESENT
 
__IO uint8_t SD_CardType = STD_CAPACITY_SD_CARD_V1_1
 
__IO uint32_t wTransferState = TRANSFER_WAIT
 

Detailed Description

This file provides the SD card driver for the SensorTile board.

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.c.

Generated by   doxygen 1.8.13