?? storage.c
字號(hào):
/* @(#) pSOSystem PowerPC/V2.2.2*/
/***********************************************************************/
/* */
/* MODULE: bsps/fuc8xx/src/storage.c */
/* DATE: 98/07/03 */
/* AUTHOR: Shan Zhengguang */
/* PURPOSE: Functions to store and retrieve configuration data to */
/* and from RAM (NO NVR) storage. */
/* */
/*---------------------------------------------------------------------*/
/* */
/* Copyright 1998 - 1999, ZHONGXING TELECOM CO.,LTD. */
/* ALL RIGHTS RESERVED */
/* */
/*---------------------------------------------------------------------*/
/* */
/***********************************************************************/
#include "bsp.h"
#include <bspfuncs.h>
#include <sysvars.h>
unsigned char *nvram;
/***********************************************************************/
/* Local Functions */
/***********************************************************************/
/***********************************************************************/
/* StorageRead: Read configuration data from EEPROM */
/* */
/* INPUTS: nbytes - number of bytes to read */
/* *Start - starting address */
/* *buff - pointer to buffer to read into */
/* */
/***********************************************************************/
void StorageRead(unsigned int nbytes, void *Start, void *buff)
{
UCHAR *dest, *src;
UINT i;
dest = (UCHAR *)buff;
nvram = (UCHAR *)(BSP_RAM_BASE + 0x4000);
src = (UCHAR *)((long)nvram + (long)Start);
for (i = 0; i < nbytes; i++)
*dest++ = *src++;
#if 0
{/* modify ip address */
int temp=((getBrdNum()&0x08)>>3)*100
+((getBrdNum()&0xc0)>>6)*10
+((getBrdNum()&0x30)>>4)*2
+(getBrdNum()&0x1);
if(temp<256 && temp>0)
{
((struct BspParms *)(BspVars))->Eth05=temp;
SysVars.Lan1IP=0x8a010a00+temp;
}
}/* modify ip address end */
#endif
}
/***********************************************************************/
/* StorageWrite: Write configuration data to EEPROM */
/* */
/* INPUTS: nbytes - number of bytes to write */
/* *Start - starting offset to write to (0 - 255) */
/* *buff - pointer to buffer to write from */
/* */
/* NOTE: The 256th byte in the EEPROM is a special case. It is used */
/* for write protection. We never program it. */
/* */
/***********************************************************************/
void StorageWrite(unsigned int nbytes, void *Start, void *buff)
{
UCHAR *dest, *src;
UINT i;
src = (UCHAR *)buff;
nvram = (UCHAR *)(BSP_RAM_BASE + 0x4000);
dest = (UCHAR *)((long)nvram + (long)Start);
for (i = 0; i < nbytes; i++)
*dest++ = *src++;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -