+ #if CPU_CM3_SAM3X8
+ SDcid cid;
+ SDcsd csd;
+ uint32_t addr;
+ uint32_t status;
+ #endif
+
+} Sd;
+
+bool sd_initUnbuf(Sd *sd, KFile *ch);
+bool sd_initBuf(Sd *sd, KFile *ch);
+
+
+#if CPU_CM3_SAM3X8
+
+void sd_dumpCsd(Sd *sd);
+void sd_dumpCid(Sd *sd);
+
+void sd_sendInit(void);
+void sd_goIdle(void);
+int sd_sendIfCond(void);
+int sd_sendAppOpCond(void);
+
+int sd_getCid(Sd *sd, uint32_t addr, uint8_t flag);
+int sd_getCsd(Sd *sd);
+int sd_getSrc(Sd *sd);
+
+int sd_appStatus(Sd *sd);
+int sd_getRelativeAddr(Sd *sd);
+
+int sd_selectCard(Sd *sd);
+int sd_deSelectCard(Sd *sd);
+int sd_setBusWidth(Sd *sd, size_t len);
+int sd_set_BlockLen(Sd *sd, size_t len);
+
+int sd_readSingleBlock(Sd *sd, size_t index, void *_buf, size_t len);
+
+
+INLINE int sd_setBus4bit(Sd *sd)
+{
+ return sd_setBusWidth(sd, 1);
+}
+
+INLINE int sd_setBus1bit(Sd *sd)
+{
+ return sd_setBusWidth(sd, 0);
+}
+
+#endif
+
+
+#if CONFIG_SD_OLD_INIT
+ #if !(ARCH & ARCH_NIGHTTEST)
+ #warning "Deprecated: this API will be removed in the next major release,"
+ #warning "please disable CONFIG_SD_OLD_INIT and pass explicitly the SD context to sd_init()."
+ #endif