38 #define SD_BLOCK_SIZE 512
Reading R1 response to CMD0 byte by byte.
Reading the 32-bit parameter after receiving 0x00 from CMD58.
Initialization sequence succesful.
enum SDCardType card_type
Type of SDCard.
void sdcard_spi_init(struct SDCard *sdcard, struct spi_periph *spi_p, const uint8_t slave_idx)
Configure initial values for SDCard.
uint8_t input_buf[SD_BLOCK_SIZE+10]
The input buffer for the SPI transaction.
uint8_t response_counter
Response counter used at various locations.
Reading R1 response to CMD24 byte by byte.
About to send dummy clock cycles to initialize spi mode.
void sdcard_spi_multiwrite_stop(struct SDCard *sdcard)
Stop with multiwrite procedure.
struct spi_transaction spi_t
The SPI transaction used for the writing and reading of registers.
void sdcard_spi_multiwrite_next(struct SDCard *sdcard, SDCardCallback callback)
Write a(nother) data block (512 bytes) to the SDCard.
enum SDCardStatus status
The status of the SD card.
Reading R3 response to CMD58 byte by byte.
uint8_t output_buf[SD_BLOCK_SIZE+10]
The output buffer for the SPI transaction.
Reading R7 response to CMD8 byte by byte.
SPI transaction structure.
void sdcard_spi_read_block(struct SDCard *sdcard, uint32_t addr, SDCardCallback callback)
Read a single block (512 bytes) from the SDCard at a given address.
Reading R1 response to CMD16 byte by byte.
SDCardCallback external_callback
Callback to call when external operation finishes.
void sdcard_spi_write_block(struct SDCard *sdcard, uint32_t addr)
Write a single block (512 bytes) to the SDCard at a given address.
Reading the 32-bit parameter after receiving 0x01.
Architecture independent SPI (Serial Peripheral Interface) API.
void sdcard_spi_multiwrite_start(struct SDCard *sdcard, uint32_t addr)
Start writing multiple blocks of 512 bytes to the SDCard.
void sdcard_spi_periodic(struct SDCard *sdcard)
Periodic function of the SDCard.
SPI peripheral structure.
void(* SDCardCallback)(void)
SDCard Callback function.
Busy sending the stop token.
struct spi_periph * spi_p
The SPI peripheral for the connection.
Busy with the SPI transfer in multiwrite.
uint32_t timeout_counter
Timeout counter used for initialization checks with ACMD41.
struct SDCard sdcard1
This is the definition of the SD card.
An error has occured, sending debug message.
Busy sending CMD25 (multiwrite start command)
Reading R1 response to CMD17 byte by byte.
enum SDCardErrorStatus error_status
Contains information on where the error has occured.
Reading R1 response to CMD25 byte by byte.
SDCard is not initialized.
SDCard is busy with internal process.
Busy sending CMD17 (block read request)
Busy flag after sending data block in multiwrite.
CMD25 complete, ready to sent blocks.
Busy sending dummy clock cycles.
Reading a byte each period until there is a data token or error.
Start data block transfer.
Reading R1 response to ACMD41 byte by byte.