STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
sd_spi.h File Reference
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for sd_spi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SD_CMD0_GO_IDLE   0U
#define SD_CMD8_SEND_IF_COND   8U
#define SD_CMD10_SEND_CID   10U
#define SD_CMD55_APP_CMD   55U
#define SD_CMD58_READ_OCR   58U
#define SD_ACMD41_SD_SEND_OP_COND   41U
#define SD_CMD8_ARG   0x000001AAU /* 2.7-3.6 V, check pattern 0xAA */
#define SD_ACMD41_HCS   0x40000000U /* host supports high capacity */
#define SD_R1_IDLE   0x01U
#define SD_R1_ILLEGAL_COMMAND   0x04U
#define SD_DATA_TOKEN   0xFEU
#define SD_OCR_CCS   0x40000000U /* card capacity status: SDHC/SDXC */

Functions

uint8_t sd_crc7 (const uint8_t *data, uint8_t len)
void sd_command_frame (uint8_t out[6], uint8_t index, uint32_t argument)
static bool sd_is_r1 (uint8_t byte)
bool sd_r7_ok (const uint8_t r7[4])
bool sd_cid_ok (const uint8_t cid[16])

Macro Definition Documentation

◆ SD_ACMD41_HCS

#define SD_ACMD41_HCS   0x40000000U /* host supports high capacity */

Definition at line 25 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_command_frames().

◆ SD_ACMD41_SD_SEND_OP_COND

#define SD_ACMD41_SD_SEND_OP_COND   41U

Definition at line 22 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_command_frames().

◆ SD_CMD0_GO_IDLE

#define SD_CMD0_GO_IDLE   0U

Definition at line 17 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_command_frames().

◆ SD_CMD10_SEND_CID

#define SD_CMD10_SEND_CID   10U

Definition at line 19 of file sd_spi.h.

Referenced by sd_read_cid(), and test_command_frames().

◆ SD_CMD55_APP_CMD

#define SD_CMD55_APP_CMD   55U

Definition at line 20 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_command_frames().

◆ SD_CMD58_READ_OCR

#define SD_CMD58_READ_OCR   58U

Definition at line 21 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_command_frames().

◆ SD_CMD8_ARG

#define SD_CMD8_ARG   0x000001AAU /* 2.7-3.6 V, check pattern 0xAA */

Definition at line 24 of file sd_spi.h.

Referenced by sd_nand_probe(), sd_r7_ok(), and test_command_frames().

◆ SD_CMD8_SEND_IF_COND

#define SD_CMD8_SEND_IF_COND   8U

Definition at line 18 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_command_frames().

◆ SD_DATA_TOKEN

#define SD_DATA_TOKEN   0xFEU

Definition at line 29 of file sd_spi.h.

Referenced by sd_read_cid().

◆ SD_OCR_CCS

#define SD_OCR_CCS   0x40000000U /* card capacity status: SDHC/SDXC */

Definition at line 30 of file sd_spi.h.

Referenced by sd_nand_probe().

◆ SD_R1_IDLE

#define SD_R1_IDLE   0x01U

Definition at line 27 of file sd_spi.h.

Referenced by sd_nand_probe(), and test_r1().

◆ SD_R1_ILLEGAL_COMMAND

#define SD_R1_ILLEGAL_COMMAND   0x04U

Definition at line 28 of file sd_spi.h.

Referenced by test_r1().

Function Documentation

◆ sd_cid_ok()

bool sd_cid_ok ( const uint8_t cid[16])

Definition at line 31 of file sd_spi.c.

References sd_crc7().

Referenced by sd_nand_probe(), and test_cid().

◆ sd_command_frame()

void sd_command_frame ( uint8_t out[6],
uint8_t index,
uint32_t argument )

Definition at line 17 of file sd_spi.c.

References sd_crc7().

Referenced by sd_command(), sd_read_cid(), and test_command_frames().

◆ sd_crc7()

uint8_t sd_crc7 ( const uint8_t * data,
uint8_t len )

Definition at line 3 of file sd_spi.c.

Referenced by sd_cid_ok(), and sd_command_frame().

◆ sd_is_r1()

bool sd_is_r1 ( uint8_t byte)
inlinestatic

Definition at line 39 of file sd_spi.h.

Referenced by sd_command(), sd_read_cid(), and test_r1().

◆ sd_r7_ok()

bool sd_r7_ok ( const uint8_t r7[4])

Definition at line 26 of file sd_spi.c.

References SD_CMD8_ARG.

Referenced by sd_nand_probe(), and test_r7().