/*
$Header: c:/cvsroot/bart/rt_serial.h,v 1.3 2004/03/09 22:09:10 mjames Exp $
*/
/*
$Log: rt_serial.h,v $
Revision 1.3 2004/03/09 22:09:10 mjames
Hardware flow control implemented
Revision 1.2 2004/03/04 21:53:02 mjames
Made the files work with a demo project
Revision 1.1.1.1 2004/03/03 22:54:33 mjames
no message
*/
#if !defined RT_SERIAL_H
#define RT_SERIAL_H
/* protocol characters */
#define CR 0x0D
#define LF 0x0A
#define XON 0x11
#define XOFF 0x13
extern volatile unsigned char SIO1_TxCount; /**< num of un-transmitted byted in FIFO */
extern volatile Bool SIO1_TxBusy; /**< TRUE when UART is transmitting */
extern void rt_serial_init(void);
/* these functions named to allow compatibility with C runtime library */
extern void putchar(char c);
extern char getchar(void);
extern void SIO1_flush(void); /* clear RX buffer */
extern void SIO1_break(char level, unsigned char ticks); /* delay for n*100 ms ticks, taking Txd to level */
extern char SIO1_pollchar(void);
extern void SIO2_putchar(char c);
extern char SIO2_getchar(void);
extern void SIO2_flush(void);
extern char SIO2_pollchar(void);
extern void SendStringCode(code char * s);
extern void SendStringXdata(xdata char * s);
extern void SendHex(unsigned char x);
#define SEND4HEX(x) { SendHex(((x)>>24)&0xff); SendHex(((x)>>16)&0xff);\
SendHex(((x)>>8)&0xff);SendHex((x)&0xff);}
extern void SIOTakeSemaphore(void);
extern char SIOSetSemaphore(Bool value);
extern void SIOPutSemaphore(void);
#define SIO_PUT_SEMAPHORE() SIOPutSemaphore()
#define SIO_TAKE_SEMAPHORE() SIOTakeSemaphore()
#define SIO_SET_SEMAPHORE(x) SIOSetSemaphore(x)
#endif