Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
a48f5ff4
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,发现更多精彩内容 >>
提交
a48f5ff4
编写于
9月 03, 2021
作者:
T
Tom Rini
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '2021-09-03-xyz-modem-fixes' into next
- Assorted x/y/z modem fixes from Pali
上级
00179319
dffeb400
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
6 deletion
+38
-6
cmd/load.c
cmd/load.c
+30
-2
common/xyzModem.c
common/xyzModem.c
+8
-4
未找到文件。
cmd/load.c
浏览文件 @
a48f5ff4
...
...
@@ -474,6 +474,14 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
addr
=
load_serial_ymodem
(
offset
,
xyzModem_ymodem
);
if
(
addr
==
~
0
)
{
image_load_addr
=
0
;
printf
(
"## Binary (ymodem) download aborted
\n
"
);
rcode
=
1
;
}
else
{
printf
(
"## Start Addr = 0x%08lX
\n
"
,
addr
);
image_load_addr
=
addr
;
}
}
else
if
(
strcmp
(
argv
[
0
],
"loadx"
)
==
0
)
{
printf
(
"## Ready for binary (xmodem) download "
"to 0x%08lX at %d bps...
\n
"
,
...
...
@@ -482,6 +490,14 @@ static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
addr
=
load_serial_ymodem
(
offset
,
xyzModem_xmodem
);
if
(
addr
==
~
0
)
{
image_load_addr
=
0
;
printf
(
"## Binary (xmodem) download aborted
\n
"
);
rcode
=
1
;
}
else
{
printf
(
"## Start Addr = 0x%08lX
\n
"
,
addr
);
image_load_addr
=
addr
;
}
}
else
{
printf
(
"## Ready for binary (kermit) download "
...
...
@@ -978,6 +994,7 @@ static ulong load_serial_ymodem(ulong offset, int mode)
res
=
xyzModem_stream_open
(
&
info
,
&
err
);
if
(
!
res
)
{
err
=
0
;
while
((
res
=
xyzModem_stream_read
(
ymodemBuf
,
1024
,
&
err
))
>
0
)
{
store_addr
=
addr
+
offset
;
...
...
@@ -990,6 +1007,9 @@ static ulong load_serial_ymodem(ulong offset, int mode)
rc
=
flash_write
((
char
*
)
ymodemBuf
,
store_addr
,
res
);
if
(
rc
!=
0
)
{
xyzModem_stream_terminate
(
true
,
&
getcxmodem
);
xyzModem_stream_close
(
&
err
);
printf
(
"
\n
"
);
flash_perror
(
rc
);
return
(
~
0
);
}
...
...
@@ -1001,16 +1021,24 @@ static ulong load_serial_ymodem(ulong offset, int mode)
}
}
if
(
err
)
{
xyzModem_stream_terminate
((
err
==
xyzModem_cancel
)
?
false
:
true
,
&
getcxmodem
);
xyzModem_stream_close
(
&
err
);
printf
(
"
\n
%s
\n
"
,
xyzModem_error
(
err
));
return
(
~
0
);
/* Download aborted */
}
if
(
IS_ENABLED
(
CONFIG_CMD_BOOTEFI
))
efi_set_bootdev
(
"Uart"
,
""
,
""
,
map_sysmem
(
offset
,
0
),
size
);
}
else
{
printf
(
"%s
\n
"
,
xyzModem_error
(
err
));
printf
(
"
\n
%s
\n
"
,
xyzModem_error
(
err
));
return
(
~
0
);
/* Download aborted */
}
xyzModem_stream_close
(
&
err
);
xyzModem_stream_terminate
(
false
,
&
getcxmodem
);
xyzModem_stream_close
(
&
err
);
flush_cache
(
offset
,
ALIGN
(
size
,
ARCH_DMA_MINALIGN
));
...
...
common/xyzModem.c
浏览文件 @
a48f5ff4
...
...
@@ -32,6 +32,7 @@
/* Values magic to the protocol */
#define SOH 0x01
#define STX 0x02
#define ETX 0x03
/* ^C for interrupt */
#define EOT 0x04
#define ACK 0x06
#define BSP 0x08
...
...
@@ -283,6 +284,7 @@ xyzModem_get_hdr (void)
hdr_found
=
true
;
break
;
case
CAN
:
case
ETX
:
xyz
.
total_CAN
++
;
ZM_DEBUG
(
zm_dump
(
__LINE__
));
if
(
++
can_total
==
xyzModem_CAN_COUNT
)
...
...
@@ -494,7 +496,7 @@ xyzModem_stream_read (char *buf, int size, int *err)
total
=
0
;
stat
=
xyzModem_cancel
;
/* Try and get 'size' bytes into the buffer */
while
(
!
xyz
.
at_eof
&&
(
size
>
0
))
while
(
!
xyz
.
at_eof
&&
xyz
.
len
>=
0
&&
(
size
>
0
))
{
if
(
xyz
.
len
==
0
)
{
...
...
@@ -572,6 +574,8 @@ xyzModem_stream_read (char *buf, int size, int *err)
CYGACC_COMM_IF_PUTC
(
*
xyz
.
__chan
,
ACK
);
ZM_DEBUG
(
zm_dprintf
(
"FINAL ACK (%d)
\n
"
,
__LINE__
));
}
else
stat
=
0
;
xyz
.
at_eof
=
true
;
break
;
}
...
...
@@ -587,7 +591,7 @@ xyzModem_stream_read (char *buf, int size, int *err)
}
}
/* Don't "read" data from the EOF protocol package */
if
(
!
xyz
.
at_eof
)
if
(
!
xyz
.
at_eof
&&
xyz
.
len
>
0
)
{
len
=
xyz
.
len
;
if
(
size
<
len
)
...
...
@@ -606,10 +610,10 @@ xyzModem_stream_read (char *buf, int size, int *err)
void
xyzModem_stream_close
(
int
*
err
)
{
diag_
printf
ZM_DEBUG
(
zm_d
printf
(
"xyzModem - %s mode, %d(SOH)/%d(STX)/%d(CAN) packets, %d retries
\n
"
,
xyz
.
crc_mode
?
"CRC"
:
"Cksum"
,
xyz
.
total_SOH
,
xyz
.
total_STX
,
xyz
.
total_CAN
,
xyz
.
total_retries
);
xyz
.
total_CAN
,
xyz
.
total_retries
)
)
;
ZM_DEBUG
(
zm_flush
());
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录