WILLY BAYOT / stm32_adafruit

Dependents:   TDEMNucleo

Embed: (wiki syntax)

« Back to documentation index

STM32_ADAFRUIT_SD_Private_Functions

STM32_ADAFRUIT_SD_Private_Functions
[STM32_ADAFRUIT_SD]

Functions

uint8_t BSP_SD_Init (void)
 Initializes the SD/SD communication.
uint8_t BSP_SD_GetCardInfo (SD_CardInfo *pCardInfo)
 Returns information about specific card.
uint8_t BSP_SD_ReadBlocks (uint32_t *pData, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Reads block(s) from a specified address in the SD card, in polling mode.
uint8_t BSP_SD_WriteBlocks (uint32_t *pData, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Writes block(s) to a specified address in the SD card, in polling mode.
uint8_t BSP_SD_GetStatus (void)
 Returns the SD status.
uint8_t BSP_SD_Erase (uint32_t StartAddr, uint32_t EndAddr)
 Erases the specified memory area of the given SD card.
static uint8_t SD_GetCSDRegister (SD_CSD *Csd)
 Reads the SD card SCD register.
static uint8_t SD_GetCIDRegister (SD_CID *Cid)
 Reads the SD card CID register.
static uint8_t SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc, uint8_t Response)
 Sends 5 bytes command to the SD card and get response.
static uint8_t SD_GetDataResponse (void)
 Gets the SD card data response.
static uint8_t SD_GoIdleState (void)
 Put the SD in Idle state.

Function Documentation

uint8_t BSP_SD_Erase ( uint32_t  StartAddr,
uint32_t  EndAddr 
)

Erases the specified memory area of the given SD card.

Parameters:
StartAddr,:Start byte address
EndAddr,:End byte address
Return values:
SDstatus

Definition at line 705 of file stm32_adafruit_sd.c.

uint8_t BSP_SD_GetCardInfo ( SD_CardInfo *  pCardInfo )

Returns information about specific card.

Parameters:
pCardInfo,:Pointer to a SD_CardInfo structure that contains all SD card information.
Return values:
TheSD Response:

  • MSD_ERROR: Sequence failed
  • MSD_OK: Sequence succeed

Definition at line 206 of file stm32_adafruit_sd.c.

uint8_t BSP_SD_GetStatus ( void   )

Returns the SD status.

Parameters:
None
Return values:
TheSD status.

Definition at line 652 of file stm32_adafruit_sd.c.

uint8_t BSP_SD_Init ( void   )

Initializes the SD/SD communication.

Parameters:
None
Return values:
TheSD Response:

  • MSD_ERROR: Sequence failed
  • MSD_OK: Sequence succeed

Definition at line 175 of file stm32_adafruit_sd.c.

uint8_t BSP_SD_ReadBlocks ( uint32_t *  pData,
uint32_t  ReadAddr,
uint16_t  BlockSize,
uint32_t  NumberOfBlocks 
)

Reads block(s) from a specified address in the SD card, in polling mode.

Parameters:
pData,:Pointer to the buffer that will contain the data to transmit
ReadAddr,:Address from where data is to be read
BlockSize,:SD card data block size, that should be 512
NumOfBlocks,:Number of SD blocks to read
Return values:
SDstatus

Definition at line 236 of file stm32_adafruit_sd.c.

uint8_t BSP_SD_WriteBlocks ( uint32_t *  pData,
uint32_t  WriteAddr,
uint16_t  BlockSize,
uint32_t  NumberOfBlocks 
)

Writes block(s) to a specified address in the SD card, in polling mode.

Parameters:
pData,:Pointer to the buffer that will contain the data to transmit
WriteAddr,:Address from where data is to be written
BlockSize,:SD card data block size, that should be 512
NumOfBlocks,:Number of SD blocks to write
Return values:
SDstatus

Definition at line 303 of file stm32_adafruit_sd.c.

static uint8_t SD_GetCIDRegister ( SD_CID *  Cid ) [static]

Reads the SD card CID register.

Reading the contents of the CID register in SPI mode is a simple read-block transaction.

Parameters:
Cid,:pointer on an CID register structure
Return values:
SDstatus

Definition at line 488 of file stm32_adafruit_sd.c.

static uint8_t SD_GetCSDRegister ( SD_CSD *  Csd ) [static]

Reads the SD card SCD register.

Reading the contents of the CSD register in SPI mode is a simple read-block transaction.

Parameters:
Csd,:pointer on an SCD register structure
Return values:
SDstatus

< Reserved

Definition at line 369 of file stm32_adafruit_sd.c.

static uint8_t SD_GetDataResponse ( void   ) [static]

Gets the SD card data response.

Parameters:
None
Return values:
TheSD status: Read data response xxx0<status>1

  • status 010: Data accecpted
  • status 101: Data rejected due to a crc error
  • status 110: Data rejected due to a Write error.
  • status 111: Data rejected due to other error.

Definition at line 602 of file stm32_adafruit_sd.c.

static uint8_t SD_GoIdleState ( void   ) [static]

Put the SD in Idle state.

Parameters:
None
Return values:
SDstatus

Definition at line 681 of file stm32_adafruit_sd.c.

static uint8_t SD_SendCmd ( uint8_t  Cmd,
uint32_t  Arg,
uint8_t  Crc,
uint8_t  Response 
) [static]

Sends 5 bytes command to the SD card and get response.

Parameters:
Cmd,:The user expected command to send to SD card.
Arg,:The command argument.
Crc,:The CRC.
Response,:Expected response from the SD card
Return values:
SDstatus

Definition at line 581 of file stm32_adafruit_sd.c.