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