15 #if defined(BOARD_SDCARD_CS_PIN) || defined(BOARD_DATAFLASH_FATFS) 26 #define FALSE ((uint8_t)0x00) 27 #define TRUE ((uint8_t)0x01) 31 #define SD_CARD_TYPE_SD1 CT_SD1 33 #define SD_CARD_TYPE_SD2 CT_SD2 35 #define SD_CARD_TYPE_SDHC CT_BLOCK 44 void spi_spiTransfer(
const uint8_t *send, uint32_t send_len, uint8_t *recv, uint32_t recv_len);
62 static uint16_t errorCode() {
return sd_status(); }
63 static uint8_t writeBlock(uint8_t *buff, uint32_t block) {
return sd_write(buff, block, 1)==
RES_OK; }
64 static uint8_t readBlock(uint8_t *buff, uint32_t block){
return sd_read( buff, block, 1)==
RES_OK; }
66 static uint8_t writeBlock(uint8_t *buff, uint32_t block, uint16_t len) {
return sd_write(buff, block, len)==
RES_OK; }
67 static uint8_t readBlock(uint8_t *buff, uint32_t block, uint16_t len){
return sd_read( buff, block, len)==
RES_OK; }
69 static uint8_t ioctl(uint32_t cmd, uint32_t *buff){
return sd_ioctl(cmd, buff) ==
RES_OK; }
71 static uint32_t sectorCount() {
79 static uint32_t blockSize() {
83 #ifdef BOARD_DATAFLASH_ERASE_SIZE 91 static uint32_t sectorSize() {
DRESULT sd_write(const uint8_t *buff, uint32_t sector, uint16_t count)
DRESULT sd_read(uint8_t *buff, uint32_t sector, uint16_t count)
uint8_t(* spi_WaitFunc)(uint8_t b)
-*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#define BOARD_DATAFLASH_ERASE_SIZE
DRESULT sd_ioctl(uint8_t cmd, void *buff)
uint8_t spi_waitFor(uint8_t out, spi_WaitFunc cb, uint32_t dly)
bool spi_chipSelectLow(bool take_sem)
uint8_t spi_spiRecv(void)
void spi_chipSelectHigh(void)
uint8_t spi_spiSend(uint8_t b)
void init()
Generic board initialization function.
void spi_spiTransfer(const uint8_t *send, uint32_t send_len, uint8_t *recv, uint32_t recv_len)
uint8_t spi_spiXchg(uint8_t b)