/** * \file * * * \author Andrea Righi * * \brief Generic USB serial device driver. * * This driver exports a USB-serial converter. It provides a KFile interface * to access the data. * \attention The API is work in progress and may change in future versions. * * $WIZ$ module_name = "usbser" * $WIZ$ module_configuration = "bertos/cfg/cfg_usbser.h" * $WIZ$ module_depends = "usb" */ #ifndef USBSER_H #define USBSER_H #include typedef uint32_t usbser_status_t; typedef struct USBSerial { /** KFile structure implementation **/ KFile fd; /** Logical port number */ unsigned int unit; #ifdef _DEBUG /** Used for debugging only */ bool is_open; #endif /** Holds the status flags. Set to 0 when no errors have occurred. */ usbser_status_t status; } USBSerial; /** * ID for usb-serial. */ #define KFT_USB_SERIAL MAKE_ID('U', 'S', 'B', 'S') INLINE USBSerial *USB_SERIAL_CAST(KFile *fd) { ASSERT(fd->_type == KFT_USB_SERIAL); return (USBSerial *)fd; } int usbser_init(struct USBSerial *fds, int unit); #endif /* USBSER_H */