00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef RS232__H
00012 #define RS232__H
00013
00014 #include "task.h"
00015
00016 #define RS232_N_PORTS 2
00017 #define RS232_DEF_BAUDRATE 115200
00018 #define RS232_DEF_T_BUFF_SIZE 256
00019 #define RS232_DEF_R_BUFF_SIZE 256
00020
00021 #define RS232_STAT_NREC 0
00022 #define RS232_STAT_TMT 1
00023
00024 typedef struct {
00025 unsigned char *pUDR;
00026 unsigned char *pUCSRnA;
00027 unsigned char *pUCSRnB;
00028 unsigned char *pUCSRnC;
00029 unsigned short *pUBRR;
00030 }RREG;
00031
00032 typedef struct {
00033 unsigned short head;
00034 unsigned short tail;
00035 unsigned short nChar;
00036 unsigned short size;
00037 ECB *pSem;
00038 char *buff;
00039
00040 }IOREC;
00041
00042 typedef struct {
00043 IOREC Rx;
00044 IOREC Tx;
00045 RREG *regs;
00046 } SERIAL;
00047
00048 extern int RInit(void);
00049
00050 #endif