xref: /nrf52832-nimble/rt-thread/examples/ymodem/null.c (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 #include <ymodem.h>
2 
3 static enum rym_code _rym_dummy_write(
4         struct rym_ctx *ctx,
5         rt_uint8_t *buf,
6         rt_size_t len)
7 {
8     return RYM_CODE_ACK;
9 }
10 
11 #ifdef RT_USING_FINSH
12 #include <finsh.h>
13 rt_err_t rym_null(char *devname)
14 {
15     struct rym_ctx rctx;
16     rt_device_t dev = rt_device_find(devname);
17     if (!dev)
18     {
19         rt_kprintf("could not find device %s\n", devname);
20         return -1;
21     }
22 
23     return rym_recv_on_device(&rctx, dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
24                               RT_NULL, _rym_dummy_write, RT_NULL, 1000);
25 }
26 FINSH_FUNCTION_EXPORT(rym_null, dump data to null);
27 #endif
28 
29