Contiki-NG
Loading...
Searching...
No Matches

Files

file  mmc-arch.h
 Header file for the SD/MMC device driver architecture-specific definitions.
 
file  mmc-arch.c
 Implementation of the SD/MMC device driver RE-Mote-specific definitions.
 

Functions

void mmc_arch_cd_changed_callback (uint8_t dev, bool cd)
 Callback of the SD/MMC driver to call when the card-detection signal changes.
 
bool mmc_arch_get_cd (uint8_t dev)
 Gets the state of the card-detection signal.
 
bool mmc_arch_get_wp (uint8_t dev)
 Gets the state of the write-protection signal.
 
void mmc_arch_spi_select (uint8_t dev, bool sel)
 Sets the SPI /CS signal as indicated.
 
void mmc_arch_spi_set_clock_freq (uint8_t dev, uint32_t freq)
 Sets the SPI clock frequency.
 
void mmc_arch_spi_xfer (uint8_t dev, const void *tx_buf, size_t tx_cnt, void *rx_buf, size_t rx_cnt)
 Performs an SPI transfer.
 

Detailed Description

SD/MMC device driver architecture-specific definitions.

Function Documentation

◆ mmc_arch_cd_changed_callback()

void mmc_arch_cd_changed_callback ( uint8_t dev,
bool cd )

Callback of the SD/MMC driver to call when the card-detection signal changes.

Parameters
devDevice
cdWhether a card is detected
Note
Using this function is not mandatory. This only allows to detect a card replacement between two successive calls to the SD/MMC driver API.

Definition at line 312 of file mmc.c.

References DISK_STATUS_DISK, DISK_STATUS_WRITABLE, mmc_arch_get_wp(), and MMC_CONF_DEV_COUNT.

◆ mmc_arch_get_cd()

bool mmc_arch_get_cd ( uint8_t dev)

Gets the state of the card-detection signal.

Parameters
devDevice
Returns
Whether a card is detected

Definition at line 73 of file mmc-arch.c.

References GPIO_CLR_PIN, GPIO_IS_OUTPUT, GPIO_READ_PIN, and GPIO_SET_OUTPUT.

◆ mmc_arch_get_wp()

bool mmc_arch_get_wp ( uint8_t dev)

Gets the state of the write-protection signal.

Parameters
devDevice
Returns
Whether the card is write-protected

Definition at line 92 of file mmc-arch.c.

Referenced by mmc_arch_cd_changed_callback().

◆ mmc_arch_spi_select()

void mmc_arch_spi_select ( uint8_t dev,
bool sel )

Sets the SPI /CS signal as indicated.

Parameters
devDevice
selWhether to assert /CS

Definition at line 98 of file mmc-arch.c.

◆ mmc_arch_spi_set_clock_freq()

void mmc_arch_spi_set_clock_freq ( uint8_t dev,
uint32_t freq )

Sets the SPI clock frequency.

Parameters
devDevice
freqFrequency (Hz)

Definition at line 108 of file mmc-arch.c.

References spix_set_clock_freq().

◆ mmc_arch_spi_xfer()

void mmc_arch_spi_xfer ( uint8_t dev,
const void * tx_buf,
size_t tx_cnt,
void * rx_buf,
size_t rx_cnt )

Performs an SPI transfer.

Parameters
devDevice
tx_bufPointer to the transmission buffer, or NULL
tx_cntNumber of bytes to transmit, or 0
rx_bufPointer to the reception buffer, or NULL
rx_cntNumber of bytes to receive, or 0

Definition at line 114 of file mmc-arch.c.