blob: 0eddbbc78fd7f2d3aa82c35552460e8e49d1ccc1 [file] [log] [blame]
Wolfgang Denkcf48eb92006-04-16 10:51:58 +02001/*
2 *==========================================================================
3 *
4 * xyzModem.h
5 *
6 * RedBoot stream handler for xyzModem protocol
7 *
8 *==========================================================================
Wolfgang Denke85427f2013-07-08 12:11:35 +02009 * SPDX-License-Identifier: eCos-2.0
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020010 *==========================================================================
11 *#####DESCRIPTIONBEGIN####
12 *
13 * Author(s): gthomas
14 * Contributors: gthomas
15 * Date: 2000-07-14
16 * Purpose:
17 * Description:
18 *
19 * This code is part of RedBoot (tm).
20 *
21 *####DESCRIPTIONEND####
22 *
23 *==========================================================================
24 */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020025
26#ifndef _XYZMODEM_H_
27#define _XYZMODEM_H_
28
29#define xyzModem_xmodem 1
30#define xyzModem_ymodem 2
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020031/* Don't define this until the protocol support is in place */
32/*#define xyzModem_zmodem 3 */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020033
34#define xyzModem_access -1
35#define xyzModem_noZmodem -2
36#define xyzModem_timeout -3
37#define xyzModem_eof -4
38#define xyzModem_cancel -5
39#define xyzModem_frame -6
40#define xyzModem_cksum -7
41#define xyzModem_sequence -8
42
43#define xyzModem_close 1
44#define xyzModem_abort 2
45
46
47#ifdef REDBOOT
48extern getc_io_funcs_t xyzModem_io;
49#else
50#define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT
51#define CYGACC_CALL_IF_SET_CONSOLE_COMM(x)
52
53#define diag_vprintf vprintf
54#define diag_printf printf
55#define diag_vsprintf vsprintf
56
57#define CYGACC_CALL_IF_DELAY_US(x) udelay(x)
58
59typedef struct {
60 char *filename;
61 int mode;
62 int chan;
63#ifdef CYGPKG_REDBOOT_NETWORKING
64 struct sockaddr_in *server;
65#endif
66} connection_info_t;
67
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020068#endif
69
70
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020071int xyzModem_stream_open(connection_info_t *info, int *err);
72void xyzModem_stream_close(int *err);
73void xyzModem_stream_terminate(bool method, int (*getc)(void));
74int xyzModem_stream_read(char *buf, int size, int *err);
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020075char *xyzModem_error(int err);
76
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020077#endif /* _XYZMODEM_H_ */