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 58 #ifndef _XYZMODEM_H_ 59 #define _XYZMODEM_H_ 60 61 #define xyzModem_xmodem 1 62 #define xyzModem_ymodem 2 63 /* Don't define this until the protocol support is in place */ 64 /*#define xyzModem_zmodem 3 */ 65 66 #define xyzModem_access -1 67 #define xyzModem_noZmodem -2 68 #define xyzModem_timeout -3 69 #define xyzModem_eof -4 70 #define xyzModem_cancel -5 71 #define xyzModem_frame -6 72 #define xyzModem_cksum -7 73 #define xyzModem_sequence -8 74 75 #define xyzModem_close 1 76 #define xyzModem_abort 2 77 78 79 #ifdef REDBOOT 80 extern getc_io_funcs_t xyzModem_io; 81 #else 82 #define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT 83 #define CYGACC_CALL_IF_SET_CONSOLE_COMM(x) 84 85 #define diag_vprintf vprintf 86 #define diag_printf printf 87 #define diag_vsprintf vsprintf 88 89 #define CYGACC_CALL_IF_DELAY_US(x) udelay(x) 90 91 typedef struct { 92 char *filename; 93 int mode; 94 int chan; 95 #ifdef CYGPKG_REDBOOT_NETWORKING 96 struct sockaddr_in *server; 97 #endif 98 } connection_info_t; 99 100 #ifndef BOOL_WAS_DEFINED 101 #define BOOL_WAS_DEFINED 102 typedef unsigned int bool; 103 #endif 104 105 #define false 0 106 #define true 1 107 108 #endif 109 110 111 int xyzModem_stream_open(connection_info_t *info, int *err); 112 void xyzModem_stream_close(int *err); 113 void xyzModem_stream_terminate(bool method, int (*getc)(void)); 114 int xyzModem_stream_read(char *buf, int size, int *err); 115 char *xyzModem_error(int err); 116 117 #endif /* _XYZMODEM_H_ */ 118