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