xyzModem.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. *==========================================================================
  3. *
  4. * xyzModem.h
  5. *
  6. * RedBoot stream handler for xyzModem protocol
  7. *
  8. *==========================================================================
  9. *####ECOSGPLCOPYRIGHTBEGIN####
  10. * -------------------------------------------
  11. * This file is part of eCos, the Embedded Configurable Operating System.
  12. * Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
  13. * Copyright (C) 2002 Gary Thomas
  14. *
  15. * eCos is free software; you can redistribute it and/or modify it under
  16. * the terms of the GNU General Public License as published by the Free
  17. * Software Foundation; either version 2 or (at your option) any later version.
  18. *
  19. * eCos is distributed in the hope that it will be useful, but WITHOUT ANY
  20. * WARRANTY; without even the implied warranty of MERCHANTABILITY or
  21. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  22. * for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License along
  25. * with eCos; if not, write to the Free Software Foundation, Inc.,
  26. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  27. *
  28. * As a special exception, if other files instantiate templates or use macros
  29. * or inline functions from this file, or you compile this file and link it
  30. * with other works to produce a work based on this file, this file does not
  31. * by itself cause the resulting work to be covered by the GNU General Public
  32. * License. However the source code for this file must still be made available
  33. * in accordance with section (3) of the GNU General Public License.
  34. *
  35. * This exception does not invalidate any other reasons why a work based on
  36. * this file might be covered by the GNU General Public License.
  37. *
  38. * Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
  39. * at http: *sources.redhat.com/ecos/ecos-license/
  40. * -------------------------------------------
  41. *####ECOSGPLCOPYRIGHTEND####
  42. *==========================================================================
  43. *#####DESCRIPTIONBEGIN####
  44. *
  45. * Author(s): gthomas
  46. * Contributors: gthomas
  47. * Date: 2000-07-14
  48. * Purpose:
  49. * Description:
  50. *
  51. * This code is part of RedBoot (tm).
  52. *
  53. *####DESCRIPTIONEND####
  54. *
  55. *==========================================================================
  56. */
  57. #ifndef _XYZMODEM_H_
  58. #define _XYZMODEM_H_
  59. #define xyzModem_xmodem 1
  60. #define xyzModem_ymodem 2
  61. /* Don't define this until the protocol support is in place */
  62. /*#define xyzModem_zmodem 3 */
  63. #define xyzModem_access -1
  64. #define xyzModem_noZmodem -2
  65. #define xyzModem_timeout -3
  66. #define xyzModem_eof -4
  67. #define xyzModem_cancel -5
  68. #define xyzModem_frame -6
  69. #define xyzModem_cksum -7
  70. #define xyzModem_sequence -8
  71. #define xyzModem_close 1
  72. #define xyzModem_abort 2
  73. #ifdef REDBOOT
  74. extern getc_io_funcs_t xyzModem_io;
  75. #else
  76. #define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT
  77. #define CYGACC_CALL_IF_SET_CONSOLE_COMM(x)
  78. #define diag_vprintf vprintf
  79. #define diag_printf printf
  80. #define diag_vsprintf vsprintf
  81. #define CYGACC_CALL_IF_DELAY_US(x) udelay(x)
  82. typedef struct {
  83. char *filename;
  84. int mode;
  85. int chan;
  86. #ifdef CYGPKG_REDBOOT_NETWORKING
  87. struct sockaddr_in *server;
  88. #endif
  89. } connection_info_t;
  90. #ifndef BOOL_WAS_DEFINED
  91. #define BOOL_WAS_DEFINED
  92. typedef unsigned int bool;
  93. #endif
  94. #define false 0
  95. #define true 1
  96. #endif
  97. int xyzModem_stream_open(connection_info_t *info, int *err);
  98. void xyzModem_stream_close(int *err);
  99. void xyzModem_stream_terminate(bool method, int (*getc)(void));
  100. int xyzModem_stream_read(char *buf, int size, int *err);
  101. char *xyzModem_error(int err);
  102. #endif /* _XYZMODEM_H_ */