Rewrite chargen UART test in C