mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-15 16:49:55 +08:00
5674198759
Real-YModem implemented a flexible YModem support. It use callback-based structure to let the user application to deal with the data. It contains 3 examples: 1. echo.c: write the data recieved on YModem to an other device 2. null.c: discard the YModem data 3. tofile.c: write the data to the file system Currently, it does not support batch file transmission.
29 lines
579 B
C
29 lines
579 B
C
#include <ymodem.h>
|
|
|
|
static enum rym_code _rym_dummy_write(
|
|
struct rym_ctx *ctx,
|
|
rt_uint8_t *buf,
|
|
rt_size_t len)
|
|
{
|
|
return RYM_CODE_ACK;
|
|
}
|
|
|
|
#ifdef RT_USING_FINSH
|
|
#include <finsh.h>
|
|
rt_err_t rym_null(char *devname)
|
|
{
|
|
struct rym_ctx rctx;
|
|
rt_device_t dev = rt_device_find(devname);
|
|
if (!dev)
|
|
{
|
|
rt_kprintf("could not find device %s\n", devname);
|
|
return -1;
|
|
}
|
|
|
|
return rym_recv_on_device(&rctx, dev,
|
|
RT_NULL, _rym_dummy_write, RT_NULL, 1000);
|
|
}
|
|
FINSH_FUNCTION_EXPORT(rym_null, dump data to null);
|
|
#endif
|
|
|