@@ -44,7 +44,65 @@ STOP_TO="${STOP_TO:-10}"
4444START_TO=" ${START_TO:- 10} "
4545POLL_I=" ${POLL_I:- 1} "
4646
47- log_info " DEBUG: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I "
47+ # --- CLI ----------------------------------------------------------------------
48+ # Default: do NOT do SSR (stop/start). Enable explicitly with --ssr
49+ DO_SSR=0
50+
51+ usage () {
52+ echo " Usage: $0 [--ssr] [--stop-to SEC] [--start-to SEC] [--poll-i SEC]" >&2
53+ echo " --ssr Perform $FW stop/start (SSR). Default: OFF" >&2
54+ echo " --stop-to SEC Stop timeout (default: $STOP_TO )" >&2
55+ echo " --start-to SEC Start timeout (default: $START_TO )" >&2
56+ echo " --poll-i SEC Poll interval (default: $POLL_I )" >&2
57+ }
58+
59+ while [ $# -gt 0 ]; do
60+ case " $1 " in
61+ --ssr)
62+ DO_SSR=1
63+ shift
64+ ;;
65+ --stop-to)
66+ if [ $# -lt 2 ]; then
67+ log_fail " Missing value for --stop-to"
68+ usage
69+ exit 2
70+ fi
71+ STOP_TO=" $2 "
72+ shift 2
73+ ;;
74+ --start-to)
75+ if [ $# -lt 2 ]; then
76+ log_fail " Missing value for --start-to"
77+ usage
78+ exit 2
79+ fi
80+ START_TO=" $2 "
81+ shift 2
82+ ;;
83+ --poll-i)
84+ if [ $# -lt 2 ]; then
85+ log_fail " Missing value for --poll-i"
86+ usage
87+ exit 2
88+ fi
89+ POLL_I=" $2 "
90+ shift 2
91+ ;;
92+ -h|--help)
93+ usage
94+ exit 0
95+ ;;
96+ * )
97+ log_warn " Unknown argument: $1 "
98+ usage
99+ exit 2
100+ ;;
101+ esac
102+ done
103+
104+ log_info " Tunables: STOP_TO=$STOP_TO START_TO=$START_TO POLL_I=$POLL_I "
105+ log_info " SSR control: DO_SSR=$DO_SSR (0=no stop/start, 1=do stop/start)"
48106
49107# DT check for entries
50108if dt_has_remoteproc_fw " $FW " ; then
@@ -96,43 +154,49 @@ while IFS='|' read -r rpath rstate rfirm rname; do
96154 continue
97155 fi
98156
99- # Stop
100- dump_rproc_logs " $rpath " before-stop
101- t0=$( date +%s)
102- log_info " $inst_id : stopping"
103- if stop_remoteproc " $rpath " && wait_remoteproc_state " $rpath " offline " $STOP_TO " " $POLL_I " ; then
104- t1=$( date +%s)
105- log_pass " $inst_id : stop PASS ($(( t1 - t0 )) s)"
106- stop_res=" PASS"
107- else
108- dump_rproc_logs " $rpath " after-stop-fail
109- log_fail " $inst_id : stop FAIL"
110- stop_res=" FAIL"
111- inst_fail=$(( inst_fail + 1 ))
112- RESULT_LINES=" $RESULT_LINES
157+ if [ " $DO_SSR " -eq 1 ]; then
158+ # Stop
159+ dump_rproc_logs " $rpath " before-stop
160+ t0=$( date +%s)
161+ log_info " $inst_id : stopping"
162+ if stop_remoteproc " $rpath " && wait_remoteproc_state " $rpath " offline " $STOP_TO " " $POLL_I " ; then
163+ t1=$( date +%s)
164+ log_pass " $inst_id : stop PASS ($(( t1 - t0 )) s)"
165+ stop_res=" PASS"
166+ else
167+ dump_rproc_logs " $rpath " after-stop-fail
168+ log_fail " $inst_id : stop FAIL"
169+ stop_res=" FAIL"
170+ inst_fail=$(( inst_fail + 1 ))
171+ RESULT_LINES=" $RESULT_LINES
113172 $inst_id : boot=$boot_res , stop=$stop_res , start=$start_res , ping=$ping_res "
114- continue
115- fi
116- dump_rproc_logs " $rpath " after-stop
117-
118- # Start
119- dump_rproc_logs " $rpath " before-start
120- t2=$( date +%s)
121- log_info " $inst_id : starting"
122- if start_remoteproc " $rpath " && wait_remoteproc_state " $rpath " running " $START_TO " " $POLL_I " ; then
123- t3=$( date +%s)
124- log_pass " $inst_id : start PASS ($(( t3 - t2 )) s)"
125- start_res=" PASS"
126- else
127- dump_rproc_logs " $rpath " after-start-fail
128- log_fail " $inst_id : start FAIL"
129- start_res=" FAIL"
130- inst_fail=$(( inst_fail + 1 ))
131- RESULT_LINES=" $RESULT_LINES
173+ continue
174+ fi
175+ dump_rproc_logs " $rpath " after-stop
176+
177+ # Start
178+ dump_rproc_logs " $rpath " before-start
179+ t2=$( date +%s)
180+ log_info " $inst_id : starting"
181+ if start_remoteproc " $rpath " && wait_remoteproc_state " $rpath " running " $START_TO " " $POLL_I " ; then
182+ t3=$( date +%s)
183+ log_pass " $inst_id : start PASS ($(( t3 - t2 )) s)"
184+ start_res=" PASS"
185+ else
186+ dump_rproc_logs " $rpath " after-start-fail
187+ log_fail " $inst_id : start FAIL"
188+ start_res=" FAIL"
189+ inst_fail=$(( inst_fail + 1 ))
190+ RESULT_LINES=" $RESULT_LINES
132191 $inst_id : boot=$boot_res , stop=$stop_res , start=$start_res , ping=$ping_res "
133- continue
192+ continue
193+ fi
194+ dump_rproc_logs " $rpath " after-start
195+ else
196+ log_info " $inst_id : SSR disabled (--ssr not set). Skipping stop/start."
197+ stop_res=" SKIPPED"
198+ start_res=" SKIPPED"
134199 fi
135- dump_rproc_logs " $rpath " after-start
136200
137201 # Optional RPMsg ping
138202 if CTRL_DEV=$( find_rpmsg_ctrl_for " $FW " ) ; then
0 commit comments