ChibiOS/HAL
6.1.0
|
Generic SD Card Driver. More...
Generic SD Card Driver.
This module implements a generic SDC (Secure Digital Card) driver.
HAL_USE_SDC
option must be enabled in halconf.h
.This driver implements a state machine internally, see the Abstract I/O Block Device module documentation for details.
This driver allows to read or write single or multiple 512 bytes blocks on a SD Card.
Macros | |
#define | _sdc_driver_methods _mmcsd_block_device_methods |
SDCDriver specific methods. More... | |
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 configuration options | |
#define | SDC_INIT_RETRY 100 |
Number of initialization attempts before rejecting the card. More... | |
#define | SDC_MMC_SUPPORT FALSE |
Include support for MMC cards. More... | |
#define | SDC_NICE_WAITING TRUE |
Delays insertions. More... | |
#define | SDC_INIT_OCR_V20 0x50FF8000U |
OCR initialization constant for V20 cards. More... | |
#define | SDC_INIT_OCR 0x80100000U |
OCR initialization constant for non-V20 cards. More... | |
Macro Functions | |
#define | sdcIsCardInserted(sdcp) (sdc_lld_is_card_inserted(sdcp)) |
Returns the card insertion status. More... | |
#define | sdcIsWriteProtected(sdcp) (sdc_lld_is_write_protected(sdcp)) |
Returns the write protect status. More... | |
PLATFORM configuration options | |
#define | PLATFORM_SDC_USE_SDC1 FALSE |
PWMD1 driver enable switch. More... | |
Typedefs | |
typedef uint32_t | sdcmode_t |
Type of card flags. More... | |
typedef uint32_t | sdcflags_t |
SDC Driver condition flags type. More... | |
typedef struct SDCDriver | SDCDriver |
Type of a structure representing an SDC driver. More... | |
Data Structures | |
struct | SDCConfig |
Driver configuration structure. More... | |
struct | SDCDriverVMT |
SDCDriver virtual methods table. More... | |
struct | SDCDriver |
Structure representing an SDC driver. More... | |
Functions | |
static bool | mode_detect (SDCDriver *sdcp) |
Detects card mode. More... | |
static bool | mmc_init (SDCDriver *sdcp) |
Init procedure for MMC. More... | |
static bool | sdc_init (SDCDriver *sdcp) |
Init procedure for SDC. More... | |
static uint32_t | mmc_cmd6_construct (mmc_switch_t access, uint32_t idx, uint32_t value, uint32_t cmd_set) |
Constructs CMD6 argument for MMC. More... | |
static uint32_t | sdc_cmd6_construct (sd_switch_t mode, sd_switch_function_t function, uint32_t value) |
Constructs CMD6 argument for SDC. More... | |
static uint16_t | sdc_cmd6_extract_info (sd_switch_function_t function, const uint8_t *buf) |
Extracts information from CMD6 answer. More... | |
static bool | sdc_cmd6_check_status (sd_switch_function_t function, const uint8_t *buf) |
Checks status after switching using CMD6. More... | |
static bool | sdc_detect_bus_clk (SDCDriver *sdcp, sdcbusclk_t *clk) |
Reads supported bus clock and switch SDC to appropriate mode. More... | |
static bool | mmc_detect_bus_clk (SDCDriver *sdcp, sdcbusclk_t *clk) |
Reads supported bus clock and switch MMC to appropriate mode. More... | |
static bool | detect_bus_clk (SDCDriver *sdcp, sdcbusclk_t *clk) |
Reads supported bus clock and switch card to appropriate mode. More... | |
static bool | sdc_set_bus_width (SDCDriver *sdcp) |
Sets bus width for SDC. More... | |
static bool | mmc_set_bus_width (SDCDriver *sdcp) |
Sets bus width for MMC. More... | |
bool | _sdc_wait_for_transfer_state (SDCDriver *sdcp) |
Wait for the card to complete pending operations. More... | |
void | sdcInit (void) |
SDC Driver initialization. More... | |
void | sdcObjectInit (SDCDriver *sdcp) |
Initializes the standard part of a SDCDriver structure. More... | |
void | sdcStart (SDCDriver *sdcp, const SDCConfig *config) |
Configures and activates the SDC peripheral. More... | |
void | sdcStop (SDCDriver *sdcp) |
Deactivates the SDC peripheral. More... | |
bool | sdcConnect (SDCDriver *sdcp) |
Performs the initialization procedure on the inserted card. More... | |
bool | sdcDisconnect (SDCDriver *sdcp) |
Brings the driver in a state safe for card removal. More... | |
bool | sdcRead (SDCDriver *sdcp, uint32_t startblk, uint8_t *buf, uint32_t n) |
Reads one or more blocks. More... | |
bool | sdcWrite (SDCDriver *sdcp, uint32_t startblk, const uint8_t *buf, uint32_t n) |
Writes one or more blocks. More... | |
sdcflags_t | sdcGetAndClearErrors (SDCDriver *sdcp) |
Returns the errors mask associated to the previous operation. More... | |
bool | sdcSync (SDCDriver *sdcp) |
Waits for card idle condition. More... | |
bool | sdcGetInfo (SDCDriver *sdcp, BlockDeviceInfo *bdip) |
Returns the media info. More... | |
bool | sdcErase (SDCDriver *sdcp, uint32_t startblk, uint32_t endblk) |
Erases the supplied blocks. More... | |
void | sdc_lld_init (void) |
Low level SDC driver initialization. More... | |
void | sdc_lld_start (SDCDriver *sdcp) |
Configures and activates the SDC peripheral. More... | |
void | sdc_lld_stop (SDCDriver *sdcp) |
Deactivates the SDC peripheral. More... | |
void | sdc_lld_start_clk (SDCDriver *sdcp) |
Starts the SDIO clock and sets it to init mode (400kHz or less). More... | |
void | sdc_lld_set_data_clk (SDCDriver *sdcp, sdcbusclk_t clk) |
Sets the SDIO clock to data mode (25MHz or less). More... | |
void | sdc_lld_stop_clk (SDCDriver *sdcp) |
Stops the SDIO clock. More... | |
void | sdc_lld_set_bus_mode (SDCDriver *sdcp, sdcbusmode_t mode) |
Switches the bus to 4 bits mode. More... | |
void | sdc_lld_send_cmd_none (SDCDriver *sdcp, uint8_t cmd, uint32_t arg) |
Sends an SDIO command with no response expected. More... | |
bool | sdc_lld_send_cmd_short (SDCDriver *sdcp, uint8_t cmd, uint32_t arg, uint32_t *resp) |
Sends an SDIO command with a short response expected. More... | |
bool | sdc_lld_send_cmd_short_crc (SDCDriver *sdcp, uint8_t cmd, uint32_t arg, uint32_t *resp) |
Sends an SDIO command with a short response expected and CRC. More... | |
bool | sdc_lld_send_cmd_long_crc (SDCDriver *sdcp, uint8_t cmd, uint32_t arg, uint32_t *resp) |
Sends an SDIO command with a long response expected and CRC. More... | |
bool | sdc_lld_read (SDCDriver *sdcp, uint32_t startblk, uint8_t *buf, uint32_t n) |
Reads one or more blocks. More... | |
bool | sdc_lld_write (SDCDriver *sdcp, uint32_t startblk, const uint8_t *buf, uint32_t n) |
Writes one or more blocks. More... | |
bool | sdc_lld_sync (SDCDriver *sdcp) |
Waits for card idle condition. More... | |
Enumerations |
Variables | |
static const struct SDCDriverVMT | sdc_vmt |
Virtual methods table. More... | |
SDCDriver | SDCD1 |
SDCD1 driver identifier. More... | |
#define SDC_INIT_RETRY 100 |
Number of initialization attempts before rejecting the card.
Definition at line 74 of file hal_sdc.h.
Referenced by mmc_init(), and sdc_init().
#define SDC_MMC_SUPPORT FALSE |
#define SDC_NICE_WAITING TRUE |
#define SDC_INIT_OCR_V20 0x50FF8000U |
OCR initialization constant for V20 cards.
Definition at line 100 of file hal_sdc.h.
Referenced by sdc_init().
#define SDC_INIT_OCR 0x80100000U |
OCR initialization constant for non-V20 cards.
Definition at line 107 of file hal_sdc.h.
Referenced by sdc_init().
#define sdcIsCardInserted | ( | sdcp | ) | (sdc_lld_is_card_inserted(sdcp)) |
Returns the card insertion status.
sdc_lld_is_card_inserted()
, this function must be provided by the application because it is not part of the SDC driver.[in] | sdcp | pointer to the SDCDriver object |
false | card not inserted. |
true | card inserted. |
#define sdcIsWriteProtected | ( | sdcp | ) | (sdc_lld_is_write_protected(sdcp)) |
Returns the write protect status.
sdc_lld_is_write_protected()
, this function must be provided by the application because it is not part of the SDC driver.[in] | sdcp | pointer to the SDCDriver object |
false | not write protected. |
true | write protected. |
#define PLATFORM_SDC_USE_SDC1 FALSE |
PWMD1 driver enable switch.
If set to TRUE
the support for PWM1 is included.
FALSE
. Definition at line 48 of file hal_sdc_lld.h.
#define _sdc_driver_methods _mmcsd_block_device_methods |
SDCDriver
specific methods.
Definition at line 98 of file hal_sdc_lld.h.
typedef uint32_t sdcmode_t |
Type of card flags.
Definition at line 63 of file hal_sdc_lld.h.
typedef uint32_t sdcflags_t |
SDC Driver condition flags type.
Definition at line 68 of file hal_sdc_lld.h.
Type of a structure representing an SDC driver.
Definition at line 73 of file hal_sdc_lld.h.
enum mmc_switch_t |
enum sd_switch_t |
enum sd_switch_function_t |
enum sdcbusmode_t |
enum sdcbusclk_t |
|
static |
Detects card mode.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 100 of file hal_sdc.c.
References SDCDriver::cardmode, MMCSD_CMD8_PATTERN, MMCSD_R1_ERROR, sdc_lld_send_cmd_none(), and sdc_lld_send_cmd_short_crc().
Referenced by sdcConnect().
|
static |
Init procedure for MMC.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 144 of file hal_sdc.c.
References SDCDriver::cardmode, osalThreadSleepMilliseconds, SDC_INIT_RETRY, and sdc_lld_send_cmd_short().
Referenced by sdcConnect().
|
static |
Init procedure for SDC.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 181 of file hal_sdc.c.
References SDCDriver::cardmode, MMCSD_R1_ERROR, osalThreadSleepMilliseconds, SDC_INIT_OCR, SDC_INIT_OCR_V20, SDC_INIT_RETRY, sdc_lld_send_cmd_short(), and sdc_lld_send_cmd_short_crc().
Referenced by sdcConnect().
|
static |
Constructs CMD6 argument for MMC.
[in] | access | EXT_CSD access mode |
[in] | idx | EXT_CSD byte number |
[in] | value | value to be written in target field |
[in] | cmd_set | switch current command set |
Definition at line 229 of file hal_sdc.c.
References osalDbgAssert.
Referenced by mmc_detect_bus_clk(), and mmc_set_bus_width().
|
static |
Constructs CMD6 argument for SDC.
[in] | mode | switch/test mode |
[in] | function | function number to be switched |
[in] | value | value to be written in target function |
Definition at line 249 of file hal_sdc.c.
References osalDbgAssert.
Referenced by sdc_detect_bus_clk().
|
static |
Extracts information from CMD6 answer.
[in] | function | function number to be switched |
[in] | buf | buffer with answer |
Definition at line 271 of file hal_sdc.c.
Referenced by sdc_detect_bus_clk().
|
static |
Checks status after switching using CMD6.
[in] | function | function number to be switched |
[in] | buf | buffer with answer |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 291 of file hal_sdc.c.
Referenced by sdc_detect_bus_clk().
|
static |
Reads supported bus clock and switch SDC to appropriate mode.
[in] | sdcp | pointer to the SDCDriver object |
[out] | clk | pointer to clock enum |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 319 of file hal_sdc.c.
References _mmcsd_get_slice(), sdc_cmd6_check_status(), sdc_cmd6_construct(), and sdc_cmd6_extract_info().
Referenced by detect_bus_clk().
|
static |
Reads supported bus clock and switch MMC to appropriate mode.
[in] | sdcp | pointer to the SDCDriver object |
[out] | clk | pointer to clock enum |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 373 of file hal_sdc.c.
References SDCDriver::config, mmc_cmd6_construct(), MMCSD_R1_ERROR, SDCConfig::scratchpad, and sdc_lld_send_cmd_short_crc().
Referenced by detect_bus_clk().
|
static |
Reads supported bus clock and switch card to appropriate mode.
[in] | sdcp | pointer to the SDCDriver object |
[out] | clk | pointer to clock enum |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 407 of file hal_sdc.c.
References SDCDriver::cardmode, mmc_detect_bus_clk(), and sdc_detect_bus_clk().
Referenced by sdcConnect().
|
static |
Sets bus width for SDC.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 426 of file hal_sdc.c.
References SDCConfig::bus_width, SDCDriver::config, MMCSD_R1_ERROR, SDCDriver::rca, sdc_lld_send_cmd_short_crc(), and sdc_lld_set_bus_mode().
Referenced by sdcConnect().
|
static |
Sets bus width for MMC.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 464 of file hal_sdc.c.
References SDCConfig::bus_width, SDCDriver::config, mmc_cmd6_construct(), MMCSD_R1_ERROR, osalDbgAssert, sdc_lld_send_cmd_short_crc(), and sdc_lld_set_bus_mode().
Referenced by sdcConnect().
bool _sdc_wait_for_transfer_state | ( | SDCDriver * | sdcp | ) |
Wait for the card to complete pending operations.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 503 of file hal_sdc.c.
References MMCSD_R1_ERROR, MMCSD_R1_STS, osalThreadSleepMilliseconds, SDCDriver::rca, and sdc_lld_send_cmd_short_crc().
Referenced by sdcDisconnect(), and sdcErase().
void sdcInit | ( | void | ) |
SDC Driver initialization.
halInit()
, there is no need to explicitly initialize the driver.Definition at line 542 of file hal_sdc.c.
References sdc_lld_init().
Referenced by halInit().
void sdcObjectInit | ( | SDCDriver * | sdcp | ) |
Initializes the standard part of a SDCDriver
structure.
[out] | sdcp | pointer to the SDCDriver object |
Definition at line 554 of file hal_sdc.c.
References BLK_STOP, SDCDriver::config, SDCDriver::errors, sdc_vmt, and SDCDriver::vmt.
Referenced by sdc_lld_init().
Configures and activates the SDC peripheral.
[in] | sdcp | pointer to the SDCDriver object |
[in] | config | pointer to the SDCConfig object, can be NULL if the driver supports a default configuration or requires no configuration |
Definition at line 573 of file hal_sdc.c.
References BLK_ACTIVE, BLK_STOP, SDCDriver::config, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), and sdc_lld_start().
void sdcStop | ( | SDCDriver * | sdcp | ) |
Deactivates the SDC peripheral.
[in] | sdcp | pointer to the SDCDriver object |
Definition at line 593 of file hal_sdc.c.
References BLK_ACTIVE, BLK_STOP, SDCDriver::config, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), and sdc_lld_stop().
bool sdcConnect | ( | SDCDriver * | sdcp | ) |
Performs the initialization procedure on the inserted card.
This function should be invoked when a card is inserted and brings the driver in the BLK_READY
state where it is possible to perform read and write operations.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 623 of file hal_sdc.c.
References _mmcsd_get_capacity(), _mmcsd_get_capacity_ext(), _mmcsd_get_slice(), BLK_ACTIVE, BLK_CONNECTING, BLK_READY, SDCDriver::cardmode, SDCDriver::config, detect_bus_clk(), mmc_init(), mmc_set_bus_width(), MMCSD_BLOCK_SIZE, MMCSD_CSD_MMC_CSD_STRUCTURE_SLICE, MMCSD_R1_ERROR, mode_detect(), osalDbgAssert, osalDbgCheck, SDCDriver::rca, SDCConfig::scratchpad, sdc_init(), sdc_lld_send_cmd_long_crc(), sdc_lld_send_cmd_none(), sdc_lld_send_cmd_short_crc(), sdc_lld_set_data_clk(), sdc_lld_start_clk(), sdc_lld_stop_clk(), and sdc_set_bus_width().
bool sdcDisconnect | ( | SDCDriver * | sdcp | ) |
Brings the driver in a state safe for card removal.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 762 of file hal_sdc.c.
References _sdc_wait_for_transfer_state(), BLK_ACTIVE, BLK_DISCONNECTING, BLK_READY, osalDbgAssert, osalDbgCheck, osalSysLock(), osalSysUnlock(), and sdc_lld_stop_clk().
bool sdcRead | ( | SDCDriver * | sdcp, |
uint32_t | startblk, | ||
uint8_t * | buf, | ||
uint32_t | n | ||
) |
Reads one or more blocks.
BLK_READY
state after a successful sdcConnect() invocation.[in] | sdcp | pointer to the SDCDriver object |
[in] | startblk | first block to read |
[out] | buf | pointer to the read buffer |
[in] | n | number of blocks to read |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 805 of file hal_sdc.c.
References BLK_READING, BLK_READY, SDCDriver::errors, osalDbgAssert, osalDbgCheck, and sdc_lld_read().
bool sdcWrite | ( | SDCDriver * | sdcp, |
uint32_t | startblk, | ||
const uint8_t * | buf, | ||
uint32_t | n | ||
) |
Writes one or more blocks.
BLK_READY
state after a successful sdcConnect() invocation.[in] | sdcp | pointer to the SDCDriver object |
[in] | startblk | first block to write |
[out] | buf | pointer to the write buffer |
[in] | n | number of blocks to write |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 842 of file hal_sdc.c.
References BLK_READY, BLK_WRITING, SDCDriver::errors, osalDbgAssert, osalDbgCheck, and sdc_lld_write().
sdcflags_t sdcGetAndClearErrors | ( | SDCDriver * | sdcp | ) |
Returns the errors mask associated to the previous operation.
[in] | sdcp | pointer to the SDCDriver object |
Definition at line 872 of file hal_sdc.c.
References BLK_READY, SDCDriver::errors, osalDbgAssert, osalDbgCheck, osalSysLock(), and osalSysUnlock().
bool sdcSync | ( | SDCDriver * | sdcp | ) |
Waits for card idle condition.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | the operation succeeded. |
HAL_FAILED | the operation failed. |
Definition at line 896 of file hal_sdc.c.
References BLK_READY, BLK_SYNCING, osalDbgCheck, and sdc_lld_sync().
bool sdcGetInfo | ( | SDCDriver * | sdcp, |
BlockDeviceInfo * | bdip | ||
) |
Returns the media info.
[in] | sdcp | pointer to the SDCDriver object |
[out] | bdip | pointer to a BlockDeviceInfo structure |
HAL_SUCCESS | the operation succeeded. |
HAL_FAILED | the operation failed. |
Definition at line 927 of file hal_sdc.c.
References BlockDeviceInfo::blk_num, BLK_READY, BlockDeviceInfo::blk_size, MMCSD_BLOCK_SIZE, and osalDbgCheck.
bool sdcErase | ( | SDCDriver * | sdcp, |
uint32_t | startblk, | ||
uint32_t | endblk | ||
) |
Erases the supplied blocks.
[in] | sdcp | pointer to the SDCDriver object |
[in] | startblk | starting block number |
[in] | endblk | ending block number |
HAL_SUCCESS | the operation succeeded. |
HAL_FAILED | the operation failed. |
Definition at line 954 of file hal_sdc.c.
References _sdc_wait_for_transfer_state(), BLK_READY, BLK_WRITING, SDCDriver::cardmode, MMCSD_BLOCK_SIZE, MMCSD_R1_ERROR, osalDbgAssert, osalDbgCheck, and sdc_lld_send_cmd_short_crc().
void sdc_lld_init | ( | void | ) |
Low level SDC driver initialization.
Definition at line 65 of file hal_sdc_lld.c.
References sdcObjectInit().
Referenced by sdcInit().
void sdc_lld_start | ( | SDCDriver * | sdcp | ) |
Configures and activates the SDC peripheral.
[in] | sdcp | pointer to the SDCDriver object |
Definition at line 79 of file hal_sdc_lld.c.
References BLK_STOP.
Referenced by sdcStart().
void sdc_lld_stop | ( | SDCDriver * | sdcp | ) |
Deactivates the SDC peripheral.
[in] | sdcp | pointer to the SDCDriver object |
Definition at line 93 of file hal_sdc_lld.c.
References BLK_STOP.
Referenced by sdcStop().
void sdc_lld_start_clk | ( | SDCDriver * | sdcp | ) |
Starts the SDIO clock and sets it to init mode (400kHz or less).
[in] | sdcp | pointer to the SDCDriver object |
Definition at line 107 of file hal_sdc_lld.c.
Referenced by sdcConnect().
void sdc_lld_set_data_clk | ( | SDCDriver * | sdcp, |
sdcbusclk_t | clk | ||
) |
Sets the SDIO clock to data mode (25MHz or less).
[in] | sdcp | pointer to the SDCDriver object |
[in] | clk | the clock mode |
Definition at line 120 of file hal_sdc_lld.c.
Referenced by sdcConnect().
void sdc_lld_stop_clk | ( | SDCDriver * | sdcp | ) |
Stops the SDIO clock.
[in] | sdcp | pointer to the SDCDriver object |
Definition at line 133 of file hal_sdc_lld.c.
Referenced by sdcConnect(), and sdcDisconnect().
void sdc_lld_set_bus_mode | ( | SDCDriver * | sdcp, |
sdcbusmode_t | mode | ||
) |
Switches the bus to 4 bits mode.
[in] | sdcp | pointer to the SDCDriver object |
[in] | mode | bus mode |
Definition at line 146 of file hal_sdc_lld.c.
References osalDbgAssert.
Referenced by mmc_set_bus_width(), and sdc_set_bus_width().
void sdc_lld_send_cmd_none | ( | SDCDriver * | sdcp, |
uint8_t | cmd, | ||
uint32_t | arg | ||
) |
Sends an SDIO command with no response expected.
[in] | sdcp | pointer to the SDCDriver object |
[in] | cmd | card command |
[in] | arg | command argument |
Definition at line 175 of file hal_sdc_lld.c.
Referenced by mode_detect(), and sdcConnect().
bool sdc_lld_send_cmd_short | ( | SDCDriver * | sdcp, |
uint8_t | cmd, | ||
uint32_t | arg, | ||
uint32_t * | resp | ||
) |
Sends an SDIO command with a short response expected.
[in] | sdcp | pointer to the SDCDriver object |
[in] | cmd | card command |
[in] | arg | command argument |
[out] | resp | pointer to the response buffer (one word) |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 197 of file hal_sdc_lld.c.
Referenced by mmc_init(), and sdc_init().
bool sdc_lld_send_cmd_short_crc | ( | SDCDriver * | sdcp, |
uint8_t | cmd, | ||
uint32_t | arg, | ||
uint32_t * | resp | ||
) |
Sends an SDIO command with a short response expected and CRC.
[in] | sdcp | pointer to the SDCDriver object |
[in] | cmd | card command |
[in] | arg | command argument |
[out] | resp | pointer to the response buffer (one word) |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 222 of file hal_sdc_lld.c.
Referenced by _sdc_wait_for_transfer_state(), mmc_detect_bus_clk(), mmc_set_bus_width(), mode_detect(), sdc_init(), sdc_set_bus_width(), sdcConnect(), and sdcErase().
bool sdc_lld_send_cmd_long_crc | ( | SDCDriver * | sdcp, |
uint8_t | cmd, | ||
uint32_t | arg, | ||
uint32_t * | resp | ||
) |
Sends an SDIO command with a long response expected and CRC.
[in] | sdcp | pointer to the SDCDriver object |
[in] | cmd | card command |
[in] | arg | command argument |
[out] | resp | pointer to the response buffer (four words) |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 247 of file hal_sdc_lld.c.
Referenced by sdcConnect().
bool sdc_lld_read | ( | SDCDriver * | sdcp, |
uint32_t | startblk, | ||
uint8_t * | buf, | ||
uint32_t | n | ||
) |
Reads one or more blocks.
[in] | sdcp | pointer to the SDCDriver object |
[in] | startblk | first block to read |
[out] | buf | pointer to the read buffer |
[in] | n | number of blocks to read |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 272 of file hal_sdc_lld.c.
Referenced by sdcRead().
bool sdc_lld_write | ( | SDCDriver * | sdcp, |
uint32_t | startblk, | ||
const uint8_t * | buf, | ||
uint32_t | n | ||
) |
Writes one or more blocks.
[in] | sdcp | pointer to the SDCDriver object |
[in] | startblk | first block to write |
[out] | buf | pointer to the write buffer |
[in] | n | number of blocks to write |
HAL_SUCCESS | operation succeeded. |
HAL_FAILED | operation failed. |
Definition at line 297 of file hal_sdc_lld.c.
Referenced by sdcWrite().
bool sdc_lld_sync | ( | SDCDriver * | sdcp | ) |
Waits for card idle condition.
[in] | sdcp | pointer to the SDCDriver object |
HAL_SUCCESS | the operation succeeded. |
HAL_FAILED | the operation failed. |
Definition at line 319 of file hal_sdc_lld.c.
Referenced by sdcSync().
|
static |
Virtual methods table.
Definition at line 74 of file hal_sdc.c.
Referenced by sdcObjectInit().
SDCDriver SDCD1 |
SDCD1 driver identifier.
Definition at line 41 of file hal_sdc_lld.c.