serial: Move new functions to serial.h