Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
0bc4a1ac
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0bc4a1ac
编写于
9月 18, 2002
作者:
W
wdenk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Initial revision
上级
ab255f26
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
184 addition
and
0 deletion
+184
-0
common/env_eeprom.c
common/env_eeprom.c
+116
-0
common/env_nowhere.c
common/env_nowhere.c
+68
-0
未找到文件。
common/env_eeprom.c
0 → 100644
浏览文件 @
0bc4a1ac
/*
* (C) Copyright 2000-2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Andreas Heppel <aheppel@sysgo.de>
* See file CREDITS for list of people who contributed to this
* project.
*
* This program 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
*/
#include <common.h>
#if defined(CFG_ENV_IS_IN_EEPROM)
/* Environment is in EEPROM */
#include <command.h>
#include <environment.h>
#include <cmd_nvedit.h>
#include <linux/stddef.h>
#include <malloc.h>
env_t
*
env_ptr
=
NULL
;
char
*
env_name_spec
=
"EEPROM"
;
extern
uchar
(
*
env_get_char
)(
int
);
extern
uchar
env_get_char_memory
(
int
index
);
uchar
env_get_char_spec
(
int
index
)
{
uchar
c
;
eeprom_read
(
CFG_DEF_EEPROM_ADDR
,
CFG_ENV_OFFSET
+
index
+
offsetof
(
env_t
,
data
),
&
c
,
1
);
return
(
c
);
}
void
env_relocate_spec
(
void
)
{
eeprom_read
(
CFG_DEF_EEPROM_ADDR
,
CFG_ENV_OFFSET
,
(
uchar
*
)
env_ptr
,
CFG_ENV_SIZE
);
}
int
saveenv
(
void
)
{
return
eeprom_write
(
CFG_DEF_EEPROM_ADDR
,
CFG_ENV_OFFSET
,
(
uchar
*
)
env_ptr
,
CFG_ENV_SIZE
);
}
/************************************************************************
* Initialize Environment use
*
* We are still running from ROM, so data use is limited
* Use a (moderately small) buffer on the stack
*/
int
env_init
(
void
)
{
DECLARE_GLOBAL_DATA_PTR
;
ulong
crc
,
len
,
new
;
unsigned
off
;
uchar
buf
[
64
];
eeprom_init
();
/* prepare for EEPROM read/write */
/* read old CRC */
eeprom_read
(
CFG_DEF_EEPROM_ADDR
,
CFG_ENV_OFFSET
+
offsetof
(
env_t
,
crc
),
(
uchar
*
)
&
crc
,
sizeof
(
ulong
));
new
=
0
;
len
=
ENV_SIZE
;
off
=
offsetof
(
env_t
,
data
);
while
(
len
>
0
)
{
int
n
=
(
len
>
sizeof
(
buf
))
?
sizeof
(
buf
)
:
len
;
eeprom_read
(
CFG_DEF_EEPROM_ADDR
,
CFG_ENV_OFFSET
+
off
,
buf
,
n
);
new
=
crc32
(
new
,
buf
,
n
);
len
-=
n
;
off
+=
n
;
}
if
(
crc
==
new
)
{
gd
->
env_addr
=
offsetof
(
env_t
,
data
);
gd
->
env_valid
=
1
;
}
else
{
gd
->
env_addr
=
0
;
gd
->
env_valid
=
0
;
}
return
(
0
);
}
#endif
/* CFG_ENV_IS_IN_EEPROM */
common/env_nowhere.c
0 → 100644
浏览文件 @
0bc4a1ac
/*
* (C) Copyright 2000-2002
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
*
* (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Andreas Heppel <aheppel@sysgo.de>
* See file CREDITS for list of people who contributed to this
* project.
*
* This program 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
*/
#include <common.h>
#if defined(CFG_ENV_IS_NOWHERE)
/* Environment is nowhere */
#include <command.h>
#include <environment.h>
#include <linux/stddef.h>
#include <malloc.h>
env_t
*
env_ptr
=
NULL
;
extern
uchar
default_environment
[];
extern
int
default_environment_size
;
void
env_relocate_spec
(
void
)
{
}
uchar
env_get_char_spec
(
int
index
)
{
DECLARE_GLOBAL_DATA_PTR
;
return
(
*
((
uchar
*
)(
gd
->
env_addr
+
index
))
);
}
/************************************************************************
* Initialize Environment use
*
* We are still running from ROM, so data use is limited
*/
int
env_init
(
void
)
{
DECLARE_GLOBAL_DATA_PTR
;
gd
->
env_addr
=
(
ulong
)
&
default_environment
[
0
];
gd
->
env_valid
=
0
;
return
(
0
);
}
#endif
/* CFG_ENV_IS_NOWHERE) */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录