stm32_eval_sdio_sd.h File Reference

This file contains all the functions prototypes for the SD Card stm32_eval_sdio_sd driver firmware library. More...

#include "stm32_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_CMD_ALL_SEND_CID   ((uint8_t)2)
#define SD_CMD_APP_CMD   ((uint8_t)55)
#define SD_CMD_APP_SD_SET_BUSWIDTH   ((uint8_t)6)
 Following commands are SD Card Specific commands.
#define SD_CMD_CLR_WRITE_PROT   ((uint8_t)29)
#define SD_CMD_ERASE   ((uint8_t)38)
#define SD_CMD_ERASE_GRP_END   ((uint8_t)36)
#define SD_CMD_ERASE_GRP_START   ((uint8_t)35)
#define SD_CMD_FAST_IO   ((uint8_t)39)
#define SD_CMD_GEN_CMD   ((uint8_t)56)
#define SD_CMD_GO_IDLE_STATE   ((uint8_t)0)
 SDIO Commands Index.
#define SD_CMD_GO_INACTIVE_STATE   ((uint8_t)15)
#define SD_CMD_GO_IRQ_STATE   ((uint8_t)40)
#define SD_CMD_HS_BUSTEST_READ   ((uint8_t)14)
#define SD_CMD_HS_BUSTEST_WRITE   ((uint8_t)19)
#define SD_CMD_HS_SEND_EXT_CSD   ((uint8_t)8)
#define SD_CMD_HS_SWITCH   ((uint8_t)6)
#define SD_CMD_LOCK_UNLOCK   ((uint8_t)42)
#define SD_CMD_NO_CMD   ((uint8_t)64)
#define SD_CMD_PROG_CID   ((uint8_t)26)
#define SD_CMD_PROG_CSD   ((uint8_t)27)
#define SD_CMD_READ_DAT_UNTIL_STOP   ((uint8_t)11)
#define SD_CMD_READ_MULT_BLOCK   ((uint8_t)18)
#define SD_CMD_READ_SINGLE_BLOCK   ((uint8_t)17)
#define SD_CMD_SD_APP_CHANGE_SECURE_AREA   ((uint8_t)49)
#define SD_CMD_SD_APP_GET_CER_RES1   ((uint8_t)48)
#define SD_CMD_SD_APP_GET_CER_RN2   ((uint8_t)46)
#define SD_CMD_SD_APP_GET_MID   ((uint8_t)44)
#define SD_CMD_SD_APP_GET_MKB   ((uint8_t)43)
 Following commands are SD Card Specific security commands.
#define SD_CMD_SD_APP_OP_COND   ((uint8_t)41)
#define SD_CMD_SD_APP_SECURE_ERASE   ((uint8_t)38)
#define SD_CMD_SD_APP_SECURE_READ_MULTIPLE_BLOCK   ((uint8_t)18)
#define SD_CMD_SD_APP_SECURE_WRITE_MKB   ((uint8_t)48)
#define SD_CMD_SD_APP_SECURE_WRITE_MULTIPLE_BLOCK   ((uint8_t)25)
#define SD_CMD_SD_APP_SEND_NUM_WRITE_BLOCKS   ((uint8_t)22)
#define SD_CMD_SD_APP_SEND_SCR   ((uint8_t)51)
#define SD_CMD_SD_APP_SET_CER_RES2   ((uint8_t)47)
#define SD_CMD_SD_APP_SET_CER_RN1   ((uint8_t)45)
#define SD_CMD_SD_APP_SET_CLR_CARD_DETECT   ((uint8_t)42)
#define SD_CMD_SD_APP_STAUS   ((uint8_t)13)
#define SD_CMD_SD_ERASE_GRP_END   ((uint8_t)33)
#define SD_CMD_SD_ERASE_GRP_START   ((uint8_t)32)
#define SD_CMD_SDIO_RW_DIRECT   ((uint8_t)52)
#define SD_CMD_SDIO_RW_EXTENDED   ((uint8_t)53)
#define SD_CMD_SDIO_SEN_OP_COND   ((uint8_t)5)
#define SD_CMD_SEL_DESEL_CARD   ((uint8_t)7)
#define SD_CMD_SEND_CID   ((uint8_t)10)
#define SD_CMD_SEND_CSD   ((uint8_t)9)
#define SD_CMD_SEND_OP_COND   ((uint8_t)1)
#define SD_CMD_SEND_STATUS   ((uint8_t)13)
#define SD_CMD_SEND_WRITE_PROT   ((uint8_t)30)
#define SD_CMD_SET_BLOCK_COUNT   ((uint8_t)23)
#define SD_CMD_SET_BLOCKLEN   ((uint8_t)16)
#define SD_CMD_SET_DSR   ((uint8_t)4)
#define SD_CMD_SET_REL_ADDR   ((uint8_t)3)
#define SD_CMD_SET_WRITE_PROT   ((uint8_t)28)
#define SD_CMD_STOP_TRANSMISSION   ((uint8_t)12)
#define SD_CMD_WRITE_DAT_UNTIL_STOP   ((uint8_t)20)
#define SD_CMD_WRITE_MULT_BLOCK   ((uint8_t)25)
#define SD_CMD_WRITE_SINGLE_BLOCK   ((uint8_t)24)
#define SD_DMA_MODE   ((uint32_t)0x00000000)
#define SD_INTERRUPT_MODE   ((uint32_t)0x00000001)
#define SD_NOT_PRESENT   ((uint8_t)0x00)
#define SD_POLLING_MODE   ((uint32_t)0x00000002)
#define SD_PRESENT   ((uint8_t)0x01)
 SD detection on its memory slot.
#define SDIO_HIGH_CAPACITY_MMC_CARD   ((uint32_t)0x00000007)
#define SDIO_HIGH_CAPACITY_SD_CARD   ((uint32_t)0x00000002)
#define SDIO_HIGH_SPEED_MULTIMEDIA_CARD   ((uint32_t)0x00000005)
#define SDIO_MULTIMEDIA_CARD   ((uint32_t)0x00000003)
#define SDIO_SECURE_DIGITAL_IO_CARD   ((uint32_t)0x00000004)
#define SDIO_SECURE_DIGITAL_IO_COMBO_CARD   ((uint32_t)0x00000006)
#define SDIO_STD_CAPACITY_SD_CARD_V1_1   ((uint32_t)0x00000000)
 Supported SD Memory Cards.
#define SDIO_STD_CAPACITY_SD_CARD_V2_0   ((uint32_t)0x00000001)

Enumerations

enum  SD_Error {
  SD_CMD_CRC_FAIL = (1), SD_DATA_CRC_FAIL = (2), SD_CMD_RSP_TIMEOUT = (3), SD_DATA_TIMEOUT = (4),
  SD_TX_UNDERRUN = (5), SD_RX_OVERRUN = (6), SD_START_BIT_ERR = (7), SD_CMD_OUT_OF_RANGE = (8),
  SD_ADDR_MISALIGNED = (9), SD_BLOCK_LEN_ERR = (10), SD_ERASE_SEQ_ERR = (11), SD_BAD_ERASE_PARAM = (12),
  SD_WRITE_PROT_VIOLATION = (13), SD_LOCK_UNLOCK_FAILED = (14), SD_COM_CRC_FAILED = (15), SD_ILLEGAL_CMD = (16),
  SD_CARD_ECC_FAILED = (17), SD_CC_ERROR = (18), SD_GENERAL_UNKNOWN_ERROR = (19), SD_STREAM_READ_UNDERRUN = (20),
  SD_STREAM_WRITE_OVERRUN = (21), SD_CID_CSD_OVERWRITE = (22), SD_WP_ERASE_SKIP = (23), SD_CARD_ECC_DISABLED = (24),
  SD_ERASE_RESET = (25), SD_AKE_SEQ_ERROR = (26), SD_INVALID_VOLTRANGE = (27), SD_ADDR_OUT_OF_RANGE = (28),
  SD_SWITCH_ERROR = (29), SD_SDIO_DISABLED = (30), SD_SDIO_FUNCTION_BUSY = (31), SD_SDIO_FUNCTION_FAILED = (32),
  SD_SDIO_UNKNOWN_FUNCTION = (33), SD_INTERNAL_ERROR, SD_NOT_CONFIGURED, SD_REQUEST_PENDING,
  SD_REQUEST_NOT_APPLICABLE, SD_INVALID_PARAMETER, SD_UNSUPPORTED_FEATURE, SD_UNSUPPORTED_HW,
  SD_ERROR, SD_OK, 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)
}
enum  SDCardState {
  SD_CARD_READY = ((uint32_t)0x00000001), SD_CARD_IDENTIFICATION = ((uint32_t)0x00000002), SD_CARD_STANDBY = ((uint32_t)0x00000003), SD_CARD_TRANSFER = ((uint32_t)0x00000004),
  SD_CARD_SENDING = ((uint32_t)0x00000005), SD_CARD_RECEIVING = ((uint32_t)0x00000006), SD_CARD_PROGRAMMING = ((uint32_t)0x00000007), SD_CARD_DISCONNECTED = ((uint32_t)0x00000008),
  SD_CARD_ERROR = ((uint32_t)0x000000FF)
}
 

