⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sd_dri.h

📁 收集了单片机对SD卡读写源码
💻 H
字号:
/*!
 *@file     sd_dri.h
 *
 * 
 *
 *@version  v1.0.0
 *@date     2007
 *@author   jacky291@126.com
*/
 #ifndef __SD_DRI_H
 #define __SD_DRI_H
 
 #ifndef __CONFIG_H
 #include "config.h"
 #endif
 
 #define  SD_INIT_FAILED           255 
 #define  SD_READ_FAILED           251
 #define  SD_WRITE_FAILED          250
 #define  WAIT_IDLE_TIMEOUT        254
 #define  SD_ERR_VOL_NOTSUSP       253
 #define  SD_ERR_TIMEOUT_WAITIDLE  252
 #define  SD_IDLE_WAIT_MAX         200
 #define  MSK_IDLE                 0x01
 #define  MSK_OCR_33               0x10


 typedef struct __sd
 {
         uint8   MID;
         uint16  OID;
         uint8   PNM[5];
         uint8   PRV;
         uint8   PSN[4];
         
 }SD_CARD;
/*!
 *@brief
 *        SD_info()
 *        read the info data from the sd card
 *
 *@param  none
 *@retval none
 */
extern uint32 SD_info(SD_CARD *s);

 /*!
*@brief
*        SD_ActiveInit()
*        active the sd card
*
*@param  none
*@retval none
*/
extern uint8 SD_ActiveInit(void);







 /*!
*@brief
*        SD_init()
*        read the info data from the sd card
*
*@param  none
*@retval none
*/

extern uint32 SD_init(void);









 /*!
*@brief
*        SD_read()
*        read the data from the sd card
*        when the addr is block_start addr and the len is READ_BL_LEN it will be the fast!
*@param  uint32 addr:start address
*@param  uint32 len:the lenth read
*@param  uint8 *buff:the receive buff
*@retval return the readed byte length
*/
extern uint32 SD_read(uint32 addr,uint32 len,uint8 *buff);




 /*!
*@brief
*        SD_write()
*        write the data to the sd card
*        when the addr is block_start addr and the len is READ_BL_LEN it will be the fast!
*@param  uint32 addr:start address
*@param  uint32 len:the lenth write
*@param  uint8 *buff:the write buff
*@retval return the writed byte length
*/
extern uint32 SD_write(uint32 addr,uint32 len,uint8 *buff);



 /*!
*@brief
*        SD_eraser()
*        eraser the data from the sd card
*        when the addr is block_start addr and the len is READ_BL_LEN it will be the fast!
*@param  uint32 addr:start address
*@param  uint32 len:the lenth eraser
*@retval return the erasered byte length
*/
extern uint32 SD_eraser(uint32 addr,uint32 len);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -