null.c 733 B

1234567891011121314151617181920212223242526272829303132333435
  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. rt_err_t rym_null(char *devname)
  19. {
  20. struct rym_ctx rctx;
  21. rt_device_t dev = rt_device_find(devname);
  22. if (!dev)
  23. {
  24. rt_kprintf("could not find device %s\n", devname);
  25. return -1;
  26. }
  27. return rym_recv_on_device(&rctx, dev, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX,
  28. RT_NULL, _rym_dummy_write, RT_NULL, 1000);
  29. }
  30. #endif