ChibiOS/HAL 9.0.0
hal_sdc.h File Reference

SDC Driver macros and structures. More...

#include "hal_sdc_lld.h"

Go to the source code of this file.

Macros

SD card types
#define SDC_MODE_CARDTYPE_MASK   0xFU
#define SDC_MODE_CARDTYPE_SDV11   0U
#define SDC_MODE_CARDTYPE_SDV20   1U
#define SDC_MODE_CARDTYPE_MMC   2U
#define SDC_MODE_HIGH_CAPACITY   0x10U
SDC bus error conditions
#define SDC_NO_ERROR   0U
#define SDC_CMD_CRC_ERROR   1U
#define SDC_DATA_CRC_ERROR   2U
#define SDC_DATA_TIMEOUT   4U
#define SDC_COMMAND_TIMEOUT   8U
#define SDC_TX_UNDERRUN   16U
#define SDC_RX_OVERRUN   32U
#define SDC_STARTBIT_ERROR   64U
#define SDC_OVERFLOW_ERROR   128U
#define SDC_UNHANDLED_ERROR   0xFFFFFFFFU
SDC configuration options
#define SDC_INIT_RETRY   100
 Number of initialization attempts before rejecting the card.
#define SDC_MMC_SUPPORT   FALSE
 Include support for MMC cards.
#define SDC_NICE_WAITING   TRUE
 Delays insertions.
#define SDC_INIT_OCR_V20   0x50FF8000U
 OCR initialization constant for V20 cards.
#define SDC_INIT_OCR   0x80100000U
 OCR initialization constant for non-V20 cards.
Macro Functions
#define sdcIsCardInserted(sdcp)
 Returns the card insertion status.
#define sdcIsWriteProtected(sdcp)
 Returns the write protect status.

Enumerations

enum  sdcbusmode_t { SDC_MODE_1BIT = 0 , SDC_MODE_4BIT , SDC_MODE_8BIT }
 Type of SDIO bus mode. More...
enum  sdcbusclk_t { SDC_CLK_25MHz = 0 , SDC_CLK_50MHz }
 Max supported clock. More...

Functions

void sdcInit (void)
 SDC Driver initialization.
void sdcObjectInit (SDCDriver *sdcp)
 Initializes the standard part of a SDCDriver structure.
msg_t sdcStart (SDCDriver *sdcp, const SDCConfig *config)
 Configures and activates the SDC peripheral.
void sdcStop (SDCDriver *sdcp)
 Deactivates the SDC peripheral.
bool sdcConnect (SDCDriver *sdcp)
 Performs the initialization procedure on the inserted card.
bool sdcDisconnect (SDCDriver *sdcp)
 Brings the driver in a state safe for card removal.
bool sdcRead (SDCDriver *sdcp, uint32_t startblk, uint8_t *buf, uint32_t n)
 Reads one or more blocks.
bool sdcWrite (SDCDriver *sdcp, uint32_t startblk, const uint8_t *buf, uint32_t n)
 Writes one or more blocks.
sdcflags_t sdcGetAndClearErrors (SDCDriver *sdcp)
 Returns the errors mask associated to the previous operation.
bool sdcSync (SDCDriver *sdcp)
 Waits for card idle condition.
bool sdcGetInfo (SDCDriver *sdcp, BlockDeviceInfo *bdip)
 Returns the media info.
bool sdcErase (SDCDriver *sdcp, uint32_t startblk, uint32_t endblk)
 Erases the supplied blocks.
bool _sdc_wait_for_transfer_state (SDCDriver *sdcp)
 Wait for the card to complete pending operations with CRC check.
bool _sdc_wait_for_transfer_state_nocrc (SDCDriver *sdcp)
 Wait for the card to complete pending operations without CRC check.

Detailed Description

SDC Driver macros and structures.

Definition in file hal_sdc.h.