summaryrefslogtreecommitdiff
path: root/common/scripts/coresight-test.sh
blob: 930b7aad6f1af4f70724b2e9bcc69dc5d4c97a5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Script to test coresight

CORESIGHT_PATH="/sys/bus/coresight/devices"

echo "ls $CORESIGHT_PATH"
ls $CORESIGHT_PATH

echo -e "SOURCE\tSINK\tRESULT"
echo -e "------\t----\t------"
for SOURCE in `ls $CORESIGHT_PATH | egrep "etm|ptm"` ; do
	for SINK in `ls $CORESIGHT_PATH | egrep "etb|tpiu"` ; do

		echo 1 > $CORESIGHT_PATH/$SINK/enable_sink

		wrt_ptr1=`cat $CORESIGHT_PATH/$SINK/status | grep wrt | awk '{print $NF}'`
		echo 1 > $CORESIGHT_PATH/$SOURCE/enable_source
		sleep 1
		echo 0 > $CORESIGHT_PATH/$SOURCE/enable_source
		wrt_ptr2=`cat $CORESIGHT_PATH/$SINK/status | grep wrt | awk '{print $NF}'`

		echo 0 > $CORESIGHT_PATH/$SINK/enable_sink

		if [ $wrt_ptr1 == $wrt_ptr2 ];
		then
		RES="FAIL"
		else
		RES="SUCCESS"
		fi

		echo -e "$SOURCE\t$SINK\t$RES"
	done
	echo
done