?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik /*! \file xmodem.h \brief XModem Transmit/Receive Implementation with CRC and 1K support. */
2 //*****************************************************************************
3 //
4 // File Name : 'xmodem.h'
5 // Title : XModem Transmit/Receive Implementation with CRC and 1K support
6 // Author : Pascal Stang - Copyright (C) 2006
7 // Created : 4/22/2006
8 // Revised : 7/22/2006
9 // Version : 0.1
10 // Target MCU : AVR processors
11 // Editor Tabs : 4
12 //
13 /// \ingroup general
14 /// \defgroup xmodem XModem Transmit/Receive Implementation with CRC and 1K support (xmodem.c)
15 /// \code #include "xmodem.h" \endcode
16 /// \par Overview
17 /// This XModem implementation supports both 128b and 1K packets with or
18 /// without CRC checking. The xmodem library must be initialized to use
19 /// a particular I/O stream by passing appropriate getbyte() and sendbyte()
20 /// functions to xmodemInit(). The xmodem transfer routines also expect
21 /// function pointers to read and write data blocks on the local system.
22 /// While this use of function pointers increases code size, it has great
23 /// adaptability. The generalized read/write data functions mean that it
24 /// is easy to pipe data to/from any storage device like EEPROMs or flash
25 /// cards, rather than being limited to just processor RAM.
26 //
27 // This code is distributed under the GNU Public License
28 // which can be found at http://www.gnu.org/licenses/gpl.txt
29 //
30 //*****************************************************************************
31 //@{
32  
33 #ifndef XMODEM_H
34 #define XMODEM_H
35  
36 // xmodem control characters
37 #define SOH 0x01
38 #define STX 0x02
39 #define EOT 0x04
40 #define ACK 0x06
41 #define NAK 0x15
42 #define CAN 0x18
43 #define CTRLZ 0x1A
44  
45 // xmodem timeout/retry parameters
46 #define XMODEM_TIMEOUT_DELAY 1000
47 #define XMODEM_RETRY_LIMIT 16
48  
49 // error return codes
50 #define XMODEM_ERROR_REMOTECANCEL -1
51 #define XMODEM_ERROR_OUTOFSYNC -2
52 #define XMODEM_ERROR_RETRYEXCEED -3
53  
54  
55 //! initialize xmodem stream I/O routines
56 void xmodemInit(void (*sendbyte_func)(unsigned char c), int (*getbyte_func)(void));
57  
58 //! xmodem receive
59 long xmodemReceive( int (*write)(unsigned char* buffer, int size) );
60  
61 //! xmodem transmit
62 long xmodemTransmit( int (*read)(unsigned char* buffer, int size) );
63  
64 //! xmodem CRC/checksum error checking
65 int xmodemCrcCheck(int crcflag, const unsigned char *buffer, int size);
66  
67 // extra stream I/O functions
68 //! get incoming character (wait for timeout)
69 int xmodemInTime(unsigned short timeout);
70  
71 //! flush incoming character stream
72 void xmodemInFlush(void);
73  
74 #endif
75  
76 //@}
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3