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

📄 mmc_spi.h

📁 avr的fat文件系统测试程序
💻 H
字号:
//#########################################################################
// File: mmc_spi.h
//
// MMC MultiMediaCard and SD SecureDigital definitions for SPI protocol
//
//#########################################################################
// Last change: 21.05.2004
//#########################################################################
// holger.klabunde@t-online.de
// http://home.t-online.de/home/holger.klabunde/homepage.htm
//#########################################################################
// Compiler: AVR-GCC 3.2
//#########################################################################

#ifndef __MMC_CARD_SPI_H
#define __MMC_CARD_SPI_H

#define SPI_WRITE(a) { SPDR=(a); }
#define SPI_WAIT() { while(!(SPSR&0x80)); }

// you don't really need the /CS pin. it works also if /CS is
// connected to ground. 
#define MMC_CS 		4	//Pin number for MMC_CS
#define MMC_CS_PORT 	PORTB   //Port where MMC_CS is located
#define MMC_CS_ON() 	sbi(MMC_CS_PORT,MMC_CS);
#define MMC_CS_OFF() 	cbi(MMC_CS_PORT,MMC_CS);

// MMC/SD commands
#define MMC_RESET		0x40 + 0
#define MMC_INIT		0x40 + 1
#define MMC_READ_CSD		0x40 + 9
#define MMC_READ_CID		0x40 + 10
#define MMC_STOP_TRANSMISSION	0x40 + 12
#define MMC_SEND_STATUS		0x40 + 13
#define MMC_SET_BLOCKLEN	0x40 + 16
#define MMC_READ_BLOCK		0x40 + 17
#define MMC_READ_MULTI_BLOCK	0x40 + 18
#define MMC_WRITE_BLOCK		0x40 + 24
#define MMC_WRITE_MULTI_BLOCK	0x40 + 25

//prototypes
extern unsigned char MMCReadSector(unsigned long sector, unsigned char *buf);
extern unsigned char MMCWriteSector(unsigned long sector, unsigned char *buf);
extern unsigned char MMCIdentify(void);

#define ReadSector(a,b) 	MMCReadSector((a),(b))
#define WriteSector(a,b) 	MMCWriteSector((a),(b))
#define IdentifyMedia()		MMCIdentify()

#endif

⌨️ 快捷键说明

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