summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/shutdown.c
blob: 0e530b60543c7c12e507437fb5ca8e5c7feca62e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Copyright 2018 SiFive, Inc */
/* SPDX-License-Identifier: Apache-2.0 */

#include <metal/machine.h>
#include <metal/shutdown.h>

extern inline void __metal_shutdown_exit(const struct __metal_shutdown *sd, int code);

#if defined(__METAL_DT_SHUTDOWN_HANDLE)
void metal_shutdown(int code)
{
    __metal_shutdown_exit(__METAL_DT_SHUTDOWN_HANDLE, code);
}
#else
# warning "There is no defined shutdown mechanism, metal_shutdown() will spin."
void metal_shutdown(int code)
{
    while (1) {
      __asm__ volatile ("nop");
    }
}
#endif