Contiki-NG
Files | Functions

SD/MMC device driver architecture-specific definitions. More...

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. More...
 
bool mmc_arch_get_cd (uint8_t dev)
 Gets the state of the card-detection signal. More...
 
bool mmc_arch_get_wp (uint8_t dev)
 Gets the state of the write-protection signal. More...
 
void mmc_arch_spi_select (uint8_t dev, bool sel)
 Sets the SPI /CS signal as indicated. More...
 
void mmc_arch_spi_set_clock_freq (uint8_t dev, uint32_t freq)
 Sets the SPI clock frequency. More...
 
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. More...
 

Detailed Description

SD/MMC device driver architecture-specific definitions.

Function Documentation

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 clock_delay_usec(), DISK_IOCTL_CTRL_SYNC, DISK_IOCTL_GET_BLOCK_SIZE, DISK_IOCTL_GET_SECTOR_COUNT, DISK_IOCTL_GET_SECTOR_SIZE, DISK_RESULT_INVALID_ARG, DISK_RESULT_IO_ERROR, DISK_RESULT_NO_INIT, DISK_RESULT_OK, DISK_RESULT_WR_PROTECTED, DISK_STATUS_DISK, DISK_STATUS_INIT, DISK_STATUS_WRITABLE, mmc_arch_get_cd(), mmc_arch_get_wp(), mmc_arch_spi_select(), mmc_arch_spi_set_clock_freq(), MMC_CONF_DEV_COUNT, RTIMER_NOW, disk_driver::status, and watchdog_periodic().

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.

Referenced by mmc_arch_cd_changed_callback().

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().

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.

Referenced by mmc_arch_cd_changed_callback().

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().

Referenced by mmc_arch_cd_changed_callback().

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.