Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
a4bc38ad
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a4bc38ad
编写于
10月 14, 2016
作者:
armink_ztl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[DeviceDrivers]Update SFUD library to lastest version.
上级
b2e14f76
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
22 deletion
+28
-22
components/drivers/spi/sfud/inc/sfud_def.h
components/drivers/spi/sfud/inc/sfud_def.h
+1
-1
components/drivers/spi/sfud/src/sfud.c
components/drivers/spi/sfud/src/sfud.c
+25
-17
components/drivers/spi/sfud/src/sfud_sfdp.c
components/drivers/spi/sfud/src/sfud_sfdp.c
+2
-4
未找到文件。
components/drivers/spi/sfud/inc/sfud_def.h
浏览文件 @
a4bc38ad
...
...
@@ -73,7 +73,7 @@ if (!(EXPR)) \
else {if (__delay_temp) {__delay_temp();} retry --;}
/* software version number */
#define SFUD_SW_VERSION "0.10.
06
"
#define SFUD_SW_VERSION "0.10.
14
"
/*
* all defined supported command
*/
...
...
components/drivers/spi/sfud/src/sfud.c
浏览文件 @
a4bc38ad
...
...
@@ -354,7 +354,7 @@ sfud_err sfud_chip_erase(const sfud_flash *flash) {
/* set the flash write enable */
result
=
set_write_enabled
(
flash
,
true
);
if
(
result
!=
SFUD_SUCCESS
)
{
goto
exit
;
goto
__
exit
;
}
cmd_data
[
0
]
=
SFUD_CMD_ERASE_CHIP
;
...
...
@@ -369,11 +369,13 @@ sfud_err sfud_chip_erase(const sfud_flash *flash) {
}
if
(
result
!=
SFUD_SUCCESS
)
{
SFUD_INFO
(
"Error: Flash chip erase SPI communicate error."
);
goto
exit
;
goto
__
exit
;
}
result
=
wait_busy
(
flash
);
exit:
__exit:
/* set the flash write disable */
set_write_enabled
(
flash
,
false
);
/* unlock SPI */
if
(
spi
->
unlock
)
{
spi
->
unlock
(
spi
);
...
...
@@ -438,7 +440,7 @@ sfud_err sfud_erase(const sfud_flash *flash, uint32_t addr, size_t size) {
/* set the flash write enable */
result
=
set_write_enabled
(
flash
,
true
);
if
(
result
!=
SFUD_SUCCESS
)
{
break
;
goto
__exit
;
}
cmd_data
[
0
]
=
cur_erase_cmd
;
...
...
@@ -447,11 +449,11 @@ sfud_err sfud_erase(const sfud_flash *flash, uint32_t addr, size_t size) {
result
=
spi
->
wr
(
spi
,
cmd_data
,
cmd_size
,
NULL
,
0
);
if
(
result
!=
SFUD_SUCCESS
)
{
SFUD_INFO
(
"Error: Flash erase SPI communicate error."
);
break
;
goto
__exit
;
}
result
=
wait_busy
(
flash
);
if
(
result
!=
SFUD_SUCCESS
)
{
break
;
goto
__exit
;
}
/* make erase align and calculate next erase address */
if
(
addr
%
cur_erase_size
!=
0
)
{
...
...
@@ -459,18 +461,21 @@ sfud_err sfud_erase(const sfud_flash *flash, uint32_t addr, size_t size) {
size
-=
cur_erase_size
-
(
addr
%
cur_erase_size
);
addr
+=
cur_erase_size
-
(
addr
%
cur_erase_size
);
}
else
{
break
;
goto
__exit
;
}
}
else
{
if
(
size
>
cur_erase_size
)
{
size
-=
cur_erase_size
;
addr
+=
cur_erase_size
;
}
else
{
break
;
goto
__exit
;
}
}
}
__exit:
/* set the flash write disable */
set_write_enabled
(
flash
,
false
);
/* unlock SPI */
if
(
spi
->
unlock
)
{
spi
->
unlock
(
spi
);
...
...
@@ -517,7 +522,7 @@ static sfud_err page256_or_1_byte_write(const sfud_flash *flash, uint32_t addr,
/* set the flash write enable */
result
=
set_write_enabled
(
flash
,
true
);
if
(
result
!=
SFUD_SUCCESS
)
{
break
;
goto
__exit
;
}
cmd_data
[
0
]
=
SFUD_CMD_PAGE_PROGRAM
;
make_adress_byte_array
(
flash
,
addr
,
&
cmd_data
[
1
]);
...
...
@@ -545,15 +550,18 @@ static sfud_err page256_or_1_byte_write(const sfud_flash *flash, uint32_t addr,
result
=
spi
->
wr
(
spi
,
cmd_data
,
cmd_size
+
data_size
,
NULL
,
0
);
if
(
result
!=
SFUD_SUCCESS
)
{
SFUD_INFO
(
"Error: Flash write SPI communicate error."
);
break
;
goto
__exit
;
}
result
=
wait_busy
(
flash
);
if
(
result
!=
SFUD_SUCCESS
)
{
break
;
goto
__exit
;
}
data
+=
data_size
;
}
__exit:
/* set the flash write disable */
set_write_enabled
(
flash
,
false
);
/* unlock SPI */
if
(
spi
->
unlock
)
{
spi
->
unlock
(
spi
);
...
...
@@ -599,7 +607,7 @@ static sfud_err aai_write(const sfud_flash *flash, uint32_t addr, size_t size, c
/* set the flash write enable */
result
=
set_write_enabled
(
flash
,
true
);
if
(
result
!=
SFUD_SUCCESS
)
{
goto
exit
;
goto
__
exit
;
}
/* loop write operate. write unit is write granularity */
cmd_data
[
0
]
=
SFUD_CMD_AAI_WORD_PROGRAM
;
...
...
@@ -632,21 +640,21 @@ static sfud_err aai_write(const sfud_flash *flash, uint32_t addr, size_t size, c
result
=
spi
->
wr
(
spi
,
cmd_data
,
cmd_size
+
data_size
,
NULL
,
0
);
if
(
result
!=
SFUD_SUCCESS
)
{
SFUD_INFO
(
"Error: Flash write SPI communicate error."
);
goto
exit
;
goto
__
exit
;
}
result
=
wait_busy
(
flash
);
if
(
result
!=
SFUD_SUCCESS
)
{
goto
exit
;
goto
__
exit
;
}
size
-=
2
;
data
+=
data_size
;
}
/* set the flash write disable */
result
=
set_write_enabled
(
flash
,
false
);
exit:
__exit:
/* set the flash write disable for exist AAI mode */
set_write_enabled
(
flash
,
false
);
/* unlock SPI */
if
(
spi
->
unlock
)
{
spi
->
unlock
(
spi
);
...
...
components/drivers/spi/sfud/src/sfud_sfdp.c
浏览文件 @
a4bc38ad
...
...
@@ -105,8 +105,6 @@ static bool read_sfdp_header(sfud_flash *flash) {
uint32_t
header_addr
=
0
;
/* each parameter header being 2 DWORDs (64-bit) */
uint8_t
header
[
2
*
4
]
=
{
0
};
/* number of parameter headers */
uint8_t
npn
=
0
;
SFUD_ASSERT
(
flash
);
...
...
@@ -126,12 +124,12 @@ static bool read_sfdp_header(sfud_flash *flash) {
}
sfdp
->
minor_rev
=
header
[
4
];
sfdp
->
major_rev
=
header
[
5
];
npn
=
header
[
6
];
if
(
sfdp
->
major_rev
>
SUPPORT_MAX_SFDP_MAJOR_REV
)
{
SFUD_INFO
(
"Error: This reversion(V%d.%d) SFDP is not supported."
,
sfdp
->
major_rev
,
sfdp
->
minor_rev
);
return
false
;
}
SFUD_DEBUG
(
"Check SFDP header is OK. The reversion is V%d.%d, NPN is %d."
,
sfdp
->
major_rev
,
sfdp
->
minor_rev
,
npn
);
SFUD_DEBUG
(
"Check SFDP header is OK. The reversion is V%d.%d, NPN is %d."
,
sfdp
->
major_rev
,
sfdp
->
minor_rev
,
header
[
6
]);
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录