ChibiOS 21.11.4
hal_mmc_spi.c File Reference

MMC over SPI driver code. More...

#include <string.h>
#include "hal.h"

Go to the source code of this file.

Functions

static bool mmc_is_card_inserted (void *instance)
static bool mmc_is_write_protected (void *instance)
static bool mmc_connect (void *instance)
static bool mmc_disconnect (void *instance)
static bool mmc_read (void *instance, uint32_t startblk, uint8_t *buffer, uint32_t n)
static bool mmc_write (void *instance, uint32_t startblk, const uint8_t *buffer, uint32_t n)
static bool mmc_sync (void *instance)
static bool mmc_get_info (void *instance, BlockDeviceInfo *bdip)
static uint8_t mmc_crc7 (uint8_t crc, const uint8_t *buffer, size_t len)
 Calculate the MMC standard CRC-7 based on a lookup table.
static bool mmc_wait_idle (MMCDriver *mmcp)
 Waits an idle condition.
static bool mmc_send_hdr (MMCDriver *mmcp, uint8_t cmd, uint32_t arg)
 Sends a command header.
static bool mmc_recvr1 (MMCDriver *mmcp, uint8_t *r1p)
 Receives a single byte response.
static bool mmc_recvr3 (MMCDriver *mmcp, uint8_t *r1p)
 Receives a three byte response.
static bool mmc_send_command_R1 (MMCDriver *mmcp, uint8_t cmd, uint32_t arg, uint8_t *r1p)
 Sends a command an returns a single byte response.
static bool mmc_send_command_R3 (MMCDriver *mmcp, uint8_t cmd, uint32_t arg, uint8_t *r1p)
 Sends a command which returns a five bytes response (R3).
static bool mmc_read_CxD (MMCDriver *mmcp, uint8_t cmd, uint32_t cxd[4])
 Reads the CSD.
void mmcInit (void)
 MMC over SPI driver initialization.
void mmcObjectInit (MMCDriver *mmcp, uint8_t *buffer)
 Initializes an instance.
msg_t mmcStart (MMCDriver *mmcp, const MMCConfig *config)
 Configures and activates the MMC peripheral.
void mmcStop (MMCDriver *mmcp)
 Disables the MMC peripheral.
bool mmcConnect (MMCDriver *mmcp)
 Performs the initialization procedure on the inserted card.
bool mmcDisconnect (MMCDriver *mmcp)
 Brings the driver in a state safe for card removal.
bool mmcStartSequentialRead (MMCDriver *mmcp, uint32_t startblk)
 Starts a sequential read.
bool mmcSequentialRead (MMCDriver *mmcp, uint8_t *buffer)
 Reads a block within a sequential read operation.
bool mmcStopSequentialRead (MMCDriver *mmcp)
 Stops a sequential read gracefully.
bool mmcStartSequentialWrite (MMCDriver *mmcp, uint32_t startblk)
 Starts a sequential write.
bool mmcSequentialWrite (MMCDriver *mmcp, const uint8_t *buffer)
 Writes a block within a sequential write operation.
bool mmcStopSequentialWrite (MMCDriver *mmcp)
 Stops a sequential write gracefully.
bool mmcSync (MMCDriver *mmcp)
 Waits for card idle condition.
bool mmcGetInfo (MMCDriver *mmcp, BlockDeviceInfo *bdip)
 Returns the media info.
bool mmcErase (MMCDriver *mmcp, uint32_t startblk, uint32_t endblk)
 Erases blocks.

Variables

static const struct mmc_spi_driver_vmt mmc_vmt
 Virtual methods table.
static const uint8_t mmc_crc7_lookup_table [256]
 Lookup table for CRC-7 ( based on polynomial x^7 + x^3 + 1).

Detailed Description

MMC over SPI driver code.

Definition in file hal_mmc_spi.c.