#!/bin/sh

#
# Usb Test 
#      $1  --- which cpu
#      $2  --- cache config
#      $3  --- regression log file
#      $4  --- test log path 
#

if [ $# -ne 4 ]; then
    echo "Usage: usb cpu# cfg regression_log test_log_path"
    exit
fi

./unexp_int -c $1 -C $2 -n "USB check pending int" -E n -L $3 -l ${4}/usb_t0 > ${4}/usb_t0.st 2>&1

./test1 -c $1 -C $2 -n "USB Aurora Test 1 on $1" -L $3 -l ${4}/usb_t1 -E n > ${4}/usb_t1.st 2>&1

#### comment it out because of BUG 2299 (pending transaction on ep2 XXX###
./test2 -c $1 -C $2 -n "USB Aurora Test 2 on $1" -L $3 -l ${4}/usb_t2 -E n > ${4}/usb_t2.st 2>&1

./test3 -c $1 -C $2 -n "USB Aurora Test 3 on $1" -L $3 -l ${4}/usb_t3 -E n > ${4}/usb_t3.st 2>&1

######## Test 4 got unexpect intr XXXX #####
./test4 -c $1 -C $2 -n "USB Aurora Test 4 on $1" -L $3 -l ${4}/usb_t4 -E n > ${4}/usb_t4.st 2>&1

./test5 -c $1 -C $2 -n "USB Aurora Test 5 on $1" -L $3 -l ${4}/usb_t5 -E n > ${4}/usb_t5.st 2>&1

./test6 -c $1 -C $2 -n "USB Aurora Test 6 on $1" -L $3 -l ${4}/usb_t6 -E n > ${4}/usb_t6.st 2>&1

./test7 -c $1 -C $2 -n "USB Aurora Test 7 on $1" -L $3 -l ${4}/usb_t7 -E n > ${4}/usb_t7.st 2>&1

####### Test8 and Test9 Suspend +wakeup +reset
#### To save time only run on cpu0
./test8 -c $1 -C $2 -n "USB Aurora Test 8 on $1" -L $3 -l ${4}/usb_t8 -E n > ${4}/usb_t8.st 2>&1

./test9 -c $1 -C $2 -n "USB Aurora Test 9 on $1" -L $3 -l ${4}/usb_t9 -E n > ${4}/usb_t9.st 2>&1

./test10 -c $1 -C $2 -n "USB Aurora Test 10 on $1" -L $3 -l ${4}/usb_t10 -E n > ${4}/usb_t10.st 2>&1

./test11 -c $1 -C $2 -n "USB Aurora Test 11 on $1" -L $3 -l ${4}/usb_t11 -E n > ${4}/usb_t11.st 2>&1

./test12 -c $1 -C $2 -n "USB Aurora Test 12 on $1" -L $3 -l ${4}/usb_t12 -E n > ${4}/usb_t12.st 2>&1

./test13 -c $1 -C $2 -n "USB Aurora Test 13 on $1" -L $3 -l ${4}/usb_t13 -E n > ${4}/usb_t13.st 2>&1

./test14 -c $1 -C $2 -n "USB Aurora Test 14 on $1" -L $3 -l ${4}/usb_t14 -E n > ${4}/usb_t14.st 2>&1

./test15 -c $1 -C $2 -n "USB Aurora Test 15 on $1" -L $3 -l ${4}/usb_t15 -E n > ${4}/usb_t15.st 2>&1

./test16 -c $1 -C $2 -n "USB Aurora Test 16 on $1" -L $3 -l ${4}/usb_t16 -E n > ${4}/usb_t16.st 2>&1

./test17 -c $1 -C $2 -n "USB Aurora Test 17 on $1" -L $3 -l ${4}/usb_t17 -E n > ${4}/usb_t17.st 2>&1

./test18 -c $1 -C $2 -n "USB Aurora Test 18 on $1" -L $3 -l ${4}/usb_t18 -E n > ${4}/usb_t18.st 2>&1

./test19 -c $1 -C $2 -n "USB Aurora Test 19 on $1" -L $3 -l ${4}/usb_t19 -E n > ${4}/usb_t19.st 2>&1

./test20 -c $1 -C $2 -n "USB Aurora Test 20 on $1" -L $3 -l ${4}/usb_t20 -E n > ${4}/usb_t20.st 2>&1

./test21 -c $1 -C $2 -n "USB Aurora Test 21 on $1" -L $3 -l ${4}/usb_t21 -E n > ${4}/usb_t21.st 2>&1

./test22 -c $1 -C $2 -n "USB Aurora Test 22 on $1" -L $3 -l ${4}/usb_t22 -E n > ${4}/usb_t22.st 2>&1

./testep0 -c $1 -C $2 -n "USB Aurora Test ep0 on $1" -L $3 -l ${4}/usb_tep0 -E n > ${4}/usb_tep0.st 2>&1

./testep1 -c $1 -C $2 -n "USB Aurora Test ep1 on $1" -L $3 -l ${4}/usb_tep1 -E n > ${4}/usb_tep1.st 2>&1

./testep2 -c $1 -C $2 -n "USB Aurora Test ep2 on $1" -L $3 -l ${4}/usb_tep2 -E n > ${4}/usb_tep2.st 2>&1

./testep3 -c $1 -C $2 -n "USB Aurora Test ep3 on $1" -L $3 -l ${4}/usb_tep3 -E n > ${4}/usb_tep3.st 2>&1

./cancel -c $1 -C $2 -n "USB cancel on $1" -L $3 -l ${4}/usb_cancel -E n > ${4}/usb_cancel.st 2>&1

./pid -c $1 -C $2 -n "USB 0 Len IN PID 0n $1" -L $3 -l ${4}/usb_pid -E n > ${4}/usb_pid.st 2>&1 

./errcase -c $1 -C $2 -n "USB error cases" -L $3 -l ${4}/usb_err -E n > ${4}/usb_err.st 2>&1

./int -c $1 -C $2 -n "USB Intr xfers" -L $3 -l ${4}/usb_int -E n > ${4}/usb_int.st 2>&1
./iso -c $1 -C $2 -n "USB ISO xfers" -L $3 -l ${4}/usb_iso -E n > ${4}/usb_iso.st 2>&1

./bitwalk -c $1 -C $2 -n "USB Bit Walk" -L $3 -l ${4}/usb_bw -E n > ${4}/usb_bw.st 2>&1
./bulk -c $1 -C $2 -n "USB BULK xfers" -L $3 -l ${4}/usb_bulk -E n > ${4}/usb_bulk.st 2>&1

./usbdata -c $1 -C $2 -n "USB debug sram" -L $3 -l ${4}/usb_data -E n > ${4}/usb_data.st 2>&1

./cov -c $1 -C $2 -n "USB get more coverage" -L $3 -l ${4}/usb_cov -E n > ${4}/usb_cov.st 2>&1

# Run unexp_int again to clean up the state of memory protection before pll_bypass test
./unexp_int -c $1 -C $2 -n "USB check pending int" -E n -L $3 -l ${4}/unexp_int > ${4}/unexp_int.st 2>&1

./pll_bypass -c $1 -C $2 -n "USB PLL bypass" -L $3 -l ${4}/usb_pll -E n > ${4}/usb_bp.st 2>&1

