1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/inc/xmodem.h
Bogdan Marinescu 0d9fcf9909 - lua parsing: lparser.c was modified to allocate some of its structures to
the heap instead of the stack. Also, the stack size was bumped to at least
  2048 bytes on all backends. Hopefully this will take care of most issues
  related to stack overflows.

- new buffering system available. Originally I planned to make it fully
  generic, but I came to the conclusions that this would take too much
  development work and system resources (RAM/Flash) if done properly, so
  currently it's only used on UART RX (although it could be easily extended
  for other peripherals). For an example of use check the AT91SAM7X and
  AVR32 backend (platform_init and associated interrupt handlers and also
  platform_conf.h).

- new XMODEM implementation. Better, cleaner, bug fixed, and BSD instead of
  GPL.

- AVR32 can use the huge (32MBytes) SDRAM on the board as system memory now.

- fixed an error in elua_sbrk/_sbrk_r (and revised the compilation options
  for dlmalloc).

- added the CPU module and interrupt support on the STR9 platform.

- uart module changes: 'sendstr' is out, but the regular 'send' will send
  strings instead of simple chars (which makes sense since Lua doesn't have
  a "char" type). Also, the 'timer_id' and 'timout' parameters of the 'recv'
  function are now optional.
2009-01-22 19:46:47 +00:00

28 lines
726 B
C

// XMODEM for eLua
#ifndef __XMODEM_H__
#define __XMODEM_H__
#include "type.h"
// XMODEM constants
#define XMODEM_INITIAL_BUFFER_SIZE 1024
#define XMODEM_INCREMENT_AMMOUNT 512
// xmodem timeout/retry parameters
#define XMODEM_TIMEOUT 1000000
#define XMODEM_RETRY_LIMIT 20
// error return codes
#define XMODEM_ERROR_REMOTECANCEL (-1)
#define XMODEM_ERROR_OUTOFSYNC (-2)
#define XMODEM_ERROR_RETRYEXCEED (-3)
#define XMODEM_ERROR_OUTOFMEM (-4)
typedef void ( *p_xm_send_func )( u8 );
typedef int ( *p_xm_recv_func )( u32 );
long xmodem_receive( char** dest );
void xmodem_init( p_xm_send_func send_func, p_xm_recv_func recv_func );
#endif // #ifndef __XMODEM_H__