serial.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef serial_h
00033 #define serial_h
00034
00035 extern long serial_recv_timeout;
00036
00041 union filedescriptor
00042 {
00043 int ifd;
00044 void *pfd;
00045 struct
00046 {
00047 void *handle;
00048 int ep;
00049 } usb;
00050 };
00051
00058 struct serial_device
00059 {
00060 void (*open)(char * port, long baud, union filedescriptor *fd);
00061 int (*setspeed)(union filedescriptor *fd, long baud);
00062 void (*close)(union filedescriptor *fd);
00063
00064 int (*send)(union filedescriptor *fd, unsigned char * buf, size_t buflen);
00065 int (*recv)(union filedescriptor *fd, unsigned char * buf, size_t buflen);
00066 int (*drain)(union filedescriptor *fd, int display);
00067 void (*poll)(void);
00068
00069 int flags;
00070 #define SERDEV_FL_NONE 0x0000
00071 #define SERDEV_FL_CANSETSPEED 0x0001
00072 };
00073
00074 extern struct serial_device *serdev;
00075 extern struct serial_device serial_serdev;
00076 extern struct serial_device usb_serdev;
00077 extern struct serial_device usb_serdev_frame;
00078 extern struct serial_device avrdoper_serdev;
00079
00080 #define serial_open (serdev->open)
00081 #define serial_setspeed (serdev->setspeed)
00082 #define serial_close (serdev->close)
00083 #define serial_send (serdev->send)
00084 #define serial_recv (serdev->recv)
00085 #define serial_drain (serdev->drain)
00086 #define serial_poll (serdev->poll)
00087
00088
00089
00090 #endif