The [AM1808 SoC](EV3 Processor) has 3 hardware UART controllers. We are also using the [PRU](EV3 PRU) to provide 2 additional software UARTs.
##Usage UART0: Input port 2 UART sensors.
UART1: Input port 1 UART sensors. Also debugging terminal (starts at boot).
UART2: Bluetooth.
PRU0/SUART0: Input port 4 UART sensors.
PRU0/SUART1: Input port 3 UART sensors.
See the [PRU](EV3 PRU) page for info on the PRU UART drivers.
The SoC UARTs are standard UARTs and therefore use the 8250 driver. Both types of UARTs (SoC and PRU) of course implement the tty device class. The interesting part is the LEGOEV3 line discipline that runs on top of the tty driver.
Source: uart-sensors/drivers/legoev3/legoev3_uart.c
There are udev rules in place (/lib/udev/rules.d/ev3dev-uart.rules in conjunction with /lib/ev3dev/uart.sh) that attach the line discipline to a tty (serial port) when a UART sensor is detected on a given input port. When the sensor is removed, the line discipline is detached (process killed).