凌云实验室推出的ARM Linux物联网网关开发板IGKBoard(IoT Gateway Kit Board)项目源码
guowenxue
2022-10-06 50c2d8def5896d5e2cdf41457248096e23a52dbe
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
36
37
38
39
40
41
42
#!/bin/sh
# 40 Pin Header GPIO loop test script, it based on pinctrl shell script
 
function loop_test()
{
   if [[ $# != 3 ]] ; then
      echo "ERROR: Invalid input arguments"
      return 1;
   fi
 
   level=$3
   pinctrl $1 $level
   res=`pinctrl -i $2`
 
   printf "$1 out [$level] --> $2 in [$res] : "
   if [[ $level == $res ]]  ; then
      printf " [  OK  ]\n"
   else
      printf " [ FAIL ]\n"
      exit 1;
   fi
}
 
 
if [[ $# != 2 ]] ; then
   echo ""
   echo "Usage  : $0 Pin1 Pin2"
   echo "Example: $0 GPIO1_IO10 GPIO1_IO11"
   echo ""
   echo "You can check pinmap by 'pinctrl -v' "
   echo ""
   exit;
fi
 
 
loop_test $1 $2 1
loop_test $1 $2 0
 
loop_test $2 $1 1
loop_test $2 $1 0
 
exit 0;