@@ -23,3 +23,162 @@ suit_plat_err_t suit_execution_mode_set(suit_execution_mode_t mode)
2323
2424 return SUIT_PLAT_ERR_INVAL ;
2525}
26+
27+ void suit_execution_mode_startup_failed (void )
28+ {
29+ switch (current_execution_mode ) {
30+ /* SUIT boot or update not yet started. */
31+ case EXECUTION_MODE_STARTUP :
32+ /* System is unprovisioned, SUIT updates Nordic components. */
33+ case EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP :
34+ /* SUIT processes update candiadate. */
35+ case EXECUTION_MODE_INSTALL :
36+ /* SUIT processes recovery update. */
37+ case EXECUTION_MODE_INSTALL_RECOVERY :
38+ /* SUIT boots from root manifest. */
39+ case EXECUTION_MODE_INVOKE :
40+ /* SUIT boots from recovery manifest. */
41+ case EXECUTION_MODE_INVOKE_RECOVERY :
42+ current_execution_mode = EXECUTION_MODE_FAIL_STARTUP ;
43+ break ;
44+
45+ /* System not booted, application MPI missing. */
46+ case EXECUTION_MODE_FAIL_NO_MPI :
47+ /* System not booted, invalid MPI format. */
48+ case EXECUTION_MODE_FAIL_MPI_INVALID :
49+ /* System not booted, Nordic and root class IDs not configured. */
50+ case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING :
51+ /* System not booted, MPI misconfigured. */
52+ case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED :
53+ /* System not booted, unable to boot recovery manifest. */
54+ case EXECUTION_MODE_FAIL_INVOKE_RECOVERY :
55+ /* System booted from root manifest. */
56+ case EXECUTION_MODE_POST_INVOKE :
57+ /* System booted from recovery manifest. */
58+ case EXECUTION_MODE_POST_INVOKE_RECOVERY :
59+ /* System failed before invoking SUIT orchestrator. */
60+ case EXECUTION_MODE_FAIL_STARTUP :
61+ break ;
62+ /* default case deliberately excluded to get warnings if missing an enum case. */
63+ }
64+ }
65+
66+ bool suit_execution_mode_booting (void )
67+ {
68+ switch (current_execution_mode ) {
69+ /* SUIT processes update candiadate. */
70+ case EXECUTION_MODE_INSTALL :
71+ /* SUIT processes recovery update. */
72+ case EXECUTION_MODE_INSTALL_RECOVERY :
73+ /* System is unprovisioned, SUIT updates Nordic components. */
74+ case EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP :
75+ /* System booted from root manifest. */
76+ case EXECUTION_MODE_POST_INVOKE :
77+ /* System booted from recovery manifest. */
78+ case EXECUTION_MODE_POST_INVOKE_RECOVERY :
79+ /* System not booted, application MPI missing. */
80+ case EXECUTION_MODE_FAIL_NO_MPI :
81+ /* System not booted, invalid MPI format. */
82+ case EXECUTION_MODE_FAIL_MPI_INVALID :
83+ /* System not booted, Nordic and root class IDs not configured. */
84+ case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING :
85+ /* System not booted, MPI misconfigured. */
86+ case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED :
87+ /* System not booted, unable to boot recovery manifest. */
88+ case EXECUTION_MODE_FAIL_INVOKE_RECOVERY :
89+ /* System failed before invoking SUIT orchestrator. */
90+ case EXECUTION_MODE_FAIL_STARTUP :
91+ return false;
92+
93+ /* SUIT boot or update not yet started. */
94+ case EXECUTION_MODE_STARTUP :
95+ /* SUIT boots from root manifest. */
96+ case EXECUTION_MODE_INVOKE :
97+ /* SUIT boots from recovery manifest. */
98+ case EXECUTION_MODE_INVOKE_RECOVERY :
99+ break ;
100+ /* default case deliberately excluded to get warnings if missing an enum case. */
101+ }
102+
103+ return true;
104+ }
105+
106+ bool suit_execution_mode_updating (void )
107+ {
108+ switch (current_execution_mode ) {
109+ /* SUIT boots from root manifest. */
110+ case EXECUTION_MODE_INVOKE :
111+ /* SUIT boots from recovery manifest. */
112+ case EXECUTION_MODE_INVOKE_RECOVERY :
113+ /* System booted from root manifest. */
114+ case EXECUTION_MODE_POST_INVOKE :
115+ /* System booted from recovery manifest. */
116+ case EXECUTION_MODE_POST_INVOKE_RECOVERY :
117+ /* System not booted, application MPI missing. */
118+ case EXECUTION_MODE_FAIL_NO_MPI :
119+ /* System not booted, invalid MPI format. */
120+ case EXECUTION_MODE_FAIL_MPI_INVALID :
121+ /* System not booted, Nordic and root class IDs not configured. */
122+ case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING :
123+ /* System not booted, MPI misconfigured. */
124+ case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED :
125+ /* System not booted, unable to boot recovery manifest. */
126+ case EXECUTION_MODE_FAIL_INVOKE_RECOVERY :
127+ /* System failed before invoking SUIT orchestrator. */
128+ case EXECUTION_MODE_FAIL_STARTUP :
129+ return false;
130+
131+ /* SUIT boot or update not yet started. */
132+ case EXECUTION_MODE_STARTUP :
133+ /* SUIT processes update candiadate. */
134+ case EXECUTION_MODE_INSTALL :
135+ /* SUIT processes recovery update. */
136+ case EXECUTION_MODE_INSTALL_RECOVERY :
137+ /* System is unprovisioned, SUIT updates Nordic components. */
138+ case EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP :
139+ break ;
140+ /* default case deliberately excluded to get warnings if missing an enum case. */
141+ }
142+
143+ return true;
144+ }
145+
146+ bool suit_execution_mode_failed (void )
147+ {
148+ switch (current_execution_mode ) {
149+ /* SUIT boot or update not yet started. */
150+ case EXECUTION_MODE_STARTUP :
151+ /* SUIT processes update candiadate. */
152+ case EXECUTION_MODE_INSTALL :
153+ /* SUIT processes recovery update. */
154+ case EXECUTION_MODE_INSTALL_RECOVERY :
155+ /* SUIT boots from root manifest. */
156+ case EXECUTION_MODE_INVOKE :
157+ /* SUIT boots from recovery manifest. */
158+ case EXECUTION_MODE_INVOKE_RECOVERY :
159+ /* System booted from root manifest. */
160+ case EXECUTION_MODE_POST_INVOKE :
161+ /* System booted from recovery manifest. */
162+ case EXECUTION_MODE_POST_INVOKE_RECOVERY :
163+ /* System is unprovisioned, SUIT updates Nordic components. */
164+ case EXECUTION_MODE_FAIL_INSTALL_NORDIC_TOP :
165+ return false;
166+
167+ /* System not booted, application MPI missing. */
168+ case EXECUTION_MODE_FAIL_NO_MPI :
169+ /* System not booted, invalid MPI format. */
170+ case EXECUTION_MODE_FAIL_MPI_INVALID :
171+ /* System not booted, Nordic and root class IDs not configured. */
172+ case EXECUTION_MODE_FAIL_MPI_INVALID_MISSING :
173+ /* System not booted, MPI misconfigured. */
174+ case EXECUTION_MODE_FAIL_MPI_UNSUPPORTED :
175+ /* System not booted, unable to boot recovery manifest. */
176+ case EXECUTION_MODE_FAIL_INVOKE_RECOVERY :
177+ /* System failed before invoking SUIT orchestrator. */
178+ case EXECUTION_MODE_FAIL_STARTUP :
179+ break ;
180+ /* default case deliberately excluded to get warnings if missing an enum case. */
181+ }
182+
183+ return true;
184+ }
0 commit comments