Hardware Abstraction Layer for FreeRTOS
sd.h File Reference
#include <FreeRTOS.h>
#include <stdint.h>
#include <stdbool.h>
#include <system.h>
#include <semphr.h>
#include <hal.h>
Include dependency graph for sd.h:

Go to the source code of this file.

Data Structures

struct  sd_generic
 
struct  sd_response
 
struct  sd_setting
 

Macros

#define SD_ERROR_AKE_SEQ_ERROR   -2
 
#define SD_ERROR_ERROR   -3
 
#define SD_ERROR_CC_ERROR   -4
 
#define SD_ERROR_CARD_ECC_FAIELD   -5
 
#define SD_ERROR_ILLEGAL_COMMAND   -6
 
#define SD_ERROR_COM_CRC_ERROR   -7
 
#define SD_ERROR_LOCK_UNLOCK_FAILED   -8
 
#define SD_ERROR_CARD_IS_LOCKED   -9
 
#define SD_ERROR_WP_VIOLATION   -10
 
#define SD_ERROR_ERASE_PARAM   -11
 
#define SD_ERROR_ERASE_SEQ_ERROR   -12
 
#define SD_ERROR_ERASE_LEN_ERROR   -13
 
#define SD_ERROR_ADDRESS_ERROR   -14
 
#define SD_ERROR_OUT_OF_RANGE   -15
 
#define SD_ERROR_FUNCTION_NUMBER   -16
 
#define CMD(x)   (x)
 
#define ACMD(x)   (x)
 

Enumerations

enum  sd_mode { SD_SPI, SD_SD, SD_SDIO }
 
enum  sd_block_size {
  SD_BLOCK_SIZE_1B, SD_BLOCK_SIZE_2B, SD_BLOCK_SIZE_4B, SD_BLOCK_SIZE_8B,
  SD_BLOCK_SIZE_16B, SD_BLOCK_SIZE_32B, SD_BLOCK_SIZE_64B, SD_BLOCK_SIZE_128B,
  SD_BLOCK_SIZE_256B, SD_BLOCK_SIZE_512B, SD_BLOCK_SIZE_1024B, SD_BLOCK_SIZE_2048B
}
 
enum  sd_bus_wide { SD_BusWide_1b, SD_BusWide_4b, SD_BusWide_8b }
 

Functions

struct sd * sd_init (uint32_t index, struct sd_setting *settings)
 
int32_t sd_deinit (struct sd *sd)
 
int32_t sd_setBlockSize (struct sd *sd, enum sd_block_size blockSize)
 
int32_t sd_setBusWide (struct sd *sd, enum sd_bus_wide busWide)
 
int32_t sd_setClock (struct sd *sd, uint64_t clock)
 
int32_t sd_sendCommand (struct sd *sd, uint32_t command, uint32_t argument, struct sd_response *response, TickType_t waittime)
 
int32_t sd_write (struct sd *sd, uint32_t command, uint32_t argument, size_t size, uint32_t *data, TickType_t waittime)
 
int32_t sd_read (struct sd *sd, uint32_t command, uint32_t argument, size_t size, uint32_t *data, TickType_t waittime)
 
int32_t sd_sendCommandISR (struct sd *sd, uint32_t command, uint32_t argument, struct sd_response *response)
 
int32_t sd_writeISR (struct sd *sd, uint32_t command, uint32_t argument, size_t size, uint32_t *data)
 
int32_t sd_readISR (struct sd *sd, uint32_t command, uint32_t argument, size_t size, uint32_t *data)