coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spi_sdcard.h File Reference
#include <stddef.h>
Include dependency graph for spi_sdcard.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  spi_sdcard
 

Functions

int spi_sdcard_init (struct spi_sdcard *card, const unsigned int bus, const unsigned int cs)
 
int spi_sdcard_single_read (const struct spi_sdcard *card, size_t block_address, void *buff)
 
int spi_sdcard_multiple_read (const struct spi_sdcard *card, size_t start_block_address, size_t end_block_address, void *buff)
 
int spi_sdcard_single_write (const struct spi_sdcard *card, size_t block_address, void *buff)
 
int spi_sdcard_read (const struct spi_sdcard *card, void *dest, size_t offset, size_t count)
 
int spi_sdcard_multiple_write (const struct spi_sdcard *card, size_t start_block_address, size_t end_block_address, void *buff)
 
int spi_sdcard_erase (const struct spi_sdcard *card, size_t start_block_address, size_t end_block_address)
 
int spi_sdcard_erase_all (const struct spi_sdcard *card)
 
size_t spi_sdcard_size (const struct spi_sdcard *card)
 

Function Documentation

◆ spi_sdcard_erase()

int spi_sdcard_erase ( const struct spi_sdcard card,
size_t  start_block_address,
size_t  end_block_address 
)

Definition at line 772 of file spi_sdcard.c.

References card, ERASE, ERASE_WR_BLK_END_ADDR, ERASE_WR_BLK_START_ADDR, NULL, SDCARD_TYPE_SDSC, spi_sdcard_do_command(), and spi_sdcard::type.

Referenced by spi_sdcard_erase_all().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_sdcard_erase_all()

int spi_sdcard_erase_all ( const struct spi_sdcard card)

Definition at line 798 of file spi_sdcard.c.

References BLOCK_SIZE, card, spi_sdcard_erase(), and spi_sdcard_size().

Here is the call graph for this function:

◆ spi_sdcard_init()

int spi_sdcard_init ( struct spi_sdcard card,
const unsigned int  bus,
const unsigned int  cs 
)

◆ spi_sdcard_multiple_read()

int spi_sdcard_multiple_read ( const struct spi_sdcard card,
size_t  start_block_address,
size_t  end_block_address,
void buff 
)

Definition at line 544 of file spi_sdcard.c.

References c, card, crc16_byte(), CT_BLOCK_START, NULL, READ_MULTIPLEBLOCK, SDCARD_TYPE_SDSC, SEND_STATUS, spi_sdcard_disable_cs(), spi_sdcard_do_command(), spi_sdcard_enable_cs(), spi_sdcard_recvbyte(), STOP_TRANSMISSION, spi_sdcard::type, and wait().

Referenced by spi_sdcard_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_sdcard_multiple_write()

int spi_sdcard_multiple_write ( const struct spi_sdcard card,
size_t  start_block_address,
size_t  end_block_address,
void buff 
)

◆ spi_sdcard_read()

int spi_sdcard_read ( const struct spi_sdcard card,
void dest,
size_t  offset,
size_t  count 
)

Definition at line 603 of file spi_sdcard.c.

References BLOCK_SIZE, card, count, memcpy(), offset, spi_sdcard_multiple_read(), and spi_sdcard_single_read().

Here is the call graph for this function:

◆ spi_sdcard_single_read()

int spi_sdcard_single_read ( const struct spi_sdcard card,
size_t  block_address,
void buff 
)

Definition at line 496 of file spi_sdcard.c.

References c, card, crc16_byte(), CT_BLOCK_START, NULL, READ_SINGLE_BLOCK, SDCARD_TYPE_SDSC, spi_sdcard_disable_cs(), spi_sdcard_do_command(), spi_sdcard_enable_cs(), spi_sdcard_recvbyte(), spi_sdcard::type, and wait().

Referenced by spi_sdcard_read().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_sdcard_single_write()

int spi_sdcard_single_write ( const struct spi_sdcard card,
size_t  block_address,
void buff 
)

◆ spi_sdcard_size()

size_t spi_sdcard_size ( const struct spi_sdcard card)

Definition at line 363 of file spi_sdcard.c.

References c, card, crc16_byte(), CT_BLOCK_START, extract_bits(), NULL, SEND_CSD, spi_sdcard_disable_cs(), spi_sdcard_do_command(), spi_sdcard_enable_cs(), spi_sdcard_recvbyte(), and wait().

Referenced by spi_sdcard_erase_all(), and spi_sdcard_init().

Here is the call graph for this function:
Here is the caller graph for this function: