summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2014-11-03 12:38:37 +0800
committerBernard Xiong <[email protected]>2014-11-03 12:38:37 +0800
commit4b41f0eeabd928b1beb8176e69c7fcbd0e8d46ab (patch)
treea020c7f406c0130bf585b34550b91d0672e5da61 /examples
parent7cb6463253cc2b92d2ece87d69af8abf7e3814ab (diff)
parentfe603dd37939574905928043f906235db13c37b6 (diff)
Merge pull request #367 from grissiom/ymodem-fix
ymodem: fix examples due to new API
Diffstat (limited to 'examples')
-rw-r--r--examples/ymodem/echo.c4
-rw-r--r--examples/ymodem/null.c4
-rw-r--r--examples/ymodem/tofile.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/examples/ymodem/echo.c b/examples/ymodem/echo.c
index 5ffa5ff417..5cb807f519 100644
--- a/examples/ymodem/echo.c
+++ b/examples/ymodem/echo.c
@@ -25,8 +25,8 @@ rt_err_t rym_cat_to_dev(rt_device_t idev, rt_device_t odev)
rt_kprintf("open output device error: 0x%x", -res);
return res;
}
- res = rym_recv_on_device(&rctx, idev,
- RT_NULL, _rym_echo_data, RT_NULL, 1000);
+ res = rym_recv_on_device(&rctx, idev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+ RT_NULL, _rym_echo_data, RT_NULL, 1000);
rt_device_close(_odev);
rt_kprintf("leaving RYM mode with code %X\n", res);
return res;
diff --git a/examples/ymodem/null.c b/examples/ymodem/null.c
index 5e3baa9870..c72ea064f8 100644
--- a/examples/ymodem/null.c
+++ b/examples/ymodem/null.c
@@ -20,8 +20,8 @@ rt_err_t rym_null(char *devname)
return -1;
}
- return rym_recv_on_device(&rctx, dev,
- RT_NULL, _rym_dummy_write, RT_NULL, 1000);
+ return rym_recv_on_device(&rctx, dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+ RT_NULL, _rym_dummy_write, RT_NULL, 1000);
}
FINSH_FUNCTION_EXPORT(rym_null, dump data to null);
#endif
diff --git a/examples/ymodem/tofile.c b/examples/ymodem/tofile.c
index 2deef73c2c..4a3705ede7 100644
--- a/examples/ymodem/tofile.c
+++ b/examples/ymodem/tofile.c
@@ -21,7 +21,7 @@ static enum rym_code _rym_bg(
struct custom_ctx *cctx = (struct custom_ctx*)ctx;
cctx->fpath[0] = '/';
/* the buf should be the file name */
- strcpy(&(cctx->fpath[1]), buf);
+ strcpy(&(cctx->fpath[1]), (const char*)buf);
cctx->fd = open(cctx->fpath, O_CREAT | O_WRONLY | O_TRUNC, 0);
if (cctx->fd < 0)
{
@@ -31,7 +31,7 @@ static enum rym_code _rym_bg(
return RYM_CODE_CAN;
}
- cctx->flen = atoi(buf+strlen(buf)+1);
+ cctx->flen = atoi((const char*)buf+strlen((const char*)buf)+1);
if (cctx->flen == 0)
cctx->flen = -1;
return RYM_CODE_ACK;
@@ -80,8 +80,8 @@ rt_err_t rym_write_to_file(rt_device_t idev)
rt_kprintf("entering RYM mode\n");
- res = rym_recv_on_device(&ctx->parent, idev,
- _rym_bg, _rym_tof, _rym_end, 1000);
+ res = rym_recv_on_device(&ctx->parent, idev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
+ _rym_bg, _rym_tof, _rym_end, 1000);
/* there is no Ymodem traffic on the line so print out info. */
rt_kprintf("leaving RYM mode with code %d\n", res);