#!/bin/sh # This script is used to test UART functionality for cyclone5 board. UART_DEVICE="/dev/ttyS0" if [ ! -e $UART_DEVICE ]; then echo "FAIL: UART device $UART_DEVICE does not exist" exit 1 else echo "PASS: UART device $UART_DEVICE exists" fi STTY=`which stty` if [ "x$STTY" != "x" ]; then echo "PASS: stty tool found" else echo "FAIL: stty tool not found" exit 1 fi $STTY -F $UART_DEVICE -a if [ $? -ne 0 ]; then echo "FAIL: read UART settings for device $UART_DEVICE fail" exit 1 fi echo "PASS: read UART settings for device $UART_DEVICE success" echo "PASS: UART test passed" exit 0