
/*************************************************************************
**
** Protocol.h
** Copyright (c) 1995,1996 Daniel Kahlin <tlr@stacken.kth.se>
**
******/

/* pr_protocol.c */
void bl_blocktest(void);
void bl_filetest(void);
void bl_sendfile(char *file,UBYTE *buffer,ULONG len,int device);
void bl_recvfile(char *file,UBYTE **buffer,ULONG *len,int device);
void bl_recvdir(char *file,UBYTE **buffer,ULONG *len,int device);
void bl_recvstatus(UBYTE **buffer,ULONG *len,int device);
void bl_sendcommand(UBYTE *buffer,ULONG len,int device);
void bl_sendmem(UBYTE *buffer,ULONG addr, ULONG len);
void bl_recvmem(UBYTE *buffer,ULONG addr, ULONG len);
void bl_sys(ULONG pc, UBYTE memory, UBYTE sr, UBYTE ac, UBYTE xr, UBYTE yr, UBYTE sp);
void bl_run(ULONG lowmem, ULONG himem);
UBYTE *bl_sendtrack(int track, int numtracks, UBYTE *buffer,int device);
UBYTE *bl_recvtrack(int track, int numtracks, UBYTE *buffer,int device);

/* pr_Support.c */
void writeblock_err(UBYTE *dataptr, ULONG datalen, int channel);
void readblock_err(UBYTE *dataptr, ULONG *datalen, int *channel,int initialtimeout);
void receivebody_err(UBYTE *dataptr, ULONG datalen);
void sendbody_err(UBYTE *dataptr, ULONG datalen);
void checkresponse_err(UBYTE *buf,ULONG len,int timeout);
void respond_err(UBYTE status);
int receivebody(UBYTE *dataptr, ULONG datalen);
int sendbody(UBYTE *dataptr, ULONG datalen);
int checkresponse(UBYTE *buf,ULONG len,int timeout);
int respond(UBYTE status);

/* pr_Simple.c */
void slowsend(UBYTE *buffer, ULONG len);
void slowsendnew(UBYTE *buffer, ULONG len, int baudrate, char *name);
void sendfile(UBYTE *buffer, ULONG len);
int receivefile(UBYTE **buffer, ULONG *len);
void sendfile_old(UBYTE *buffer, ULONG len);
int receivefile_old(UBYTE **buffer, ULONG *len);

/* pr_Server.c */
int bl_server(void);
int bl_srvload(struct srvld_header *);
int bl_srvsave(struct srvsv_header *);
int bl_srvcommand(struct srvcm_header *);
int bl_srvreadstring(struct srvrs_header *);


#define PRERR_OK	0
#define PRERR_ERROR 1
#define PRERR_UNKNOWNERROR	0x20
#define PRERR_FORMAT	0x21
#define PRERR_UNEXPECTEDPACKET	0x22
#define PRERR_NOTSUPPORTED	0x23
#define PRERR_COMMANDFAILED	0x24

