blob: a8911b6bf5744a8eb88ff7c47b5d733e2720c739 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: eCos-2.0 */
Wolfgang Denkcf48eb92006-04-16 10:51:58 +02002/*
3 *==========================================================================
4 *
5 * xyzModem.h
6 *
7 * RedBoot stream handler for xyzModem protocol
8 *
9 *==========================================================================
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020010 *#####DESCRIPTIONBEGIN####
11 *
12 * Author(s): gthomas
13 * Contributors: gthomas
14 * Date: 2000-07-14
15 * Purpose:
16 * Description:
17 *
18 * This code is part of RedBoot (tm).
19 *
20 *####DESCRIPTIONEND####
21 *
22 *==========================================================================
23 */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020024
25#ifndef _XYZMODEM_H_
26#define _XYZMODEM_H_
27
Simon Glassc05ed002020-05-10 11:40:11 -060028#include <linux/delay.h>
29
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020030#define xyzModem_xmodem 1
31#define xyzModem_ymodem 2
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020032/* Don't define this until the protocol support is in place */
33/*#define xyzModem_zmodem 3 */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020034
35#define xyzModem_access -1
36#define xyzModem_noZmodem -2
37#define xyzModem_timeout -3
38#define xyzModem_eof -4
39#define xyzModem_cancel -5
40#define xyzModem_frame -6
41#define xyzModem_cksum -7
42#define xyzModem_sequence -8
43
44#define xyzModem_close 1
45#define xyzModem_abort 2
46
47
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020048#define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT
49#define CYGACC_CALL_IF_SET_CONSOLE_COMM(x)
50
51#define diag_vprintf vprintf
52#define diag_printf printf
53#define diag_vsprintf vsprintf
54
55#define CYGACC_CALL_IF_DELAY_US(x) udelay(x)
56
57typedef struct {
58 char *filename;
59 int mode;
60 int chan;
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020061} connection_info_t;
62
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020063
64
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020065int xyzModem_stream_open(connection_info_t *info, int *err);
66void xyzModem_stream_close(int *err);
67void xyzModem_stream_terminate(bool method, int (*getc)(void));
68int xyzModem_stream_read(char *buf, int size, int *err);
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020069char *xyzModem_error(int err);
70
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020071#endif /* _XYZMODEM_H_ */