From fe603dd37939574905928043f906235db13c37b6 Mon Sep 17 00:00:00 2001 From: Grissiom Date: Mon, 3 Nov 2014 11:46:57 +0800 Subject: [PATCH] ymodem: fix examples due to new API --- examples/ymodem/echo.c | 4 ++-- examples/ymodem/null.c | 4 ++-- examples/ymodem/tofile.c | 8 ++++---- 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);