/************************************************************************/
/* Copyright 2013-2018 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												*/
/* 13mar2018 rah - ported to BEDS2 using FatFs							*/
/************************************************************************/
/* 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 INCbedszmh
#define INCbedszmh		1

#include <mbariTypes.h>
#include <beds.h>
#include <serial.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
/* and this one, 14mar2018, rah, MBARI					*/
//#define FATFS

#define zbitch(s)		zperr(s)

/* Declarations for externally called functions			*/
int zmSendFiles(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);
void	purgeline(void);
void	flushmo(void);
void	vfile(char *f, ...);
void	zperr(char *s, ...);
void	zclose(int);
int		zseek(long n);
int		checkline(void);
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 /* INCbedszmh */
