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

📄 cfcard.h

📁 这项工程将让您把自己的MP3播放器平台
💻 H
字号:
//++
//cfcard.h - declarations for cfcard.c module
//
// Copyright (C) 2005 by Spare Time Gizmos.  All rights reserved.
//
// This file is part of the Spare Time Gizmos' MP3 Player firmware.
//
// This firmware is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place, Suite 330, Boston, MA  02111-1307  USA
//
//REVISION HISTORY:
// dd-mmm-yy    who     description
// 20-May-05	RLA	New file.
// 12-Oct-05	RLA	Add new global members ...
// 19-Oct-05	RLA	Add STACKSLOCS hack to IdentifyCard() for SDCC.
// 20-Oct-05	RLA	Reduce CARD_NAME_LENGTH to 21 because we really
//			 need the XDATA space on the P89C664.
//--
#ifndef _cfcard_h_
#define _cfcard_h_
#include "slocs.h"	// STACKSLOCS hack for SDCC

// Miscellaneous IDE constants...
#define IDE_SECTOR_SIZE	    512	// size (in bytes) an IDE sector
#define FLASH_MEMORY_CARD 0x848A// CompactFlash attribute returned by IDENTIFY DEVICE
//   Note that the string returned by IDENTIFY DEVICE can actually be up to 40
// characters long, but there's no point in remembering all of those when we only
// have a 20 column display.  It'd be nice to keep them, but XRAM is tight on the
// P89C664 device and these few bytes make the difference between one disk buffer
// and two...
#define CARD_NAME_LENGTH     21	// size of card name/model (IDENTIFY DEVICE) +1

//   IDE registers and bits...  Remember that the primary (e.g. CS1FX) IDE
// registers are numbered 0..7 and the secondary (CS3FX) registers are 8..15.
#define IDE_REG_COMMAND		007		// drive command register (write only)
#define IDE_REG_STATUS		007		// status register (read only)
#define  IDE_STATUS_BSY		0x80		//  drive busy
#define  IDE_STATUS_DRDY	0x40		//  drive ready
#define  IDE_STATUS_DRQ		0x08		//  data request
#define  IDE_STATUS_ERR		0x01		//  drive error
#define IDE_REG_SELECT		006		// drive/head select register
#define  IDE_SELECT_SLAVE	0x10		//  select the slave drive
#define  IDE_LBA_MODE		0x40		//  select LBA mode
#define IDE_REG_CYLINDER_H	005		// cylinder address (high)
#define IDE_REG_CYLINDER_L	004		//  "   "    "   "  (low)
#define IDE_REG_SECTOR		003		// sector address
#define IDE_REG_COUNT 		002		// sector count register
#define IDE_REG_ERROR		001		// error register (read only)
#define IDE_REG_FEATURES	001		// features register (write only)
#define IDE_REG_DATA		000		// data register
#define IDE_REG_CONTROL		016		// device control register
#define  IDE_SOFTWARE_RESET	0x04		//  software reset bit

//   IDE Commands and arguments...  These are written to the IDE_REG_COMMAND
//  register...
#define IDE_CMD_SET_FEATURES	0xEF		// set drive features (notably 8 bit mode!)
#define  IDE_FEATURE_8BIT	0x01		//  argument passed in IDE_REG_FEATURES
#define IDE_CMD_IDENTIFY_DEVICE	0xEC		// identify device
#define IDE_CMD_READ_SECTOR	0x20		// read sector(s) with retry

// Low level routines from IDE.A51...
extern void WriteIDE (BYTE bReg, BYTE bValue);
extern BYTE ReadIDE (BYTE bReg);
extern WORD ReadIDEBuffer (PXBYTE pxBuffer, WORD cbMaxBuf);

// Methods...
extern BOOL IsCardInserted (void);
extern BOOL InitializeCard (void);
extern BOOL IdentifyCard (void) STACKSLOCS;
extern BOOL ReadSector (LONG lLBN, PXBYTE pxBuffer);

// Members...
extern XDATA char g_szCardName[CARD_NAME_LENGTH];
extern XDATA WORD g_wCardSize, g_wCardAttributes;
extern XDATA LONG g_lCardSectors;

#endif	// _cfcard_h_

⌨️ 快捷键说明

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