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



/* bl_block.c */

#define BLERR_OK	0
#define BLERR_RESEND 1
#define BLERR_ERROR 2
#define BLERR_TIMEOUT 3
#define BLERR_HEADERFORMAT 4
#define BLERR_HEADERCHECKSUM 5
#define BLERR_DATACHECKSUM 6
#define BLERR_BLOCKMISMATCH 7
#define BLERR_LENGTHMISMATCH 8

int writeblock(UBYTE *dataptr, ULONG datalen, int channel);
int readblock(UBYTE *dataptr, ULONG *datalen, int *channel, int initialtimeout);
void doreset(void);





/* bl_serial.c */

/*
** Set Baud rate etc...
*/
extern void SetFlags(struct IOExtSer *SomeRequest);
extern void Setbaud(int baudrate);

/*
** Sendbreak
*/
void SendBreak(void);

/*
** Clear
*/
void ClearSerial(void);

/*
** Write buffer to serport   (Size=-1) => zero terminated string
*/
extern void SerWrite(APTR Buffer,LONG Size);

/*
** Read from serport to buffer (timeout=-1) => no timeout!
*/
extern int SerRead(APTR Buffer,ULONG Size,LONG timeout);

/*
** Deallocate all serial stuffs
*/
extern void DeleteSerial(void);


/*
** Return string for serial error
*/
extern STRPTR GetSerialError(LONG Error);


/*
** Allocate all serial stuffs
*/
extern STRPTR CreateSerial(void);


/* HandleSerial():
**
**	Handle the data coming in from the serial line.
*/
extern BYTE HandleSerial(void);


extern void MicroWait(ULONG microsecs);