SD Card States.

More...
enum  SDTransferState { SD_TRANSFER_OK = 0, SD_TRANSFER_BUSY = 1, SD_TRANSFER_ERROR }
 

SDIO Transfer state.

More...

Functions

void SD_DeInit (void)
 DeInitializes the SDIO interface.
uint8_t SD_Detect (void)
 Detect if SD card is correctly plugged in the memory slot.
SD_Error SD_EnableWideBusOperation (uint32_t WideMode)
 Enables wide bus opeartion for the requeseted card if supported by card.
SD_Error SD_Erase (uint32_t startaddr, uint32_t endaddr)
 Allows to erase memory area specified for the given card.
SD_Error SD_GetCardInfo (SD_CardInfo *cardinfo)
 Returns information about specific card.
SDCardState SD_GetState (void)
 Returns the current card's state.
SDTransferState SD_GetStatus (void)
 Gets the cuurent sd card data transfer status.
SDTransferState SD_GetTransferState (void)
 Gets the cuurent data transfer state.
SD_Error SD_Init (void)
 Initializes the SD Card and put it into StandBy State (Ready for data transfer).
SD_Error SD_InitializeCards (void)
 Intialises all cards or single card as the case may be Card(s) come into standby state.
SD_Error SD_PowerOFF (void)
 Turns the SDIO output signals off.
SD_Error SD_PowerON (void)
 Enquires cards about their operating voltage and configures clock controls.
SD_Error SD_ProcessIRQSrc (void)
 Allows to process all the interrupts that are high.
SD_Error SD_ReadBlock (uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize)
 Allows to read one block from a specified address in a card.
SD_Error SD_ReadMultiBlocks (uint8_t *readbuff, uint32_t ReadAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Allows to read blocks from a specified address in a card.
SD_Error SD_SelectDeselect (uint32_t addr)
 Selects od Deselects the corresponding card.
SD_Error SD_SendSDStatus (uint32_t *psdstatus)
 Returns the current SD card's status.
SD_Error SD_SendStatus (uint32_t *pcardstatus)
 Returns the current card's status.
SD_Error SD_SetDeviceMode (uint32_t Mode)
 Sets device mode whether to operate in Polling, Interrupt or DMA mode.
SD_Error SD_StopTransfer (void)
 Aborts an ongoing data transfer.
SD_Error SD_WriteBlock (uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize)
 Allows to write one block starting from a specified address in a card.
SD_Error SD_WriteMultiBlocks (uint8_t *writebuff, uint32_t WriteAddr, uint16_t BlockSize, uint32_t NumberOfBlocks)
 Allows to write blocks starting from a specified address in a card.

Detailed Description

This file contains all the functions prototypes for the SD Card stm32_eval_sdio_sd driver firmware library.

Author:
MCD Application Team
Version:
V4.3.0
Date:
10/15/2010

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics

Definition in file stm32_eval_sdio_sd.h.

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32