null.c 804 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. */
  9. #include <ymodem.h>
  10. static enum rym_code _rym_dummy_write(
  11. struct rym_ctx *ctx,
  12. rt_uint8_t *buf,
  13. rt_size_t len)
  14. {
  15. return RYM_CODE_ACK;
  16. }
  17. #ifdef RT_USING_FINSH
  18. #include <finsh.h>
  19. rt_err_t rym_null(char *devname)
  20. {
  21. struct rym_ctx rctx;
  22. rt_device_t dev = rt_device_find(devname);
  23. if (!dev)
  24. {
  25. rt_kprintf("could not find device %s\n", devname);
  26. return -1;
  27. }
  28. return rym_recv_on_device(&rctx, dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
  29. RT_NULL, _rym_dummy_write, RT_NULL, 1000);
  30. }
  31. FINSH_FUNCTION_EXPORT(rym_null, dump data to null);
  32. #endif