STM8S/A Standard Peripherals Firmware Library: stm8s_eval_spi_sd.h File Reference

STM8S/A

stm8s_eval_spi_sd.h File Reference
#include "stm8s_eval.h"

Go to the source code of this file.

Data Structures

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

Defines

#define SD_ADDRESS_ERROR   0x20
#define SD_BLOCK_SIZE   0x200
 Block Size.
#define SD_CMD_CLR_WRITE_PROT   29
#define SD_CMD_ERASE   38
#define SD_CMD_ERASE_GRP_END   36
#define SD_CMD_ERASE_GRP_START   35
#define SD_CMD_GO_IDLE_STATE   0
 Commands: CMDxx = CMD-number | 0x40.
#define SD_CMD_PROG_CSD   27
#define SD_CMD_READ_MULT_BLOCK   18
#define SD_CMD_READ_SINGLE_BLOCK   17
#define SD_CMD_SD_ERASE_GRP_END   33
#define SD_CMD_SD_ERASE_GRP_START   32
#define SD_CMD_SEND_CID   10
#define SD_CMD_SEND_CSD   9
#define SD_CMD_SEND_OP_COND   1
#define SD_CMD_SEND_STATUS   13
#define SD_CMD_SEND_WRITE_PROT   30
#define SD_CMD_SET_BLOCK_COUNT   23
#define SD_CMD_SET_BLOCKLEN   16
#define SD_CMD_SET_WRITE_PROT   28
#define SD_CMD_STOP_TRANSMISSION   12
#define SD_CMD_UNTAG_ERASE_GROUP   37
#define SD_CMD_UNTAG_SECTOR   34
#define SD_CMD_WRITE_MULT_BLOCK   25
#define SD_CMD_WRITE_SINGLE_BLOCK   24
#define SD_COM_CRC_ERROR   0x08
#define SD_CS_HIGH()   GPIO_WriteHigh(SD_CS_GPIO_PORT, SD_CS_PIN)
 Deselect SD Card: ChipSelect pin high.
#define SD_CS_LOW()   GPIO_WriteLow(SD_CS_GPIO_PORT, SD_CS_PIN)
 Select SD Card: ChipSelect pin low.
#define SD_DATA_CRC_ERROR   0x0B
#define SD_DATA_OK   0x05
 Data response error.
#define SD_DATA_OTHER_ERROR   0xFF
#define SD_DATA_WRITE_ERROR   0x0D
#define SD_DUMMY_BYTE   0xFF
 Dummy byte.
#define SD_ERASE_RESET   0x02
#define SD_ERASE_SEQUENCE_ERROR   0x10
#define SD_ILLEGAL_COMMAND   0x04
#define SD_IN_IDLE_STATE   0x01
#define SD_NOT_PRESENT   ((uint8_t)0x00)
#define SD_PARAMETER_ERROR   0x40
#define SD_PRESENT   ((uint8_t)0x01)
 SD detection on its memory slot.
#define SD_RESPONSE_FAILURE   0xFF
#define SD_RESPONSE_NO_ERROR   0x00
 SD responses and error flags.
#define SD_START_DATA_MULTIPLE_BLOCK_READ   0xFE
#define SD_START_DATA_MULTIPLE_BLOCK_WRITE   0xFD
#define SD_START_DATA_SINGLE_BLOCK_READ   0xFE
 Start Data tokens: Tokens (necessary because at nop/idle (and CS active) only 0xff is on the data/command line)
#define SD_START_DATA_SINGLE_BLOCK_WRITE   0xFE
#define SD_STOP_DATA_MULTIPLE_BLOCK_WRITE   0xFD

Functions

void SD_DeInit (void)
 DeInitializes the SD/SD communication.
uint8_t SD_Detect (void)
 Detect if SD card is correctly plugged in the memory slot.
uint8_t SD_GetCardInfo (SD_CardInfo *cardinfo)
 Returns information about specific card.
uint8_t SD_GetCIDRegister (SD_CID *SD_cid)
 Read the CID card register.
uint8_t SD_GetCSDRegister (SD_CSD *SD_csd)
 Read the CSD card register.
uint8_t SD_GetDataResponse (void)
 Get SD card data response.
uint8_t SD_GetResponse (uint8_t Response)
 Returns the SD response.
uint16_t SD_GetStatus (void)
 Returns the SD status.
uint8_t SD_GoIdleState (void)
 Put SD in Idle state.
uint8_t SD_Init (void)
 Initializes the SD/SD communication.
uint8_t SD_ReadBlock (uint8_t *pBuffer, uint32_t ReadAddr, uint16_t BlockSize)
 Reads a block of data from the SD.
uint8_t SD_ReadBuffer (uint8_t *pBuffer, uint32_t ReadAddr, uint32_t NumByteToRead)
 Read a buffer (many blocks) from the SD card.
uint8_t SD_ReadByte (void)
 Read a byte from the SD.
void SD_SendCmd (uint8_t Cmd, uint32_t Arg, uint8_t Crc)
 Send 5 bytes command to the SD card.
uint8_t SD_WriteBlock (uint8_t *pBuffer, uint32_t WriteAddr, uint16_t BlockSize)
 Writes a block on the SD.
uint8_t SD_WriteBuffer (uint8_t *pBuffer, uint32_t WriteAddr, uint32_t NumByteToWrite)
 Write a buffer (many blocks) in the SD card.
uint8_t SD_WriteByte (uint8_t byte)
 Write a byte on the SD.
STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com