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

📄 compact.h

📁 e1c0df5d-c8bc-48a5-bc02-a2b7c51c0dbf是做mp3的源代码
💻 H
字号:
//#########################################################################// File: compact.h//// CompactFlash hardware definitions////#########################################################################// Last change: 21.04.2003//#########################################################################// holger.klabunde@t-online.de// http://home.t-online.de/home/holger.klabunde/homepage.htm//#########################################################################// Compiler: AVR-GCC 3.2//##########################################################################ifndef __COMPACT_FLASH_H#define __COMPACT_FLASH_H#define DEBUG#include <avr/io.h>#include <inttypes.h>#define BYTE_PER_SEC 512	//FAT, 512 bytes per sector#define NOP() asm volatile("nop" ::)//CF register adresses#define CF_IO		0	//IO-Port#define CF_FEATURES	1	//Errors Out / Features In#define CF_SECCOUNT	2	//Sectorcount#define CF_LBA0		3	//LBA 0-7#define CF_LBA1		4	//LBA 8-15#define CF_LBA2		5	//LBA 16-23#define CF_LBA3		6	//LBA 24-27#define CF_STACOM	7	//Status Out / Command In//ATAPI commands#define CF_READ_SEC	0x20#define CF_WRITE_SEC    0x30#define CF_IDENTIFY     0xEC//#define SER_BIN		1  //DumpSector() output in binary//#define SER_HEX		1  //ASCII-HEX//port where data i/o has to be done//without pullups on PortA some CF do not work !//maybe for some CF ATMegas internal pullups are to weak.//then use 10k external pullups on port and please use short//cables (max. 30cm)#define CF_DATA_DIR_IN()  	DDRA=0x00; PORTA=0xFF; // set io-pins to inputs, Pullups#define CF_DATA_DIR_OUT() 	DDRA=0xFF; // set io-pins to outputs#define CF_READ_DATA()    	PINA	  // read PIN, ! NOT ! PORT#define CF_WRITE_DATA(a)  	PORTA=(a); // write to data port#define CF_ADR_PORT 	PORTC   //Port CF_Adresspins ( D0..3 )#define CF_ADR_PIN 	PINC    #define CF_CS 		PC7	//Pin number for CF_CS#define CF_CS_PORT 	PORTC   //Port where CF_CS is located#define CF_CS_ON() 	sbi(CF_CS_PORT,CF_CS);#define CF_CS_OFF() 	cbi(CF_CS_PORT,CF_CS);#define CF_RD 		PC6	//Pin number for CF_RD#define CF_RD_PORT 	PORTC   //Port where CF_RD is located#define CF_RD_ON() 	sbi(CF_RD_PORT,CF_RD);#define CF_RD_OFF() 	cbi(CF_RD_PORT,CF_RD);#define CF_WR 		PC5	//Pin number for CF_WR#define CF_WR_PORT 	PORTC   //Port where CF_WR is located#define CF_WR_ON() 	sbi(CF_WR_PORT,CF_WR);#define CF_WR_OFF() 	cbi(CF_WR_PORT,CF_WR);//prototypesunsigned char secbuf[512]; //Sectorbufferextern unsigned long maxsect;extern unsigned int heads, sectors_per_track;unsigned char CFReadSector(unsigned long lba); // __attribute__ ((section(".bootloader"))) ;unsigned char CFWaitReady(void); // __attribute__ ((section(".bootloader")));unsigned char CFWaitDrq(void); // __attribute__ ((section(".bootloader")));void CFWriteAdr(unsigned char adr, unsigned char dat); // __attribute__ ((section(".bootloader")));void CFSetAdr(unsigned char adr); // __attribute__ ((section(".bootloader")));unsigned char CFReadAdr(unsigned char adr); // __attribute__ ((section(".bootloader")));unsigned char CFIdentify(); //  __attribute__ ((section(".bootloader")));unsigned char CFRead(void); // __attribute__ ((section(".bootloader")));#endif

⌨️ 快捷键说明

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