1 | |
---|
2 | TREE_FILE=psim_tree.${LOGNAME} |
---|
3 | |
---|
4 | case $0 in |
---|
5 | *4.8*) rtemsTarget=powerpc-rtems4.8 ;; |
---|
6 | *4.9*) rtemsTarget=powerpc-rtems4.9 ;; |
---|
7 | *4.10*) rtemsTarget=powerpc-rtems4.10 ;; |
---|
8 | *) ;; |
---|
9 | esac |
---|
10 | |
---|
11 | ### Generate the PSIM device tree based upon the type of application being run |
---|
12 | gen_device_tree() |
---|
13 | { |
---|
14 | enable_sysv_ipc="yes" |
---|
15 | |
---|
16 | if [ ${use_sysv_ipc} = "yes" ] ; then |
---|
17 | enable_sysv_ipc="yes" |
---|
18 | value=-1 # for now assume we are slave in this mode |
---|
19 | else |
---|
20 | case ${1} in |
---|
21 | *mp*) |
---|
22 | enable_sysv_devices="yes" |
---|
23 | case ${1} in |
---|
24 | *node1*) value=1 ;; |
---|
25 | *) value=-1 ;; |
---|
26 | esac |
---|
27 | ;; |
---|
28 | *) |
---|
29 | enable_sysv_devices="no" |
---|
30 | ;; |
---|
31 | esac |
---|
32 | fi |
---|
33 | |
---|
34 | if [ ${enable_sysv_devices} = "yes" ] ; then |
---|
35 | if [ X${RTEMS_SHM_SEMAPHORE_KEY} = X -o X${RTEMS_SHM_KEY} = X ] ; then |
---|
36 | fatal RTEMS_SHM_SEMAPHORE_KEY and/or RTEMS_SHM_KEY not set |
---|
37 | fi |
---|
38 | fi |
---|
39 | |
---|
40 | cat <<EOF |
---|
41 | # |
---|
42 | # Device Tree for PSIM |
---|
43 | # |
---|
44 | # Automatically Generated -- DO NOT EDIT!! |
---|
45 | # |
---|
46 | /#address-cells 1 |
---|
47 | /openprom/init/register/pvr 0xfffe0000 |
---|
48 | /openprom/options/oea-memory-size 8388608 |
---|
49 | ##### EEPROM @ 0x0c000000 for 512K |
---|
50 | /eeprom@0x0c000000/reg 0x0c000000 0x80000 |
---|
51 | /eeprom@0x0c000000/nr-sectors 8 |
---|
52 | /eeprom@0x0c000000/sector-size 0x10000 |
---|
53 | /eeprom@0x0c000000/byte-write-delay 1000 |
---|
54 | /eeprom@0x0c000000/sector-start-delay 100 |
---|
55 | /eeprom@0x0c000000/erase-delay 1000 |
---|
56 | /eeprom@0x0c000000/manufacture-code 0x01 |
---|
57 | /eeprom@0x0c000000/device-code 0xa4 |
---|
58 | |
---|
59 | ##### NVRAM/RTC NVRAM Portion is 0x0c080000 for 512K |
---|
60 | ##### NVRAM/RTC RTC Portion is 0x0c100000 for 12 |
---|
61 | /nvram@0x0c080000/reg 0x0c080000 524300 |
---|
62 | /nvram@0x0c080000/timezone -3600 |
---|
63 | EOF |
---|
64 | |
---|
65 | if [ ${enable_sysv_devices} = yes ] ; then |
---|
66 | echo "##### System V IPC (Semaphore) 0x0c100010 for 12" |
---|
67 | echo "/sem@0x0c100010/reg 0x0c100010 12" |
---|
68 | echo "/sem@0x0c100010/key ${RTEMS_SHM_SEMAPHORE_KEY}" |
---|
69 | echo "/sem@0x0c100010/value ${value}" |
---|
70 | echo |
---|
71 | echo "##### System V IPC (Shared Memory) 0x0c110000 for 128K" |
---|
72 | echo "/shm@0x0c110000/reg 0x0c110000 0x20000" |
---|
73 | echo "/shm@0x0c110000/key ${RTEMS_SHM_KEY}" |
---|
74 | fi |
---|
75 | } |
---|
76 | |
---|
77 | ### run the specified test with the time limit |
---|
78 | runone() |
---|
79 | { |
---|
80 | testname=${1} |
---|
81 | max_run_time=${2} |
---|
82 | if [ $# -eq 3 ] ; then |
---|
83 | treefile=${3} |
---|
84 | else |
---|
85 | treefile=${TREE_FILE} |
---|
86 | fi |
---|
87 | if [ ${max_run_time} -eq 0 ] ; then |
---|
88 | #echo run ${testname} forever |
---|
89 | ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} |
---|
90 | else |
---|
91 | #echo run ${testname} for maximum ${max_run_time} seconds |
---|
92 | ${RUN} -f ${treefile} ${RUN_DEBUG} ${testname} & |
---|
93 | pid=$! |
---|
94 | |
---|
95 | # Make sure it won't run forever... |
---|
96 | time_run=0 |
---|
97 | while [ $time_run -lt $max_run_time ] |
---|
98 | do |
---|
99 | # sleep 5s at a time waiting for job to finish or timer to expire |
---|
100 | # if job has exited, then we exit, too. |
---|
101 | sleep 1 |
---|
102 | kill -0 $pid 2> /dev/null |
---|
103 | running=$? |
---|
104 | if [ $running -eq 0 ] ; then |
---|
105 | time_run=$((time_run + 5)) |
---|
106 | if [ $time_run -ge $max_run_time ]; then |
---|
107 | kill -9 $pid 2> /dev/null |
---|
108 | ran_too_long="yes" |
---|
109 | echo "${testname} killed after running ${max_run_time} seconds" |
---|
110 | fi |
---|
111 | else |
---|
112 | ran_too_long="no" |
---|
113 | break |
---|
114 | fi |
---|
115 | done |
---|
116 | fi |
---|
117 | } |
---|
118 | |
---|