Merge pull request #367 from grissiom/ymodem-fix

ymodem: fix examples due to new API
This commit is contained in:
Bernard Xiong 2014-11-03 12:38:37 +08:00
commit 4b41f0eeab
3 changed files with 8 additions and 8 deletions

View File

@ -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;

View File

@ -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

View File

@ -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);