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