EDK2 doxygen online documents - Firmware Encoding Index 1
EDK2 doxygen online documents - Firmware Encoding Index

S3C24xxPkg/Sec/include/ymodem.h

Go to the documentation of this file.
00001 /* YMODEM support for bootldr
00002  * ^^^^^^^^^^^^^^^^^^^^^^^^^^
00003  * Copyright (C) 2001  John G Dorsey
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  *
00019  * The author may be contacted via electronic mail at <john+@cs.cmu.edu>,
00020  * or at the following address:
00021  *
00022  *   John Dorsey
00023  *   Carnegie Mellon University
00024  *   HbH2201 - ICES
00025  *   5000 Forbes Avenue
00026  *   Pittsburgh, PA  15213
00027  */
00028 
00029 #ifndef CONFIG_ACCEPT_GPL
00030 #error This file covered by GPL but CONFIG_ACCEPT_GPL undefined.
00031 #endif
00032 
00033 #if !defined(_YMODEM_H)
00034 #define _YMODEM_H
00035 
00036 #define PACKET_SEQNO_INDEX      (1)
00037 #define PACKET_SEQNO_COMP_INDEX (2)
00038 
00039 #define PACKET_HEADER           (3)     /* start, block, block-complement */
00040 #define PACKET_TRAILER_CRC      (2)     /* CRC bytes */
00041 #define PACKET_TRAILER          (1)
00042 #define PACKET_OVERHEAD_CRC     (PACKET_HEADER + PACKET_TRAILER_CRC)
00043 #define PACKET_OVERHEAD         (PACKET_HEADER + PACKET_TRAILER)
00044 #define PACKET_SIZE             (128)
00045 #define PACKET_1K_SIZE          (1024)
00046 
00047 #define FILE_NAME_LENGTH (255)
00048 #define FILE_SIZE_LENGTH (16)
00049 
00050 /* ASCII control codes: */
00051 #define SOH (0x01)      /* start of 128-byte data packet */
00052 #define STX (0x02)      /* start of 1024-byte data packet */
00053 #define EOT (0x04)      /* end of transmission */
00054 #define ACK (0x06)      /* receive OK */
00055 #define NAK (0x15)      /* receiver error; retry */
00056 #define CAN (0x18)      /* two of these in succession aborts transfer */
00057 #define CRC (0x43)      /* use in place of first NAK for CRC mode */
00058 
00059 #define INITIAL_TIMEOUT (15)
00060 #define CRC_TIMEOUT     (3)
00061 #define NAK_TIMEOUT     (10)
00062 
00063 /* Number of attempts at soliciting CRC mode from sender before falling
00064  * back to arithmetic checksum:
00065  */
00066 #define MAX_CRC_TRIES (5)
00067 
00068 /* Number of consecutive receive errors we will tolerate before giving 
00069  * up:
00070  */
00071 #define MAX_ERRORS    (5)
00072 
00073 extern int ymodem_receive(char *buf, unsigned int length);
00074 
00075 #endif  /* !define(_YMODEM_H) */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Defines