ser_p.h

Go to the documentation of this file.
00001 
00042 #ifndef DRV_SER_P_H
00043 #define DRV_SER_P_H
00044 
00045 #include <cfg/compiler.h> /* size_t */
00046 
00047 struct SerialHardware;
00048 struct Serial;
00049 
00050 struct SerialHardwareVT
00051 {
00052     void (*init)(struct SerialHardware *ctx, struct Serial *ser);
00053     void (*cleanup)(struct SerialHardware *ctx);
00054     void (*setBaudrate)(struct SerialHardware *ctx, unsigned long rate);
00055     void (*setParity)(struct SerialHardware *ctx, int parity);
00056     void (*txStart)(struct SerialHardware *ctx);
00057     bool (*txSending)(struct SerialHardware *ctx);
00058 };
00059 
00060 struct SerialHardware
00061 {
00062     const struct SerialHardwareVT *table;
00063     unsigned char *txbuffer;
00064     unsigned char *rxbuffer;
00065     size_t         txbuffer_size;
00066     size_t         rxbuffer_size;
00067 };
00068 
00069 struct SerialHardware *ser_hw_getdesc(int unit);
00070 
00071 #endif /* DRV_SER_P_H */