Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: eCos-2.0 */ |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 2 | /* |
| 3 | *========================================================================== |
| 4 | * |
| 5 | * xyzModem.h |
| 6 | * |
| 7 | * RedBoot stream handler for xyzModem protocol |
| 8 | * |
| 9 | *========================================================================== |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 10 | *#####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 Klotzbuecher | 387f541 | 2006-03-30 13:40:55 +0200 | [diff] [blame] | 24 | |
| 25 | #ifndef _XYZMODEM_H_ |
| 26 | #define _XYZMODEM_H_ |
| 27 | |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 28 | #include <linux/delay.h> |
| 29 | |
Markus Klotzbuecher | 387f541 | 2006-03-30 13:40:55 +0200 | [diff] [blame] | 30 | #define xyzModem_xmodem 1 |
| 31 | #define xyzModem_ymodem 2 |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 32 | /* Don't define this until the protocol support is in place */ |
| 33 | /*#define xyzModem_zmodem 3 */ |
Markus Klotzbuecher | 387f541 | 2006-03-30 13:40:55 +0200 | [diff] [blame] | 34 | |
| 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 | |
Markus Klotzbuecher | 387f541 | 2006-03-30 13:40:55 +0200 | [diff] [blame] | 47 | #define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT |
| 48 | #define CYGACC_CALL_IF_SET_CONSOLE_COMM(x) |
| 49 | |
| 50 | #define diag_vprintf vprintf |
| 51 | #define diag_printf printf |
| 52 | #define diag_vsprintf vsprintf |
| 53 | |
| 54 | #define CYGACC_CALL_IF_DELAY_US(x) udelay(x) |
| 55 | |
| 56 | typedef struct { |
| 57 | char *filename; |
| 58 | int mode; |
| 59 | int chan; |
Markus Klotzbuecher | 387f541 | 2006-03-30 13:40:55 +0200 | [diff] [blame] | 60 | } connection_info_t; |
| 61 | |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 62 | int xyzModem_stream_open(connection_info_t *info, int *err); |
| 63 | void xyzModem_stream_close(int *err); |
| 64 | void xyzModem_stream_terminate(bool method, int (*getc)(void)); |
| 65 | int xyzModem_stream_read(char *buf, int size, int *err); |
Markus Klotzbuecher | 387f541 | 2006-03-30 13:40:55 +0200 | [diff] [blame] | 66 | char *xyzModem_error(int err); |
| 67 | |
Wolfgang Denk | ebd3deb | 2006-04-16 10:51:58 +0200 | [diff] [blame] | 68 | #endif /* _XYZMODEM_H_ */ |