[En-Nut-Discussion] New UART driver

Harald Kipp harald.kipp at egnite.de
Sun Nov 30 17:51:03 CET 2003


I'm currently working on a new UART driver. It should
support:

1. Hardware (RTS/CTS) and software (XON/XOFF) handshake
2. Half duplex mode (used by RS485)
3. Interface de-initialization
4. Adding Brett Abbott's 9-bit mode
5. More complete implementation of ioctls
6. Several optimizations
7. Configurable buffer sizes

The existing driver will be marked deprecated, but should
still work for some time.

The new driver will be split in a hardware dependent and
independent part, making it easier to implement new devices.

dev/usart.c: Hardware independant part.
dev/usart0avr.c: Hardware dependant part for AVR U(S)ART0.
dev/usart1avr.c: Hardware dependant part for AVR U(S)ART1.

An enhanced USARTDCB structure will be used to link both
parts by including a jump table

     int dcb_init()
     int dcb_deinit()
     u_long dcb_get_speed()
     int dcb_set_speed()
     u_char dcb_get_data_bits()
     int dcb_set_data_bits()
     u_char dcb_get_parity()
     int dcb_set_parity()
     u_char dcb_get_stop_bits()
     int dcb_set_stop_bits()

...etc. Additionally the IFSTREAM structure will not be
used anymore. The buffers and queues will be moved to the
USARTDCB structure, which simplifies interrupt handling.

The existing driver uses the tx complete interrupt, while
the new driver will use this interrupt in half duplex mode
only and use the data register empty interrupt for full
duplex communication.

Harald




More information about the En-Nut-Discussion mailing list