/** * \file * * * \brief Hardware dependent serial driver (interface) * * * \author Stefano Fedrigo * \author Giovanni Bajo */ #ifndef DRV_SER_P_H #define DRV_SER_P_H #include /* size_t */ struct SerialHardware; struct Serial; struct SerialHardwareVT { void (*init)(struct SerialHardware *ctx, struct Serial *ser); void (*cleanup)(struct SerialHardware *ctx); void (*setBaudrate)(struct SerialHardware *ctx, unsigned long rate); void (*setParity)(struct SerialHardware *ctx, int parity); void (*txStart)(struct SerialHardware *ctx); bool (*txSending)(struct SerialHardware *ctx); }; struct SerialHardware { const struct SerialHardwareVT *table; unsigned char *txbuffer; unsigned char *rxbuffer; size_t txbuffer_size; size_t rxbuffer_size; }; struct SerialHardware *ser_hw_getdesc(int unit); #endif /* DRV_SER_P_H */