2009-01-22 19:46:47 +00:00
|
|
|
// XMODEM for eLua
|
2008-07-29 11:08:54 +00:00
|
|
|
|
2009-01-22 19:46:47 +00:00
|
|
|
#ifndef __XMODEM_H__
|
|
|
|
#define __XMODEM_H__
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
#include "type.h"
|
2011-10-08 20:07:14 +03:00
|
|
|
#include "platform.h"
|
2008-07-29 11:08:54 +00:00
|
|
|
|
2008-10-31 21:32:15 +00:00
|
|
|
// XMODEM constants
|
|
|
|
#define XMODEM_INITIAL_BUFFER_SIZE 1024
|
|
|
|
#define XMODEM_INCREMENT_AMMOUNT 512
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
// xmodem timeout/retry parameters
|
2009-01-22 19:46:47 +00:00
|
|
|
#define XMODEM_TIMEOUT 1000000
|
|
|
|
#define XMODEM_RETRY_LIMIT 20
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
// error return codes
|
2009-01-22 19:46:47 +00:00
|
|
|
#define XMODEM_ERROR_REMOTECANCEL (-1)
|
|
|
|
#define XMODEM_ERROR_OUTOFSYNC (-2)
|
|
|
|
#define XMODEM_ERROR_RETRYEXCEED (-3)
|
|
|
|
#define XMODEM_ERROR_OUTOFMEM (-4)
|
2008-07-29 11:08:54 +00:00
|
|
|
|
|
|
|
typedef void ( *p_xm_send_func )( u8 );
|
2011-10-08 20:07:14 +03:00
|
|
|
typedef int ( *p_xm_recv_func )( timer_data_type );
|
2008-10-31 21:32:15 +00:00
|
|
|
long xmodem_receive( char** dest );
|
2008-08-04 12:04:36 +00:00
|
|
|
void xmodem_init( p_xm_send_func send_func, p_xm_recv_func recv_func );
|
|
|
|
|
2009-01-22 19:46:47 +00:00
|
|
|
#endif // #ifndef __XMODEM_H__
|