/************************************************************************/
/* Copyright 2013 MBARI							*/
/************************************************************************/
/* Summary  : Include file for porting Embedded ZModem to BEDS on Persistor*/
/* Filename : bedszm.h							*/
/* Author   : Robert Herlien (rah)					*/
/* Project  : Benthic Event Detection System (BEDS)			*/
/* Revision : 1.0							*/
/* Created  : 10/2/2013							*/
/*									    */
/* MBARI provides this documentation and code "as is", with no warranty,    */
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium  */
/* Research Institute to assist in its use, correction, modification, or    */
/* enhancement. This information should not be published or distributed to  */
/* third parties without specific written permission from MBARI.            */
/*									    */
/************************************************************************/
/* Modification History:						*/
/* 2oct2013 rah - created						*/
/************************************************************************/
/* This file was created for porting Embedded ZModem from Omen to BEDS	*/
/* on the CF2.  It's needed primarily because the ^*%&^%* Metrowerks	*/
/* compiler does not support -Ddef, as is standard for every other	*/
/* C compiler in the modern world.					*/
/************************************************************************/

#ifndef ZMODEM_INC
#define ZMODEM_INC			1

#include <cfxpico.h>

/* Defines that are normally in Makefile as -Ddef	*/

#define DIAGS
#define DEBUGZ
#define ZSTAB
#define MANYREGS
#define NOCOPYTX
#define UNSL unsigned

/* Added this one, 7oct2013, rah, MBARI			*/
#define HAVE_STAT

//#define flushmo()	CIOdrain()
#define zbitch(s)	zperr(s)

/* Declarations for externally called functions		*/
int zmSendFiles(char *path, char *name, int verbose, unsigned window, unsigned framelen);

/* From isz.c		*/
void	startz(void);
int		wcs(char *name);
void	saybibi(void);

/* From bedszm.c - these are the (mostly) MBARI-written functions for	*/
/* porting Industrial ZModem to PicoDOS on the Persistor CF2		*/
void	sendline(int c);
int		readline(int timeout);
int 	checkline(void);
void 	purgeline(void);
void	vfile(char *f, ...);
void	zperr(char *s, ...);
void	zclose(int);
int		zseek(long n);
int		zfilbuf(void);

/* Add'l functions for Persistor port	*/
int		insertStat(char *q);

/* Forward declarations, because compiler pedantically spits out warnings*/
/* if function has no prototype and is not declared static, even if	*/
/* function appears ahead of any use of it				*/

/* From izm.c		*/
void	zsbh32(char *hdr, int type);

/* From izmr.c		*/
void	zsdar32(char *buf, int length, int frameend);
int		zrdatr32(char *buf, int length);

#endif
