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

📄 emulator.c

📁 sonata2standardsourcedriver的EEProm读写方案
💻 C
字号:
//=============================================================================// File Name: emulator.c//// Copyright 2000 Cirrus Logic Corporation//// Description://  	The API for the AT24C01A and AT24C02 EEPROM's.//		This version emulates EEPROM using RAM//// Modification History://  	$Id: emulator.c,v 1.4 2003/11/20 21:32:17 matthieu Exp $//  	$Log: emulator.c,v $//  	Revision 1.4  2003/11/20 21:32:17  matthieu//  	Remove the //Perl skip lines...//  	//  	Revision 1.3  2003/11/20 08:42:09  akipnis//  	Renamed CLASI functions and responses to follow naming conventions//  	//  	Revision 1.2  2003/11/05 01:54:59  haluk//  	9898 finialized eeprom//  	//  	Revision 1.1  2003/09/11 00:55:02  matthieu//  	Initial Sonata 2 tree//  	//  	Revision 1.1.1.1  2003/06/27 03:14:12  jalves//  	initial check in//  	//  	Revision 1.1.1.1  2003/06/06 20:59:06  matthieu//  	LG code//  	Initial code from sonata tree with tag  : MATT_20030606//  	//  	Revision 1.2  2003/06/02 17:16:43  matthieu//  	Merge to DVDev_2-5-3//  	//  	Revision 1.1  2003/02/18 00:58:22  matthieu//  	merging to dvdev_2-0-0//  	//  	Revision 1.2  2003/01/16 20:03:21  jtodd//  	Integrated #992//  	//  	Revision 1.1.2.1  2003/01/14 15:39:35  dbercot//  	Changes to kill compiler warnings//  	Removed flotsam from ASIC header files & created HAL files//  	////=============================================================================#include "basetype.h"#include "eeprom.h"#include "string.h"#define BUF_SIZE  0x1000static Byte m_EEPROMBuf[BUF_SIZE];int EEPROM_GetSize(Uint32 *size){	*size = BUF_SIZE;	return SUCCESS;}int EEPROM_Write8( Uint32 addr, Byte data ){	if ( addr >= BUF_SIZE )	{		return FAIL;	} // end if		m_EEPROMBuf[addr] = data;		return SUCCESS;}int EEPROM_Write32( Uint32 addr, Uint32 data ){	if ( addr+4 >= BUF_SIZE )	{		return FAIL;	} // end if		(Uint32)m_EEPROMBuf[addr] = data;		return SUCCESS;}int EEPROM_BufWrite( Uint32 addr, void * bufPtr, Uint32 length ){	if ( addr+length >= BUF_SIZE )	{		return FAIL;	} // end if		memcpy( &m_EEPROMBuf[addr], bufPtr, length );	return SUCCESS;}int EEPROM_Read( Uint32 addr, void * bufPtr, Uint32 length ){	if ( addr+length >= BUF_SIZE )	{		return FAIL;	} // end if		memcpy( bufPtr, &m_EEPROMBuf[addr], length );	return SUCCESS;}

⌨️ 快捷键说明

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