summaryrefslogtreecommitdiff
path: root/components/utilities
diff options
context:
space:
mode:
authorArda <[email protected]>2014-11-24 11:57:31 +0800
committerArda <[email protected]>2014-11-24 11:57:31 +0800
commit143d3b82244b977735649e7d7c201d2affe67460 (patch)
tree61503d3a150cef8d8184c858efc139b146b50cf6 /components/utilities
parentbc2a890ab08d163ccea323f7e719c4fdf53050cd (diff)
parent9ecd18411fc1344e3d080d844b60c7070c3fb4d8 (diff)
Merge pull request #2 from RT-Thread/master
update from official source
Diffstat (limited to 'components/utilities')
-rw-r--r--components/utilities/logtrace/log_trace.c2
-rw-r--r--components/utilities/ymodem/ymodem.c11
-rw-r--r--components/utilities/ymodem/ymodem.h7
3 files changed, 13 insertions, 7 deletions
diff --git a/components/utilities/logtrace/log_trace.c b/components/utilities/logtrace/log_trace.c
index d060465907..2ac94c19d1 100644
--- a/components/utilities/logtrace/log_trace.c
+++ b/components/utilities/logtrace/log_trace.c
@@ -404,7 +404,7 @@ rt_err_t log_trace_set_device(const char *device_name)
rt_err_t result;
/* open device */
- result = rt_device_open(output_device, RT_DEVICE_FLAG_STREAM | RT_DEVICE_FLAG_RDWR);
+ result = rt_device_open(output_device, RT_DEVICE_FLAG_STREAM | RT_DEVICE_OFLAG_RDWR);
if (result != RT_EOK)
{
rt_kprintf("Open trace device failed.\n");
diff --git a/components/utilities/ymodem/ymodem.c b/components/utilities/ymodem/ymodem.c
index f5ebeab832..7e8ad12419 100644
--- a/components/utilities/ymodem/ymodem.c
+++ b/components/utilities/ymodem/ymodem.c
@@ -197,7 +197,7 @@ static rt_err_t _rym_do_trans(struct rym_ctx *ctx)
{
rt_err_t err;
enum rym_code code;
- rt_size_t data_sz;
+ rt_size_t data_sz, i;
code = _rym_read_code(ctx,
RYM_WAIT_PKG_TICK);
@@ -223,8 +223,9 @@ static rt_err_t _rym_do_trans(struct rym_ctx *ctx)
{
case RYM_CODE_CAN:
/* the spec require multiple CAN */
- _rym_putchar(ctx, RYM_CODE_CAN);
- _rym_putchar(ctx, RYM_CODE_CAN);
+ for (i = 0; i < RYM_END_SESSION_SEND_CAN_NUM; i++) {
+ _rym_putchar(ctx, RYM_CODE_CAN);
+ }
return -RYM_ERR_CAN;
case RYM_CODE_ACK:
_rym_putchar(ctx, RYM_CODE_ACK);
@@ -310,6 +311,7 @@ static rt_err_t _rym_do_recv(
rt_err_t rym_recv_on_device(
struct rym_ctx *ctx,
rt_device_t dev,
+ rt_uint16_t oflag,
rym_callback on_begin,
rym_callback on_data,
rym_callback on_end,
@@ -340,7 +342,7 @@ rt_err_t rym_recv_on_device(
dev->flag &= ~RT_DEVICE_FLAG_STREAM;
rt_hw_interrupt_enable(int_lvl);
- res = rt_device_open(dev, 0);
+ res = rt_device_open(dev, oflag);
if (res != RT_EOK)
goto __exit;
@@ -363,4 +365,3 @@ __exit:
return res;
}
-
diff --git a/components/utilities/ymodem/ymodem.h b/components/utilities/ymodem/ymodem.h
index 43ee6f5c10..09b5bae791 100644
--- a/components/utilities/ymodem/ymodem.h
+++ b/components/utilities/ymodem/ymodem.h
@@ -55,6 +55,11 @@ enum rym_code {
#define RYM_CHD_INTV_TICK (RT_TICK_PER_SECOND * 3)
#endif
+/* how many CAN be sent when user active end the session. */
+#ifndef RYM_END_SESSION_SEND_CAN_NUM
+#define RYM_END_SESSION_SEND_CAN_NUM 0x07
+#endif
+
enum rym_stage {
RYM_STAGE_NONE,
/* set when C is send */
@@ -128,7 +133,7 @@ struct rym_ctx
* @param handshake_timeout the timeout when hand shaking. The unit is in
* second.
*/
-rt_err_t rym_recv_on_device(struct rym_ctx *ctx, rt_device_t dev,
+rt_err_t rym_recv_on_device(struct rym_ctx *ctx, rt_device_t dev, rt_uint16_t oflag,
rym_callback on_begin, rym_callback on_data, rym_callback on_end,
int handshake_timeout);