freescale
来自「Freescale 系列单片机常用模块与综合系统设计」· 代码 · 共 62 行
TXT
62 行
#ifndef __SD__
#define __SD__
/* Includes */
#include "FslTypes.h"
#include "derivative.h"
#include "SPI.h"
/* User definitions */
#define SD_BLOCK_512
#define SD_WAIT_CYCLES 10
#define SD_DE PTBD_PTBD7 // card detection
#define _SD_DE PTBDD_PTBDD7 // card detection
#define kSD_Insert 0
#define kSD_Desert 1
#define SD_WR PTBD_PTBD6 // write protection
#define _SD_WR PTBD_PTBD6 // write protection
#define kSD_WP 1
#define kSD_WnP 0
/* Static Definitions */
/******************************* SD Card Standard Commands **********************************/
enum{
SD_CMD0, /* Resets the SD Memory Card */
SD_CMD1, /* Sends host capacity support information and activates the card's
initialization process. HCS is effective when card receives SEND_IF_COND
command. Reserved bits shall be set to '0'. */
SD_CMD2,
SD_CMD3,
SD_CMD4,
SD_CMD5,
SD_CMD6, /* Checks switchable function (mode 0) and switches card function (mode 1).*/
SD_CMD7,
SD_CMD8, /* Sends SD Memory Card interface condition that includes host supply voltage
information and asks the accessed card whether card can operate in supplied
voltage range. Reserved bits shall be set to '0'.*/
SD_CMD9, /* Asks the selected card to send its cardspecific data (CSD)*/
SD_CMD10, /* Asks the selected card to send its card identification (CID) */
SD_CMD11,
SD_CMD12, /* Forces the card to stop transmission in Multiple Block Read Operation */
SD_CMD13, /* Asks the selected card to send its status register. */
SD_CMD14,
SD_CMD15,
SD_CMD16, /* Sets a block length (in bytes) for all following block commands (read and
write) of a Standard Capacity Card. Block length of the read and write
commands are fixed to 512 bytes in a High Capacity Card. The length of
LOCK_UNLOCK command is set by this command in both capacity cards.*/
SD_CMD17, /* Reads a block of the size selected by the SET_BLOCKLEN command.*/
SD_CMD18, /* Continuously transfers data blocks from card to host until interrupted by a
STOP_TRANSMISSION command.*/
SD_CMD19,
SD_CMD20,
SD_CMD21,
SD_CMD22,
SD_CMD23,
SD_CMD24, /* Writes a block of the size selected by the SET_BLOCKLEN command. */
SD_CMD25, /* Continuously writes blocks of data until 扴top Tran
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?