]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_GCC/freedom-metal/src/shutdown.c
0e530b60543c7c12e507437fb5ca8e5c7feca62e
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_GCC / freedom-metal / src / shutdown.c
1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
3
4 #include <metal/machine.h>
5 #include <metal/shutdown.h>
6
7 extern inline void __metal_shutdown_exit(const struct __metal_shutdown *sd, int code);
8
9 #if defined(__METAL_DT_SHUTDOWN_HANDLE)
10 void metal_shutdown(int code)
11 {
12     __metal_shutdown_exit(__METAL_DT_SHUTDOWN_HANDLE, code);
13 }
14 #else
15 # warning "There is no defined shutdown mechanism, metal_shutdown() will spin."
16 void metal_shutdown(int code)
17 {
18     while (1) {
19       __asm__ volatile ("nop");
20     }
21 }
22 #endif