Hi,
RS485 is a half duplex communication mode. The key to the design of UART to RS485 is how to control the direction of receiving and transmitting data.
The above imx.c supports two control modes: GPIO or UART CTS.
For example, see circuit below, please!

---GPIO
You can use GPIO to control the level of DE/ RE# pin to determine whether data is received or sent on the bus.
This method is difficult to guarantee performance, because there must be necessary delay time between TX and RX. This time is controlled by software. In fact, you can also use this GPIO to control IO direction in application layer software.
---UART_CTS
UART_CTS pin controls IO direction, which may have better performance than GPIO mode, but it also depends on software to determine when TX ends or RX ends. There is always a delay.
---Hardware controls IO direction
The following circuit is using UART_TXD's level feature to control IO directory automatically,No software is needed to control IO direction.

I hope the above explanation will help you!
Have a nice day!
BR,
Weidong