Subversion Repositories Bart

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 mjames 1
/*
2
   $Header: c:/cvsroot/bart/rt_serial.h,v 1.3 2004/03/09 22:09:10 mjames Exp $
3
 */
4
 
5
/*
6
   $Log: rt_serial.h,v $
7
   Revision 1.3  2004/03/09 22:09:10  mjames
8
   Hardware flow control implemented
9
 
10
   Revision 1.2  2004/03/04 21:53:02  mjames
11
   Made the files work with a demo project
12
 
13
   Revision 1.1.1.1  2004/03/03 22:54:33  mjames
14
   no message
15
 
16
 
17
 */
18
 
19
#if !defined RT_SERIAL_H
20
#define RT_SERIAL_H
21
 
22
/* protocol characters */
23
#define CR   0x0D
24
#define LF   0x0A
25
#define XON  0x11
26
#define XOFF 0x13
27
 
28
 
29
extern volatile unsigned char  SIO1_TxCount;           /**< num of un-transmitted byted in FIFO */
30
extern volatile Bool SIO1_TxBusy;            /**< TRUE when UART is transmitting      */
31
 
32
extern void rt_serial_init(void);
33
 
34
 
35
/* these functions named to allow compatibility with C runtime library */
36
extern void putchar(char c);
37
 
38
extern char getchar(void);
39
 
40
extern void SIO1_flush(void); /* clear RX buffer */
41
 
42
extern void SIO1_break(char level, unsigned char ticks); /* delay for n*100 ms ticks, taking Txd to level */
43
 
44
extern char SIO1_pollchar(void);
45
 
46
extern void SIO2_putchar(char c);
47
 
48
extern char SIO2_getchar(void);
49
 
50
extern void SIO2_flush(void);
51
 
52
extern char  SIO2_pollchar(void);
53
 
54
extern void SendStringCode(code char * s);
55
extern void SendStringXdata(xdata char * s);
56
 
57
extern void SendHex(unsigned char x);
58
 
59
#define SEND4HEX(x) { SendHex(((x)>>24)&0xff); SendHex(((x)>>16)&0xff);\
60
                      SendHex(((x)>>8)&0xff);SendHex((x)&0xff);}
61
 
62
extern void SIOTakeSemaphore(void);
63
 
64
extern char SIOSetSemaphore(Bool value);
65
 
66
extern void SIOPutSemaphore(void);
67
 
68
#define SIO_PUT_SEMAPHORE() SIOPutSemaphore()
69
#define SIO_TAKE_SEMAPHORE() SIOTakeSemaphore()
70
#define SIO_SET_SEMAPHORE(x) SIOSetSemaphore(x)
71
 
72
 
73
#endif
74